Class: Pipedrive::FilesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FilesApi

Returns a new instance of FilesApi.



19
20
21
# File 'lib/pipedrive-openapi-client/api/files_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/files_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#files_get(opts = {}) ⇒ GetAllFiles

Get all files Returns data about all files.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :include_deleted_files (NumberBoolean)

    When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.

  • :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, product_id, add_time, update_time, file_name, file_type, file_size, comment.

Returns:



30
31
32
33
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 30

def files_get(opts = {})
  data, _status_code, _headers = files_get_with_http_info(opts)
  data
end

#files_get_with_http_info(opts = {}) ⇒ Array<(GetAllFiles, Integer, Hash)>

Get all files Returns data about all files.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :include_deleted_files (NumberBoolean)

    When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.

  • :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, product_id, add_time, update_time, file_name, file_type, file_size, comment.

Returns:

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

    GetAllFiles data, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 43

def files_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_get ...'
  end
  # resource path
  local_var_path = '/files'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'GetAllFiles' 

  # 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: FilesApi#files_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_id_delete(id, opts = {}) ⇒ DeleteFile

Delete a file Marks a file as deleted.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:



95
96
97
98
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 95

def files_id_delete(id, opts = {})
  data, _status_code, _headers = files_id_delete_with_http_info(id, opts)
  data
end

#files_id_delete_with_http_info(id, opts = {}) ⇒ Array<(DeleteFile, Integer, Hash)>

Delete a file Marks a file as deleted.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:

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

    DeleteFile data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 105

def files_id_delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_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 FilesApi.files_id_delete"
  end
  # resource path
  local_var_path = '/files/{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] || 'DeleteFile' 

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

  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: FilesApi#files_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_id_download_get(id, opts = {}) ⇒ File

Download one file Initializes a file download.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:

  • (File)


157
158
159
160
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 157

def files_id_download_get(id, opts = {})
  data, _status_code, _headers = files_id_download_get_with_http_info(id, opts)
  data
end

#files_id_download_get_with_http_info(id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Download one file Initializes a file download.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 167

def files_id_download_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_id_download_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 FilesApi.files_id_download_get"
  end
  # resource path
  local_var_path = '/files/{id}/download'.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/octet-stream'])

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

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

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

  # 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: FilesApi#files_id_download_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_id_get(id, opts = {}) ⇒ GetOneFile

Get one file Returns data about a specific file.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:



219
220
221
222
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 219

def files_id_get(id, opts = {})
  data, _status_code, _headers = files_id_get_with_http_info(id, opts)
  data
end

#files_id_get_with_http_info(id, opts = {}) ⇒ Array<(GetOneFile, Integer, Hash)>

Get one file Returns data about a specific file.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Returns:

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

    GetOneFile data, response status code and response headers



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 229

def files_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_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 FilesApi.files_id_get"
  end
  # resource path
  local_var_path = '/files/{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] || 'GetOneFile' 

  # 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: FilesApi#files_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_id_put(id, opts = {}) ⇒ UpdateFile

Update file details Updates the properties of a file.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Visible name of the file

  • :description (String)

    Description of the file

Returns:



283
284
285
286
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 283

def files_id_put(id, opts = {})
  data, _status_code, _headers = files_id_put_with_http_info(id, opts)
  data
end

#files_id_put_with_http_info(id, opts = {}) ⇒ Array<(UpdateFile, Integer, Hash)>

Update file details Updates the properties of a file.

Parameters:

  • id (Integer)

    ID of the file

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Visible name of the file

  • :description (String)

    Description of the file

Returns:

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

    UpdateFile data, response status code and response headers



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
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 295

def files_id_put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_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 FilesApi.files_id_put"
  end
  # resource path
  local_var_path = '/files/{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['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?

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

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

  # 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: FilesApi#files_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_post(file, opts = {}) ⇒ AddFile

Add file Lets you upload a file and associate it with Deal, Person, Organization, Activity or Product. For more information on how to add a file, see <a href="pipedrive.readme.io/docs/adding-a-file" target="_blank" rel="noopener noreferrer">this tutorial</a>.

