=begin #SendinBlue API #SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | OpenAPI spec version: 3.0.0 Contact: contact@sendinblue.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'uri' module SibApiV3Sdk class ContactsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Set custom user_agent if explicitly passed in api # default will still remain Swagger-Codegen/#{VERSION}/ruby def setUserAgent(user_agent) @user_agent = user_agent if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_') @api_client.default_headers['User-Agent'] = @user_agent end end # Add existing contacts to a list # @param list_id Id of the list # @param contact_emails Emails addresses OR IDs of the contacts # @param [Hash] opts the optional parameters # @return [PostContactInfo] def add_contact_to_list(list_id, contact_emails, opts = {}) data, _status_code, _headers = add_contact_to_list_with_http_info(list_id, contact_emails, opts) data end # Add existing contacts to a list # @param list_id Id of the list # @param contact_emails Emails addresses OR IDs of the contacts # @param [Hash] opts the optional parameters # @return [Array<(PostContactInfo, Fixnum, Hash)>] PostContactInfo data, response status code and response headers def add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.add_contact_to_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.add_contact_to_list" end # verify the required parameter 'contact_emails' is set if @api_client.config.client_side_validation && contact_emails.nil? fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ContactsApi.add_contact_to_list" end # resource path local_var_path = '/contacts/lists/{listId}/contacts/add'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(contact_emails) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PostContactInfo') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#add_contact_to_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create contact attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the attribute # @param create_attribute Values to create an attribute # @param [Hash] opts the optional parameters # @return [nil] def create_attribute(attribute_category, attribute_name, create_attribute, opts = {}) create_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts) nil end # Create contact attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the attribute # @param create_attribute Values to create an attribute # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def create_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_attribute ...' end # verify the required parameter 'attribute_category' is set if @api_client.config.client_side_validation && attribute_category.nil? fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.create_attribute" end # verify enum value if @api_client.config.client_side_validation && !['normal', 'transactional', 'category', 'calculated', 'global'].include?(attribute_category) fail ArgumentError, "invalid value for 'attribute_category', must be one of normal, transactional, category, calculated, global" end # verify the required parameter 'attribute_name' is set if @api_client.config.client_side_validation && attribute_name.nil? fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.create_attribute" end # verify the required parameter 'create_attribute' is set if @api_client.config.client_side_validation && create_attribute.nil? fail ArgumentError, "Missing the required parameter 'create_attribute' when calling ContactsApi.create_attribute" end # resource path local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(create_attribute) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a contact # @param create_contact Values to create a contact # @param [Hash] opts the optional parameters # @return [CreateUpdateContactModel] def create_contact(create_contact, opts = {}) data, _status_code, _headers = create_contact_with_http_info(create_contact, opts) data end # Create a contact # @param create_contact Values to create a contact # @param [Hash] opts the optional parameters # @return [Array<(CreateUpdateContactModel, Fixnum, Hash)>] CreateUpdateContactModel data, response status code and response headers def create_contact_with_http_info(create_contact, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_contact ...' end # verify the required parameter 'create_contact' is set if @api_client.config.client_side_validation && create_contact.nil? fail ArgumentError, "Missing the required parameter 'create_contact' when calling ContactsApi.create_contact" end # resource path local_var_path = '/contacts' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(create_contact) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateUpdateContactModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create Contact via DOI (Double-Opt-In) Flow # @param create_doi_contact Values to create the Double opt-in (DOI) contact # @param [Hash] opts the optional parameters # @return [nil] def create_doi_contact(create_doi_contact, opts = {}) create_doi_contact_with_http_info(create_doi_contact, opts) nil end # Create Contact via DOI (Double-Opt-In) Flow # @param create_doi_contact Values to create the Double opt-in (DOI) contact # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def create_doi_contact_with_http_info(create_doi_contact, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_doi_contact ...' end # verify the required parameter 'create_doi_contact' is set if @api_client.config.client_side_validation && create_doi_contact.nil? fail ArgumentError, "Missing the required parameter 'create_doi_contact' when calling ContactsApi.create_doi_contact" end # resource path local_var_path = '/contacts/doubleOptinConfirmation' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(create_doi_contact) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_doi_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a folder # @param create_folder Name of the folder # @param [Hash] opts the optional parameters # @return [CreateModel] def create_folder(create_folder, opts = {}) data, _status_code, _headers = create_folder_with_http_info(create_folder, opts) data end # Create a folder # @param create_folder Name of the folder # @param [Hash] opts the optional parameters # @return [Array<(CreateModel, Fixnum, Hash)>] CreateModel data, response status code and response headers def create_folder_with_http_info(create_folder, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_folder ...' end # verify the required parameter 'create_folder' is set if @api_client.config.client_side_validation && create_folder.nil? fail ArgumentError, "Missing the required parameter 'create_folder' when calling ContactsApi.create_folder" end # resource path local_var_path = '/contacts/folders' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(create_folder) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a list # @param create_list Values to create a list # @param [Hash] opts the optional parameters # @return [CreateModel] def create_list(create_list, opts = {}) data, _status_code, _headers = create_list_with_http_info(create_list, opts) data end # Create a list # @param create_list Values to create a list # @param [Hash] opts the optional parameters # @return [Array<(CreateModel, Fixnum, Hash)>] CreateModel data, response status code and response headers def create_list_with_http_info(create_list, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.create_list ...' end # verify the required parameter 'create_list' is set if @api_client.config.client_side_validation && create_list.nil? fail ArgumentError, "Missing the required parameter 'create_list' when calling ContactsApi.create_list" end # resource path local_var_path = '/contacts/lists' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(create_list) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the existing attribute # @param [Hash] opts the optional parameters # @return [nil] def delete_attribute(attribute_category, attribute_name, opts = {}) delete_attribute_with_http_info(attribute_category, attribute_name, opts) nil end # Delete an attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the existing attribute # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_attribute_with_http_info(attribute_category, attribute_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.delete_attribute ...' end # verify the required parameter 'attribute_category' is set if @api_client.config.client_side_validation && attribute_category.nil? fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.delete_attribute" end # verify enum value if @api_client.config.client_side_validation && !['normal', 'transactional', 'category', 'calculated', 'global'].include?(attribute_category) fail ArgumentError, "invalid value for 'attribute_category', must be one of normal, transactional, category, calculated, global" end # verify the required parameter 'attribute_name' is set if @api_client.config.client_side_validation && attribute_name.nil? fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.delete_attribute" end # resource path local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#delete_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a contact # @param identifier Email (urlencoded) OR ID of the contact # @param [Hash] opts the optional parameters # @return [nil] def delete_contact(identifier, opts = {}) delete_contact_with_http_info(identifier, opts) nil end # Delete a contact # @param identifier Email (urlencoded) OR ID of the contact # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_contact_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.delete_contact ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.delete_contact" end # resource path local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a folder (and all its lists) # @param folder_id Id of the folder # @param [Hash] opts the optional parameters # @return [nil] def delete_folder(folder_id, opts = {}) delete_folder_with_http_info(folder_id, opts) nil end # Delete a folder (and all its lists) # @param folder_id Id of the folder # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_folder_with_http_info(folder_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.delete_folder ...' end # verify the required parameter 'folder_id' is set if @api_client.config.client_side_validation && folder_id.nil? fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.delete_folder" end # resource path local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#delete_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a list # @param list_id Id of the list # @param [Hash] opts the optional parameters # @return [nil] def delete_list(list_id, opts = {}) delete_list_with_http_info(list_id, opts) nil end # Delete a list # @param list_id Id of the list # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.delete_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.delete_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List all attributes # @param [Hash] opts the optional parameters # @return [GetAttributes] def get_attributes(opts = {}) data, _status_code, _headers = get_attributes_with_http_info(opts) data end # List all attributes # @param [Hash] opts the optional parameters # @return [Array<(GetAttributes, Fixnum, Hash)>] GetAttributes data, response status code and response headers def get_attributes_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_attributes ...' end # resource path local_var_path = '/contacts/attributes' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetAttributes') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a contact's details # @param identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value # @param [Hash] opts the optional parameters # @return [GetExtendedContactDetails] def get_contact_info(identifier, opts = {}) data, _status_code, _headers = get_contact_info_with_http_info(identifier, opts) data end # Get a contact's details # @param identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value # @param [Hash] opts the optional parameters # @return [Array<(GetExtendedContactDetails, Fixnum, Hash)>] GetExtendedContactDetails data, response status code and response headers def get_contact_info_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_contact_info ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.get_contact_info" end # resource path local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetExtendedContactDetails') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_contact_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get email campaigns' statistics for a contact # @param identifier Email (urlencoded) OR ID of the contact # @param [Hash] opts the optional parameters # @option opts [String] :start_date Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate # @option opts [String] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate # @return [GetContactCampaignStats] def get_contact_stats(identifier, opts = {}) data, _status_code, _headers = get_contact_stats_with_http_info(identifier, opts) data end # Get email campaigns' statistics for a contact # @param identifier Email (urlencoded) OR ID of the contact # @param [Hash] opts the optional parameters # @option opts [String] :start_date Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate # @option opts [String] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate # @return [Array<(GetContactCampaignStats, Fixnum, Hash)>] GetContactCampaignStats data, response status code and response headers def get_contact_stats_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_contact_stats ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.get_contact_stats" end # resource path local_var_path = '/contacts/{identifier}/campaignStats'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetContactCampaignStats') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_contact_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all the contacts # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page (default to 50) # @option opts [Integer] :offset Index of the first document of the page (default to 0) # @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (default to desc) # @return [GetContacts] def get_contacts(opts = {}) data, _status_code, _headers = get_contacts_with_http_info(opts) data end # Get all the contacts # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page # @option opts [Integer] :offset Index of the first document of the page # @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed # @return [Array<(GetContacts, Fixnum, Hash)>] GetContacts data, response status code and response headers def get_contacts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_contacts ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts' # query parameters query_params = {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetContacts') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get contacts in a list # @param list_id Id of the list # @param [Hash] opts the optional parameters # @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. # @option opts [Integer] :limit Number of documents per page (default to 50) # @option opts [Integer] :offset Index of the first document of the page (default to 0) # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (default to desc) # @return [GetContacts] def get_contacts_from_list(list_id, opts = {}) data, _status_code, _headers = get_contacts_from_list_with_http_info(list_id, opts) data end # Get contacts in a list # @param list_id Id of the list # @param [Hash] opts the optional parameters # @option opts [String] :modified_since Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. # @option opts [Integer] :limit Number of documents per page # @option opts [Integer] :offset Index of the first document of the page # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed # @return [Array<(GetContacts, Fixnum, Hash)>] GetContacts data, response status code and response headers def get_contacts_from_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_contacts_from_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.get_contacts_from_list" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_contacts_from_list, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetContacts') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_contacts_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Returns a folder's details # @param folder_id id of the folder # @param [Hash] opts the optional parameters # @return [GetFolder] def get_folder(folder_id, opts = {}) data, _status_code, _headers = get_folder_with_http_info(folder_id, opts) data end # Returns a folder's details # @param folder_id id of the folder # @param [Hash] opts the optional parameters # @return [Array<(GetFolder, Fixnum, Hash)>] GetFolder data, response status code and response headers def get_folder_with_http_info(folder_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_folder ...' end # verify the required parameter 'folder_id' is set if @api_client.config.client_side_validation && folder_id.nil? fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.get_folder" end # resource path local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFolder') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get lists in a folder # @param folder_id Id of the folder # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page (default to 10) # @option opts [Integer] :offset Index of the first document of the page (default to 0) # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (default to desc) # @return [GetFolderLists] def get_folder_lists(folder_id, opts = {}) data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts) data end # Get lists in a folder # @param folder_id Id of the folder # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page # @option opts [Integer] :offset Index of the first document of the page # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed # @return [Array<(GetFolderLists, Fixnum, Hash)>] GetFolderLists data, response status code and response headers def get_folder_lists_with_http_info(folder_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_folder_lists ...' end # verify the required parameter 'folder_id' is set if @api_client.config.client_side_validation && folder_id.nil? fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.get_folder_lists" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_folder_lists, must be smaller than or equal to 50.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/folders/{folderId}/lists'.sub('{' + 'folderId' + '}', folder_id.to_s) # query parameters query_params = {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFolderLists') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_folder_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all folders # @param limit Number of documents per page # @param offset Index of the first document of the page # @param [Hash] opts the optional parameters # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (default to desc) # @return [GetFolders] def get_folders(limit, offset, opts = {}) data, _status_code, _headers = get_folders_with_http_info(limit, offset, opts) data end # Get all folders # @param limit Number of documents per page # @param offset Index of the first document of the page # @param [Hash] opts the optional parameters # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed # @return [Array<(GetFolders, Fixnum, Hash)>] GetFolders data, response status code and response headers def get_folders_with_http_info(limit, offset, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_folders ...' end # verify the required parameter 'limit' is set if @api_client.config.client_side_validation && limit.nil? fail ArgumentError, "Missing the required parameter 'limit' when calling ContactsApi.get_folders" end if @api_client.config.client_side_validation && limit > 50 fail ArgumentError, 'invalid value for "limit" when calling ContactsApi.get_folders, must be smaller than or equal to 50.' end # verify the required parameter 'offset' is set if @api_client.config.client_side_validation && offset.nil? fail ArgumentError, "Missing the required parameter 'offset' when calling ContactsApi.get_folders" end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/folders' # query parameters query_params = {} query_params[:'limit'] = limit query_params[:'offset'] = offset query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFolders') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_folders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a list's details # @param list_id Id of the list # @param [Hash] opts the optional parameters # @return [GetExtendedList] def get_list(list_id, opts = {}) data, _status_code, _headers = get_list_with_http_info(list_id, opts) data end # Get a list's details # @param list_id Id of the list # @param [Hash] opts the optional parameters # @return [Array<(GetExtendedList, Fixnum, Hash)>] GetExtendedList data, response status code and response headers def get_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.get_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetExtendedList') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all the lists # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page (default to 10) # @option opts [Integer] :offset Index of the first document of the page (default to 0) # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed (default to desc) # @return [GetLists] def get_lists(opts = {}) data, _status_code, _headers = get_lists_with_http_info(opts) data end # Get all the lists # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of documents per page # @option opts [Integer] :offset Index of the first document of the page # @option opts [String] :sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed # @return [Array<(GetLists, Fixnum, Hash)>] GetLists data, response status code and response headers def get_lists_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.get_lists ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ContactsApi.get_lists, must be smaller than or equal to 50.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/lists' # query parameters query_params = {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetLists') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Import contacts # It returns the background process ID which on completion calls the notify URL that you have set in the input. # @param request_contact_import Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` # @param [Hash] opts the optional parameters # @return [CreatedProcessId] def import_contacts(request_contact_import, opts = {}) data, _status_code, _headers = import_contacts_with_http_info(request_contact_import, opts) data end # Import contacts # It returns the background process ID which on completion calls the notify URL that you have set in the input. # @param request_contact_import Values to import contacts in Sendinblue. To know more about the expected format, please have a look at ``https://help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns`` # @param [Hash] opts the optional parameters # @return [Array<(CreatedProcessId, Fixnum, Hash)>] CreatedProcessId data, response status code and response headers def import_contacts_with_http_info(request_contact_import, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.import_contacts ...' end # verify the required parameter 'request_contact_import' is set if @api_client.config.client_side_validation && request_contact_import.nil? fail ArgumentError, "Missing the required parameter 'request_contact_import' when calling ContactsApi.import_contacts" end # resource path local_var_path = '/contacts/import' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(request_contact_import) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreatedProcessId') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#import_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a contact from a list # @param list_id Id of the list # @param contact_emails Emails addresses OR IDs of the contacts # @param [Hash] opts the optional parameters # @return [PostContactInfo] def remove_contact_from_list(list_id, contact_emails, opts = {}) data, _status_code, _headers = remove_contact_from_list_with_http_info(list_id, contact_emails, opts) data end # Delete a contact from a list # @param list_id Id of the list # @param contact_emails Emails addresses OR IDs of the contacts # @param [Hash] opts the optional parameters # @return [Array<(PostContactInfo, Fixnum, Hash)>] PostContactInfo data, response status code and response headers def remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.remove_contact_from_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.remove_contact_from_list" end # verify the required parameter 'contact_emails' is set if @api_client.config.client_side_validation && contact_emails.nil? fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ContactsApi.remove_contact_from_list" end # resource path local_var_path = '/contacts/lists/{listId}/contacts/remove'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(contact_emails) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PostContactInfo') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#remove_contact_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Export contacts # It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv. # @param request_contact_export Values to request a contact export # @param [Hash] opts the optional parameters # @return [CreatedProcessId] def request_contact_export(request_contact_export, opts = {}) data, _status_code, _headers = request_contact_export_with_http_info(request_contact_export, opts) data end # Export contacts # It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv. # @param request_contact_export Values to request a contact export # @param [Hash] opts the optional parameters # @return [Array<(CreatedProcessId, Fixnum, Hash)>] CreatedProcessId data, response status code and response headers def request_contact_export_with_http_info(request_contact_export, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.request_contact_export ...' end # verify the required parameter 'request_contact_export' is set if @api_client.config.client_side_validation && request_contact_export.nil? fail ArgumentError, "Missing the required parameter 'request_contact_export' when calling ContactsApi.request_contact_export" end # resource path local_var_path = '/contacts/export' # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(request_contact_export) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreatedProcessId') if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#request_contact_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update contact attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the existing attribute # @param update_attribute Values to update an attribute # @param [Hash] opts the optional parameters # @return [nil] def update_attribute(attribute_category, attribute_name, update_attribute, opts = {}) update_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts) nil end # Update contact attribute # @param attribute_category Category of the attribute # @param attribute_name Name of the existing attribute # @param update_attribute Values to update an attribute # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.update_attribute ...' end # verify the required parameter 'attribute_category' is set if @api_client.config.client_side_validation && attribute_category.nil? fail ArgumentError, "Missing the required parameter 'attribute_category' when calling ContactsApi.update_attribute" end # verify enum value if @api_client.config.client_side_validation && !['category', 'calculated', 'global'].include?(attribute_category) fail ArgumentError, "invalid value for 'attribute_category', must be one of category, calculated, global" end # verify the required parameter 'attribute_name' is set if @api_client.config.client_side_validation && attribute_name.nil? fail ArgumentError, "Missing the required parameter 'attribute_name' when calling ContactsApi.update_attribute" end # verify the required parameter 'update_attribute' is set if @api_client.config.client_side_validation && update_attribute.nil? fail ArgumentError, "Missing the required parameter 'update_attribute' when calling ContactsApi.update_attribute" end # resource path local_var_path = '/contacts/attributes/{attributeCategory}/{attributeName}'.sub('{' + 'attributeCategory' + '}', attribute_category.to_s).sub('{' + 'attributeName' + '}', attribute_name.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(update_attribute) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#update_attribute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a contact # @param identifier Email (urlencoded) OR ID of the contact # @param update_contact Values to update a contact # @param [Hash] opts the optional parameters # @return [nil] def update_contact(identifier, update_contact, opts = {}) update_contact_with_http_info(identifier, update_contact, opts) nil end # Update a contact # @param identifier Email (urlencoded) OR ID of the contact # @param update_contact Values to update a contact # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_contact_with_http_info(identifier, update_contact, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.update_contact ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ContactsApi.update_contact" end # verify the required parameter 'update_contact' is set if @api_client.config.client_side_validation && update_contact.nil? fail ArgumentError, "Missing the required parameter 'update_contact' when calling ContactsApi.update_contact" end # resource path local_var_path = '/contacts/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(update_contact) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a folder # @param folder_id Id of the folder # @param update_folder Name of the folder # @param [Hash] opts the optional parameters # @return [nil] def update_folder(folder_id, update_folder, opts = {}) update_folder_with_http_info(folder_id, update_folder, opts) nil end # Update a folder # @param folder_id Id of the folder # @param update_folder Name of the folder # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_folder_with_http_info(folder_id, update_folder, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.update_folder ...' end # verify the required parameter 'folder_id' is set if @api_client.config.client_side_validation && folder_id.nil? fail ArgumentError, "Missing the required parameter 'folder_id' when calling ContactsApi.update_folder" end # verify the required parameter 'update_folder' is set if @api_client.config.client_side_validation && update_folder.nil? fail ArgumentError, "Missing the required parameter 'update_folder' when calling ContactsApi.update_folder" end # resource path local_var_path = '/contacts/folders/{folderId}'.sub('{' + 'folderId' + '}', folder_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(update_folder) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#update_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a list # @param list_id Id of the list # @param update_list Values to update a list # @param [Hash] opts the optional parameters # @return [nil] def update_list(list_id, update_list, opts = {}) update_list_with_http_info(list_id, update_list, opts) nil end # Update a list # @param list_id Id of the list # @param update_list Values to update a list # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_list_with_http_info(list_id, update_list, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContactsApi.update_list ...' end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ContactsApi.update_list" end # verify the required parameter 'update_list' is set if @api_client.config.client_side_validation && update_list.nil? fail ArgumentError, "Missing the required parameter 'update_list' when calling ContactsApi.update_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(update_list) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContactsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end