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,158 @@
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 Lock:
12
+ default_attributes = {
13
+ "path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
14
+ "timeout": None, # int64 - Lock timeout in seconds
15
+ "depth": None, # string
16
+ "recursive": None, # boolean - Does lock apply to subfolders?
17
+ "owner": None, # string - Owner of the lock. This can be any arbitrary string.
18
+ "scope": None, # string
19
+ "exclusive": None, # boolean - Is lock exclusive?
20
+ "token": None, # string - Lock token. Use to release lock.
21
+ "type": None, # string
22
+ "allow_access_by_any_user": None, # boolean - Can lock be modified by users other than its creator?
23
+ "user_id": None, # int64 - Lock creator user ID
24
+ "username": None, # string - Lock creator username
25
+ }
26
+
27
+ def __init__(self, attributes=None, options=None):
28
+ if not isinstance(attributes, dict):
29
+ attributes = {}
30
+ if not isinstance(options, dict):
31
+ options = {}
32
+ self.set_attributes(attributes)
33
+ self.options = options
34
+
35
+ def set_attributes(self, attributes):
36
+ for attribute, default_value in Lock.default_attributes.items():
37
+ setattr(self, attribute, attributes.get(attribute, default_value))
38
+
39
+ def get_attributes(self):
40
+ return {
41
+ k: getattr(self, k, None)
42
+ for k in Lock.default_attributes
43
+ if getattr(self, k, None) is not None
44
+ }
45
+
46
+ # Parameters:
47
+ # token (required) - string - Lock token
48
+ def delete(self, params=None):
49
+ if not isinstance(params, dict):
50
+ params = {}
51
+
52
+ if hasattr(self, "path") and self.path:
53
+ params["path"] = self.path
54
+ else:
55
+ raise MissingParameterError("Current object doesn't have a path")
56
+ if "path" not in params:
57
+ raise MissingParameterError("Parameter missing: path")
58
+ if "token" not in params:
59
+ raise MissingParameterError("Parameter missing: token")
60
+ if "path" in params and not isinstance(params["path"], str):
61
+ raise InvalidParameterError("Bad parameter: path must be an str")
62
+ if "token" in params and not isinstance(params["token"], str):
63
+ raise InvalidParameterError("Bad parameter: token must be an str")
64
+ Api.send_request(
65
+ "DELETE",
66
+ "/locks/{path}".format(path=params["path"]),
67
+ params,
68
+ self.options,
69
+ )
70
+
71
+ def destroy(self, params=None):
72
+ self.delete(params)
73
+
74
+ def save(self):
75
+ new_obj = create(self.path, self.get_attributes(), self.options)
76
+ self.set_attributes(new_obj.get_attributes())
77
+ return True
78
+
79
+
80
+ # Parameters:
81
+ # 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.
82
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
83
+ # path (required) - string - Path to operate on.
84
+ # include_children - boolean - Include locks from children objects?
85
+ def list_for(path, params=None, options=None):
86
+ if not isinstance(params, dict):
87
+ params = {}
88
+ if not isinstance(options, dict):
89
+ options = {}
90
+ params["path"] = path
91
+ if "cursor" in params and not isinstance(params["cursor"], str):
92
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
93
+ if "per_page" in params and not isinstance(params["per_page"], int):
94
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
95
+ if "path" in params and not isinstance(params["path"], str):
96
+ raise InvalidParameterError("Bad parameter: path must be an str")
97
+ if "path" not in params:
98
+ raise MissingParameterError("Parameter missing: path")
99
+ return ListObj(
100
+ Lock,
101
+ "GET",
102
+ "/locks/{path}".format(path=params["path"]),
103
+ params,
104
+ options,
105
+ )
106
+
107
+
108
+ # Parameters:
109
+ # path (required) - string - Path
110
+ # allow_access_by_any_user - boolean - Can lock be modified by users other than its creator?
111
+ # exclusive - boolean - Is lock exclusive?
112
+ # recursive - boolean - Does lock apply to subfolders?
113
+ # timeout - int64 - Lock timeout in seconds
114
+ def create(path, params=None, options=None):
115
+ if not isinstance(params, dict):
116
+ params = {}
117
+ if not isinstance(options, dict):
118
+ options = {}
119
+ params["path"] = path
120
+ if "path" in params and not isinstance(params["path"], str):
121
+ raise InvalidParameterError("Bad parameter: path must be an str")
122
+ if "timeout" in params and not isinstance(params["timeout"], int):
123
+ raise InvalidParameterError("Bad parameter: timeout must be an int")
124
+ if "path" not in params:
125
+ raise MissingParameterError("Parameter missing: path")
126
+ response, options = Api.send_request(
127
+ "POST", "/locks/{path}".format(path=params["path"]), params, options
128
+ )
129
+ return Lock(response.data, options)
130
+
131
+
132
+ # Parameters:
133
+ # token (required) - string - Lock token
134
+ def delete(path, params=None, options=None):
135
+ if not isinstance(params, dict):
136
+ params = {}
137
+ if not isinstance(options, dict):
138
+ options = {}
139
+ params["path"] = path
140
+ if "path" in params and not isinstance(params["path"], str):
141
+ raise InvalidParameterError("Bad parameter: path must be an str")
142
+ if "token" in params and not isinstance(params["token"], str):
143
+ raise InvalidParameterError("Bad parameter: token must be an str")
144
+ if "path" not in params:
145
+ raise MissingParameterError("Parameter missing: path")
146
+ if "token" not in params:
147
+ raise MissingParameterError("Parameter missing: token")
148
+ Api.send_request(
149
+ "DELETE", "/locks/{path}".format(path=params["path"]), params, options
150
+ )
151
+
152
+
153
+ def destroy(path, params=None, options=None):
154
+ delete(path, params, options)
155
+
156
+
157
+ def new(*args, **kwargs):
158
+ return Lock(*args, **kwargs)
@@ -0,0 +1,244 @@
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 Message:
12
+ default_attributes = {
13
+ "id": None, # int64 - Message ID
14
+ "subject": None, # string - Message subject.
15
+ "body": None, # string - Message body.
16
+ "comments": None, # array(object) - Comments.
17
+ "user_id": None, # int64 - User ID. Provide a value of `0` to operate the current session's user.
18
+ "project_id": None, # int64 - Project to which the message should be attached.
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 attribute, default_value in Message.default_attributes.items():
31
+ setattr(self, attribute, attributes.get(attribute, default_value))
32
+
33
+ def get_attributes(self):
34
+ return {
35
+ k: getattr(self, k, None)
36
+ for k in Message.default_attributes
37
+ if getattr(self, k, None) is not None
38
+ }
39
+
40
+ # Parameters:
41
+ # project_id (required) - int64 - Project to which the message should be attached.
42
+ # subject (required) - string - Message subject.
43
+ # body (required) - string - Message body.
44
+ def update(self, params=None):
45
+ if not isinstance(params, dict):
46
+ params = {}
47
+
48
+ if hasattr(self, "id") and self.id:
49
+ params["id"] = self.id
50
+ else:
51
+ raise MissingParameterError("Current object doesn't have a id")
52
+ if "id" not in params:
53
+ raise MissingParameterError("Parameter missing: id")
54
+ if "project_id" not in params:
55
+ raise MissingParameterError("Parameter missing: project_id")
56
+ if "subject" not in params:
57
+ raise MissingParameterError("Parameter missing: subject")
58
+ if "body" not in params:
59
+ raise MissingParameterError("Parameter missing: body")
60
+ if "id" in params and not isinstance(params["id"], int):
61
+ raise InvalidParameterError("Bad parameter: id must be an int")
62
+ if "project_id" in params and not isinstance(
63
+ params["project_id"], int
64
+ ):
65
+ raise InvalidParameterError(
66
+ "Bad parameter: project_id must be an int"
67
+ )
68
+ if "subject" in params and not isinstance(params["subject"], str):
69
+ raise InvalidParameterError(
70
+ "Bad parameter: subject must be an str"
71
+ )
72
+ if "body" in params and not isinstance(params["body"], str):
73
+ raise InvalidParameterError("Bad parameter: body must be an str")
74
+ response, _options = Api.send_request(
75
+ "PATCH",
76
+ "/messages/{id}".format(id=params["id"]),
77
+ params,
78
+ self.options,
79
+ )
80
+ return response.data
81
+
82
+ def delete(self, params=None):
83
+ if not isinstance(params, dict):
84
+ params = {}
85
+
86
+ if hasattr(self, "id") and self.id:
87
+ params["id"] = self.id
88
+ else:
89
+ raise MissingParameterError("Current object doesn't have a id")
90
+ if "id" not in params:
91
+ raise MissingParameterError("Parameter missing: id")
92
+ if "id" in params and not isinstance(params["id"], int):
93
+ raise InvalidParameterError("Bad parameter: id must be an int")
94
+ Api.send_request(
95
+ "DELETE",
96
+ "/messages/{id}".format(id=params["id"]),
97
+ params,
98
+ self.options,
99
+ )
100
+
101
+ def destroy(self, params=None):
102
+ self.delete(params)
103
+
104
+ def save(self):
105
+ if hasattr(self, "id") and self.id:
106
+ new_obj = self.update(self.get_attributes())
107
+ self.set_attributes(new_obj.get_attributes())
108
+ return True
109
+ else:
110
+ new_obj = create(self.get_attributes(), self.options)
111
+ self.set_attributes(new_obj.get_attributes())
112
+ return True
113
+
114
+
115
+ # Parameters:
116
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
117
+ # 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.
118
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
119
+ # project_id (required) - int64 - Project for which to return messages.
120
+ def list(params=None, options=None):
121
+ if not isinstance(params, dict):
122
+ params = {}
123
+ if not isinstance(options, dict):
124
+ options = {}
125
+ if "user_id" in params and not isinstance(params["user_id"], int):
126
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
127
+ if "cursor" in params and not isinstance(params["cursor"], str):
128
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
129
+ if "per_page" in params and not isinstance(params["per_page"], int):
130
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
131
+ if "project_id" in params and not isinstance(params["project_id"], int):
132
+ raise InvalidParameterError("Bad parameter: project_id must be an int")
133
+ if "project_id" not in params:
134
+ raise MissingParameterError("Parameter missing: project_id")
135
+ return ListObj(Message, "GET", "/messages", params, options)
136
+
137
+
138
+ def all(params=None, options=None):
139
+ list(params, options)
140
+
141
+
142
+ # Parameters:
143
+ # id (required) - int64 - Message ID.
144
+ def find(id, params=None, options=None):
145
+ if not isinstance(params, dict):
146
+ params = {}
147
+ if not isinstance(options, dict):
148
+ options = {}
149
+ params["id"] = id
150
+ if "id" in params and not isinstance(params["id"], int):
151
+ raise InvalidParameterError("Bad parameter: id must be an int")
152
+ if "id" not in params:
153
+ raise MissingParameterError("Parameter missing: id")
154
+ response, options = Api.send_request(
155
+ "GET", "/messages/{id}".format(id=params["id"]), params, options
156
+ )
157
+ return Message(response.data, options)
158
+
159
+
160
+ def get(id, params=None, options=None):
161
+ find(id, params, options)
162
+
163
+
164
+ # Parameters:
165
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
166
+ # project_id (required) - int64 - Project to which the message should be attached.
167
+ # subject (required) - string - Message subject.
168
+ # body (required) - string - Message body.
169
+ def create(params=None, options=None):
170
+ if not isinstance(params, dict):
171
+ params = {}
172
+ if not isinstance(options, dict):
173
+ options = {}
174
+ if "user_id" in params and not isinstance(params["user_id"], int):
175
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
176
+ if "project_id" in params and not isinstance(params["project_id"], int):
177
+ raise InvalidParameterError("Bad parameter: project_id must be an int")
178
+ if "subject" in params and not isinstance(params["subject"], str):
179
+ raise InvalidParameterError("Bad parameter: subject must be an str")
180
+ if "body" in params and not isinstance(params["body"], str):
181
+ raise InvalidParameterError("Bad parameter: body must be an str")
182
+ if "project_id" not in params:
183
+ raise MissingParameterError("Parameter missing: project_id")
184
+ if "subject" not in params:
185
+ raise MissingParameterError("Parameter missing: subject")
186
+ if "body" not in params:
187
+ raise MissingParameterError("Parameter missing: body")
188
+ response, options = Api.send_request("POST", "/messages", params, options)
189
+ return Message(response.data, options)
190
+
191
+
192
+ # Parameters:
193
+ # project_id (required) - int64 - Project to which the message should be attached.
194
+ # subject (required) - string - Message subject.
195
+ # body (required) - string - Message body.
196
+ def update(id, params=None, options=None):
197
+ if not isinstance(params, dict):
198
+ params = {}
199
+ if not isinstance(options, dict):
200
+ options = {}
201
+ params["id"] = id
202
+ if "id" in params and not isinstance(params["id"], int):
203
+ raise InvalidParameterError("Bad parameter: id must be an int")
204
+ if "project_id" in params and not isinstance(params["project_id"], int):
205
+ raise InvalidParameterError("Bad parameter: project_id must be an int")
206
+ if "subject" in params and not isinstance(params["subject"], str):
207
+ raise InvalidParameterError("Bad parameter: subject must be an str")
208
+ if "body" in params and not isinstance(params["body"], str):
209
+ raise InvalidParameterError("Bad parameter: body must be an str")
210
+ if "id" not in params:
211
+ raise MissingParameterError("Parameter missing: id")
212
+ if "project_id" not in params:
213
+ raise MissingParameterError("Parameter missing: project_id")
214
+ if "subject" not in params:
215
+ raise MissingParameterError("Parameter missing: subject")
216
+ if "body" not in params:
217
+ raise MissingParameterError("Parameter missing: body")
218
+ response, options = Api.send_request(
219
+ "PATCH", "/messages/{id}".format(id=params["id"]), params, options
220
+ )
221
+ return Message(response.data, options)
222
+
223
+
224
+ def delete(id, params=None, options=None):
225
+ if not isinstance(params, dict):
226
+ params = {}
227
+ if not isinstance(options, dict):
228
+ options = {}
229
+ params["id"] = id
230
+ if "id" in params and not isinstance(params["id"], int):
231
+ raise InvalidParameterError("Bad parameter: id must be an int")
232
+ if "id" not in params:
233
+ raise MissingParameterError("Parameter missing: id")
234
+ Api.send_request(
235
+ "DELETE", "/messages/{id}".format(id=params["id"]), params, options
236
+ )
237
+
238
+
239
+ def destroy(id, params=None, options=None):
240
+ delete(id, params, options)
241
+
242
+
243
+ def new(*args, **kwargs):
244
+ return Message(*args, **kwargs)
@@ -0,0 +1,223 @@
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 MessageComment:
12
+ default_attributes = {
13
+ "id": None, # int64 - Message Comment ID
14
+ "body": None, # string - Comment body.
15
+ "reactions": None, # array(object) - Reactions to this comment.
16
+ "user_id": None, # int64 - User ID. Provide a value of `0` to operate the current session's user.
17
+ }
18
+
19
+ def __init__(self, attributes=None, options=None):
20
+ if not isinstance(attributes, dict):
21
+ attributes = {}
22
+ if not isinstance(options, dict):
23
+ options = {}
24
+ self.set_attributes(attributes)
25
+ self.options = options
26
+
27
+ def set_attributes(self, attributes):
28
+ for (
29
+ attribute,
30
+ default_value,
31
+ ) in MessageComment.default_attributes.items():
32
+ setattr(self, attribute, attributes.get(attribute, default_value))
33
+
34
+ def get_attributes(self):
35
+ return {
36
+ k: getattr(self, k, None)
37
+ for k in MessageComment.default_attributes
38
+ if getattr(self, k, None) is not None
39
+ }
40
+
41
+ # Parameters:
42
+ # body (required) - string - Comment body.
43
+ def update(self, params=None):
44
+ if not isinstance(params, dict):
45
+ params = {}
46
+
47
+ if hasattr(self, "id") and self.id:
48
+ params["id"] = self.id
49
+ else:
50
+ raise MissingParameterError("Current object doesn't have a id")
51
+ if "id" not in params:
52
+ raise MissingParameterError("Parameter missing: id")
53
+ if "body" not in params:
54
+ raise MissingParameterError("Parameter missing: body")
55
+ if "id" in params and not isinstance(params["id"], int):
56
+ raise InvalidParameterError("Bad parameter: id must be an int")
57
+ if "body" in params and not isinstance(params["body"], str):
58
+ raise InvalidParameterError("Bad parameter: body must be an str")
59
+ response, _options = Api.send_request(
60
+ "PATCH",
61
+ "/message_comments/{id}".format(id=params["id"]),
62
+ params,
63
+ self.options,
64
+ )
65
+ return response.data
66
+
67
+ def delete(self, params=None):
68
+ if not isinstance(params, dict):
69
+ params = {}
70
+
71
+ if hasattr(self, "id") and self.id:
72
+ params["id"] = self.id
73
+ else:
74
+ raise MissingParameterError("Current object doesn't have a id")
75
+ if "id" not in params:
76
+ raise MissingParameterError("Parameter missing: id")
77
+ if "id" in params and not isinstance(params["id"], int):
78
+ raise InvalidParameterError("Bad parameter: id must be an int")
79
+ Api.send_request(
80
+ "DELETE",
81
+ "/message_comments/{id}".format(id=params["id"]),
82
+ params,
83
+ self.options,
84
+ )
85
+
86
+ def destroy(self, params=None):
87
+ self.delete(params)
88
+
89
+ def save(self):
90
+ if hasattr(self, "id") and self.id:
91
+ new_obj = self.update(self.get_attributes())
92
+ self.set_attributes(new_obj.get_attributes())
93
+ return True
94
+ else:
95
+ new_obj = create(self.get_attributes(), self.options)
96
+ self.set_attributes(new_obj.get_attributes())
97
+ return True
98
+
99
+
100
+ # Parameters:
101
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
102
+ # 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.
103
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
104
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
105
+ # message_id (required) - int64 - Message comment to return comments for.
106
+ def list(params=None, options=None):
107
+ if not isinstance(params, dict):
108
+ params = {}
109
+ if not isinstance(options, dict):
110
+ options = {}
111
+ if "user_id" in params and not isinstance(params["user_id"], int):
112
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
113
+ if "cursor" in params and not isinstance(params["cursor"], str):
114
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
115
+ if "per_page" in params and not isinstance(params["per_page"], int):
116
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
117
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
118
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
119
+ if "message_id" in params and not isinstance(params["message_id"], int):
120
+ raise InvalidParameterError("Bad parameter: message_id must be an int")
121
+ if "message_id" not in params:
122
+ raise MissingParameterError("Parameter missing: message_id")
123
+ return ListObj(MessageComment, "GET", "/message_comments", params, options)
124
+
125
+
126
+ def all(params=None, options=None):
127
+ list(params, options)
128
+
129
+
130
+ # Parameters:
131
+ # id (required) - int64 - Message Comment ID.
132
+ def find(id, params=None, options=None):
133
+ if not isinstance(params, dict):
134
+ params = {}
135
+ if not isinstance(options, dict):
136
+ options = {}
137
+ params["id"] = id
138
+ if "id" in params and not isinstance(params["id"], int):
139
+ raise InvalidParameterError("Bad parameter: id must be an int")
140
+ if "id" not in params:
141
+ raise MissingParameterError("Parameter missing: id")
142
+ response, options = Api.send_request(
143
+ "GET",
144
+ "/message_comments/{id}".format(id=params["id"]),
145
+ params,
146
+ options,
147
+ )
148
+ return MessageComment(response.data, options)
149
+
150
+
151
+ def get(id, params=None, options=None):
152
+ find(id, params, options)
153
+
154
+
155
+ # Parameters:
156
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
157
+ # body (required) - string - Comment body.
158
+ def create(params=None, options=None):
159
+ if not isinstance(params, dict):
160
+ params = {}
161
+ if not isinstance(options, dict):
162
+ options = {}
163
+ if "user_id" in params and not isinstance(params["user_id"], int):
164
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
165
+ if "body" in params and not isinstance(params["body"], str):
166
+ raise InvalidParameterError("Bad parameter: body must be an str")
167
+ if "body" not in params:
168
+ raise MissingParameterError("Parameter missing: body")
169
+ response, options = Api.send_request(
170
+ "POST", "/message_comments", params, options
171
+ )
172
+ return MessageComment(response.data, options)
173
+
174
+
175
+ # Parameters:
176
+ # body (required) - string - Comment body.
177
+ def update(id, params=None, options=None):
178
+ if not isinstance(params, dict):
179
+ params = {}
180
+ if not isinstance(options, dict):
181
+ options = {}
182
+ params["id"] = id
183
+ if "id" in params and not isinstance(params["id"], int):
184
+ raise InvalidParameterError("Bad parameter: id must be an int")
185
+ if "body" in params and not isinstance(params["body"], str):
186
+ raise InvalidParameterError("Bad parameter: body must be an str")
187
+ if "id" not in params:
188
+ raise MissingParameterError("Parameter missing: id")
189
+ if "body" not in params:
190
+ raise MissingParameterError("Parameter missing: body")
191
+ response, options = Api.send_request(
192
+ "PATCH",
193
+ "/message_comments/{id}".format(id=params["id"]),
194
+ params,
195
+ options,
196
+ )
197
+ return MessageComment(response.data, options)
198
+
199
+
200
+ def delete(id, params=None, options=None):
201
+ if not isinstance(params, dict):
202
+ params = {}
203
+ if not isinstance(options, dict):
204
+ options = {}
205
+ params["id"] = id
206
+ if "id" in params and not isinstance(params["id"], int):
207
+ raise InvalidParameterError("Bad parameter: id must be an int")
208
+ if "id" not in params:
209
+ raise MissingParameterError("Parameter missing: id")
210
+ Api.send_request(
211
+ "DELETE",
212
+ "/message_comments/{id}".format(id=params["id"]),
213
+ params,
214
+ options,
215
+ )
216
+
217
+
218
+ def destroy(id, params=None, options=None):
219
+ delete(id, params, options)
220
+
221
+
222
+ def new(*args, **kwargs):
223
+ return MessageComment(*args, **kwargs)