MailSlurpClient::TemplateControllerApi

All URIs are relative to https://api.mailslurp.com

MethodHTTP requestDescription
create_templatePOST /templatesCreate a Template
delete_templateDELETE /templates/{templateId}Delete Template
get_all_templatesGET /templates/paginatedGet all Templates in paginated format
get_templateGET /templates/{templateId}Get Template
get_templatesGET /templatesGet all Templates
update_templatePUT /templates/{templateId}Update a Template

create_template

TemplateDto create_template(create_template_options)

Create a Template

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new
create_template_options = MailSlurpClient::CreateTemplateOptions.new # CreateTemplateOptions | createTemplateOptions

begin
  #Create a Template
  result = api_instance.create_template(create_template_options)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->create_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
create_template_optionsCreateTemplateOptionscreateTemplateOptions

Return type

TemplateDto

Authorization

API_KEY

HTTP request headers

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

delete_template

delete_template(template_id)

Delete Template

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new
template_id = 'template_id_example' # String | templateId

begin
  #Delete Template
  api_instance.delete_template(template_id)
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->delete_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
template_idStringtemplateId

Return type

nil (empty response body)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

get_all_templates

PageTemplateProjection get_all_templates(opts)

Get all Templates in paginated format

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new
opts = {
  before: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter by created at before the given timestamp
  page: 0, # Integer | Optional page  in list pagination
  since: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | Filter by created at after the given timestamp
  size: 20, # Integer | Optional page size in list pagination
  sort: 'ASC' # String | Optional createdAt sort direction ASC or DESC
}

begin
  #Get all Templates in paginated format
  result = api_instance.get_all_templates(opts)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->get_all_templates: #{e}"
end

Parameters

NameTypeDescriptionNotes
beforeDateTimeFilter by created at before the given timestamp[optional]
pageIntegerOptional page in list pagination[optional] [default to 0]
sinceDateTimeFilter by created at after the given timestamp[optional]
sizeIntegerOptional page size in list pagination[optional] [default to 20]
sortStringOptional createdAt sort direction ASC or DESC[optional] [default to ‘ASC’]

Return type

PageTemplateProjection

Authorization

API_KEY

HTTP request headers

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

get_template

TemplateDto get_template(template_id)

Get Template

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new
template_id = 'template_id_example' # String | templateId

begin
  #Get Template
  result = api_instance.get_template(template_id)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->get_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
template_idStringtemplateId

Return type

TemplateDto

Authorization

API_KEY

HTTP request headers

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

get_templates

Array get_templates

Get all Templates

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new

begin
  #Get all Templates
  result = api_instance.get_templates
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->get_templates: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

Array

Authorization

API_KEY

HTTP request headers

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

update_template

TemplateDto update_template(template_id, create_template_options)

Update a Template

Example

# load the gem
require 'mailslurp_client'
# setup authorization
MailSlurpClient.configure do |config|
  # Configure API key authorization: API_KEY
  config.api_key['x-api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['x-api-key'] = 'Bearer'
end

api_instance = MailSlurpClient::TemplateControllerApi.new
template_id = 'template_id_example' # String | templateId
create_template_options = MailSlurpClient::CreateTemplateOptions.new # CreateTemplateOptions | createTemplateOptions

begin
  #Update a Template
  result = api_instance.update_template(template_id, create_template_options)
  p result
rescue MailSlurpClient::ApiError => e
  puts "Exception when calling TemplateControllerApi->update_template: #{e}"
end

Parameters

NameTypeDescriptionNotes
template_idStringtemplateId
create_template_optionsCreateTemplateOptionscreateTemplateOptions

Return type

TemplateDto

Authorization

API_KEY

HTTP request headers

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