files.com 1.1.768 → 1.1.770

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +47 -7
  4. data/_VERSION +1 -1
  5. data/docs/file.md +37 -0
  6. data/lib/files.com/api.rb +9 -4
  7. data/lib/files.com/api_client.rb +181 -55
  8. data/lib/files.com/list.rb +98 -66
  9. data/lib/files.com/models/action_log.rb +7 -2
  10. data/lib/files.com/models/action_notification_export.rb +13 -3
  11. data/lib/files.com/models/action_notification_export_result.rb +7 -2
  12. data/lib/files.com/models/ai_assistant_personality.rb +34 -8
  13. data/lib/files.com/models/ai_task.rb +39 -8
  14. data/lib/files.com/models/api_key.rb +49 -10
  15. data/lib/files.com/models/api_request_log.rb +7 -2
  16. data/lib/files.com/models/app.rb +7 -2
  17. data/lib/files.com/models/as2_incoming_message.rb +7 -2
  18. data/lib/files.com/models/as2_outgoing_message.rb +7 -2
  19. data/lib/files.com/models/as2_partner.rb +34 -8
  20. data/lib/files.com/models/as2_station.rb +34 -8
  21. data/lib/files.com/models/automation.rb +50 -10
  22. data/lib/files.com/models/automation_log.rb +7 -2
  23. data/lib/files.com/models/automation_run.rb +31 -6
  24. data/lib/files.com/models/bandwidth_snapshot.rb +7 -2
  25. data/lib/files.com/models/behavior.rb +46 -10
  26. data/lib/files.com/models/bundle.rb +39 -8
  27. data/lib/files.com/models/bundle_action.rb +7 -2
  28. data/lib/files.com/models/bundle_download.rb +7 -2
  29. data/lib/files.com/models/bundle_notification.rb +34 -8
  30. data/lib/files.com/models/bundle_recipient.rb +14 -4
  31. data/lib/files.com/models/bundle_registration.rb +7 -2
  32. data/lib/files.com/models/chat_session.rb +13 -3
  33. data/lib/files.com/models/child_site_management_policy.rb +34 -8
  34. data/lib/files.com/models/clickwrap.rb +34 -8
  35. data/lib/files.com/models/custom_domain.rb +40 -9
  36. data/lib/files.com/models/desktop_configuration_profile.rb +34 -8
  37. data/lib/files.com/models/dns_record.rb +7 -2
  38. data/lib/files.com/models/email_incoming_message.rb +7 -2
  39. data/lib/files.com/models/email_log.rb +7 -2
  40. data/lib/files.com/models/event_channel.rb +34 -8
  41. data/lib/files.com/models/event_delivery_attempt.rb +13 -3
  42. data/lib/files.com/models/event_record.rb +13 -3
  43. data/lib/files.com/models/event_subscription.rb +34 -8
  44. data/lib/files.com/models/event_target.rb +34 -8
  45. data/lib/files.com/models/exavault_api_request_log.rb +7 -2
  46. data/lib/files.com/models/expectation.rb +40 -9
  47. data/lib/files.com/models/expectation_evaluation.rb +13 -3
  48. data/lib/files.com/models/expectation_incident.rb +31 -6
  49. data/lib/files.com/models/external_event.rb +20 -5
  50. data/lib/files.com/models/file.rb +93 -15
  51. data/lib/files.com/models/file_comment.rb +28 -7
  52. data/lib/files.com/models/file_comment_reaction.rb +11 -2
  53. data/lib/files.com/models/file_migration.rb +6 -1
  54. data/lib/files.com/models/file_migration_log.rb +7 -2
  55. data/lib/files.com/models/folder.rb +13 -3
  56. data/lib/files.com/models/form_field_set.rb +34 -8
  57. data/lib/files.com/models/ftp_action_log.rb +7 -2
  58. data/lib/files.com/models/gpg_key.rb +34 -8
  59. data/lib/files.com/models/group.rb +34 -8
  60. data/lib/files.com/models/group_user.rb +29 -7
  61. data/lib/files.com/models/history.rb +35 -10
  62. data/lib/files.com/models/history_export.rb +13 -3
  63. data/lib/files.com/models/history_export_result.rb +7 -2
  64. data/lib/files.com/models/holiday_calendar.rb +34 -8
  65. data/lib/files.com/models/holiday_region.rb +7 -2
  66. data/lib/files.com/models/inbound_s3_log.rb +7 -2
  67. data/lib/files.com/models/inbox_recipient.rb +14 -4
  68. data/lib/files.com/models/inbox_registration.rb +7 -2
  69. data/lib/files.com/models/inbox_upload.rb +7 -2
  70. data/lib/files.com/models/integration_centric_profile.rb +34 -8
  71. data/lib/files.com/models/invoice.rb +13 -3
  72. data/lib/files.com/models/ip_address.rb +28 -8
  73. data/lib/files.com/models/key_lifecycle_rule.rb +34 -8
  74. data/lib/files.com/models/lock.rb +18 -3
  75. data/lib/files.com/models/metadata_category.rb +41 -10
  76. data/lib/files.com/models/notification.rb +34 -8
  77. data/lib/files.com/models/outbound_connection_log.rb +7 -2
  78. data/lib/files.com/models/partner.rb +34 -8
  79. data/lib/files.com/models/partner_channel.rb +34 -8
  80. data/lib/files.com/models/partner_channel_template.rb +34 -8
  81. data/lib/files.com/models/partner_site.rb +4 -0
  82. data/lib/files.com/models/partner_site_request.rb +33 -4
  83. data/lib/files.com/models/payment.rb +13 -3
  84. data/lib/files.com/models/pending_work_event.rb +13 -3
  85. data/lib/files.com/models/permission.rb +18 -4
  86. data/lib/files.com/models/public_hosting_request_log.rb +7 -2
  87. data/lib/files.com/models/public_key.rb +34 -8
  88. data/lib/files.com/models/remote_bandwidth_snapshot.rb +7 -2
  89. data/lib/files.com/models/remote_mount_backend.rb +39 -8
  90. data/lib/files.com/models/remote_server.rb +52 -11
  91. data/lib/files.com/models/remote_server_credential.rb +34 -8
  92. data/lib/files.com/models/request.rb +25 -6
  93. data/lib/files.com/models/restore.rb +14 -4
  94. data/lib/files.com/models/schedule.rb +34 -8
  95. data/lib/files.com/models/scheduled_export.rb +34 -8
  96. data/lib/files.com/models/scim_log.rb +13 -3
  97. data/lib/files.com/models/secret.rb +34 -8
  98. data/lib/files.com/models/session.rb +11 -2
  99. data/lib/files.com/models/settings_change.rb +7 -2
  100. data/lib/files.com/models/sftp_action_log.rb +7 -2
  101. data/lib/files.com/models/sftp_host_key.rb +34 -8
  102. data/lib/files.com/models/share_group.rb +34 -8
  103. data/lib/files.com/models/siem_http_destination.rb +39 -8
  104. data/lib/files.com/models/siem_http_destination_event.rb +13 -3
  105. data/lib/files.com/models/site.rb +16 -3
  106. data/lib/files.com/models/site_subdomain_redirect.rb +17 -3
  107. data/lib/files.com/models/snapshot.rb +39 -8
  108. data/lib/files.com/models/sso_event.rb +13 -3
  109. data/lib/files.com/models/sso_strategy.rb +18 -3
  110. data/lib/files.com/models/style.rb +20 -5
  111. data/lib/files.com/models/sync.rb +44 -8
  112. data/lib/files.com/models/sync_log.rb +7 -2
  113. data/lib/files.com/models/sync_run.rb +13 -3
  114. data/lib/files.com/models/usage_daily_snapshot.rb +7 -2
  115. data/lib/files.com/models/usage_snapshot.rb +7 -2
  116. data/lib/files.com/models/user.rb +50 -8
  117. data/lib/files.com/models/user_additional_email_recipient.rb +34 -8
  118. data/lib/files.com/models/user_cipher_use.rb +7 -2
  119. data/lib/files.com/models/user_lifecycle_rule.rb +34 -8
  120. data/lib/files.com/models/user_request.rb +24 -5
  121. data/lib/files.com/models/user_security_event.rb +13 -3
  122. data/lib/files.com/models/user_sftp_client_use.rb +7 -2
  123. data/lib/files.com/models/web_dav_action_log.rb +7 -2
  124. data/lib/files.com/models/webhook_test.rb +7 -2
  125. data/lib/files.com/models/workspace.rb +34 -8
  126. data/lib/files.com/response.rb +24 -0
  127. data/lib/files.com/sizable_io.rb +65 -4
  128. data/lib/files.com/version.rb +1 -1
  129. data/lib/files.com.rb +23 -1
  130. data/spec/language_spec.rb +20 -10
  131. data/spec/lib/api_client_spec.rb +173 -18
  132. data/spec/list_spec.rb +203 -187
  133. data/spec/models/file_transfer_spec.rb +346 -0
  134. data/spec/models/persistence_spec.rb +167 -0
  135. data/spec/spec_helper.rb +122 -6
  136. data/spec/support/stubbed_api.rb +14 -0
  137. data/spec/support/transfer_server.rb +60 -0
  138. metadata +6 -2
