Skip to content

Latest commit

 

History

History
236 lines (165 loc) · 12.5 KB

File metadata and controls

236 lines (165 loc) · 12.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

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetTemplateListResponse;
import com.clerk.backend_api.models.operations.TemplateType;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetTemplateListResponse res = sdk.emailSMSTemplates().list()
                .templateType(TemplateType.SMS)
                .call();

        if (res.templateList().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

GetTemplateListResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 422 application/json
models/errors/SDKError 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

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.RevertTemplatePathParamTemplateType;
import com.clerk.backend_api.models.operations.RevertTemplateResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        RevertTemplateResponse res = sdk.emailSMSTemplates().revert()
                .templateType(RevertTemplatePathParamTemplateType.EMAIL)
                .slug("<value>")
                .call();

        if (res.template().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

RevertTemplateResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 402, 404 application/json
models/errors/SDKError 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

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetTemplateResponse;
import com.clerk.backend_api.models.operations.PathParamTemplateType;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        GetTemplateResponse res = sdk.emailSMSTemplates().get()
                .templateType(PathParamTemplateType.SMS)
                .slug("<value>")
                .call();

        if (res.template().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
templateType 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

GetTemplateResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 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

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryPathParamTemplateType;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryRequestBody;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        ToggleTemplateDeliveryResponse res = sdk.emailSMSTemplates().toggleTemplateDelivery()
                .templateType(ToggleTemplateDeliveryPathParamTemplateType.SMS)
                .slug("<value>")
                .requestBody(ToggleTemplateDeliveryRequestBody.builder()
                    .build())
                .call();

        if (res.template().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
templateType ToggleTemplateDeliveryPathParamTemplateType ✔️ The type of template to toggle delivery for
slug String ✔️ The slug of the template for which to toggle delivery
requestBody Optional<ToggleTemplateDeliveryRequestBody> N/A

Response

ToggleTemplateDeliveryResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 4XX, 5XX */*