Skip to content

Latest commit

 

History

History
449 lines (320 loc) · 13 KB

EmailSMSTemplatesApi.md

File metadata and controls

449 lines (320 loc) · 13 KB

ClerkBackend::EmailSMSTemplatesApi

All URIs are relative to https://api.clerk.com/v1

Method HTTP request Description
get_template GET /templates/{template_type}/{slug} Retrieve a template
get_template_list GET /templates/{template_type} List all templates
preview_template POST /templates/{template_type}/{slug}/preview Preview changes to a template
revert_template POST /templates/{template_type}/{slug}/revert Revert a template
toggle_template_delivery POST /templates/{template_type}/{slug}/toggle_delivery Toggle the delivery by Clerk for a template of a given type and slug
upsert_template PUT /templates/{template_type}/{slug} Update a template for a given type and slug

get_template

get_template(template_type, slug)

Retrieve a template

Returns the details of a template

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'email' # String | The type of templates to retrieve (email or SMS)
slug = 'slug_example' # String | The slug (i.e. machine-friendly name) of the template to retrieve

begin
  # Retrieve a template
  result = api_instance.get_template(template_type, slug)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->get_template: #{e}"
end

Using the get_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_template_with_http_info(template_type, slug)

begin
  # Retrieve a template
  data, status_code, headers = api_instance.get_template_with_http_info(template_type, slug)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Template>
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->get_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of templates to retrieve (email or SMS)
slug String The slug (i.e. machine-friendly name) of the template to retrieve

Return type

Template

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_template_list

<Array> get_template_list(template_type)

List all templates

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

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'email' # String | The type of templates to list (email or SMS)

begin
  # List all templates
  result = api_instance.get_template_list(template_type)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->get_template_list: #{e}"
end

Using the get_template_list_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(<Array>, Integer, Hash)> get_template_list_with_http_info(template_type)

begin
  # List all templates
  data, status_code, headers = api_instance.get_template_list_with_http_info(template_type)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<Template>>
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->get_template_list_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of templates to list (email or SMS)

Return type

Array<Template>

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

preview_template

Object preview_template(template_type, slug, opts)

Preview changes to a template

Returns a preview of a template for a given template_type, slug and body

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'template_type_example' # String | The type of template to preview
slug = 'slug_example' # String | The slug of the template to preview
opts = {
  preview_template_request: ClerkBackend::PreviewTemplateRequest.new # PreviewTemplateRequest | Required parameters
}

begin
  # Preview changes to a template
  result = api_instance.preview_template(template_type, slug, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->preview_template: #{e}"
end

Using the preview_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(Object, Integer, Hash)> preview_template_with_http_info(template_type, slug, opts)

begin
  # Preview changes to a template
  data, status_code, headers = api_instance.preview_template_with_http_info(template_type, slug, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => Object
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->preview_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of template to preview
slug String The slug of the template to preview
preview_template_request PreviewTemplateRequest Required parameters [optional]

Return type

Object

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

revert_template

revert_template(template_type, slug)

Revert a template

Reverts an updated template to its default state

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'email' # String | The type of template to revert
slug = 'slug_example' # String | The slug of the template to revert

begin
  # Revert a template
  result = api_instance.revert_template(template_type, slug)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->revert_template: #{e}"
end

Using the revert_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> revert_template_with_http_info(template_type, slug)

begin
  # Revert a template
  data, status_code, headers = api_instance.revert_template_with_http_info(template_type, slug)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Template>
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->revert_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of template to revert
slug String The slug of the template to revert

Return type

Template

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

toggle_template_delivery

toggle_template_delivery(template_type, slug, opts)

Toggle the delivery by Clerk for a template of a given type and slug

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.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'email' # String | The type of template to toggle delivery for
slug = 'slug_example' # String | The slug of the template for which to toggle delivery
opts = {
  toggle_template_delivery_request: ClerkBackend::ToggleTemplateDeliveryRequest.new # ToggleTemplateDeliveryRequest | 
}

begin
  # Toggle the delivery by Clerk for a template of a given type and slug
  result = api_instance.toggle_template_delivery(template_type, slug, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->toggle_template_delivery: #{e}"
end

Using the toggle_template_delivery_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> toggle_template_delivery_with_http_info(template_type, slug, opts)

begin
  # Toggle the delivery by Clerk for a template of a given type and slug
  data, status_code, headers = api_instance.toggle_template_delivery_with_http_info(template_type, slug, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Template>
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->toggle_template_delivery_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of template to toggle delivery for
slug String The slug of the template for which to toggle delivery
toggle_template_delivery_request ToggleTemplateDeliveryRequest [optional]

Return type

Template

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

upsert_template

upsert_template(template_type, slug, opts)

Update a template for a given type and slug

Updates the existing template of the given type and slug

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::EmailSMSTemplatesApi.new
template_type = 'email' # String | The type of template to update
slug = 'slug_example' # String | The slug of the template to update
opts = {
  upsert_template_request: ClerkBackend::UpsertTemplateRequest.new # UpsertTemplateRequest | 
}

begin
  # Update a template for a given type and slug
  result = api_instance.upsert_template(template_type, slug, opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->upsert_template: #{e}"
end

Using the upsert_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> upsert_template_with_http_info(template_type, slug, opts)

begin
  # Update a template for a given type and slug
  data, status_code, headers = api_instance.upsert_template_with_http_info(template_type, slug, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Template>
rescue ClerkBackend::ApiError => e
  puts "Error when calling EmailSMSTemplatesApi->upsert_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_type String The type of template to update
slug String The slug of the template to update
upsert_template_request UpsertTemplateRequest [optional]

Return type

Template

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json