@@ -127,14 +127,19 @@ module Files
127
127
  # per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
128
128
  # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `created_at` or `expectation_id`.
129
129
  # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `expectation_id` and `workspace_id`. Valid field combinations are `[ workspace_id, expectation_id ]`.
130
+ #
131
+ # params:: Hash of API operation parameter values.
132
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
133
+ #
134
+ # Returns a Files::List of Files::ExpectationIncident objects.
130
135
  def self.list(params = {}, options = {})
131
136
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
132
137
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
133
138
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
134
139
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
135
140
 
136
- List.new(ExpectationIncident, params) do
137
- Api.send_request("/expectation_incidents", :get, params, options)
141
+ List.new(ExpectationIncident, params) do |page_params, &check_page|
142
+ Api.send_request("/expectation_incidents", :get, page_params, options, &check_page)
138
143
  end
139
144
  end
140
145
 
@@ -144,13 +149,18 @@ module Files
144
149
 
145
150
  # Parameters:
146
151
  # id (required) - int64 - Expectation Incident ID.
152
+ #
153
+ # params:: Hash of API operation parameter values.
154
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
155
+ #
156
+ # Returns a Files::ExpectationIncident.
147
157
  def self.find(id, params = {}, options = {})
148
158
  params ||= {}
149
159
  params[:id] = id
