Class: Pipedrive::NotesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pipedrive-openapi-client/api/notes_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ NotesApi

Returns a new instance of NotesApi.



19
20
21
# File 'lib/pipedrive-openapi-client/api/notes_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pipedrive-openapi-client/api/notes_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#notes_get(opts = {}) ⇒ GetNotes

Get all notes Returns all notes.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user whose notes to fetch. If omitted, notes by all users will be returned.

  • :deal_id (Integer)

    ID of the deal which notes to fetch. If omitted, notes about all deals with be returned.

  • :person_id (Integer)

    ID of the person whose notes to fetch. If omitted, notes about all persons with be returned.

  • :org_id (Integer)

    ID of the organization which notes to fetch. If omitted, notes about all organizations with be returned.

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :sort (String)

    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.

  • :start_date (Date)

    Date in format of YYYY-MM-DD from which notes to fetch from.

  • :end_date (Date)

    Date in format of YYYY-MM-DD until which notes to fetch to.

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state.

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state.

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state.

Returns:



38
39
40
41
# 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 = {}) ⇒ Array<(GetNotes, Integer, Hash)>

Get all notes Returns all notes.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user whose notes to fetch. If omitted, notes by all users will be returned.

  • :deal_id (Integer)

    ID of the deal which notes to fetch. If omitted, notes about all deals with be returned.

  • :person_id (Integer)

    ID of the person whose notes to fetch. If omitted, notes about all persons with be returned.

  • :org_id (Integer)

    ID of the organization which notes to fetch. If omitted, notes about all organizations with be returned.

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :sort (String)

    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.

  • :start_date (Date)

    Date in format of YYYY-MM-DD from which notes to fetch from.

  • :end_date (Date)

    Date in format of YYYY-MM-DD until which notes to fetch to.

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state.

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state.

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state.

Returns:

  • (Array<(GetNotes, Integer, Hash)>)

    GetNotes data, response status code and response headers



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# 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 = {}) ⇒ DeleteNote

Delete a note Deletes a specific note.

Parameters:

  • id (Integer)

    ID of the note

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



119
120
121
122
# 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 = {}) ⇒ Array<(DeleteNote, Integer, Hash)>

Delete a note Deletes a specific note.

Parameters:

  • id (Integer)

    ID of the note

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteNote, Integer, Hash)>)

    DeleteNote data, response status code and response headers



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# 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 = {}) ⇒ PostNote

Get one note Returns details about a specific note.

Parameters:

  • id (Integer)

    ID of the note

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



181
182
183
184
# 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 = {}) ⇒ Array<(PostNote, Integer, Hash)>

Get one note Returns details about a specific note.

Parameters:

  • id (Integer)

    ID of the note

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PostNote, Integer, Hash)>)

    PostNote data, response status code and response headers



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# 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 = {}) ⇒ PostNote

Update a note Updates a note.

Parameters:

  • id (Integer)

    ID of the note

  • content (String)

    Content of the note in HTML format. Subject to sanitization on the back-end.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user who will be marked as the author of this note. Only an admin can change the author.

  • :deal_id (Integer)

    ID of the deal the note will be attached to.

  • :person_id (Integer)

    ID of the person this note will be attached to.

  • :org_id (Integer)

    ID of the organization this note will be attached to.

  • :add_time (String)

    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

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state (deal_id is also required).

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state (org_id is also required).

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state (person_id is also required).

Returns:



252
253
254
255
# 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 = {}) ⇒ Array<(PostNote, Integer, Hash)>

Update a note Updates a note.

Parameters:

  • id (Integer)

    ID of the note

  • content (String)

    Content of the note in HTML format. Subject to sanitization on the back-end.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user who will be marked as the author of this note. Only an admin can change the author.

  • :deal_id (Integer)

    ID of the deal the note will be attached to.

  • :person_id (Integer)

    ID of the person this note will be attached to.

  • :org_id (Integer)

    ID of the organization this note will be attached to.

  • :add_time (String)

    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

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state (deal_id is also required).

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state (org_id is also required).

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state (person_id is also required).

Returns:

  • (Array<(PostNote, Integer, Hash)>)

    PostNote data, response status code and response headers



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# 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 = {}) ⇒ PostNote

Add a note Adds a new note.

Parameters:

  • content (String)

    Content of the note in HTML format. Subject to sanitization on the back-end.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user who will be marked as the author of this note. Only an admin can change the author.

  • :deal_id (Integer)

    ID of the deal the note will be attached to.

  • :person_id (Integer)

    ID of the person this note will be attached to.

  • :org_id (Integer)

    ID of the organization this note will be attached to.

  • :add_time (String)

    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

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state (deal_id is also required).

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state (org_id is also required).

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state (person_id is also required).

Returns:



346
347
348
349
# 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 = {}) ⇒ Array<(PostNote, Integer, Hash)>

Add a note Adds a new note.

Parameters:

  • content (String)

    Content of the note in HTML format. Subject to sanitization on the back-end.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    ID of the user who will be marked as the author of this note. Only an admin can change the author.

  • :deal_id (Integer)

    ID of the deal the note will be attached to.

  • :person_id (Integer)

    ID of the person this note will be attached to.

  • :org_id (Integer)

    ID of the organization this note will be attached to.

  • :add_time (String)

    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

  • :pinned_to_deal_flag (NumberBoolean)

    If set, then results are filtered by note to deal pinning state (deal_id is also required).

  • :pinned_to_organization_flag (NumberBoolean)

    If set, then results are filtered by note to organization pinning state (org_id is also required).

  • :pinned_to_person_flag (NumberBoolean)

    If set, then results are filtered by note to person pinning state (person_id is also required).

Returns:

  • (Array<(PostNote, Integer, Hash)>)

    PostNote data, response status code and response headers



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# 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