Parameters:

  • file (File)

    A single file, supplied in the multipart/form-data encoding and contained within the given boundaries.

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

    the optional parameters

Options Hash (opts):

  • :deal_id (Integer)

    ID of the deal to associate file(s) with

  • :person_id (Integer)

    ID of the person to associate file(s) with

  • :org_id (Integer)

    ID of the organization to associate file(s) with

  • :product_id (Integer)

    ID of the product to associate file(s) with

  • :activity_id (Integer)

    ID of the activity to associate file(s) with

Returns:



356
357
358
359
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 356

def files_post(file, opts = {})
  data, _status_code, _headers = files_post_with_http_info(file, opts)
  data
end

#files_post_with_http_info(file, opts = {}) ⇒ Array<(AddFile, Integer, Hash)>

Add file Lets you upload a file and associate it with Deal, Person, Organization, Activity or Product. For more information on how to add a file, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/adding-a-file&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • file (File)

    A single file, supplied in the multipart/form-data encoding and contained within the given boundaries.

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

    the optional parameters

Options Hash (opts):

  • :deal_id (Integer)

    ID of the deal to associate file(s) with

  • :person_id (Integer)

    ID of the person to associate file(s) with

  • :org_id (Integer)

    ID of the organization to associate file(s) with

  • :product_id (Integer)

    ID of the product to associate file(s) with

  • :activity_id (Integer)

    ID of the activity to associate file(s) with

Returns:

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

    AddFile data, response status code and response headers



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
421
422
423
424
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 371

def files_post_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_post ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling FilesApi.files_post"
  end
  # resource path
  local_var_path = '/files'

  # 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(['multipart/form-data'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  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['product_id'] = opts[:'product_id'] if !opts[:'product_id'].nil?
  form_params['activity_id'] = opts[:'activity_id'] if !opts[:'activity_id'].nil?

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

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

  # 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: FilesApi#files_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_remote_link_post(item_type, item_id, remote_id, remote_location, opts = {}) ⇒ LinkRemoteFileToItem

Link a remote file to an item Links an existing remote file (googledrive) to the item you supply. For more information on how to link a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>.

Parameters:

  • item_type (String)

    The item type

  • item_id (Integer)

    ID of the item to associate the file with

  • remote_id (String)

    The remote item id

  • remote_location (String)

    The location type to send the file to. Only googledrive is supported at the moment.

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

    the optional parameters

Returns:



434
435
436
437
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 434

def files_remote_link_post(item_type, item_id, remote_id, remote_location, opts = {})
  data, _status_code, _headers = files_remote_link_post_with_http_info(item_type, item_id, remote_id, remote_location, opts)
  data
end

#files_remote_link_post_with_http_info(item_type, item_id, remote_id, remote_location, opts = {}) ⇒ Array<(LinkRemoteFileToItem, Integer, Hash)>

Link a remote file to an item Links an existing remote file (googledrive) to the item you supply. For more information on how to link a remote file, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/adding-a-remote-file&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • item_type (String)

    The item type

  • item_id (Integer)

    ID of the item to associate the file with

  • remote_id (String)

    The remote item id

  • remote_location (String)

    The location type to send the file to. Only googledrive is supported at the moment.

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

    the optional parameters

Returns:

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

    LinkRemoteFileToItem data, response status code and response headers



447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 447