150
160
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
151
161
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
152
162
 
153
- response, options = Api.send_request("/expectation_incidents/#{params[:id]}", :get, params, options)
163
+ response, options = Api.send_request("/expectation_incidents/#{params[:id]}", :get, params, options) { |reply| reply.require_object("ExpectationIncident") }
154
164
  ExpectationIncident.new(response.data, options)
155
165
  end
156
166
 
@@ -159,13 +169,18 @@ module Files
159
169
  end
160
170
 
161
171
  # Resolve an expectation incident
172
+ #
173
+ # params:: Hash of API operation parameter values.
174
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
175
+ #
176
+ # Returns a Files::ExpectationIncident.
162
177
  def self.resolve(id, params = {}, options = {})
163
178
  params ||= {}
164
179
  params[:id] = id
165
180
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
166
181
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
167
182
 
168
- response, options = Api.send_request("/expectation_incidents/#{params[:id]}/resolve", :post, params, options)
183
+ response, options = Api.send_request("/expectation_incidents/#{params[:id]}/resolve", :post, params, options) { |reply| reply.require_object("ExpectationIncident") }
169
184
  ExpectationIncident.new(response.data, options)
170
185
  end
171
186
 
@@ -173,6 +188,11 @@ module Files
173
188
  #
174
189
  # Parameters:
175
190
  # snoozed_until (required) - string - Time until which the incident should remain snoozed.
191
+ #
192
+ # params:: Hash of API operation parameter values.
193
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
194
+ #
195
+ # Returns a Files::ExpectationIncident.
176
196
  def self.snooze(id, params = {}, options = {})
177
197
  params ||= {}
178
198
  params[:id] = id
@@ -181,18 +201,23 @@ module Files
181
201
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
182
202
  raise MissingParameterError.new("Parameter missing: snoozed_until") unless params[:snoozed_until]
183
203
 
184
- response, options = Api.send_request("/expectation_incidents/#{params[:id]}/snooze", :post, params, options)
204
+ response, options = Api.send_request("/expectation_incidents/#{params[:id]}/snooze", :post, params, options) { |reply| reply.require_object("ExpectationIncident") }
185
205
  ExpectationIncident.new(response.data, options)
186
206
  end
187
207
 
188
208
  # Acknowledge an expectation incident
209
+ #
210
+ # params:: Hash of API operation parameter values.
211
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
212
+ #
213
+ # Returns a Files::ExpectationIncident.
189
214
  def self.acknowledge(id, params = {}, options = {})
190
215
  params ||= {}
191
216
  params[:id] = id
192
217
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
193
218
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
194
219
 
195
- response, options = Api.send_request("/expectation_incidents/#{params[:id]}/acknowledge", :post, params, options)
220
+ response, options = Api.send_request("/expectation_incidents/#{params[:id]}/acknowledge", :post, params, options) { |reply| reply.require_object("ExpectationIncident") }
196
221
  ExpectationIncident.new(response.data, options)
197
222
  end
198
223
  end
@@ -64,9 +64,9 @@ module Files
64
64
  raise NotImplementedError.new("The ExternalEvent object doesn't support updates.")
65
65
  else
66
66
  new_obj = ExternalEvent.create(@attributes, @options)
67
+ @attributes = new_obj.attributes
67
68
  end
68
69
 
69
- @attributes = new_obj.attributes
70
70
  true
71
71
  end
72
72
 
@@ -79,6 +79,11 @@ module Files
79
79
  # filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
80
80
  # filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
81
81
  # filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
82
+ #
83
+ # params:: Hash of API operation parameter values.
84
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
85
+ #
86
+ # Returns a Files::List of Files::ExternalEvent objects.
82
87
  def self.list(params = {}, options = {})
83
88
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
84
89
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
@@ -89,8 +94,8 @@ module Files
89
94
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
90
95
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
91
96
 
92
- List.new(ExternalEvent, params) do
93
- Api.send_request("/external_events", :get, params, options)
97
+ List.new(ExternalEvent, params) do |page_params, &check_page|
98
+ Api.send_request("/external_events", :get, page_params, options, &check_page)
94
99
  end
