Skip to content

Latest commit

 

History

History
217 lines (136 loc) · 11.5 KB

File metadata and controls

217 lines (136 loc) · 11.5 KB

EmailSMSTemplates

(emailSMSTemplates)

Overview

Available Operations

  • list - List all templates ⚠️ Deprecated
  • revert - Revert a template ⚠️ Deprecated
  • get - Retrieve a template ⚠️ Deprecated
  • toggleTemplateDelivery - Toggle the delivery by Clerk for a template of a given type and slug ⚠️ Deprecated

list

Returns a list of all templates. The templates are returned sorted by position.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->emailSMSTemplates->list(
    templateType: Operations\TemplateType::Sms
);

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

Parameters

Parameter Type Required Description
templateType Operations\TemplateType ✔️ The type of templates to list (email or SMS)

Response

?Operations\GetTemplateListResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors16 400, 401, 422 application/json
Errors\SDKException 4XX, 5XX */*

revert

Reverts an updated template to its default state

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->emailSMSTemplates->revert(
    templateType: Operations\RevertTemplatePathParamTemplateType::Email,
    slug: '<value>'

);

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

Parameters

Parameter Type Required Description
templateType Operations\RevertTemplatePathParamTemplateType ✔️ The type of template to revert
slug string ✔️ The slug of the template to revert

Response

?Operations\RevertTemplateResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors19 400, 401, 402, 404 application/json
Errors\SDKException 4XX, 5XX */*

get

Returns the details of a template

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();



$response = $sdk->emailSMSTemplates->get(
    templateType: Operations\PathParamTemplateType::Sms,
    slug: '<value>'

);

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

Parameters

Parameter Type Required Description
templateType Operations\PathParamTemplateType ✔️ The type of templates to retrieve (email or SMS)
slug string ✔️ The slug (i.e. machine-friendly name) of the template to retrieve

Response

?Operations\GetTemplateResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors17 400, 401, 404 application/json
Errors\SDKException 4XX, 5XX */*

toggleTemplateDelivery

Toggles the delivery by Clerk for a template of a given type and slug. If disabled, Clerk will not deliver the resulting email or SMS. The app developer will need to listen to the email.created or sms.created webhooks in order to handle delivery themselves.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Clerk\Backend;
use Clerk\Backend\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Backend\ClerkBackend::builder()->setSecurity($security)->build();

$requestBody = new Operations\ToggleTemplateDeliveryRequestBody();

$response = $sdk->emailSMSTemplates->toggleTemplateDelivery(
    templateType: Operations\ToggleTemplateDeliveryPathParamTemplateType::Sms,
    slug: '<value>',
    requestBody: $requestBody

);

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

Parameters

Parameter Type Required Description
templateType Operations\ToggleTemplateDeliveryPathParamTemplateType ✔️ The type of template to toggle delivery for
slug string ✔️ The slug of the template for which to toggle delivery
requestBody ?Operations\ToggleTemplateDeliveryRequestBody N/A

Response

?Operations\ToggleTemplateDeliveryResponse

Errors

Error Type Status Code Content Type
Errors\ClerkErrors21 400, 401, 404 application/json
Errors\SDKException 4XX, 5XX */*