files-com 1.5.0__py3-none-any.whl

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.

Potentially problematic release.


This version of files-com might be problematic. Click here for more details.

Files changed (113) hide show
  1. README.md +682 -0
  2. _VERSION +1 -0
  3. files_com-1.5.0.dist-info/METADATA +694 -0
  4. files_com-1.5.0.dist-info/RECORD +113 -0
  5. files_com-1.5.0.dist-info/WHEEL +5 -0
  6. files_com-1.5.0.dist-info/licenses/LICENSE +21 -0
  7. files_com-1.5.0.dist-info/top_level.txt +1 -0
  8. files_sdk/__init__.py +270 -0
  9. files_sdk/api.py +57 -0
  10. files_sdk/api_client.py +327 -0
  11. files_sdk/error.py +2891 -0
  12. files_sdk/list_obj.py +42 -0
  13. files_sdk/models/__init__.py +104 -0
  14. files_sdk/models/account_line_item.py +51 -0
  15. files_sdk/models/action.py +49 -0
  16. files_sdk/models/action_notification_export.py +147 -0
  17. files_sdk/models/action_notification_export_result.py +88 -0
  18. files_sdk/models/api_key.py +322 -0
  19. files_sdk/models/api_request_log.py +87 -0
  20. files_sdk/models/app.py +89 -0
  21. files_sdk/models/as2_incoming_message.py +123 -0
  22. files_sdk/models/as2_outgoing_message.py +119 -0
  23. files_sdk/models/as2_partner.py +374 -0
  24. files_sdk/models/as2_station.py +271 -0
  25. files_sdk/models/auto.py +36 -0
  26. files_sdk/models/automation.py +691 -0
  27. files_sdk/models/automation_log.py +77 -0
  28. files_sdk/models/automation_run.py +108 -0
  29. files_sdk/models/bandwidth_snapshot.py +91 -0
  30. files_sdk/models/behavior.py +334 -0
  31. files_sdk/models/bundle.py +550 -0
  32. files_sdk/models/bundle_action.py +86 -0
  33. files_sdk/models/bundle_download.py +94 -0
  34. files_sdk/models/bundle_notification.py +217 -0
  35. files_sdk/models/bundle_path.py +37 -0
  36. files_sdk/models/bundle_recipient.py +120 -0
  37. files_sdk/models/bundle_registration.py +79 -0
  38. files_sdk/models/clickwrap.py +268 -0
  39. files_sdk/models/dns_record.py +59 -0
  40. files_sdk/models/email_incoming_message.py +102 -0
  41. files_sdk/models/email_log.py +74 -0
  42. files_sdk/models/errors.py +37 -0
  43. files_sdk/models/exavault_api_request_log.py +85 -0
  44. files_sdk/models/external_event.py +148 -0
  45. files_sdk/models/file.py +791 -0
  46. files_sdk/models/file_action.py +39 -0
  47. files_sdk/models/file_comment.py +191 -0
  48. files_sdk/models/file_comment_reaction.py +125 -0
  49. files_sdk/models/file_migration.py +69 -0
  50. files_sdk/models/file_migration_log.py +78 -0
  51. files_sdk/models/file_upload_part.py +54 -0
  52. files_sdk/models/folder.py +154 -0
  53. files_sdk/models/form_field.py +43 -0
  54. files_sdk/models/form_field_set.py +240 -0
  55. files_sdk/models/ftp_action_log.py +87 -0
  56. files_sdk/models/gpg_key.py +254 -0
  57. files_sdk/models/group.py +276 -0
  58. files_sdk/models/group_user.py +231 -0
  59. files_sdk/models/history.py +236 -0
  60. files_sdk/models/history_export.py +238 -0
  61. files_sdk/models/history_export_result.py +98 -0
  62. files_sdk/models/image.py +37 -0
  63. files_sdk/models/inbox_recipient.py +118 -0
  64. files_sdk/models/inbox_registration.py +79 -0
  65. files_sdk/models/inbox_upload.py +80 -0
  66. files_sdk/models/invoice.py +91 -0
  67. files_sdk/models/invoice_line_item.py +46 -0
  68. files_sdk/models/ip_address.py +119 -0
  69. files_sdk/models/lock.py +158 -0
  70. files_sdk/models/message.py +244 -0
  71. files_sdk/models/message_comment.py +223 -0
  72. files_sdk/models/message_comment_reaction.py +181 -0
  73. files_sdk/models/message_reaction.py +170 -0
  74. files_sdk/models/notification.py +357 -0
  75. files_sdk/models/outbound_connection_log.py +88 -0
  76. files_sdk/models/payment.py +91 -0
  77. files_sdk/models/payment_line_item.py +42 -0
  78. files_sdk/models/permission.py +174 -0
  79. files_sdk/models/preview.py +40 -0
  80. files_sdk/models/priority.py +63 -0
  81. files_sdk/models/project.py +205 -0
  82. files_sdk/models/public_hosting_request_log.py +82 -0
  83. files_sdk/models/public_ip_address.py +42 -0
  84. files_sdk/models/public_key.py +212 -0
  85. files_sdk/models/remote_bandwidth_snapshot.py +91 -0
  86. files_sdk/models/remote_server.py +1677 -0
  87. files_sdk/models/remote_server_configuration_file.py +72 -0
  88. files_sdk/models/request.py +180 -0
  89. files_sdk/models/restore.py +104 -0
  90. files_sdk/models/session.py +100 -0
  91. files_sdk/models/settings_change.py +71 -0
  92. files_sdk/models/sftp_action_log.py +91 -0
  93. files_sdk/models/sftp_host_key.py +215 -0
  94. files_sdk/models/share_group.py +228 -0
  95. files_sdk/models/share_group_member.py +41 -0
  96. files_sdk/models/siem_http_destination.py +773 -0
  97. files_sdk/models/site.py +767 -0
  98. files_sdk/models/snapshot.py +255 -0
  99. files_sdk/models/sso_strategy.py +167 -0
  100. files_sdk/models/status.py +42 -0
  101. files_sdk/models/style.py +152 -0
  102. files_sdk/models/sync_log.py +75 -0
  103. files_sdk/models/usage_by_top_level_dir.py +41 -0
  104. files_sdk/models/usage_daily_snapshot.py +93 -0
  105. files_sdk/models/usage_snapshot.py +73 -0
  106. files_sdk/models/user.py +893 -0
  107. files_sdk/models/user_cipher_use.py +68 -0
  108. files_sdk/models/user_request.py +166 -0
  109. files_sdk/models/user_sftp_client_use.py +68 -0
  110. files_sdk/models/web_dav_action_log.py +87 -0
  111. files_sdk/models/webhook_test.py +104 -0
  112. files_sdk/path_util.py +42 -0
  113. files_sdk/util.py +34 -0