95
100
  end
96
101
 
@@ -100,13 +105,18 @@ module Files
100
105
 
101
106
  # Parameters:
102
107
  # id (required) - int64 - External Event ID.
108
+ #
109
+ # params:: Hash of API operation parameter values.
110
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
111
+ #
112
+ # Returns a Files::ExternalEvent.
103
113
  def self.find(id, params = {}, options = {})
104
114
  params ||= {}
105
115
  params[:id] = id
106
116
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
107
117
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
108
118
 
109
- response, options = Api.send_request("/external_events/#{params[:id]}", :get, params, options)
119
+ response, options = Api.send_request("/external_events/#{params[:id]}", :get, params, options) { |reply| reply.require_object("ExternalEvent") }
110
120
  ExternalEvent.new(response.data, options)
111
121
  end
112
122
 
@@ -117,13 +127,18 @@ module Files
117
127
  # Parameters:
118
128
  # status (required) - string - Status of event.
119
129
  # body (required) - string - Event body
130
+ #
131
+ # params:: Hash of API operation parameter values.
132
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
133
+ #
134
+ # Returns a Files::ExternalEvent.
120
135
  def self.create(params = {}, options = {})
121
136
  raise InvalidParameterError.new("Bad parameter: status must be an String") if params[:status] and !params[:status].is_a?(String)
122
137
  raise InvalidParameterError.new("Bad parameter: body must be an String") if params[:body] and !params[:body].is_a?(String)
123
138
  raise MissingParameterError.new("Parameter missing: status") unless params[:status]
124
139
  raise MissingParameterError.new("Parameter missing: body") unless params[:body]
125
140
 
126
- response, options = Api.send_request("/external_events", :post, params, options)
141
+ response, options = Api.send_request("/external_events", :post, params, options) { |reply| reply.require_object("ExternalEvent") }
127
142
  ExternalEvent.new(response.data, options)
128
143
  end
129
144
  end
@@ -218,7 +218,7 @@ module Files
218
218
 
219
219
  create(destination, params, options)
220
220
  ensure
221
- local_file.close
221
+ local_file&.close
222
222
  end
223
223
 
224
224
  def self.write(*_args)
@@ -455,10 +455,16 @@ module Files
455
455
  r, w = SizableIO.pipe
456
456
  Thread.new do
457
457
  download_content(w, **options)
458
+ rescue StandardError => e
459
+ # The reader raises this instead of seeing a clean end of file, even when the download never started.
460
+ w.do_set_error(e)
458
461
  ensure
459
462
  w.close
460
463
  end
461
464
  r.wait!(5)
465
+ rescue StandardError
466
+ r&.close
467
+ raise
462
468
  end
463
469
  end
464
470
 
@@ -1103,7 +1109,9 @@ module Files
1103
1109
  raise InvalidParameterError.new("Bad parameter: priority_color must be an String") if params[:priority_color] and !params[:priority_color].is_a?(String)
1104
1110
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1105
1111
 
1106
- Api.send_request("/files/#{@attributes[:path]}", :patch, params, @options)
1112
+ response, options = Api.send_request("/files/#{@attributes[:path]}", :patch, params, @options) { |reply| reply.require_object("File") }
1113
+ @attributes = response.data
1114
+ [ response, options ]
1107
1115
  end
1108
1116
 
1109
1117
  # Parameters:
@@ -1306,6 +1314,11 @@ module Files
1306
1314
  # with_previews - boolean - Include file preview information?
1307
1315
  # with_priority_color - boolean - Include file priority color information?
1308
1316
  # with_direct_connection_info - boolean - Include optional direct connection information for a direct Agent transfer attempt?
1317
+ #
1318
+ # params:: Hash of API operation parameter values.
1319
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1320
+ #
1321
+ # Returns a Files::File.
1309
1322
  def self.download(path, params = {}, options = {})
1310
1323
  params ||= {}
1311
1324
  params[:path] = path
@@ -1314,7 +1327,7 @@ module Files
1314
1327
  raise InvalidParameterError.new("Bad parameter: preview_size must be an String") if params[:preview_size] and !params[:preview_size].is_a?(String)
1315
1328
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1316
1329
 
1317
- response, options = Api.send_request("/files/#{params[:path]}", :get, params, options)
1330
+ response, options = Api.send_request("/files/#{params[:path]}", :get, params, options) { |reply| reply.require_object("File") }
1318
1331
  File.new(response.data, options)
1319
1332
  end
1320
1333
 
@@ -1337,6 +1350,11 @@ module Files
1337
1350
  # with_rename - boolean - Allow file rename instead of overwrite?
1338
1351
  # buffered_upload - boolean - If true, and the path refers to a destination not stored on Files.com (such as a remote server mount), the upload will be uploaded first to Files.com before being sent to the remote server mount. This can allow clients to upload using parallel parts to a remote server destination that does not offer parallel parts support natively.
