class MailSlurpClient::ContactControllerApi
Attributes
Public Class Methods
# File lib/mailslurp_client/api/contact_controller_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a contact @param create_contact_options [CreateContactOptions] createContactOptions @param [Hash] opts the optional parameters @return [ContactDto]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 26 def create_contact(create_contact_options, opts = {}) data, _status_code, _headers = create_contact_with_http_info(create_contact_options, opts) data end
Create a contact @param create_contact_options [CreateContactOptions] createContactOptions @param [Hash] opts the optional parameters @return [Array<(ContactDto
, Integer, Hash)>] ContactDto
data, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 35 def create_contact_with_http_info(create_contact_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.create_contact ...' end # verify the required parameter 'create_contact_options' is set if @api_client.config.client_side_validation && create_contact_options.nil? fail ArgumentError, "Missing the required parameter 'create_contact_options' when calling ContactControllerApi.create_contact" end # resource path local_var_path = '/contacts' # 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_contact_options) # return_type return_type = opts[:return_type] || 'ContactDto' # 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: ContactControllerApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete contact @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [nil]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 88 def delete_contact(contact_id, opts = {}) delete_contact_with_http_info(contact_id, opts) nil end
Delete contact @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 97 def delete_contact_with_http_info(contact_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.delete_contact ...' end # verify the required parameter 'contact_id' is set if @api_client.config.client_side_validation && contact_id.nil? fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactControllerApi.delete_contact" end # resource path local_var_path = '/contacts/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_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: ContactControllerApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all contacts @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 [PageContactProjection]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 150 def get_all_contacts(opts = {}) data, _status_code, _headers = get_all_contacts_with_http_info(opts) data end
Get all contacts @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<(PageContactProjection
, Integer, Hash)>] PageContactProjection
data, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 163 def get_all_contacts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.get_all_contacts ...' 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 = '/contacts/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] || 'PageContactProjection' # 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: ContactControllerApi#get_all_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get contact @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [ContactDto]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 219 def get_contact(contact_id, opts = {}) data, _status_code, _headers = get_contact_with_http_info(contact_id, opts) data end
Get contact vCard vcf file @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [String]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 279 def get_contact_v_card(contact_id, opts = {}) data, _status_code, _headers = get_contact_v_card_with_http_info(contact_id, opts) data end
Get contact vCard vcf file @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 288 def get_contact_v_card_with_http_info(contact_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.get_contact_v_card ...' end # verify the required parameter 'contact_id' is set if @api_client.config.client_side_validation && contact_id.nil? fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactControllerApi.get_contact_v_card" end # resource path local_var_path = '/contacts/{contactId}/download'.sub('{' + 'contactId' + '}', CGI.escape(contact_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/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: ContactControllerApi#get_contact_v_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get contact @param contact_id [String] contactId @param [Hash] opts the optional parameters @return [Array<(ContactDto
, Integer, Hash)>] ContactDto
data, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 228 def get_contact_with_http_info(contact_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.get_contact ...' end # verify the required parameter 'contact_id' is set if @api_client.config.client_side_validation && contact_id.nil? fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactControllerApi.get_contact" end # resource path local_var_path = '/contacts/{contactId}'.sub('{' + 'contactId' + '}', CGI.escape(contact_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] || 'ContactDto' # 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: ContactControllerApi#get_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all contacts @param [Hash] opts the optional parameters @return [Array<ContactProjection>]
# File lib/mailslurp_client/api/contact_controller_api.rb, line 338 def get_contacts(opts = {}) data, _status_code, _headers = get_contacts_with_http_info(opts) data end
Get all contacts @param [Hash] opts the optional parameters @return [Array<(Array<ContactProjection>, Integer, Hash)>] Array<ContactProjection> data, response status code and response headers
# File lib/mailslurp_client/api/contact_controller_api.rb, line 346 def get_contacts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactControllerApi.get_contacts ...' end # resource path local_var_path = '/contacts' # 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<ContactProjection>' # 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: ContactControllerApi#get_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end