@@ -0,0 +1,550 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class Bundle:
12
+ default_attributes = {
13
+ "code": None, # string - Bundle code. This code forms the end part of the Public URL.
14
+ "color_left": None, # string - Page link and button color
15
+ "color_link": None, # string - Top bar link color
16
+ "color_text": None, # string - Page link and button color
17
+ "color_top": None, # string - Top bar background color
18
+ "color_top_text": None, # string - Top bar text color
19
+ "url": None, # string - Public URL of Share Link
20
+ "description": None, # string - Public description
21
+ "expires_at": None, # date-time - Bundle expiration date/time
22
+ "password_protected": None, # boolean - Is this bundle password protected?
23
+ "permissions": None, # string - Permissions that apply to Folders in this Share Link.
24
+ "preview_only": None, # boolean
25
+ "require_registration": None, # boolean - Show a registration page that captures the downloader's name and email address?
26
+ "require_share_recipient": None, # boolean - Only allow access to recipients who have explicitly received the share via an email sent through the Files.com UI?
27
+ "require_logout": None, # boolean - If true, we will hide the 'Remember Me' box on the Bundle registration page, requiring that the user logout and log back in every time they visit the page.
28
+ "clickwrap_body": None, # string - Legal text that must be agreed to prior to accessing Bundle.
29
+ "form_field_set": None, # FormFieldSet - Custom Form to use
30
+ "skip_name": None, # boolean - BundleRegistrations can be saved without providing name?
31
+ "skip_email": None, # boolean - BundleRegistrations can be saved without providing email?
32
+ "start_access_on_date": None, # date-time - Date when share will start to be accessible. If `nil` access granted right after create.
33
+ "skip_company": None, # boolean - BundleRegistrations can be saved without providing company?
34
+ "id": None, # int64 - Bundle ID
35
+ "created_at": None, # date-time - Bundle created at date/time
36
+ "dont_separate_submissions_by_folder": None, # boolean - Do not create subfolders for files uploaded to this share. Note: there are subtle security pitfalls with allowing anonymous uploads from multiple users to live in the same folder. We strongly discourage use of this option unless absolutely required.
37
+ "max_uses": None, # int64 - Maximum number of times bundle can be accessed
38
+ "note": None, # string - Bundle internal note
39
+ "path_template": None, # string - Template for creating submission subfolders. Can use the uploader's name, email address, ip, company, `strftime` directives, and any custom form data.
40
+ "path_template_time_zone": None, # string - Timezone to use when rendering timestamps in path templates.
41
+ "send_email_receipt_to_uploader": None, # boolean - Send delivery receipt to the uploader. Note: For writable share only
42
+ "snapshot_id": None, # int64 - ID of the snapshot containing this bundle's contents.
43
+ "user_id": None, # int64 - Bundle creator user ID
44
+ "username": None, # string - Bundle creator username
45
+ "clickwrap_id": None, # int64 - ID of the clickwrap to use with this bundle.
46
+ "inbox_id": None, # int64 - ID of the associated inbox, if available.
47
+ "watermark_attachment": None, # Image - Preview watermark image applied to all bundle items.
48
+ "watermark_value": None, # object - Preview watermark settings applied to all bundle items. Uses the same keys as Behavior.value
49
+ "has_inbox": None, # boolean - Does this bundle have an associated inbox?
50
+ "dont_allow_folders_in_uploads": None, # boolean - Should folder uploads be prevented?
51
+ "paths": None, # array(string) - A list of paths in this bundle. For performance reasons, this is not provided when listing bundles.
52
+ "bundlepaths": None, # array(object) - A list of bundlepaths in this bundle. For performance reasons, this is not provided when listing bundles.
53
+ "password": None, # string - Password for this bundle.
54
+ "form_field_set_id": None, # int64 - Id of Form Field Set to use with this bundle
55
+ "create_snapshot": None, # boolean - If true, create a snapshot of this bundle's contents.
56
+ "finalize_snapshot": None, # boolean - If true, finalize the snapshot of this bundle's contents. Note that `create_snapshot` must also be true.
57
+ "watermark_attachment_file": None, # file - Preview watermark image applied to all bundle items.
58
+ "watermark_attachment_delete": None, # boolean - If true, will delete the file stored in watermark_attachment
59
+ }
60
+
61
+ def __init__(self, attributes=None, options=None):
62
+ if not isinstance(attributes, dict):
63
+ attributes = {}
64
+ if not isinstance(options, dict):
65
+ options = {}
66
+ self.set_attributes(attributes)
67
+ self.options = options
68
+
69
+ def set_attributes(self, attributes):
70
+ for attribute, default_value in Bundle.default_attributes.items():
71
+ setattr(self, attribute, attributes.get(attribute, default_value))
72
+
73
+ def get_attributes(self):
74
+ return {
75
+ k: getattr(self, k, None)
76
+ for k in Bundle.default_attributes
77
+ if getattr(self, k, None) is not None
78
+ }
79
+
80
+ # Send email(s) with a link to bundle
81
+ #
82
+ # Parameters:
83
+ # to - array(string) - A list of email addresses to share this bundle with. Required unless `recipients` is used.
84
+ # note - string - Note to include in email.
85
+ # recipients - array(object) - A list of recipients to share this bundle with. Required unless `to` is used.
86
+ def share(self, params=None):
87
+ if not isinstance(params, dict):
88
+ params = {}
89
+
90
+ if hasattr(self, "id") and self.id:
91
+ params["id"] = self.id
92
+ else:
93
+ raise MissingParameterError("Current object doesn't have a id")
94
+ if "id" not in params:
95
+ raise MissingParameterError("Parameter missing: id")
96
+ if "id" in params and not isinstance(params["id"], int):
97
+ raise InvalidParameterError("Bad parameter: id must be an int")
98
+ if "to" in params and not isinstance(params["to"], builtins.list):
99
+ raise InvalidParameterError("Bad parameter: to must be an list")
100
+ if "note" in params and not isinstance(params["note"], str):
101
+ raise InvalidParameterError("Bad parameter: note must be an str")
102
+ if "recipients" in params and not isinstance(
103
+ params["recipients"], builtins.list
104
+ ):
105
+ raise InvalidParameterError(
106
+ "Bad parameter: recipients must be an list"
107
+ )
108
+ Api.send_request(
109
+ "POST",
110
+ "/bundles/{id}/share".format(id=params["id"]),
111
+ params,
112
+ self.options,
113
+ )
114
+
115
+ # Parameters:
116
+ # paths - array(string) - A list of paths to include in this bundle.
117
+ # password - string - Password for this bundle.
118
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
119
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
120
+ # code - string - Bundle code. This code forms the end part of the Public URL.
121
+ # create_snapshot - boolean - If true, create a snapshot of this bundle's contents.
122
+ # description - string - Public description
123
+ # dont_separate_submissions_by_folder - boolean - Do not create subfolders for files uploaded to this share. Note: there are subtle security pitfalls with allowing anonymous uploads from multiple users to live in the same folder. We strongly discourage use of this option unless absolutely required.
124
+ # expires_at - string - Bundle expiration date/time
125
+ # finalize_snapshot - boolean - If true, finalize the snapshot of this bundle's contents. Note that `create_snapshot` must also be true.
126
+ # inbox_id - int64 - ID of the associated inbox, if available.
127
+ # max_uses - int64 - Maximum number of times bundle can be accessed
128
+ # note - string - Bundle internal note
129
+ # path_template - string - Template for creating submission subfolders. Can use the uploader's name, email address, ip, company, `strftime` directives, and any custom form data.
130
+ # path_template_time_zone - string - Timezone to use when rendering timestamps in path templates.
131
+ # permissions - string - Permissions that apply to Folders in this Share Link.
132
+ # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
133
+ # require_share_recipient - boolean - Only allow access to recipients who have explicitly received the share via an email sent through the Files.com UI?
134
+ # send_email_receipt_to_uploader - boolean - Send delivery receipt to the uploader. Note: For writable share only
135
+ # skip_company - boolean - BundleRegistrations can be saved without providing company?
136
+ # start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
137
+ # skip_email - boolean - BundleRegistrations can be saved without providing email?
138
+ # skip_name - boolean - BundleRegistrations can be saved without providing name?
139
+ # watermark_attachment_delete - boolean - If true, will delete the file stored in watermark_attachment
140
+ # watermark_attachment_file - file - Preview watermark image applied to all bundle items.
141
+ def update(self, params=None):
142
+ if not isinstance(params, dict):
143
+ params = {}
144
+
145
+ if hasattr(self, "id") and self.id:
146
+ params["id"] = self.id
147
+ else:
148
+ raise MissingParameterError("Current object doesn't have a id")
149
+ if "id" not in params:
150
+ raise MissingParameterError("Parameter missing: id")
151
+ if "id" in params and not isinstance(params["id"], int):
152
+ raise InvalidParameterError("Bad parameter: id must be an int")
153
+ if "paths" in params and not isinstance(
154
+ params["paths"], builtins.list
155
+ ):
156
+ raise InvalidParameterError("Bad parameter: paths must be an list")
157
+ if "password" in params and not isinstance(params["password"], str):
158
+ raise InvalidParameterError(
159
+ "Bad parameter: password must be an str"
160
+ )
161
+ if "form_field_set_id" in params and not isinstance(
162
+ params["form_field_set_id"], int
163
+ ):
164
+ raise InvalidParameterError(
165
+ "Bad parameter: form_field_set_id must be an int"
166
+ )
167
+ if "clickwrap_id" in params and not isinstance(
168
+ params["clickwrap_id"], int
169
+ ):
170
+ raise InvalidParameterError(
171
+ "Bad parameter: clickwrap_id must be an int"
172
+ )
173
+ if "code" in params and not isinstance(params["code"], str):
174
+ raise InvalidParameterError("Bad parameter: code must be an str")
175
+ if "description" in params and not isinstance(
176
+ params["description"], str
177
+ ):
178
+ raise InvalidParameterError(
179
+ "Bad parameter: description must be an str"
180
+ )
181
+ if "expires_at" in params and not isinstance(
182
+ params["expires_at"], str
183
+ ):
184
+ raise InvalidParameterError(
185
+ "Bad parameter: expires_at must be an str"
186
+ )
187
+ if "inbox_id" in params and not isinstance(params["inbox_id"], int):
188
+ raise InvalidParameterError(
189
+ "Bad parameter: inbox_id must be an int"
190
+ )
191
+ if "max_uses" in params and not isinstance(params["max_uses"], int):
192
+ raise InvalidParameterError(
193
+ "Bad parameter: max_uses must be an int"
194
+ )
195
+ if "note" in params and not isinstance(params["note"], str):
196
+ raise InvalidParameterError("Bad parameter: note must be an str")
197
+ if "path_template" in params and not isinstance(
198
+ params["path_template"], str
199
+ ):
200
+ raise InvalidParameterError(
201
+ "Bad parameter: path_template must be an str"
202
+ )
203
+ if "path_template_time_zone" in params and not isinstance(
204
+ params["path_template_time_zone"], str
205
+ ):
206
+ raise InvalidParameterError(
207
+ "Bad parameter: path_template_time_zone must be an str"
208
+ )
209
+ if "permissions" in params and not isinstance(
210
+ params["permissions"], str
211
+ ):
212
+ raise InvalidParameterError(
213
+ "Bad parameter: permissions must be an str"
214
+ )
215
+ if "start_access_on_date" in params and not isinstance(
216
+ params["start_access_on_date"], str
217
+ ):
218
+ raise InvalidParameterError(
219
+ "Bad parameter: start_access_on_date must be an str"
220
+ )
221
+ response, _options = Api.send_request(
222
+ "PATCH",
223
+ "/bundles/{id}".format(id=params["id"]),
224
+ params,
225
+ self.options,
226
+ )
227
+ return response.data
228
+
229
+ def delete(self, params=None):
230
+ if not isinstance(params, dict):
231
+ params = {}
232
+
233
+ if hasattr(self, "id") and self.id:
234
+ params["id"] = self.id
235
+ else:
236
+ raise MissingParameterError("Current object doesn't have a id")
237
+ if "id" not in params:
238
+ raise MissingParameterError("Parameter missing: id")
239
+ if "id" in params and not isinstance(params["id"], int):
240
+ raise InvalidParameterError("Bad parameter: id must be an int")
241
+ Api.send_request(
242
+ "DELETE",
243
+ "/bundles/{id}".format(id=params["id"]),
244
+ params,
245
+ self.options,
246
+ )
247
+
248
+ def destroy(self, params=None):
249
+ self.delete(params)
250
+
251
+ def save(self):
252
+ if hasattr(self, "id") and self.id:
253
+ new_obj = self.update(self.get_attributes())
254
+ self.set_attributes(new_obj.get_attributes())
255
+ return True
256
+ else:
257
+ new_obj = create(self.get_attributes(), self.options)
258
+ self.set_attributes(new_obj.get_attributes())
259
+ return True
260
+
261
+
262
+ # Parameters:
263
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
264
+ # 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.
265
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
266
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `expires_at`.
267
+ def list(params=None, options=None):
268
+ if not isinstance(params, dict):
269
+ params = {}
270
+ if not isinstance(options, dict):
271
+ options = {}
272
+ if "user_id" in params and not isinstance(params["user_id"], int):
273
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
274
+ if "cursor" in params and not isinstance(params["cursor"], str):
275
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
276
+ if "per_page" in params and not isinstance(params["per_page"], int):
277
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
278
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
279
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
280
+ return ListObj(Bundle, "GET", "/bundles", params, options)
281
+
282
+
283
+ def all(params=None, options=None):
284
+ list(params, options)
285
+
286
+
287
+ # Parameters:
288
+ # id (required) - int64 - Bundle ID.
289
+ def find(id, params=None, options=None):
290
+ if not isinstance(params, dict):
291
+ params = {}
292
+ if not isinstance(options, dict):
293
+ options = {}
294
+ params["id"] = id
295
+ if "id" in params and not isinstance(params["id"], int):
296
+ raise InvalidParameterError("Bad parameter: id must be an int")
297
+ if "id" not in params:
298
+ raise MissingParameterError("Parameter missing: id")
299
+ response, options = Api.send_request(
300
+ "GET", "/bundles/{id}".format(id=params["id"]), params, options
301
+ )
302
+ return Bundle(response.data, options)
303
+
304
+
305
+ def get(id, params=None, options=None):
306
+ find(id, params, options)
307
+
308
+
309
+ # Parameters:
310
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
311
+ # paths (required) - array(string) - A list of paths to include in this bundle.
312
+ # password - string - Password for this bundle.
313
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
314
+ # create_snapshot - boolean - If true, create a snapshot of this bundle's contents.
315
+ # dont_separate_submissions_by_folder - boolean - Do not create subfolders for files uploaded to this share. Note: there are subtle security pitfalls with allowing anonymous uploads from multiple users to live in the same folder. We strongly discourage use of this option unless absolutely required.
316
+ # expires_at - string - Bundle expiration date/time
317
+ # finalize_snapshot - boolean - If true, finalize the snapshot of this bundle's contents. Note that `create_snapshot` must also be true.
318
+ # max_uses - int64 - Maximum number of times bundle can be accessed
319
+ # description - string - Public description
320
+ # note - string - Bundle internal note
321
+ # code - string - Bundle code. This code forms the end part of the Public URL.
322
+ # path_template - string - Template for creating submission subfolders. Can use the uploader's name, email address, ip, company, `strftime` directives, and any custom form data.
323
+ # path_template_time_zone - string - Timezone to use when rendering timestamps in path templates.
324
+ # permissions - string - Permissions that apply to Folders in this Share Link.
325
+ # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
326
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
327
+ # inbox_id - int64 - ID of the associated inbox, if available.
328
+ # require_share_recipient - boolean - Only allow access to recipients who have explicitly received the share via an email sent through the Files.com UI?
329
+ # send_email_receipt_to_uploader - boolean - Send delivery receipt to the uploader. Note: For writable share only
330
+ # skip_email - boolean - BundleRegistrations can be saved without providing email?
331
+ # skip_name - boolean - BundleRegistrations can be saved without providing name?
332
+ # skip_company - boolean - BundleRegistrations can be saved without providing company?
333
+ # start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
334
+ # snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
335
+ # watermark_attachment_file - file - Preview watermark image applied to all bundle items.
336
+ def create(params=None, options=None):
337
+ if not isinstance(params, dict):
338
+ params = {}
339
+ if not isinstance(options, dict):
340
+ options = {}
341
+ if "user_id" in params and not isinstance(params["user_id"], int):
342
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
343
+ if "paths" in params and not isinstance(params["paths"], builtins.list):
344
+ raise InvalidParameterError("Bad parameter: paths must be an list")
345
+ if "password" in params and not isinstance(params["password"], str):
346
+ raise InvalidParameterError("Bad parameter: password must be an str")
347
+ if "form_field_set_id" in params and not isinstance(
348
+ params["form_field_set_id"], int
349
+ ):
350
+ raise InvalidParameterError(
351
+ "Bad parameter: form_field_set_id must be an int"
352
+ )
353
+ if "expires_at" in params and not isinstance(params["expires_at"], str):
354
+ raise InvalidParameterError("Bad parameter: expires_at must be an str")
355
+ if "max_uses" in params and not isinstance(params["max_uses"], int):
356
+ raise InvalidParameterError("Bad parameter: max_uses must be an int")
357
+ if "description" in params and not isinstance(params["description"], str):
358
+ raise InvalidParameterError(
359
+ "Bad parameter: description must be an str"
360
+ )
361
+ if "note" in params and not isinstance(params["note"], str):
362
+ raise InvalidParameterError("Bad parameter: note must be an str")
363
+ if "code" in params and not isinstance(params["code"], str):
364
+ raise InvalidParameterError("Bad parameter: code must be an str")
365
+ if "path_template" in params and not isinstance(
366
+ params["path_template"], str
367
+ ):
368
+ raise InvalidParameterError(
369
+ "Bad parameter: path_template must be an str"
370
+ )
371
+ if "path_template_time_zone" in params and not isinstance(
372
+ params["path_template_time_zone"], str
373
+ ):
374
+ raise InvalidParameterError(
375
+ "Bad parameter: path_template_time_zone must be an str"
376
+ )
377
+ if "permissions" in params and not isinstance(params["permissions"], str):
378
+ raise InvalidParameterError(
379
+ "Bad parameter: permissions must be an str"
380
+ )
381
+ if "clickwrap_id" in params and not isinstance(
382
+ params["clickwrap_id"], int
383
+ ):
384
+ raise InvalidParameterError(
385
+ "Bad parameter: clickwrap_id must be an int"
386
+ )
387
+ if "inbox_id" in params and not isinstance(params["inbox_id"], int):
388
+ raise InvalidParameterError("Bad parameter: inbox_id must be an int")
389
+ if "start_access_on_date" in params and not isinstance(
390
+ params["start_access_on_date"], str
391
+ ):
392
+ raise InvalidParameterError(
393
+ "Bad parameter: start_access_on_date must be an str"
394
+ )
395
+ if "snapshot_id" in params and not isinstance(params["snapshot_id"], int):
396
+ raise InvalidParameterError(
397
+ "Bad parameter: snapshot_id must be an int"
398
+ )
399
+ if "paths" not in params:
400
+ raise MissingParameterError("Parameter missing: paths")
401
+ response, options = Api.send_request("POST", "/bundles", params, options)
402
+ return Bundle(response.data, options)
403
+
404
+
405
+ # Send email(s) with a link to bundle
406
+ #
407
+ # Parameters:
408
+ # to - array(string) - A list of email addresses to share this bundle with. Required unless `recipients` is used.
409
+ # note - string - Note to include in email.
410
+ # recipients - array(object) - A list of recipients to share this bundle with. Required unless `to` is used.
411
+ def share(id, params=None, options=None):
412
+ if not isinstance(params, dict):
413
+ params = {}
414
+ if not isinstance(options, dict):
415
+ options = {}
416
+ params["id"] = id
417
+ if "id" in params and not isinstance(params["id"], int):
418
+ raise InvalidParameterError("Bad parameter: id must be an int")
419
+ if "to" in params and not isinstance(params["to"], builtins.list):
420
+ raise InvalidParameterError("Bad parameter: to must be an list")
421
+ if "note" in params and not isinstance(params["note"], str):
422
+ raise InvalidParameterError("Bad parameter: note must be an str")
423
+ if "recipients" in params and not isinstance(
424
+ params["recipients"], builtins.list
425
+ ):
426
+ raise InvalidParameterError(
427
+ "Bad parameter: recipients must be an list"
428
+ )
429
+ if "id" not in params:
430
+ raise MissingParameterError("Parameter missing: id")
431
+ Api.send_request(
432
+ "POST", "/bundles/{id}/share".format(id=params["id"]), params, options
433
+ )
434
+
435
+
436
+ # Parameters:
437
+ # paths - array(string) - A list of paths to include in this bundle.
438
+ # password - string - Password for this bundle.
439
+ # form_field_set_id - int64 - Id of Form Field Set to use with this bundle
440
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
441
+ # code - string - Bundle code. This code forms the end part of the Public URL.
442
+ # create_snapshot - boolean - If true, create a snapshot of this bundle's contents.
443
+ # description - string - Public description
444
+ # dont_separate_submissions_by_folder - boolean - Do not create subfolders for files uploaded to this share. Note: there are subtle security pitfalls with allowing anonymous uploads from multiple users to live in the same folder. We strongly discourage use of this option unless absolutely required.
445
+ # expires_at - string - Bundle expiration date/time
446
+ # finalize_snapshot - boolean - If true, finalize the snapshot of this bundle's contents. Note that `create_snapshot` must also be true.
447
+ # inbox_id - int64 - ID of the associated inbox, if available.
448
+ # max_uses - int64 - Maximum number of times bundle can be accessed
449
+ # note - string - Bundle internal note
450
+ # path_template - string - Template for creating submission subfolders. Can use the uploader's name, email address, ip, company, `strftime` directives, and any custom form data.
451
+ # path_template_time_zone - string - Timezone to use when rendering timestamps in path templates.
452
+ # permissions - string - Permissions that apply to Folders in this Share Link.
453
+ # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
454
+ # require_share_recipient - boolean - Only allow access to recipients who have explicitly received the share via an email sent through the Files.com UI?
455
+ # send_email_receipt_to_uploader - boolean - Send delivery receipt to the uploader. Note: For writable share only
456
+ # skip_company - boolean - BundleRegistrations can be saved without providing company?
457
+ # start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
458
+ # skip_email - boolean - BundleRegistrations can be saved without providing email?
459
+ # skip_name - boolean - BundleRegistrations can be saved without providing name?
460
+ # watermark_attachment_delete - boolean - If true, will delete the file stored in watermark_attachment
461
+ # watermark_attachment_file - file - Preview watermark image applied to all bundle items.
462
+ def update(id, params=None, options=None):
463
+ if not isinstance(params, dict):
464
+ params = {}
465
+ if not isinstance(options, dict):
466
+ options = {}
467
+ params["id"] = id
468
+ if "id" in params and not isinstance(params["id"], int):
469
+ raise InvalidParameterError("Bad parameter: id must be an int")
470
+ if "paths" in params and not isinstance(params["paths"], builtins.list):
471
+ raise InvalidParameterError("Bad parameter: paths must be an list")
472
+ if "password" in params and not isinstance(params["password"], str):
473
+ raise InvalidParameterError("Bad parameter: password must be an str")
474
+ if "form_field_set_id" in params and not isinstance(
475
+ params["form_field_set_id"], int
476
+ ):
477
+ raise InvalidParameterError(
478
+ "Bad parameter: form_field_set_id must be an int"
479
+ )
480
+ if "clickwrap_id" in params and not isinstance(
481
+ params["clickwrap_id"], int
482
+ ):
483
+ raise InvalidParameterError(
484
+ "Bad parameter: clickwrap_id must be an int"
485
+ )
486
+ if "code" in params and not isinstance(params["code"], str):
487
+ raise InvalidParameterError("Bad parameter: code must be an str")
488
+ if "description" in params and not isinstance(params["description"], str):
489
+ raise InvalidParameterError(
490
+ "Bad parameter: description must be an str"
491
+ )
492
+ if "expires_at" in params and not isinstance(params["expires_at"], str):
493
+ raise InvalidParameterError("Bad parameter: expires_at must be an str")
494
+ if "inbox_id" in params and not isinstance(params["inbox_id"], int):
495
+ raise InvalidParameterError("Bad parameter: inbox_id must be an int")
496
+ if "max_uses" in params and not isinstance(params["max_uses"], int):
497
+ raise InvalidParameterError("Bad parameter: max_uses must be an int")
498
+ if "note" in params and not isinstance(params["note"], str):
499
+ raise InvalidParameterError("Bad parameter: note must be an str")
500
+ if "path_template" in params and not isinstance(
501
+ params["path_template"], str
502
+ ):
503
+ raise InvalidParameterError(
504
+ "Bad parameter: path_template must be an str"
505
+ )
506
+ if "path_template_time_zone" in params and not isinstance(
507
+ params["path_template_time_zone"], str
508
+ ):
509
+ raise InvalidParameterError(
510
+ "Bad parameter: path_template_time_zone must be an str"
511
+ )
512
+ if "permissions" in params and not isinstance(params["permissions"], str):
513
+ raise InvalidParameterError(
514
+ "Bad parameter: permissions must be an str"
515
+ )
516
+ if "start_access_on_date" in params and not isinstance(
517
+ params["start_access_on_date"], str
518
+ ):
519
+ raise InvalidParameterError(
520
+ "Bad parameter: start_access_on_date must be an str"
521
+ )
522
+ if "id" not in params:
523
+ raise MissingParameterError("Parameter missing: id")
524
+ response, options = Api.send_request(
525
+ "PATCH", "/bundles/{id}".format(id=params["id"]), params, options
526
+ )
527
+ return Bundle(response.data, options)
528
+
529
+
530
+ def delete(id, params=None, options=None):
531
+ if not isinstance(params, dict):
532
+ params = {}
533
+ if not isinstance(options, dict):
534
+ options = {}
535
+ params["id"] = id
536
+ if "id" in params and not isinstance(params["id"], int):
537
+ raise InvalidParameterError("Bad parameter: id must be an int")
538
+ if "id" not in params:
539
+ raise MissingParameterError("Parameter missing: id")
540
+ Api.send_request(
541
+ "DELETE", "/bundles/{id}".format(id=params["id"]), params, options
542
+ )
543
+
544
+
545
+ def destroy(id, params=None, options=None):
546
+ delete(id, params, options)
547
+
548
+
549
+ def new(*args, **kwargs):
550
+ return Bundle(*args, **kwargs)
@@ -0,0 +1,86 @@
1
+ import builtins # noqa: F401
2
+ from files_sdk.api import Api # noqa: F401
3
+ from files_sdk.list_obj import ListObj
4
+ from files_sdk.error import ( # noqa: F401
5
+ InvalidParameterError,
6
+ MissingParameterError,
7
+ NotImplementedError,
8
+ )
9
+
10
+
11
+ class BundleAction:
12
+ default_attributes = {
13
+ "action": None, # string - Type of action
14
+ "bundle_registration": None, # BundleRegistration - Object that contains bundle registration information
15
+ "created_at": None, # date-time - Action occurrence date/time
16
+ "destination": None, # string - The destination path for this bundle action, if applicable
17
+ "path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
18
+ "source": None, # string - The source path for this bundle action, if applicable
19
+ }
20
+
21
+ def __init__(self, attributes=None, options=None):
22
+ if not isinstance(attributes, dict):
23
+ attributes = {}
24
+ if not isinstance(options, dict):
25
+ options = {}
26
+ self.set_attributes(attributes)
27
+ self.options = options
28
+
29
+ def set_attributes(self, attributes):
30
+ for (
31
+ attribute,
32
+ default_value,
33
+ ) in BundleAction.default_attributes.items():
34
+ setattr(self, attribute, attributes.get(attribute, default_value))
35
+
36
+ def get_attributes(self):
37
+ return {
38
+ k: getattr(self, k, None)
39
+ for k in BundleAction.default_attributes
40
+ if getattr(self, k, None) is not None
41
+ }
42
+
43
+
44
+ # Parameters:
45
+ # 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.
46
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
47
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`.
48
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `bundle_id` or `bundle_registration_id`. Valid field combinations are `[ bundle_id, created_at ]`, `[ bundle_registration_id, created_at ]`, `[ bundle_id, bundle_registration_id ]` or `[ bundle_id, bundle_registration_id, created_at ]`.
49
+ # filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
50
+ # filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
51
+ # filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
52
+ # filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
53
+ def list(params=None, options=None):
54
+ if not isinstance(params, dict):
55
+ params = {}
56
+ if not isinstance(options, dict):
57
+ options = {}
58
+ if "cursor" in params and not isinstance(params["cursor"], str):
59
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
60
+ if "per_page" in params and not isinstance(params["per_page"], int):
61
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
62
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
63
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
64
+ if "filter" in params and not isinstance(params["filter"], dict):
65
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
66
+ if "filter_gt" in params and not isinstance(params["filter_gt"], dict):
67
+ raise InvalidParameterError("Bad parameter: filter_gt must be an dict")
68
+ if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict):
69
+ raise InvalidParameterError(
70
+ "Bad parameter: filter_gteq must be an dict"
71
+ )
72
+ if "filter_lt" in params and not isinstance(params["filter_lt"], dict):
73
+ raise InvalidParameterError("Bad parameter: filter_lt must be an dict")
74
+ if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict):
75
+ raise InvalidParameterError(
76
+ "Bad parameter: filter_lteq must be an dict"
77
+ )
78
+ return ListObj(BundleAction, "GET", "/bundle_actions", params, options)
79
+
80
+
81
+ def all(params=None, options=None):
82
+ list(params, options)
83
+
84
+
85
+ def new(*args, **kwargs):
86
+ return BundleAction(*args, **kwargs)