1339
1352
  # with_direct_connection_info - boolean - Include optional direct connection information for a direct Agent transfer attempt?
1353
+ #
1354
+ # params:: Hash of API operation parameter values.
1355
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1356
+ #
1357
+ # Returns a Files::File.
1340
1358
  def self.create(path, params = {}, options = {})
1341
1359
  params ||= {}
1342
1360
  params[:path] = path
@@ -1353,7 +1371,7 @@ module Files
1353
1371
  raise InvalidParameterError.new("Bad parameter: structure must be an String") if params[:structure] and !params[:structure].is_a?(String)
1354
1372
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1355
1373
 
1356
- response, options = Api.send_request("/files/#{params[:path]}", :post, params, options)
1374
+ response, options = Api.send_request("/files/#{params[:path]}", :post, params, options) { |reply| reply.require_object("File") }
1357
1375
  File.new(response.data, options)
1358
1376
  end
1359
1377
 
@@ -1361,6 +1379,11 @@ module Files
1361
1379
  # custom_metadata - object - Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value.
1362
1380
  # provided_mtime - string - Modified time of file.
1363
1381
  # priority_color - string - Priority/Bookmark color of file.
1382
+ #
1383
+ # params:: Hash of API operation parameter values.
1384
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1385
+ #
1386
+ # Returns a Files::File.
1364
1387
  def self.update(path, params = {}, options = {})
1365
1388
  params ||= {}
1366
1389
  params[:path] = path
@@ -1370,12 +1393,17 @@ module Files
1370
1393
  raise InvalidParameterError.new("Bad parameter: priority_color must be an String") if params[:priority_color] and !params[:priority_color].is_a?(String)
1371
1394
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1372
1395
 
1373
- response, options = Api.send_request("/files/#{params[:path]}", :patch, params, options)
1396
+ response, options = Api.send_request("/files/#{params[:path]}", :patch, params, options) { |reply| reply.require_object("File") }
1374
1397
  File.new(response.data, options)
1375
1398
  end
1376
1399
 
1377
1400
  # Parameters:
1378
1401
  # recursive - boolean - If true, will recursively delete folders. Otherwise, will error on non-empty folders.
1402
+ #
1403
+ # params:: Hash of API operation parameter values.
1404
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1405
+ #
1406
+ # Returns nil.
1379
1407
  def self.delete(path, params = {}, options = {})
1380
1408
  params ||= {}
1381
1409
  params[:path] = path
@@ -1396,6 +1424,11 @@ module Files
1396
1424
  # preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
1397
1425
  # with_previews - boolean - Include file preview information?
1398
1426
  # with_priority_color - boolean - Include file priority color information?
1427
+ #
1428
+ # params:: Hash of API operation parameter values.
1429
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1430
+ #
1431
+ # Returns a Files::File.
1399
1432
  def self.find(path, params = {}, options = {})
1400
1433
  params ||= {}
1401
1434
  params[:path] = path
@@ -1403,7 +1436,7 @@ module Files
1403
1436
  raise InvalidParameterError.new("Bad parameter: preview_size must be an String") if params[:preview_size] and !params[:preview_size].is_a?(String)
1404
1437
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1405
1438
 
1406
- response, options = Api.send_request("/file_actions/metadata/#{params[:path]}", :get, params, options)
1439
+ response, options = Api.send_request("/file_actions/metadata/#{params[:path]}", :get, params, options) { |reply| reply.require_object("File") }
1407
1440
  File.new(response.data, options)
1408
1441
  end
1409
1442
 
@@ -1412,13 +1445,18 @@ module Files
1412
1445
  end
1413
1446
 
1414
1447
  # List the contents of a ZIP file
1448
+ #
1449
+ # params:: Hash of API operation parameter values.
1450
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1451
+ #
1452
+ # Returns an Array of Files::ZipListEntry objects.
1415
1453
  def self.zip_list_contents(path, params = {}, options = {})
1416
1454
  params ||= {}
1417
1455
  params[:path] = path
1418
1456
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
1419
1457
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1420
1458
 
1421
- response, options = Api.send_request("/file_actions/zip_list/#{params[:path]}", :get, params, options)
1459
+ response, options = Api.send_request("/file_actions/zip_list/#{params[:path]}", :get, params, options) { |reply| reply.require_list("ZipListEntry") }
1422
1460
  response.data.map do |entity_data|
1423
1461
  ZipListEntry.new(entity_data, options)
1424
1462
  end
@@ -1431,6 +1469,11 @@ module Files
1431
1469
  # copy_behaviors - boolean - If copying a folder, also copy supported behaviors, email notification subscriptions, and per-folder branding to the destination folder tree?
1432
1470
  # structure - boolean - Copy structure only?
1433
1471
  # overwrite - boolean - Overwrite existing file(s) in the destination?
1472
+ #
1473
+ # params:: Hash of API operation parameter values.
1474
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1475
+ #
1476
+ # Returns a Files::FileAction.
1434
1477
  def self.copy(path, params = {}, options = {})
