Skip to content

Latest commit

 

History

History
814 lines (629 loc) · 51 KB

File metadata and controls

814 lines (629 loc) · 51 KB

Messaging

Overview

Available Operations

listConversations

List Conversations

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;
use StackOne\client\Utils;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingListConversationsRequest(
    xAccountId: '<id>',
    fields: 'id,remote_id,participants,name,private,created_at,last_message_at,unified_custom_fields',
    filter: new Operations\MessagingListConversationsQueryParamFilter(
        updatedAfter: Utils\Utils::parseDateTime('2020-01-01T00:00:00.000Z'),
    ),
    prefer: 'heartbeat',
);

$responses = $sdk->messaging->listConversations(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Operations\MessagingListConversationsRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingListConversationsResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

createConversation

Create Conversation

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$messagingCreateConversationRequestDto = new Components\MessagingCreateConversationRequestDto(
    participants: [
        'c28xIQ1',
        'c28xIQ2',
    ],
    name: 'Project Discussion',
    private: true,
);

$response = $sdk->messaging->createConversation(
    xAccountId: '<id>',
    messagingCreateConversationRequestDto: $messagingCreateConversationRequestDto,
    prefer: 'heartbeat'

);

if ($response->createResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
xAccountId string ✔️ The account identifier
messagingCreateConversationRequestDto Components\MessagingCreateConversationRequestDto ✔️ N/A
prefer ?string Set to "heartbeat" to enable keep-alive newline heartbeats during long-running requests. Response includes Preference-Applied: heartbeat header when honored. (RFC 7240) heartbeat

Response

?Operations\MessagingCreateConversationResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

getConversation

Get Conversation

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingGetConversationRequest(
    xAccountId: '<id>',
    id: '<id>',
    fields: 'id,remote_id,participants,name,private,created_at,last_message_at,unified_custom_fields',
    prefer: 'heartbeat',
);

$response = $sdk->messaging->getConversation(
    request: $request
);

if ($response->messagingConversationResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\MessagingGetConversationRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingGetConversationResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

downloadMessagingAttachment

Download Attachment

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingDownloadMessagingAttachmentRequest(
    xAccountId: '<id>',
    id: '<id>',
    subResourceId: '<id>',
    format: 'base64',
    exportFormat: 'text/plain',
    prefer: 'heartbeat',
);

$response = $sdk->messaging->downloadMessagingAttachment(
    request: $request
);

if ($response->body !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\MessagingDownloadMessagingAttachmentRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingDownloadMessagingAttachmentResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

listAttachments

List Attachments

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;
use StackOne\client\Utils;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingListAttachmentsRequest(
    xAccountId: '<id>',
    id: '<id>',
    fields: 'id,remote_id,file_name,file_size,file_type,unified_custom_fields',
    filter: new Operations\MessagingListAttachmentsQueryParamFilter(
        updatedAfter: Utils\Utils::parseDateTime('2020-01-01T00:00:00.000Z'),
    ),
    prefer: 'heartbeat',
);

$responses = $sdk->messaging->listAttachments(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Operations\MessagingListAttachmentsRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingListAttachmentsResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

getAttachment

Get Attachment

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingGetAttachmentRequest(
    xAccountId: '<id>',
    id: '<id>',
    subResourceId: '<id>',
    fields: 'id,remote_id,file_name,file_size,file_type,unified_custom_fields',
    prefer: 'heartbeat',
);

$response = $sdk->messaging->getAttachment(
    request: $request
);

if ($response->messagingAttachmentResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\MessagingGetAttachmentRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingGetAttachmentResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

listUsers

List Users

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;
use StackOne\client\Utils;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingListUsersRequest(
    xAccountId: '<id>',
    fields: 'id,remote_id,email,username,name,first_name,last_name,bot,active,unified_custom_fields',
    filter: new Operations\MessagingListUsersQueryParamFilter(
        updatedAfter: Utils\Utils::parseDateTime('2020-01-01T00:00:00.000Z'),
    ),
    prefer: 'heartbeat',
);

$responses = $sdk->messaging->listUsers(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Operations\MessagingListUsersRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingListUsersResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

getUser

Get User

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingGetUserRequest(
    xAccountId: '<id>',
    id: '<id>',
    fields: 'id,remote_id,email,username,name,first_name,last_name,bot,active,unified_custom_fields',
    prefer: 'heartbeat',
);

$response = $sdk->messaging->getUser(
    request: $request
);

if ($response->messagingUserResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\MessagingGetUserRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingGetUserResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

listConversationMessages

List Conversation Messages

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;
use StackOne\client\Utils;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingListConversationMessagesRequest(
    xAccountId: '<id>',
    id: '<id>',
    fields: 'id,remote_id,content,parent_message_id,remote_parent_message_id,attachments,author,created_at,updated_at,unified_custom_fields',
    filter: new Operations\MessagingListConversationMessagesQueryParamFilter(
        updatedAfter: Utils\Utils::parseDateTime('2020-01-01T00:00:00.000Z'),
    ),
    prefer: 'heartbeat',
);

$responses = $sdk->messaging->listConversationMessages(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Operations\MessagingListConversationMessagesRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingListConversationMessagesResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

getMessage

Get Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;
use StackOne\client\Models\Operations;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Operations\MessagingGetMessageRequest(
    xAccountId: '<id>',
    id: '<id>',
    fields: 'id,remote_id,content,parent_message_id,remote_parent_message_id,attachments,author,created_at,updated_at,unified_custom_fields',
    prefer: 'heartbeat',
);

$response = $sdk->messaging->getMessage(
    request: $request
);

if ($response->messagingMessageResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\MessagingGetMessageRequest ✔️ The request object to use for the request.

Response

?Operations\MessagingGetMessageResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*

sendMessage

Send Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$messagingMessageSendRequestDto = new Components\MessagingMessageSendRequestDto(
    content: 'Hello, world!',
    recipient: 'c28xyrc55866bvuv',
    sender: '+34820398402',
);

$response = $sdk->messaging->sendMessage(
    xAccountId: '<id>',
    messagingMessageSendRequestDto: $messagingMessageSendRequestDto,
    prefer: 'heartbeat'

);

if ($response->createResult !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
xAccountId string ✔️ The account identifier
messagingMessageSendRequestDto Components\MessagingMessageSendRequestDto ✔️ N/A
prefer ?string Set to "heartbeat" to enable keep-alive newline heartbeats during long-running requests. Response includes Preference-Applied: heartbeat header when honored. (RFC 7240) heartbeat

Response

?Operations\MessagingSendMessageResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*