class Pipedrive::NotesApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

notes_get(opts = {}) click to toggle source

Get all notes Returns all notes. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user whose notes to fetch. If omitted, notes by all users will be returned. @option opts [Integer] :deal_id ID of the deal which notes to fetch. If omitted, notes about all deals with be returned. @option opts [Integer] :person_id ID of the person whose notes to fetch. If omitted, notes about all persons with be returned. @option opts [Integer] :org_id ID of the organization which notes to fetch. If omitted, notes about all organizations with be returned. @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, content, add_time, update_time. @option opts [Date] :start_date Date in format of YYYY-MM-DD from which notes to fetch from. @option opts [Date] :end_date Date in format of YYYY-MM-DD until which notes to fetch to. @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state. @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state. @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state. @return [GetNotes]

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 38
def notes_get(opts = {})
  data, _status_code, _headers = notes_get_with_http_info(opts)
  data
end
notes_get_with_http_info(opts = {}) click to toggle source

Get all notes Returns all notes. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user whose notes to fetch. If omitted, notes by all users will be returned. @option opts [Integer] :deal_id ID of the deal which notes to fetch. If omitted, notes about all deals with be returned. @option opts [Integer] :person_id ID of the person whose notes to fetch. If omitted, notes about all persons with be returned. @option opts [Integer] :org_id ID of the organization which notes to fetch. If omitted, notes about all organizations with be returned. @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, content, add_time, update_time. @option opts [Date] :start_date Date in format of YYYY-MM-DD from which notes to fetch from. @option opts [Date] :end_date Date in format of YYYY-MM-DD until which notes to fetch to. @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state. @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state. @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state. @return [Array<(GetNotes, Integer, Hash)>] GetNotes data, response status code and response headers

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 59
def notes_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotesApi.notes_get ...'
  end
  # resource path
  local_var_path = '/notes'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'deal_id'] = opts[:'deal_id'] if !opts[:'deal_id'].nil?
  query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  query_params[:'org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'pinned_to_deal_flag'] = opts[:'pinned_to_deal_flag'] if !opts[:'pinned_to_deal_flag'].nil?
  query_params[:'pinned_to_organization_flag'] = opts[:'pinned_to_organization_flag'] if !opts[:'pinned_to_organization_flag'].nil?
  query_params[:'pinned_to_person_flag'] = opts[:'pinned_to_person_flag'] if !opts[:'pinned_to_person_flag'].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] || 'GetNotes' 

  # 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: NotesApi#notes_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
notes_id_delete(id, opts = {}) click to toggle source

Delete a note Deletes a specific note. @param id [Integer] ID of the note @param [Hash] opts the optional parameters @return [DeleteNote]

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 119
def notes_id_delete(id, opts = {})
  data, _status_code, _headers = notes_id_delete_with_http_info(id, opts)
  data
end
notes_id_delete_with_http_info(id, opts = {}) click to toggle source

Delete a note Deletes a specific note. @param id [Integer] ID of the note @param [Hash] opts the optional parameters @return [Array<(DeleteNote, Integer, Hash)>] DeleteNote data, response status code and response headers

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 129
def notes_id_delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotesApi.notes_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 NotesApi.notes_id_delete"
  end
  # resource path
  local_var_path = '/notes/{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] || 'DeleteNote' 

  # 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: NotesApi#notes_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
notes_id_get(id, opts = {}) click to toggle source

Get one note Returns details about a specific note. @param id [Integer] ID of the note @param [Hash] opts the optional parameters @return [PostNote]

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 181
def notes_id_get(id, opts = {})
  data, _status_code, _headers = notes_id_get_with_http_info(id, opts)
  data
end
notes_id_get_with_http_info(id, opts = {}) click to toggle source

Get one note Returns details about a specific note. @param id [Integer] ID of the note @param [Hash] opts the optional parameters @return [Array<(PostNote, Integer, Hash)>] PostNote data, response status code and response headers

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 191
def notes_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotesApi.notes_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 NotesApi.notes_id_get"
  end
  # resource path
  local_var_path = '/notes/{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] || 'PostNote' 

  # 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: NotesApi#notes_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
notes_id_put(id, content, opts = {}) click to toggle source

Update a note Updates a note. @param id [Integer] ID of the note @param content [String] Content of the note in HTML format. Subject to sanitization on the back-end. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user who will be marked as the author of this note. Only an admin can change the author. @option opts [Integer] :deal_id ID of the deal the note will be attached to. @option opts [Integer] :person_id ID of the person this note will be attached to. @option opts [Integer] :org_id ID of the organization this note will be attached to. @option opts [String] :add_time Optional creation date &amp; time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state (deal_id is also required). @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state (org_id is also required). @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state (person_id is also required). @return [PostNote]

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 252
def notes_id_put(id, content, opts = {})
  data, _status_code, _headers = notes_id_put_with_http_info(id, content, opts)
  data