1435
1478
  params ||= {}
1436
1479
  params[:path] = path
@@ -1439,7 +1482,7 @@ module Files
1439
1482
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1440
1483
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1441
1484
 
1442
- response, options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options)
1485
+ response, options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options) { |reply| reply.require_object("FileAction") }
1443
1486
  FileAction.new(response.data, options)
1444
1487
  end
1445
1488
 
@@ -1448,6 +1491,11 @@ module Files
1448
1491
  # Parameters:
1449
1492
  # destination (required) - string - Move destination path.
1450
1493
  # overwrite - boolean - Overwrite existing file(s) in the destination?
1494
+ #
1495
+ # params:: Hash of API operation parameter values.
1496
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1497
+ #
1498
+ # Returns a Files::FileAction.
1451
1499
  def self.move(path, params = {}, options = {})
1452
1500
  params ||= {}
1453
1501
  params[:path] = path
@@ -1456,7 +1504,7 @@ module Files
1456
1504
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1457
1505
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1458
1506
 
1459
- response, options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options)
1507
+ response, options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options) { |reply| reply.require_object("FileAction") }
1460
1508
  FileAction.new(response.data, options)
1461
1509
  end
1462
1510
 
@@ -1470,6 +1518,11 @@ module Files
1470
1518
  # width - int64 - Maximum output width for image_convert.
1471
1519
  # height - int64 - Maximum output height for image_convert.
1472
1520
  # overwrite - boolean - Overwrite existing file in the destination?
1521
+ #
1522
+ # params:: Hash of API operation parameter values.
1523
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1524
+ #
1525
+ # Returns a Files::FileAction.
1473
1526
  def self.transform(path, params = {}, options = {})
1474
1527
  params ||= {}
1475
1528
  params[:path] = path
@@ -1485,7 +1538,7 @@ module Files
1485
1538
  raise MissingParameterError.new("Parameter missing: transform_type") unless params[:transform_type]
1486
1539
  raise MissingParameterError.new("Parameter missing: target_format") unless params[:target_format]
1487
1540
 
1488
- response, options = Api.send_request("/file_actions/transform/#{params[:path]}", :post, params, options)
1541
+ response, options = Api.send_request("/file_actions/transform/#{params[:path]}", :post, params, options) { |reply| reply.require_object("FileAction") }
1489
1542
  FileAction.new(response.data, options)
1490
1543
  end
1491
1544
 
@@ -1498,6 +1551,11 @@ module Files
1498
1551
  # use_all_private_keys - boolean - Use every accessible private GPG key in the source workspace for decryption.
1499
1552
  # ignore_mdc_error - boolean - Ignore errors from the MDC (modification detection code) check.
1500
1553
  # overwrite - boolean - Overwrite existing file in the destination?
1554
+ #
1555
+ # params:: Hash of API operation parameter values.
1556
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1557
+ #
1558
+ # Returns a Files::FileAction.
1501
1559
  def self.gpg_decrypt(path, params = {}, options = {})
1502
1560
  params ||= {}
1503
1561
  params[:path] = path
@@ -1508,7 +1566,7 @@ module Files
1508
1566
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1509
1567
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1510
1568
 
1511
- response, options = Api.send_request("/file_actions/gpg_decrypt/#{params[:path]}", :post, params, options)
1569
+ response, options = Api.send_request("/file_actions/gpg_decrypt/#{params[:path]}", :post, params, options) { |reply| reply.require_object("FileAction") }
1512
1570
  FileAction.new(response.data, options)
1513
1571
  end
1514
1572
 
@@ -1521,6 +1579,11 @@ module Files
1521
1579
  # signing_key_id - int64 - Optional GPG Key ID to sign with.
1522
1580
  # armor - boolean - Output ASCII-armored encrypted data.
1523
1581
  # overwrite - boolean - Overwrite existing file in the destination?
1582
+ #
1583
+ # params:: Hash of API operation parameter values.
1584
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1585
+ #
1586
+ # Returns a Files::FileAction.
1524
1587
  def self.gpg_encrypt(path, params = {}, options = {})
1525
1588
  params ||= {}
1526
1589
  params[:path] = path
@@ -1532,7 +1595,7 @@ module Files
1532
1595
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1533
1596
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1534
1597
 
1535
- response, options = Api.send_request("/file_actions/gpg_encrypt/#{params[:path]}", :post, params, options)
1598
+ response, options = Api.send_request("/file_actions/gpg_encrypt/#{params[:path]}", :post, params, options) { |reply| reply.require_object("FileAction") }
1536
1599
  FileAction.new(response.data, options)
1537
1600
  end
1538
1601
 
@@ -1542,6 +1605,11 @@ module Files
1542
1605
  # destination (required) - string - Destination folder path for extracted files.
1543
1606
  # filename - string - Optional single entry filename to extract.
1544
1607
  # overwrite - boolean - Overwrite existing files in the destination?
