Skip to content

Commit 21d035d

Browse files
authored
Merge pull request #1 from jordanbyron/master
DocumentsApi Insert / Update: url param is optional
2 parents 851d3d2 + bf4ab73 commit 21d035d

2 files changed

Lines changed: 65 additions & 67 deletions

File tree

docs/DocumentsApi.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,15 @@ record_type = "record_type_example" # String | Entity type
314314

315315
title = "title_example" # String | Document title
316316

317-
url = "url_example" # String | Document url
318-
319317
opts = {
320-
file: File.new("/path/to/file.txt"), # File | File to upload
318+
url: "//path/to/file", # String | Url of file to attach
319+
file: File.open("/path/to/file.txt"), # File | File to upload
321320
private_flag: true, # BOOLEAN | Indicates if document is private
322321
read_only_flag: true # BOOLEAN | Indicates if document is readonly
323322
}
324323

325324
begin
326-
result = api_instance.system_documents_id_post(id, record_id, record_type, title, url, opts)
325+
result = api_instance.system_documents_id_post(id, record_id, record_type, title, opts)
327326
p result
328327
rescue Connectwise::ApiError => e
329328
puts "Exception when calling DocumentsApi->system_documents_id_post: #{e}"
@@ -338,8 +337,8 @@ Name | Type | Description | Notes
338337
**record_id** | **Integer**| Entity id |
339338
**record_type** | **String**| Entity type |
340339
**title** | **String**| Document title |
341-
**url** | **String**| Document url |
342-
**file** | **File**| File to upload | [optional]
340+
**url** | **String**| Document url | [optional if file present]
341+
**file** | **File**| File to upload | [optional if url present]
343342
**private_flag** | **BOOLEAN**| Indicates if document is private | [optional]
344343
**read_only_flag** | **BOOLEAN**| Indicates if document is readonly | [optional]
345344

@@ -384,16 +383,15 @@ record_type = "record_type_example" # String | Entity type
384383

385384
title = "title_example" # String | Document title
386385

387-
url = "url_example" # String | Document url
388-
389386
opts = {
390-
file: File.new("/path/to/file.txt"), # File | File to upload
387+
url: "//path/to/file", # String | Document url
388+
file: File.open("/path/to/file.txt"), # File | File to upload
391389
private_flag: true, # BOOLEAN | Indicates if document is private
392390
read_only_flag: true # BOOLEAN | Indicates if document is readonly
393391
}
394392

395393
begin
396-
result = api_instance.system_documents_post(record_id, record_type, title, url, opts)
394+
result = api_instance.system_documents_post(record_id, record_type, title, opts)
397395
p result
398396
rescue Connectwise::ApiError => e
399397
puts "Exception when calling DocumentsApi->system_documents_post: #{e}"

lib/connectwise-ruby-sdk/api/documents_api.rb

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ def initialize(api_client = ApiClient.default)
3131
@api_client = api_client
3232
end
3333

34-
#
34+
#
3535
# Get Documents Info Count
3636
# @param [Hash] opts the optional parameters
37-
# @option opts [String] :record_type
38-
# @option opts [Integer] :record_id
37+
# @option opts [String] :record_type
38+
# @option opts [Integer] :record_id
3939
# @return [Count]
4040
def system_documents_count_get(opts = {})
4141
data, _status_code, _headers = system_documents_count_get_with_http_info(opts)
4242
return data
4343
end
4444

45-
#
45+
#
4646
# Get Documents Info Count
4747
# @param [Hash] opts the optional parameters
48-
# @option opts [String] :record_type
49-
# @option opts [Integer] :record_id
48+
# @option opts [String] :record_type
49+
# @option opts [Integer] :record_id
5050
# @return [Array<(Count, Fixnum, Hash)>] Count data, response status code and response headers
5151
def system_documents_count_get_with_http_info(opts = {})
5252
if @api_client.config.debugging
@@ -93,26 +93,26 @@ def system_documents_count_get_with_http_info(opts = {})
9393
return data, status_code, headers
9494
end
9595

