Skip to content

Latest commit

 

History

History
356 lines (272 loc) · 15.2 KB

README.md

File metadata and controls

356 lines (272 loc) · 15.2 KB

Messages

(sms->messages)

Overview

Available Operations

create

Create Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Apideck\Unify\Utils;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->build();

$request = new Operations\SmsMessagesAddRequest(
    message: new Components\MessageInput(
        from: '+15017122661',
        to: '+15017122662',
        body: 'Hi! How are you doing?',
        subject: 'Picture',
        type: Components\MessageType::Sms,
        scheduledAt: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
        webhookUrl: 'https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms',
        reference: 'CUST001',
        messagingServiceId: '123456',
        passThrough: [
            new Components\PassThroughBody(
                serviceId: '<id>',
                extendPaths: [
                    new Components\ExtendPaths(
                        path: '$.nested.property',
                        value: [
                            'TaxClassificationRef' => [
                                'value' => 'EUC-99990201-V1-00020000',
                            ],
                        ],
                    ),
                ],
            ),
        ],
    ),
    serviceId: 'salesforce',
);

$response = $sdk->sms->messages->create(
    request: $request
);

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

Parameters

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

Response

?Operations\SmsMessagesAddResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

list

List Messages

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->build();

$request = new Operations\SmsMessagesAllRequest(
    serviceId: 'salesforce',
    fields: 'id,updated_at',
);

$responses = $sdk->sms->messages->list(
    request: $request
);


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

Parameters

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

Response

?Operations\SmsMessagesAllResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

delete

Delete Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->build();

$request = new Operations\SmsMessagesDeleteRequest(
    id: '<id>',
    serviceId: 'salesforce',
);

$response = $sdk->sms->messages->delete(
    request: $request
);

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

Parameters

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

Response

?Operations\SmsMessagesDeleteResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

get

Get Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->build();

$request = new Operations\SmsMessagesOneRequest(
    id: '<id>',
    serviceId: 'salesforce',
    fields: 'id,updated_at',
);

$response = $sdk->sms->messages->get(
    request: $request
);

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

Parameters

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

Response

?Operations\SmsMessagesOneResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

update

Update Message

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Apideck\Unify\Utils;

$sdk = Unify\Apideck::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->build();

$request = new Operations\SmsMessagesUpdateRequest(
    id: '<id>',
    message: new Components\MessageInput(
        from: '+15017122661',
        to: '+15017122662',
        body: 'Hi! How are you doing?',
        subject: 'Picture',
        type: Components\MessageType::Sms,
        scheduledAt: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
        webhookUrl: 'https://unify.apideck.com/webhook/webhooks/eyz329dkffdl4949/x/sms',
        reference: 'CUST001',
        messagingServiceId: '123456',
        passThrough: [
            new Components\PassThroughBody(
                serviceId: '<id>',
                extendPaths: [
                    new Components\ExtendPaths(
                        path: '$.nested.property',
                        value: [
                            'TaxClassificationRef' => [
                                'value' => 'EUC-99990201-V1-00020000',
                            ],
                        ],
                    ),
                ],
            ),
        ],
    ),
    serviceId: 'salesforce',
);

$response = $sdk->sms->messages->update(
    request: $request
);

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

Parameters

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

Response

?Operations\SmsMessagesUpdateResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*