1608
+ #
1609
+ # params:: Hash of API operation parameter values.
1610
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1611
+ #
1612
+ # Returns a Files::FileAction.
1545
1613
  def self.unzip(path, params = {}, options = {})
1546
1614
  params ||= {}
1547
1615
  params[:path] = path
@@ -1551,7 +1619,7 @@ module Files
1551
1619
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1552
1620
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1553
1621
 
1554
- response, options = Api.send_request("/file_actions/unzip", :post, params, options)
1622
+ response, options = Api.send_request("/file_actions/unzip", :post, params, options) { |reply| reply.require_object("FileAction") }
1555
1623
  FileAction.new(response.data, options)
1556
1624
  end
1557
1625
 
@@ -1559,13 +1627,18 @@ module Files
1559
1627
  # paths (required) - array(string) - Paths to include in the ZIP.
1560
1628
  # destination (required) - string - Destination file path for the ZIP.
1561
1629
  # overwrite - boolean - Overwrite existing file in the destination?
1630
+ #
1631
+ # params:: Hash of API operation parameter values.
1632
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1633
+ #
1634
+ # Returns a Files::FileAction.
1562
1635
  def self.zip(params = {}, options = {})
1563
1636
  raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params[:paths] and !params[:paths].is_a?(Array)
1564
1637
  raise InvalidParameterError.new("Bad parameter: destination must be an String") if params[:destination] and !params[:destination].is_a?(String)
1565
1638
  raise MissingParameterError.new("Parameter missing: paths") unless params[:paths]
1566
1639
  raise MissingParameterError.new("Parameter missing: destination") unless params[:destination]
1567
1640
 
1568
- response, options = Api.send_request("/file_actions/zip", :post, params, options)
1641
+ response, options = Api.send_request("/file_actions/zip", :post, params, options) { |reply| reply.require_object("FileAction") }
1569
1642
  FileAction.new(response.data, options)
1570
1643
  end
1571
1644
 
@@ -1581,6 +1654,11 @@ module Files
1581
1654
  # with_rename - boolean - Allow file rename instead of overwrite?
1582
1655
  # buffered_upload - boolean - If true, and the path refers to a destination not stored on Files.com (such as a remote server mount), the upload will be uploaded first to Files.com before being sent to the remote server mount. This can allow clients to upload using parallel parts to a remote server destination that does not offer parallel parts support natively.
1583
1656
  # with_direct_connection_info - boolean - Include optional direct connection information for a direct Agent transfer attempt?
1657
+ #
1658
+ # params:: Hash of API operation parameter values.
1659
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
1660
+ #
1661
+ # Returns an Array of Files::FileUploadPart objects.
1584
1662
  def self.begin_upload(path, params = {}, options = {})
1585
1663
  params ||= {}
1586
1664
  params[:path] = path
@@ -1592,7 +1670,7 @@ module Files
1592
1670
  raise InvalidParameterError.new("Bad parameter: size must be an Integer") if params[:size] and !params[:size].is_a?(Integer)
1593
1671
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
1594
1672
 
1595
- response, options = Api.send_request("/file_actions/begin_upload/#{params[:path]}", :post, params, options)
1673
+ response, options = Api.send_request("/file_actions/begin_upload/#{params[:path]}", :post, params, options) { |reply| reply.require_list("FileUploadPart") }
1596
1674
  response.data.map do |entity_data|
1597
1675
  FileUploadPart.new(entity_data, options)
1598
1676
  end
@@ -56,7 +56,9 @@ module Files
56
56
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
57
57
  raise MissingParameterError.new("Parameter missing: body") unless params[:body]
58
58
 
