class SibApiV3Sdk::ContactsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

add_contact_to_list(list_id, contact_emails, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 37
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_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 47
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_attribute(attribute_category, attribute_name, create_attribute, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 96
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_attribute_with_http_info(attribute_category, attribute_name, create_attribute, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 107
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_contact(create_contact, opts = {}) click to toggle source

Create a contact @param create_contact Values to create a contact @param [Hash] opts the optional parameters @return [CreateUpdateContactModel]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 161
def create_contact(create_contact, opts = {})
  data, _status_code, _headers = create_contact_with_http_info(create_contact, opts)
  data
end
create_contact_with_http_info(create_contact, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 170
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_doi_contact(create_doi_contact, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 213
def create_doi_contact(create_doi_contact, opts = {})
  create_doi_contact_with_http_info(create_doi_contact, opts)
  nil
end
create_doi_contact_with_http_info(create_doi_contact, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 222
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_folder(create_folder, opts = {}) click to toggle source

Create a folder @param create_folder Name of the folder @param [Hash] opts the optional parameters @return [CreateModel]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 264
def create_folder(create_folder, opts = {})
  data, _status_code, _headers = create_folder_with_http_info(create_folder, opts)
  data
end
create_folder_with_http_info(create_folder, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 273
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_list(create_list, opts = {}) click to toggle source

Create a list @param create_list Values to create a list @param [Hash] opts the optional parameters @return [CreateModel]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 316
def create_list(create_list, opts = {})
  data, _status_code, _headers = create_list_with_http_info(create_list, opts)
  data
end
create_list_with_http_info(create_list, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 325
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_attribute(attribute_category, attribute_name, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 369
def delete_attribute(attribute_category, attribute_name, opts = {})
  delete_attribute_with_http_info(attribute_category, attribute_name, opts)
  nil
end
delete_attribute_with_http_info(attribute_category, attribute_name, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 379
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_contact(identifier, opts = {}) click to toggle source

Delete a contact @param identifier Email (urlencoded) OR ID of the contact @param [Hash] opts the optional parameters @return [nil]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 429
def delete_contact(identifier, opts = {})
  delete_contact_with_http_info(identifier, opts)
  nil
end
delete_contact_with_http_info(identifier, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 438
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_folder(folder_id, opts = {}) click to toggle source

Delete a folder (and all its lists) @param folder_id Id of the folder @param [Hash] opts the optional parameters @return [nil]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 480
def delete_folder(folder_id, opts = {})
  delete_folder_with_http_info(folder_id, opts)
  nil
end
delete_folder_with_http_info(folder_id, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 489
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_list(list_id, opts = {}) click to toggle source

Delete a list @param list_id Id of the list @param [Hash] opts the optional parameters @return [nil]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 531
def delete_list(list_id, opts = {})
  delete_list_with_http_info(list_id, opts)
  nil
end
delete_list_with_http_info(list_id, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 540
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
get_attributes(opts = {}) click to toggle source

List all attributes @param [Hash] opts the optional parameters @return [GetAttributes]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 581
def get_attributes(opts = {})
  data, _status_code, _headers = get_attributes_with_http_info(opts)
  data
end
get_attributes_with_http_info(opts = {}) click to toggle source

List all attributes @param [Hash] opts the optional parameters @return [Array<(GetAttributes, Fixnum, Hash)>] GetAttributes data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 589
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_contact_info(identifier, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 628
def get_contact_info(identifier, opts = {})
  data, _status_code, _headers = get_contact_info_with_http_info(identifier, opts)
  data
end
get_contact_info_with_http_info(identifier, opts = {}) click to toggle source

Get a contact&#39;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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 637
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_contact_stats(identifier, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 682
def get_contact_stats(identifier, opts = {})
  data, _status_code, _headers = get_contact_stats_with_http_info(identifier, opts)
  data
end
get_contact_stats_with_http_info(identifier, opts = {}) click to toggle source

Get email campaigns&#39; 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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 693
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_contacts(opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed (default to desc) @return [GetContacts]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 741
def get_contacts(opts = {})
  data, _status_code, _headers = get_contacts_with_http_info(opts)
  data
end
get_contacts_from_list(list_id, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed (default to desc) @return [GetContacts]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 807
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_from_list_with_http_info(list_id, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed @return [Array<(GetContacts, Fixnum, Hash)>] GetContacts data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 820
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
get_contacts_with_http_info(opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed @return [Array<(GetContacts, Fixnum, Hash)>] GetContacts data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 753
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_folder(folder_id, opts = {}) click to toggle source

Returns a folder's details @param folder_id id of the folder @param [Hash] opts the optional parameters @return [GetFolder]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 874
def get_folder(folder_id, opts = {})
  data, _status_code, _headers = get_folder_with_http_info(folder_id, opts)
  data
end
get_folder_lists(folder_id, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed (default to desc) @return [GetFolderLists]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 929
def get_folder_lists(folder_id, opts = {})
  data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts)
  data
end
get_folder_lists_with_http_info(folder_id, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed @return [Array<(GetFolderLists, Fixnum, Hash)>] GetFolderLists data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 941
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_folder_with_http_info(folder_id, opts = {}) click to toggle source

Returns a folder&#39;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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 883
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_folders(limit, offset, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed (default to desc) @return [GetFolders]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 996
def get_folders(limit, offset, opts = {})
  data, _status_code, _headers = get_folders_with_http_info(limit, offset, opts)
  data
end
get_folders_with_http_info(limit, offset, opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed @return [Array<(GetFolders, Fixnum, Hash)>] GetFolders data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1007
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_list(list_id, opts = {}) click to toggle source

Get a list's details @param list_id Id of the list @param [Hash] opts the optional parameters @return [GetExtendedList]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1064
def get_list(list_id, opts = {})
  data, _status_code, _headers = get_list_with_http_info(list_id, opts)
  data
end
get_list_with_http_info(list_id, opts = {}) click to toggle source

Get a list&#39;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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1073
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_lists(opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed (default to desc) @return [GetLists]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1118
def get_lists(opts = {})
  data, _status_code, _headers = get_lists_with_http_info(opts)
  data
end
get_lists_with_http_info(opts = {}) click to toggle source

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 &#x60;sort&#x60; is not passed @return [Array<(GetLists, Fixnum, Hash)>] GetLists data, response status code and response headers

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1129
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(request_contact_import, opts = {}) click to toggle source

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 &#x60;&#x60;help.sendinblue.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns``; @param [Hash] opts the optional parameters @return [CreatedProcessId]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1179
def import_contacts(request_contact_import, opts = {})
  data, _status_code, _headers = import_contacts_with_http_info(request_contact_import, opts)
  data
end
import_contacts_with_http_info(request_contact_import, opts = {}) click to toggle source

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 &#x60;&#x60;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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1189
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
remove_contact_from_list(list_id, contact_emails, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1233
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
remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1243
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
request_contact_export(request_contact_export, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1291
def request_contact_export(request_contact_export, opts = {})
  data, _status_code, _headers = request_contact_export_with_http_info(request_contact_export, opts)
  data
end
request_contact_export_with_http_info(request_contact_export, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1301
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
setUserAgent(user_agent) click to toggle source

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#{VERSION}/ruby

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 25
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
update_attribute(attribute_category, attribute_name, update_attribute, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1346
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_attribute_with_http_info(attribute_category, attribute_name, update_attribute, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1357
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_contact(identifier, update_contact, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1412
def update_contact(identifier, update_contact, opts = {})
  update_contact_with_http_info(identifier, update_contact, opts)
  nil
end
update_contact_with_http_info(identifier, update_contact, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1422
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_folder(folder_id, update_folder, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1469
def update_folder(folder_id, update_folder, opts = {})
  update_folder_with_http_info(folder_id, update_folder, opts)
  nil
end
update_folder_with_http_info(folder_id, update_folder, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1479
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_list(list_id, update_list, opts = {}) click to toggle source

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]

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1526
def update_list(list_id, update_list, opts = {})
  update_list_with_http_info(list_id, update_list, opts)
  nil
end
update_list_with_http_info(list_id, update_list, opts = {}) click to toggle source

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

# File lib/sib-api-v3-sdk/api/contacts_api.rb, line 1536
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