def files_remote_link_post_with_http_info(item_type, item_id, remote_id, remote_location, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_remote_link_post ...'
  end
  # verify the required parameter 'item_type' is set
  if @api_client.config.client_side_validation && item_type.nil?
    fail ArgumentError, "Missing the required parameter 'item_type' when calling FilesApi.files_remote_link_post"
  end
  # verify enum value
  allowable_values = ["deal", "organization", "person"]
  if @api_client.config.client_side_validation && !allowable_values.include?(item_type)
    fail ArgumentError, "invalid value for \"item_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'item_id' is set
  if @api_client.config.client_side_validation && item_id.nil?
    fail ArgumentError, "Missing the required parameter 'item_id' when calling FilesApi.files_remote_link_post"
  end
  # verify the required parameter 'remote_id' is set
  if @api_client.config.client_side_validation && remote_id.nil?
    fail ArgumentError, "Missing the required parameter 'remote_id' when calling FilesApi.files_remote_link_post"
  end
  # verify the required parameter 'remote_location' is set
  if @api_client.config.client_side_validation && remote_location.nil?
    fail ArgumentError, "Missing the required parameter 'remote_location' when calling FilesApi.files_remote_link_post"
  end
  # verify enum value
  allowable_values = ["googledrive"]
  if @api_client.config.client_side_validation && !allowable_values.include?(remote_location)
    fail ArgumentError, "invalid value for \"remote_location\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/files/remoteLink'

  # 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['item_type'] = item_type
  form_params['item_id'] = item_id
  form_params['remote_id'] = remote_id
  form_params['remote_location'] = remote_location

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

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

  # 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: FilesApi#files_remote_link_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#files_remote_post(file_type, title, item_type, item_id, remote_location, opts = {}) ⇒ CreateRemoteFileAndLinkItToItem

Create a remote file and link it to an item Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information on how to add a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>.

Parameters:

  • file_type (String)

    The file type

  • title (String)

    The title of the file

  • item_type (String)

    The item type

  • item_id (Integer)

    ID of the item to associate the file with

  • remote_location (String)

    The location type to send the file to. Only googledrive is supported at the moment.

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

    the optional parameters

Returns:



531
532
533
534
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 531

def files_remote_post(file_type, title, item_type, item_id, remote_location, opts = {})
  data, _status_code, _headers = files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts)
  data
end

#files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts = {}) ⇒ Array<(CreateRemoteFileAndLinkItToItem, Integer, Hash)>

Create a remote file and link it to an item Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information on how to add a remote file, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/adding-a-remote-file&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • file_type (String)

    The file type

  • title (String)

    The title of the file

  • item_type (String)

    The item type

  • item_id (Integer)

    ID of the item to associate the file with

  • remote_location (String)

    The location type to send the file to. Only googledrive is supported at the moment.

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

    the optional parameters

Returns:



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/pipedrive-openapi-client/api/files_api.rb', line 545

def files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FilesApi.files_remote_post ...'
  end
  # verify the required parameter 'file_type' is set
  if @api_client.config.client_side_validation && file_type.nil?
    fail ArgumentError, "Missing the required parameter 'file_type' when calling FilesApi.files_remote_post"
  end
  # verify enum value
  allowable_values = ["gdoc", "gslides", "gsheet", "gform", "gdraw"]
  if @api_client.config.client_side_validation && !allowable_values.include?(file_type)
    fail ArgumentError, "invalid value for \"file_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'title' is set
  if @api_client.config.client_side_validation && title.nil?
    fail ArgumentError, "Missing the required parameter 'title' when calling FilesApi.files_remote_post"
  end
  # verify the required parameter 'item_type' is set
  if @api_client.config.client_side_validation && item_type.nil?
    fail ArgumentError, "Missing the required parameter 'item_type' when calling FilesApi.files_remote_post"
  end
  # verify enum value
  allowable_values = ["deal", "organization", "person"]
  if @api_client.config.client_side_validation && !allowable_values.include?(item_type)
    fail ArgumentError, "invalid value for \"item_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'item_id' is set
  if @api_client.config.client_side_validation && item_id.nil?
    fail ArgumentError, "Missing the required parameter 'item_id' when calling FilesApi.files_remote_post"
  end
  # verify the required parameter 'remote_location' is set
  if @api_client.config.client_side_validation && remote_location.nil?
    fail ArgumentError, "Missing the required parameter 'remote_location' when calling FilesApi.files_remote_post"
  end
  # verify enum value
  allowable_values = ["googledrive"]
  if @api_client.config.client_side_validation && !allowable_values.include?(remote_location)
    fail ArgumentError, "invalid value for \"remote_location\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/files/remote'

  # 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['file_type'] = file_type
  form_params['title'] = title
  form_params['item_type'] = item_type
  form_params['item_id'] = item_id
  form_params['remote_location'] = remote_location

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

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

  # 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: FilesApi#files_remote_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end