96-
#
96+
#
9797
# Get Documents Info
9898
# @param [Hash] opts the optional parameters
99-
# @option opts [String] :record_type
100-
# @option opts [Integer] :record_id
101-
# @option opts [Integer] :page
102-
# @option opts [Integer] :page_size
99+
# @option opts [String] :record_type
100+
# @option opts [Integer] :record_id
101+
# @option opts [Integer] :page
102+
# @option opts [Integer] :page_size
103103
# @return [Array<DocumentInfo>]
104104
def system_documents_get(opts = {})
105105
data, _status_code, _headers = system_documents_get_with_http_info(opts)
106106
return data
107107
end
108108

109-
#
109+
#
110110
# Get Documents Info
111111
# @param [Hash] opts the optional parameters
112-
# @option opts [String] :record_type
113-
# @option opts [Integer] :record_id
114-
# @option opts [Integer] :page
115-
# @option opts [Integer] :page_size
112+
# @option opts [String] :record_type
113+
# @option opts [Integer] :record_id
114+
# @option opts [Integer] :page
115+
# @option opts [Integer] :page_size
116116
# @return [Array<(Array<DocumentInfo>, Fixnum, Hash)>] Array<DocumentInfo> data, response status code and response headers
117117
def system_documents_get_with_http_info(opts = {})
118118
if @api_client.config.debugging
@@ -161,19 +161,19 @@ def system_documents_get_with_http_info(opts = {})
161161
return data, status_code, headers
162162
end
163163

164-
#
164+
#
165165
# Delete Document Info By Id
166-
# @param id
166+
# @param id
167167
# @param [Hash] opts the optional parameters
168168
# @return [nil]
169169
def system_documents_id_delete(id, opts = {})
170170
system_documents_id_delete_with_http_info(id, opts)
171171
return nil
172172
end
173173

174-
#
174+
#
175175
# Delete Document Info By Id
176-
# @param id
176+
# @param id
177177
# @param [Hash] opts the optional parameters
178178
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
179179
def system_documents_id_delete_with_http_info(id, opts = {})
@@ -217,22 +217,22 @@ def system_documents_id_delete_with_http_info(id, opts = {})
217217
return data, status_code, headers
218218
end
219219

220-
#
220+
#
221221
# Download Document
222-
# @param id
222+
# @param id
223223
# @param [Hash] opts the optional parameters
224-
# @option opts [String] :last_modified
224+
# @option opts [String] :last_modified
225225
# @return [nil]
226226
def system_documents_id_download_get(id, opts = {})
227227
system_documents_id_download_get_with_http_info(id, opts)
228228
return nil
229229
end
230230

231-
#
231+
#
232232
# Download Document
233-
# @param id
233+
# @param id
234234
# @param [Hash] opts the optional parameters
235-
# @option opts [String] :last_modified
235+
# @option opts [String] :last_modified
236236
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
237237
def system_documents_id_download_get_with_http_info(id, opts = {})
238238
if @api_client.config.debugging
@@ -276,19 +276,19 @@ def system_documents_id_download_get_with_http_info(id, opts = {})
276276
return data, status_code, headers
277277
end
278278

279-
#
279+
#
280280
# Get Document Info By Id
281-
# @param id
281+
# @param id
282282
# @param [Hash] opts the optional parameters
283283
# @return [DocumentInfo]
284284
def system_documents_id_get(id, opts = {})
285285
data, _status_code, _headers = system_documents_id_get_with_http_info(id, opts)
286286
return data
287287
end
288288

289-
#
289+
#
290290
# Get Document Info By Id
291-
# @param id
291+
# @param id
292292
# @param [Hash] opts the optional parameters
293293
# @return [Array<(DocumentInfo, Fixnum, Hash)>] DocumentInfo data, response status code and response headers
294294
def system_documents_id_get_with_http_info(id, opts = {})
@@ -333,36 +333,36 @@ def system_documents_id_get_with_http_info(id, opts = {})
333333
return data, status_code, headers
334334
end
335335