59
- Api.send_request("/file_comments/#{@attributes[:id]}", :patch, params, @options)
59
+ response, options = Api.send_request("/file_comments/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("FileComment") }
60
+ @attributes = response.data
61
+ [ response, options ]
60
62
  end
61
63
 
62
64
  def delete(params = {})
@@ -76,12 +78,12 @@ module Files
76
78
 
77
79
  def save
78
80
  if @attributes[:id]
79
- new_obj = update(@attributes)
81
+ update(@attributes)
80
82
  else
81
83
  new_obj = FileComment.create(@attributes, @options)
84
+ @attributes = new_obj.attributes
82
85
  end
83
86
 
84
- @attributes = new_obj.attributes
85
87
  true
86
88
  end
87
89
 
@@ -89,6 +91,11 @@ module Files
89
91
  # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
90
92
  # per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
91
93
  # path (required) - string - Path to operate on.
94
+ #
95
+ # params:: Hash of API operation parameter values.
96
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
97
+ #
98
+ # Returns a Files::List of Files::FileComment objects.
92
99
  def self.list_for(path, params = {}, options = {})
93
100
  params ||= {}
94
101
  params[:path] = path
@@ -97,26 +104,36 @@ module Files
97
104
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
98
105
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
99
106
 
100
- List.new(FileComment, params) do
101
- Api.send_request("/file_comments/files/#{params[:path]}", :get, params, options)
107
+ List.new(FileComment, params) do |page_params, &check_page|
108
+ Api.send_request("/file_comments/files/#{page_params[:path]}", :get, page_params, options, &check_page)
102
109
  end
103
110
  end
104
111
 
105
112
  # Parameters:
106
113
  # body (required) - string - Comment body.
107
114
  # path (required) - string - File path.
115
+ #
116
+ # params:: Hash of API operation parameter values.
117
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
118
+ #
119
+ # Returns a Files::FileComment.
108
120
  def self.create(params = {}, options = {})
109
121
  raise InvalidParameterError.new("Bad parameter: body must be an String") if params[:body] and !params[:body].is_a?(String)
110
122
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
111
123
  raise MissingParameterError.new("Parameter missing: body") unless params[:body]
112
124
  raise MissingParameterError.new("Parameter missing: path") unless params[:path]
113
125
 
114
- response, options = Api.send_request("/file_comments", :post, params, options)
126
+ response, options = Api.send_request("/file_comments", :post, params, options) { |reply| reply.require_object("FileComment") }
115
127
  FileComment.new(response.data, options)
116
128
  end
117
129
 
118
130
  # Parameters:
119
131
  # body (required) - string - Comment body.
132
+ #
133
+ # params:: Hash of API operation parameter values.
134
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
135
+ #
136
+ # Returns a Files::FileComment.
120
137
  def self.update(id, params = {}, options = {})
121
138
  params ||= {}
122
139
  params[:id] = id
@@ -125,10 +142,14 @@ module Files
125
142
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
126
143
  raise MissingParameterError.new("Parameter missing: body") unless params[:body]
127
144
 
128
- response, options = Api.send_request("/file_comments/#{params[:id]}", :patch, params, options)
145
+ response, options = Api.send_request("/file_comments/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("FileComment") }
129
146
  FileComment.new(response.data, options)
130
147
  end
131
148
 
149
+ # params:: Hash of API operation parameter values.
150
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
151
+ #
152
+ # Returns nil.
132
153
  def self.delete(id, params = {}, options = {})
133
154
  params ||= {}
134
155
  params[:id] = id
@@ -65,9 +65,9 @@ module Files
65
65
  raise NotImplementedError.new("The FileCommentReaction object doesn't support updates.")
66
66
  else
67
67
  new_obj = FileCommentReaction.create(@attributes, @options)
68
+ @attributes = new_obj.attributes
68
69
  end
69
70
 
70
- @attributes = new_obj.attributes
71
71
  true
72
72
  end
73
73
 
@@ -75,6 +75,11 @@ module Files
75
75
  # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
76
76
  # file_comment_id (required) - int64 - ID of file comment to attach reaction to.
77
77
  # emoji (required) - string - Emoji to react with.
78
+ #
79
+ # params:: Hash of API operation parameter values.
80
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
81
+ #
82
+ # Returns a Files::FileCommentReaction.
78
83
  def self.create(params = {}, options = {})
79
84
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
80
85
  raise InvalidParameterError.new("Bad parameter: file_comment_id must be an Integer") if params[:file_comment_id] and !params[:file_comment_id].is_a?(Integer)
@@ -82,10 +87,14 @@ module Files
82
87
  raise MissingParameterError.new("Parameter missing: file_comment_id") unless params[:file_comment_id]
83
88
  raise MissingParameterError.new("Parameter missing: emoji") unless params[:emoji]
84
89
 
85
- response, options = Api.send_request("/file_comment_reactions", :post, params, options)
90
+ response, options = Api.send_request("/file_comment_reactions", :post, params, options) { |reply| reply.require_object("FileCommentReaction") }
86
91
  FileCommentReaction.new(response.data, options)
87
92
  end
88
93
 
94
+ # params:: Hash of API operation parameter values.
95
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
96
+ #
97
+ # Returns nil.
89
98
  def self.delete(id, params = {}, options = {})
90
99
  params ||= {}
91
100
  params[:id] = id
@@ -61,13 +61,18 @@ module Files
61
61
 
62
62
  # Parameters:
63
63
  # id (required) - int64 - File Migration ID.
64
+ #
65
+ # params:: Hash of API operation parameter values.
66
+ # options:: Hash of optional request configuration passed to Files::Api.send_request.
67
+ #
68
+ # Returns a Files::FileMigration.
64
69
  def self.find(id, params = {}, options = {})
65
70
  params ||= {}
66
71
  params[:id] = id
67
72
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
68
73
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
69
74
 
70
- response, options = Api.send_request("/file_migrations/#{params[:id]}", :get, params, options)
75
+ response, options = Api.send_request("/file_migrations/#{params[:id]}", :get, params, options) { |reply| reply.require_object("FileMigration") }
71
76
  FileMigration.new(response.data, options)
72
77
  end
73
78