class MailSlurpClient::TemplateControllerApi
Attributes
Public Class Methods
# File lib/mailslurp_client/api/template_controller_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a Template @param create_template_options [CreateTemplateOptions] createTemplateOptions @param [Hash] opts the optional parameters @return [TemplateDto]
# File lib/mailslurp_client/api/template_controller_api.rb, line 26 def create_template(create_template_options, opts = {}) data, _status_code, _headers = create_template_with_http_info(create_template_options, opts) data end
Create a Template @param create_template_options [CreateTemplateOptions] createTemplateOptions @param [Hash] opts the optional parameters @return [Array<(TemplateDto
, Integer, Hash)>] TemplateDto
data, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 35 def create_template_with_http_info(create_template_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.create_template ...' end # verify the required parameter 'create_template_options' is set if @api_client.config.client_side_validation && create_template_options.nil? fail ArgumentError, "Missing the required parameter 'create_template_options' when calling TemplateControllerApi.create_template" end # resource path local_var_path = '/templates' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_template_options) # return_type return_type = opts[:return_type] || 'TemplateDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete Template @param template_id [String] templateId @param [Hash] opts the optional parameters @return [nil]
# File lib/mailslurp_client/api/template_controller_api.rb, line 88 def delete_template(template_id, opts = {}) delete_template_with_http_info(template_id, opts) nil end
Delete Template @param template_id [String] templateId @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 97 def delete_template_with_http_info(template_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.delete_template ...' end # verify the required parameter 'template_id' is set if @api_client.config.client_side_validation && template_id.nil? fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateControllerApi.delete_template" end # resource path local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all Templates in paginated format @param [Hash] opts the optional parameters @option opts [DateTime] :before Filter by created at before the given timestamp @option opts [Integer] :page Optional page index in list pagination (default to 0) @option opts [DateTime] :since Filter by created at after the given timestamp @option opts [Integer] :size Optional page size in list pagination (default to 20) @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') @return [PageTemplateProjection]
# File lib/mailslurp_client/api/template_controller_api.rb, line 150 def get_all_templates(opts = {}) data, _status_code, _headers = get_all_templates_with_http_info(opts) data end
Get all Templates in paginated format @param [Hash] opts the optional parameters @option opts [DateTime] :before Filter by created at before the given timestamp @option opts [Integer] :page Optional page index in list pagination @option opts [DateTime] :since Filter by created at after the given timestamp @option opts [Integer] :size Optional page size in list pagination @option opts [String] :sort Optional createdAt sort direction ASC or DESC @return [Array<(PageTemplateProjection
, Integer, Hash)>] PageTemplateProjection
data, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 163 def get_all_templates_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.get_all_templates ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/templates/paginated' # query parameters query_params = opts[:query_params] || {} query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageTemplateProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#get_all_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Template @param template_id [String] templateId @param [Hash] opts the optional parameters @return [TemplateDto]
# File lib/mailslurp_client/api/template_controller_api.rb, line 219 def get_template(template_id, opts = {}) data, _status_code, _headers = get_template_with_http_info(template_id, opts) data end
Get Template @param template_id [String] templateId @param [Hash] opts the optional parameters @return [Array<(TemplateDto
, Integer, Hash)>] TemplateDto
data, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 228 def get_template_with_http_info(template_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.get_template ...' end # verify the required parameter 'template_id' is set if @api_client.config.client_side_validation && template_id.nil? fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateControllerApi.get_template" end # resource path local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'TemplateDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#get_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all Templates @param [Hash] opts the optional parameters @return [Array<TemplateProjection>]
# File lib/mailslurp_client/api/template_controller_api.rb, line 278 def get_templates(opts = {}) data, _status_code, _headers = get_templates_with_http_info(opts) data end
Get all Templates @param [Hash] opts the optional parameters @return [Array<(Array<TemplateProjection>, Integer, Hash)>] Array<TemplateProjection> data, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 286 def get_templates_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.get_templates ...' end # resource path local_var_path = '/templates' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<TemplateProjection>' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a Template @param template_id [String] templateId @param create_template_options [CreateTemplateOptions] createTemplateOptions @param [Hash] opts the optional parameters @return [TemplateDto]
# File lib/mailslurp_client/api/template_controller_api.rb, line 334 def update_template(template_id, create_template_options, opts = {}) data, _status_code, _headers = update_template_with_http_info(template_id, create_template_options, opts) data end
Update a Template @param template_id [String] templateId @param create_template_options [CreateTemplateOptions] createTemplateOptions @param [Hash] opts the optional parameters @return [Array<(TemplateDto
, Integer, Hash)>] TemplateDto
data, response status code and response headers
# File lib/mailslurp_client/api/template_controller_api.rb, line 344 def update_template_with_http_info(template_id, create_template_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TemplateControllerApi.update_template ...' end # verify the required parameter 'template_id' is set if @api_client.config.client_side_validation && template_id.nil? fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateControllerApi.update_template" end # verify the required parameter 'create_template_options' is set if @api_client.config.client_side_validation && create_template_options.nil? fail ArgumentError, "Missing the required parameter 'create_template_options' when calling TemplateControllerApi.update_template" end # resource path local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_template_options) # return_type return_type = opts[:return_type] || 'TemplateDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TemplateControllerApi#update_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end