336-
#
336+
#
337337
# Update Document By Id
338-
# @param id
338+
# @param id
339339
# @param record_id Entity id
340340
# @param record_type Entity type
341341
# @param title Document title
342-
# @param url Document url
343342
# @param [Hash] opts the optional parameters
343+
# @option opts [String] :url Document url
344344
# @option opts [File] :file File to upload
345345
# @option opts [BOOLEAN] :private_flag Indicates if document is private
346346
# @option opts [BOOLEAN] :read_only_flag Indicates if document is readonly
347347
# @return [DocumentInfo]
348-
def system_documents_id_post(id, record_id, record_type, title, url, opts = {})
349-
data, _status_code, _headers = system_documents_id_post_with_http_info(id, record_id, record_type, title, url, opts)
348+
def system_documents_id_post(id, record_id, record_type, title, opts = {})
349+
data, _status_code, _headers = system_documents_id_post_with_http_info(id, record_id, record_type, title, opts)
350350
return data
351351
end
352352

353-
#
353+
#
354354
# Update Document By Id
355-
# @param id
355+
# @param id
356356
# @param record_id Entity id
357357
# @param record_type Entity type
358358
# @param title Document title
359-
# @param url Document url
360359
# @param [Hash] opts the optional parameters
360+
# @option opts [String] :url Document url
361361
# @option opts [File] :file File to upload
362362
# @option opts [BOOLEAN] :private_flag Indicates if document is private
363363
# @option opts [BOOLEAN] :read_only_flag Indicates if document is readonly
364364
# @return [Array<(DocumentInfo, Fixnum, Hash)>] DocumentInfo data, response status code and response headers
365-
def system_documents_id_post_with_http_info(id, record_id, record_type, title, url, opts = {})
365+
def system_documents_id_post_with_http_info(id, record_id, record_type, title, opts = {})
366366
if @api_client.config.debugging
367367
@api_client.config.logger.debug "Calling API: DocumentsApi.system_documents_id_post ..."
368368
end
@@ -382,9 +382,9 @@ def system_documents_id_post_with_http_info(id, record_id, record_type, title, u
382382
fail ArgumentError, 'invalid value for "title" when calling DocumentsApi.system_documents_id_post, the character length must be smaller than or equal to 100.'
383383
end
384384

385-
# verify the required parameter 'url' is set
386-
fail ArgumentError, "Missing the required parameter 'url' when calling DocumentsApi.system_documents_id_post" if url.nil?
387-
if url.to_s.length > 500
385+
# verify the required parameter 'url' or 'file' is set
386+
fail ArgumentError, "Missing the required options 'url' or 'file' when calling DocumentsApi.system_documents_id_post" if opts[:url].nil? && opts[:file].nil?
387+
if opts[:url] && opts[:url].to_s.length > 500
388388
fail ArgumentError, 'invalid value for "url" when calling DocumentsApi.system_documents_id_post, the character length must be smaller than or equal to 500.'
389389
end
390390

@@ -410,7 +410,7 @@ def system_documents_id_post_with_http_info(id, record_id, record_type, title, u
410410
form_params["recordId"] = record_id
411411
form_params["recordType"] = record_type
412412
form_params["title"] = title
413-
form_params["url"] = url
413+
form_params["url"] = opts[:url] unless opts[:url].nil?
414414
form_params["file"] = opts[:'file'] if !opts[:'file'].nil?
415415
form_params["privateFlag"] = opts[:'private_flag'] if !opts[:'private_flag'].nil?
416416
form_params["readOnlyFlag"] = opts[:'read_only_flag'] if !opts[:'read_only_flag'].nil?
@@ -431,34 +431,34 @@ def system_documents_id_post_with_http_info(id, record_id, record_type, title, u
431431
return data, status_code, headers
432432
end
433433

434-
#
434+
#
435435
# Insert Document
436436
# @param record_id Entity id
437437
# @param record_type Entity type
438438
# @param title Document title
439-
# @param url Document url
440439
# @param [Hash] opts the optional parameters
440+
# @option opts [String] :url Document url
441441
# @option opts [File] :file File to upload
442442
# @option opts [BOOLEAN] :private_flag Indicates if document is private
443443
# @option opts [BOOLEAN] :read_only_flag Indicates if document is readonly
444444
# @return [DocumentInfo]
445-
def system_documents_post(record_id, record_type, title, url, opts = {})
446-
data, _status_code, _headers = system_documents_post_with_http_info(record_id, record_type, title, url, opts)
445+
def system_documents_post(record_id, record_type, title, opts = {})
446+
data, _status_code, _headers = system_documents_post_with_http_info(record_id, record_type, title, opts)
447447
return data
448448
end
449449

450-
#
450+
#
451451
# Insert Document
452452
# @param record_id Entity id
453453
# @param record_type Entity type
454454
# @param title Document title
455-
# @param url Document url
456455
# @param [Hash] opts the optional parameters
456+
# @option opts [String] :url Document url
457457
# @option opts [File] :file File to upload
458458
# @option opts [BOOLEAN] :private_flag Indicates if document is private
459459
# @option opts [BOOLEAN] :read_only_flag Indicates if document is readonly
460460
# @return [Array<(DocumentInfo, Fixnum, Hash)>] DocumentInfo data, response status code and response headers
461-
def system_documents_post_with_http_info(record_id, record_type, title, url, opts = {})
461+
def system_documents_post_with_http_info(record_id, record_type, title, opts = {})
462462
if @api_client.config.debugging
463463
@api_client.config.logger.debug "Calling API: DocumentsApi.system_documents_post ..."
464464
end
@@ -476,10 +476,10 @@ def system_documents_post_with_http_info(record_id, record_type, title, url, opt
476476
fail ArgumentError, 'invalid value for "title" when calling DocumentsApi.system_documents_post, the character length must be smaller than or equal to 100.'
477477
end
478478

479-
# verify the required parameter 'url' is set
480-
fail ArgumentError, "Missing the required parameter 'url' when calling DocumentsApi.system_documents_post" if url.nil?
481-
if url.to_s.length > 500
482-
fail ArgumentError, 'invalid value for "url" when calling DocumentsApi.system_documents_post, the character length must be smaller than or equal to 500.'
479+
# verify the required parameter 'url' or 'file' is set
480+
fail ArgumentError, "Missing the required options 'url' or 'file' when calling DocumentsApi.system_documents_id_post" if opts[:url].nil? && opts[:file].nil?
481+
if opts[:url] && opts[:url].to_s.length > 500
482+
fail ArgumentError, 'invalid value for "url" when calling DocumentsApi.system_documents_id_post, the character length must be smaller than or equal to 500.'
483483
end
484484

485485
# resource path
@@ -504,7 +504,7 @@ def system_documents_post_with_http_info(record_id, record_type, title, url, opt
504504
form_params["recordId"] = record_id
505505
form_params["recordType"] = record_type
506506
form_params["title"] = title
507-
form_params["url"] = url
507+
form_params["url"] = opts[:url] unless opts[:url].nil?
508508
form_params["file"] = opts[:'file'] if !opts[:'file'].nil?
509509
form_params["privateFlag"] = opts[:'private_flag'] if !opts[:'private_flag'].nil?
510510
form_params["readOnlyFlag"] = opts[:'read_only_flag'] if !opts[:'read_only_flag'].nil?
@@ -525,7 +525,7 @@ def system_documents_post_with_http_info(record_id, record_type, title, url, opt
525525
return data, status_code, headers
526526
end
527527

528-
#
528+
#
529529
# Get Upload Sample Page
530530
# @param [Hash] opts the optional parameters
531531
# @return [nil]
@@ -534,7 +534,7 @@ def system_documents_uploadsample_get(opts = {})
534534
return nil
535535
end
536536

537-
#
537+
#
538538
# Get Upload Sample Page
539539
# @param [Hash] opts the optional parameters
540540
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

0 commit comments

Comments
 (0)