class Pipedrive::MailThreadsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

mailbox_mail_threads_get(folder, opts = {}) click to toggle source

Get mail threads Returns mail threads in specified folder ordered by most recent message within. @param folder [String] Type of folder to fetch. @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @return [MailThread]

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 29
def mailbox_mail_threads_get(folder, opts = {})
  data, _status_code, _headers = mailbox_mail_threads_get_with_http_info(folder, opts)
  data
end
mailbox_mail_threads_get_with_http_info(folder, opts = {}) click to toggle source

Get mail threads Returns mail threads in specified folder ordered by most recent message within. @param folder [String] Type of folder to fetch. @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(MailThread, Integer, Hash)>] MailThread data, response status code and response headers

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 41
def mailbox_mail_threads_get_with_http_info(folder, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailThreadsApi.mailbox_mail_threads_get ...'
  end
  # verify the required parameter 'folder' is set
  if @api_client.config.client_side_validation && folder.nil?
    fail ArgumentError, "Missing the required parameter 'folder' when calling MailThreadsApi.mailbox_mail_threads_get"
  end
  # verify enum value
  allowable_values = ["inbox", "drafts", "sent", "archive"]
  if @api_client.config.client_side_validation && !allowable_values.include?(folder)
    fail ArgumentError, "invalid value for \"folder\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/mailbox/mailThreads'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'folder'] = folder
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'MailThread' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailThreadsApi#mailbox_mail_threads_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
mailbox_mail_threads_id_delete(id, opts = {}) click to toggle source

Delete mail thread Marks mail thread as deleted. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [MailThreadDelete]

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 101
def mailbox_mail_threads_id_delete(id, opts = {})
  data, _status_code, _headers = mailbox_mail_threads_id_delete_with_http_info(id, opts)
  data
end
mailbox_mail_threads_id_delete_with_http_info(id, opts = {}) click to toggle source

Delete mail thread Marks mail thread as deleted. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [Array<(MailThreadDelete, Integer, Hash)>] MailThreadDelete data, response status code and response headers

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 111
def mailbox_mail_threads_id_delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailThreadsApi.mailbox_mail_threads_id_delete ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MailThreadsApi.mailbox_mail_threads_id_delete"
  end
  # resource path
  local_var_path = '/mailbox/mailThreads/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'MailThreadDelete' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailThreadsApi#mailbox_mail_threads_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
mailbox_mail_threads_id_get(id, opts = {}) click to toggle source

Get one mail thread Returns specific mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [MailThreadOne]

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 163
def mailbox_mail_threads_id_get(id, opts = {})
  data, _status_code, _headers = mailbox_mail_threads_id_get_with_http_info(id, opts)
  data
end
mailbox_mail_threads_id_get_with_http_info(id, opts = {}) click to toggle source

Get one mail thread Returns specific mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [Array<(MailThreadOne, Integer, Hash)>] MailThreadOne data, response status code and response headers

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 173
def mailbox_mail_threads_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailThreadsApi.mailbox_mail_threads_id_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MailThreadsApi.mailbox_mail_threads_id_get"
  end
  # resource path
  local_var_path = '/mailbox/mailThreads/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'MailThreadOne' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailThreadsApi#mailbox_mail_threads_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
mailbox_mail_threads_id_mail_messages_get(id, opts = {}) click to toggle source

Get all mail messages of mail thread Get mail messages inside specified mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [MailThreadMessages]

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 225
def mailbox_mail_threads_id_mail_messages_get(id, opts = {})
  data, _status_code, _headers = mailbox_mail_threads_id_mail_messages_get_with_http_info(id, opts)
  data
end
mailbox_mail_threads_id_mail_messages_get_with_http_info(id, opts = {}) click to toggle source

Get all mail messages of mail thread Get mail messages inside specified mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @return [Array<(MailThreadMessages, Integer, Hash)>] MailThreadMessages data, response status code and response headers

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 235
def mailbox_mail_threads_id_mail_messages_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailThreadsApi.mailbox_mail_threads_id_mail_messages_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MailThreadsApi.mailbox_mail_threads_id_mail_messages_get"
  end
  # resource path
  local_var_path = '/mailbox/mailThreads/{id}/mailMessages'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'MailThreadMessages' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailThreadsApi#mailbox_mail_threads_id_mail_messages_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
mailbox_mail_threads_id_put(id, opts = {}) click to toggle source

Update mail thread details Updates the properties of a mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @option opts [Integer] :deal_id ID of the deal this thread is associated with @option opts [NumberBoolean] :shared_flag @option opts [NumberBoolean] :read_flag @option opts [NumberBoolean] :archived_flag @return [MailThreadPut]

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 291
def mailbox_mail_threads_id_put(id, opts = {})
  data, _status_code, _headers = mailbox_mail_threads_id_put_with_http_info(id, opts)
  data
end
mailbox_mail_threads_id_put_with_http_info(id, opts = {}) click to toggle source

Update mail thread details Updates the properties of a mail thread. @param id [Integer] ID of the mail thread @param [Hash] opts the optional parameters @option opts [Integer] :deal_id ID of the deal this thread is associated with @option opts [NumberBoolean] :shared_flag @option opts [NumberBoolean] :read_flag @option opts [NumberBoolean] :archived_flag @return [Array<(MailThreadPut, Integer, Hash)>] MailThreadPut data, response status code and response headers

# File lib/pipedrive-openapi-client/api/mail_threads_api.rb, line 305
def mailbox_mail_threads_id_put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MailThreadsApi.mailbox_mail_threads_id_put ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MailThreadsApi.mailbox_mail_threads_id_put"
  end
  # resource path
  local_var_path = '/mailbox/mailThreads/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['deal_id'] = opts[:'deal_id'] if !opts[:'deal_id'].nil?
  form_params['shared_flag'] = opts[:'shared_flag'] if !opts[:'shared_flag'].nil?
  form_params['read_flag'] = opts[:'read_flag'] if !opts[:'read_flag'].nil?
  form_params['archived_flag'] = opts[:'archived_flag'] if !opts[:'archived_flag'].nil?

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'MailThreadPut' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MailThreadsApi#mailbox_mail_threads_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end