end
notes_id_put_with_http_info(id, content, opts = {}) click to toggle source

Update a note Updates a note. @param id [Integer] ID of the note @param content [String] Content of the note in HTML format. Subject to sanitization on the back-end. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user who will be marked as the author of this note. Only an admin can change the author. @option opts [Integer] :deal_id ID of the deal the note will be attached to. @option opts [Integer] :person_id ID of the person this note will be attached to. @option opts [Integer] :org_id ID of the organization this note will be attached to. @option opts [String] :add_time Optional creation date &amp; time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state (deal_id is also required). @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state (org_id is also required). @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state (person_id is also required). @return [Array<(PostNote, Integer, Hash)>] PostNote data, response status code and response headers

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 271
def notes_id_put_with_http_info(id, content, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotesApi.notes_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 NotesApi.notes_id_put"
  end
  # verify the required parameter 'content' is set
  if @api_client.config.client_side_validation && content.nil?
    fail ArgumentError, "Missing the required parameter 'content' when calling NotesApi.notes_id_put"
  end
  # resource path
  local_var_path = '/notes/{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['content'] = content
  form_params['user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  form_params['deal_id'] = opts[:'deal_id'] if !opts[:'deal_id'].nil?
  form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  form_params['org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  form_params['add_time'] = opts[:'add_time'] if !opts[:'add_time'].nil?
  form_params['pinned_to_deal_flag'] = opts[:'pinned_to_deal_flag'] if !opts[:'pinned_to_deal_flag'].nil?
  form_params['pinned_to_organization_flag'] = opts[:'pinned_to_organization_flag'] if !opts[:'pinned_to_organization_flag'].nil?
  form_params['pinned_to_person_flag'] = opts[:'pinned_to_person_flag'] if !opts[:'pinned_to_person_flag'].nil?

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

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

  # 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: NotesApi#notes_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
notes_post(content, opts = {}) click to toggle source

Add a note Adds a new note. @param content [String] Content of the note in HTML format. Subject to sanitization on the back-end. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user who will be marked as the author of this note. Only an admin can change the author. @option opts [Integer] :deal_id ID of the deal the note will be attached to. @option opts [Integer] :person_id ID of the person this note will be attached to. @option opts [Integer] :org_id ID of the organization this note will be attached to. @option opts [String] :add_time Optional creation date &amp; time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state (deal_id is also required). @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state (org_id is also required). @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state (person_id is also required). @return [PostNote]

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 346
def notes_post(content, opts = {})
  data, _status_code, _headers = notes_post_with_http_info(content, opts)
  data
end
notes_post_with_http_info(content, opts = {}) click to toggle source

Add a note Adds a new note. @param content [String] Content of the note in HTML format. Subject to sanitization on the back-end. @param [Hash] opts the optional parameters @option opts [Integer] :user_id ID of the user who will be marked as the author of this note. Only an admin can change the author. @option opts [Integer] :deal_id ID of the deal the note will be attached to. @option opts [Integer] :person_id ID of the person this note will be attached to. @option opts [Integer] :org_id ID of the organization this note will be attached to. @option opts [String] :add_time Optional creation date &amp; time of the Note in UTC. Can be set in the past or in the future. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS @option opts [NumberBoolean] :pinned_to_deal_flag If set, then results are filtered by note to deal pinning state (deal_id is also required). @option opts [NumberBoolean] :pinned_to_organization_flag If set, then results are filtered by note to organization pinning state (org_id is also required). @option opts [NumberBoolean] :pinned_to_person_flag If set, then results are filtered by note to person pinning state (person_id is also required). @return [Array<(PostNote, Integer, Hash)>] PostNote data, response status code and response headers

# File lib/pipedrive-openapi-client/api/notes_api.rb, line 364
def notes_post_with_http_info(content, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotesApi.notes_post ...'
  end
  # verify the required parameter 'content' is set
  if @api_client.config.client_side_validation && content.nil?
    fail ArgumentError, "Missing the required parameter 'content' when calling NotesApi.notes_post"
  end
  # resource path
  local_var_path = '/notes'

  # 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['content'] = content
  form_params['user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  form_params['deal_id'] = opts[:'deal_id'] if !opts[:'deal_id'].nil?
  form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  form_params['org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  form_params['add_time'] = opts[:'add_time'] if !opts[:'add_time'].nil?
  form_params['pinned_to_deal_flag'] = opts[:'pinned_to_deal_flag'] if !opts[:'pinned_to_deal_flag'].nil?
  form_params['pinned_to_organization_flag'] = opts[:'pinned_to_organization_flag'] if !opts[:'pinned_to_organization_flag'].nil?
  form_params['pinned_to_person_flag'] = opts[:'pinned_to_person_flag'] if !opts[:'pinned_to_person_flag'].nil?

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

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

  # 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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NotesApi#notes_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end