files-com 1.6.208__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.
- README.md +758 -0
- _VERSION +1 -0
- files_com-1.6.208.dist-info/METADATA +770 -0
- files_com-1.6.208.dist-info/RECORD +126 -0
- files_com-1.6.208.dist-info/WHEEL +5 -0
- files_com-1.6.208.dist-info/licenses/LICENSE +21 -0
- files_com-1.6.208.dist-info/top_level.txt +1 -0
- files_sdk/__init__.py +309 -0
- files_sdk/api.py +63 -0
- files_sdk/api_client.py +336 -0
- files_sdk/error.py +2981 -0
- files_sdk/list_obj.py +42 -0
- files_sdk/models/__init__.py +119 -0
- files_sdk/models/account_line_item.py +51 -0
- files_sdk/models/action.py +49 -0
- files_sdk/models/action_notification_export.py +153 -0
- files_sdk/models/action_notification_export_result.py +88 -0
- files_sdk/models/agent_push_update.py +44 -0
- files_sdk/models/api_key.py +318 -0
- files_sdk/models/api_request_log.py +105 -0
- files_sdk/models/app.py +89 -0
- files_sdk/models/as2_incoming_message.py +117 -0
- files_sdk/models/as2_outgoing_message.py +113 -0
- files_sdk/models/as2_partner.py +415 -0
- files_sdk/models/as2_station.py +282 -0
- files_sdk/models/auto.py +36 -0
- files_sdk/models/automation.py +823 -0
- files_sdk/models/automation_log.py +94 -0
- files_sdk/models/automation_run.py +112 -0
- files_sdk/models/bandwidth_snapshot.py +91 -0
- files_sdk/models/behavior.py +340 -0
- files_sdk/models/bundle.py +686 -0
- files_sdk/models/bundle_action.py +93 -0
- files_sdk/models/bundle_download.py +94 -0
- files_sdk/models/bundle_notification.py +252 -0
- files_sdk/models/bundle_path.py +37 -0
- files_sdk/models/bundle_recipient.py +133 -0
- files_sdk/models/bundle_registration.py +82 -0
- files_sdk/models/child_site_management_policy.py +278 -0
- files_sdk/models/clickwrap.py +268 -0
- files_sdk/models/dns_record.py +59 -0
- files_sdk/models/email_incoming_message.py +102 -0
- files_sdk/models/email_log.py +84 -0
- files_sdk/models/errors.py +37 -0
- files_sdk/models/exavault_api_request_log.py +102 -0
- files_sdk/models/external_event.py +148 -0
- files_sdk/models/file.py +851 -0
- files_sdk/models/file_action.py +39 -0
- files_sdk/models/file_comment.py +191 -0
- files_sdk/models/file_comment_reaction.py +125 -0
- files_sdk/models/file_migration.py +69 -0
- files_sdk/models/file_migration_log.py +88 -0
- files_sdk/models/file_upload_part.py +54 -0
- files_sdk/models/folder.py +186 -0
- files_sdk/models/form_field.py +43 -0
- files_sdk/models/form_field_set.py +265 -0
- files_sdk/models/ftp_action_log.py +104 -0
- files_sdk/models/gpg_key.py +333 -0
- files_sdk/models/group.py +338 -0
- files_sdk/models/group_user.py +235 -0
- files_sdk/models/history.py +236 -0
- files_sdk/models/history_export.py +238 -0
- files_sdk/models/history_export_result.py +98 -0
- files_sdk/models/holiday_region.py +58 -0
- files_sdk/models/image.py +37 -0
- files_sdk/models/inbound_s3_log.py +95 -0
- files_sdk/models/inbox_recipient.py +124 -0
- files_sdk/models/inbox_registration.py +79 -0
- files_sdk/models/inbox_upload.py +80 -0
- files_sdk/models/invoice.py +91 -0
- files_sdk/models/invoice_line_item.py +51 -0
- files_sdk/models/ip_address.py +119 -0
- files_sdk/models/key_lifecycle_rule.py +243 -0
- files_sdk/models/lock.py +174 -0
- files_sdk/models/message.py +244 -0
- files_sdk/models/message_comment.py +223 -0
- files_sdk/models/message_comment_reaction.py +181 -0
- files_sdk/models/message_reaction.py +170 -0
- files_sdk/models/notification.py +451 -0
- files_sdk/models/outbound_connection_log.py +105 -0
- files_sdk/models/partner.py +307 -0
- files_sdk/models/payment.py +91 -0
- files_sdk/models/payment_line_item.py +42 -0
- files_sdk/models/permission.py +190 -0
- files_sdk/models/preview.py +40 -0
- files_sdk/models/priority.py +63 -0
- files_sdk/models/project.py +205 -0
- files_sdk/models/public_hosting_request_log.py +101 -0
- files_sdk/models/public_ip_address.py +42 -0
- files_sdk/models/public_key.py +269 -0
- files_sdk/models/remote_bandwidth_snapshot.py +91 -0
- files_sdk/models/remote_mount_backend.py +438 -0
- files_sdk/models/remote_server.py +1854 -0
- files_sdk/models/remote_server_configuration_file.py +73 -0
- files_sdk/models/remote_server_credential.py +855 -0
- files_sdk/models/request.py +184 -0
- files_sdk/models/restore.py +142 -0
- files_sdk/models/scim_log.py +88 -0
- files_sdk/models/session.py +100 -0
- files_sdk/models/settings_change.py +71 -0
- files_sdk/models/sftp_action_log.py +108 -0
- files_sdk/models/sftp_host_key.py +215 -0
- files_sdk/models/share_group.py +228 -0
- files_sdk/models/share_group_member.py +41 -0
- files_sdk/models/siem_http_destination.py +1074 -0
- files_sdk/models/site.py +1289 -0
- files_sdk/models/snapshot.py +255 -0
- files_sdk/models/sso_strategy.py +168 -0
- files_sdk/models/status.py +42 -0
- files_sdk/models/style.py +152 -0
- files_sdk/models/sync.py +588 -0
- files_sdk/models/sync_log.py +86 -0
- files_sdk/models/sync_run.py +124 -0
- files_sdk/models/usage_by_top_level_dir.py +41 -0
- files_sdk/models/usage_daily_snapshot.py +93 -0
- files_sdk/models/usage_snapshot.py +73 -0
- files_sdk/models/user.py +1232 -0
- files_sdk/models/user_cipher_use.py +91 -0
- files_sdk/models/user_lifecycle_rule.py +355 -0
- files_sdk/models/user_request.py +166 -0
- files_sdk/models/user_sftp_client_use.py +68 -0
- files_sdk/models/web_dav_action_log.py +104 -0
- files_sdk/models/webhook_test.py +116 -0
- files_sdk/models/workspace.py +202 -0
- files_sdk/path_util.py +42 -0
- files_sdk/util.py +34 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.models.file import File
|
|
3
|
+
from files_sdk.api import Api # noqa: F401
|
|
4
|
+
from files_sdk.list_obj import ListObj
|
|
5
|
+
from files_sdk.error import ( # noqa: F401
|
|
6
|
+
InvalidParameterError,
|
|
7
|
+
MissingParameterError,
|
|
8
|
+
NotImplementedError,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Folder:
|
|
13
|
+
default_attributes = {
|
|
14
|
+
"path": None, # string - File/Folder path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
15
|
+
"created_by_id": None, # int64 - User ID of the User who created the file/folder
|
|
16
|
+
"created_by_api_key_id": None, # int64 - ID of the API key that created the file/folder
|
|
17
|
+
"created_by_as2_incoming_message_id": None, # int64 - ID of the AS2 Incoming Message that created the file/folder
|
|
18
|
+
"created_by_automation_id": None, # int64 - ID of the Automation that created the file/folder
|
|
19
|
+
"created_by_bundle_registration_id": None, # int64 - ID of the Bundle Registration that created the file/folder
|
|
20
|
+
"created_by_inbox_id": None, # int64 - ID of the Inbox that created the file/folder
|
|
21
|
+
"created_by_remote_server_id": None, # int64 - ID of the Remote Server that created the file/folder
|
|
22
|
+
"created_by_sync_id": None, # int64 - ID of the Sync that created the file/folder
|
|
23
|
+
"custom_metadata": None, # object - Custom metadata map of keys and values. Limited to 32 keys, 256 characters per key and 1024 characters per value.
|
|
24
|
+
"display_name": None, # string - File/Folder display name
|
|
25
|
+
"type": None, # string - Type: `directory` or `file`.
|
|
26
|
+
"size": None, # int64 - File/Folder size
|
|
27
|
+
"created_at": None, # date-time - File created date/time
|
|
28
|
+
"last_modified_by_id": None, # int64 - User ID of the User who last modified the file/folder
|
|
29
|
+
"last_modified_by_api_key_id": None, # int64 - ID of the API key that last modified the file/folder
|
|
30
|
+
"last_modified_by_automation_id": None, # int64 - ID of the Automation that last modified the file/folder
|
|
31
|
+
"last_modified_by_bundle_registration_id": None, # int64 - ID of the Bundle Registration that last modified the file/folder
|
|
32
|
+
"last_modified_by_remote_server_id": None, # int64 - ID of the Remote Server that last modified the file/folder
|
|
33
|
+
"last_modified_by_sync_id": None, # int64 - ID of the Sync that last modified the file/folder
|
|
34
|
+
"mtime": None, # date-time - File last modified date/time, according to the server. This is the timestamp of the last Files.com operation of the file, regardless of what modified timestamp was sent.
|
|
35
|
+
"provided_mtime": None, # date-time - File last modified date/time, according to the client who set it. Files.com allows desktop, FTP, SFTP, and WebDAV clients to set modified at times. This allows Desktop<->Cloud syncing to preserve modified at times.
|
|
36
|
+
"crc32": None, # string - File CRC32 checksum. This is sometimes delayed, so if you get a blank response, wait and try again.
|
|
37
|
+
"md5": None, # string - File MD5 checksum. This is sometimes delayed, so if you get a blank response, wait and try again.
|
|
38
|
+
"sha1": None, # string - File SHA1 checksum. This is sometimes delayed, so if you get a blank response, wait and try again.
|
|
39
|
+
"sha256": None, # string - File SHA256 checksum. This is sometimes delayed, so if you get a blank response, wait and try again.
|
|
40
|
+
"mime_type": None, # string - MIME Type. This is determined by the filename extension and is not stored separately internally.
|
|
41
|
+
"region": None, # string - Region location
|
|
42
|
+
"permissions": None, # string - A short string representing the current user's permissions. Can be `r` (Read),`w` (Write),`d` (Delete), `l` (List) or any combination
|
|
43
|
+
"subfolders_locked?": None, # boolean - Are subfolders locked and unable to be modified?
|
|
44
|
+
"is_locked": None, # boolean - Is this folder locked and unable to be modified?
|
|
45
|
+
"download_uri": None, # string - Link to download file. Provided only in response to a download request.
|
|
46
|
+
"priority_color": None, # string - Bookmark/priority color of file/folder
|
|
47
|
+
"preview_id": None, # int64 - File preview ID
|
|
48
|
+
"preview": None, # Preview - File preview
|
|
49
|
+
"mkdir_parents": None, # boolean - Create parent directories if they do not exist?
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
def __init__(self, attributes=None, options=None):
|
|
53
|
+
if not isinstance(attributes, dict):
|
|
54
|
+
attributes = {}
|
|
55
|
+
if not isinstance(options, dict):
|
|
56
|
+
options = {}
|
|
57
|
+
self.set_attributes(attributes)
|
|
58
|
+
self.options = options
|
|
59
|
+
|
|
60
|
+
def set_attributes(self, attributes):
|
|
61
|
+
for attribute, default_value in Folder.default_attributes.items():
|
|
62
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
63
|
+
|
|
64
|
+
def get_attributes(self):
|
|
65
|
+
return {
|
|
66
|
+
k: getattr(self, k, None)
|
|
67
|
+
for k in Folder.default_attributes
|
|
68
|
+
if getattr(self, k, None) is not None
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
def save(self):
|
|
72
|
+
new_obj = create(self.path, self.get_attributes(), self.options)
|
|
73
|
+
self.set_attributes(new_obj.get_attributes())
|
|
74
|
+
return True
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# Parameters:
|
|
78
|
+
# cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
|
79
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
80
|
+
# path (required) - string - Path to operate on.
|
|
81
|
+
# preview_size - string - Request a preview size. Can be `small` (default), `large`, `xlarge`, or `pdf`.
|
|
82
|
+
# sort_by - object - Search by field and direction. Valid fields are `path`, `size`, `modified_at_datetime`, `provided_modified_at`. Valid directions are `asc` and `desc`. Defaults to `{"path":"asc"}`.
|
|
83
|
+
# search - string - If specified, will search the folders/files list by name. Ignores text before last `/`. This is the same API used by the search bar in the web UI when running 'Search This Folder'. Search results are a best effort, not real time, and not guaranteed to perfectly match the latest folder listing. Results may be truncated if more than 1,000 possible matches exist. This field should only be used for ad-hoc (human) searching, and not as part of an automated process.
|
|
84
|
+
# search_custom_metadata_key - string - If provided, the search string in `search` will search for files where this custom metadata key matches the value sent in `search`. Set this to `*` to allow any metadata key to match the value sent in `search`.
|
|
85
|
+
# search_all - boolean - Search entire site? If true, we will search the entire site. Do not provide a path when using this parameter. This is the same API used by the search bar in the web UI when running 'Search All Files'. Search results are a best effort, not real time, and not guaranteed to match every file. This field should only be used for ad-hoc (human) searching, and not as part of an automated process.
|
|
86
|
+
# with_previews - boolean - Include file previews?
|
|
87
|
+
# with_priority_color - boolean - Include file priority color information?
|
|
88
|
+
# type - string - Type of objects to return. Can be `folder` or `file`.
|
|
89
|
+
# modified_at_datetime - string - If provided, will only return files/folders modified after this time. Can be used only in combination with `type` filter.
|
|
90
|
+
def list_for(path, params=None, options=None):
|
|
91
|
+
if not isinstance(params, dict):
|
|
92
|
+
params = {}
|
|
93
|
+
if not isinstance(options, dict):
|
|
94
|
+
options = {}
|
|
95
|
+
params["path"] = path
|
|
96
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
97
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
98
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
99
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
100
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
101
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
102
|
+
if "preview_size" in params and not isinstance(
|
|
103
|
+
params["preview_size"], str
|
|
104
|
+
):
|
|
105
|
+
raise InvalidParameterError(
|
|
106
|
+
"Bad parameter: preview_size must be an str"
|
|
107
|
+
)
|
|
108
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
109
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
110
|
+
if "search" in params and not isinstance(params["search"], str):
|
|
111
|
+
raise InvalidParameterError("Bad parameter: search must be an str")
|
|
112
|
+
if "search_custom_metadata_key" in params and not isinstance(
|
|
113
|
+
params["search_custom_metadata_key"], str
|
|
114
|
+
):
|
|
115
|
+
raise InvalidParameterError(
|
|
116
|
+
"Bad parameter: search_custom_metadata_key must be an str"
|
|
117
|
+
)
|
|
118
|
+
if "search_all" in params and not isinstance(params["search_all"], bool):
|
|
119
|
+
raise InvalidParameterError(
|
|
120
|
+
"Bad parameter: search_all must be an bool"
|
|
121
|
+
)
|
|
122
|
+
if "with_previews" in params and not isinstance(
|
|
123
|
+
params["with_previews"], bool
|
|
124
|
+
):
|
|
125
|
+
raise InvalidParameterError(
|
|
126
|
+
"Bad parameter: with_previews must be an bool"
|
|
127
|
+
)
|
|
128
|
+
if "with_priority_color" in params and not isinstance(
|
|
129
|
+
params["with_priority_color"], bool
|
|
130
|
+
):
|
|
131
|
+
raise InvalidParameterError(
|
|
132
|
+
"Bad parameter: with_priority_color must be an bool"
|
|
133
|
+
)
|
|
134
|
+
if "type" in params and not isinstance(params["type"], str):
|
|
135
|
+
raise InvalidParameterError("Bad parameter: type must be an str")
|
|
136
|
+
if "modified_at_datetime" in params and not isinstance(
|
|
137
|
+
params["modified_at_datetime"], str
|
|
138
|
+
):
|
|
139
|
+
raise InvalidParameterError(
|
|
140
|
+
"Bad parameter: modified_at_datetime must be an str"
|
|
141
|
+
)
|
|
142
|
+
if "path" not in params:
|
|
143
|
+
raise MissingParameterError("Parameter missing: path")
|
|
144
|
+
return ListObj(
|
|
145
|
+
File,
|
|
146
|
+
"GET",
|
|
147
|
+
"/folders/{path}".format(path=params["path"]),
|
|
148
|
+
params,
|
|
149
|
+
options,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# Parameters:
|
|
154
|
+
# path (required) - string - Path to operate on.
|
|
155
|
+
# mkdir_parents - boolean - Create parent directories if they do not exist?
|
|
156
|
+
# provided_mtime - string - User provided modification time.
|
|
157
|
+
def create(path, params=None, options=None):
|
|
158
|
+
if not isinstance(params, dict):
|
|
159
|
+
params = {}
|
|
160
|
+
if not isinstance(options, dict):
|
|
161
|
+
options = {}
|
|
162
|
+
params["path"] = path
|
|
163
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
164
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
165
|
+
if "mkdir_parents" in params and not isinstance(
|
|
166
|
+
params["mkdir_parents"], bool
|
|
167
|
+
):
|
|
168
|
+
raise InvalidParameterError(
|
|
169
|
+
"Bad parameter: mkdir_parents must be an bool"
|
|
170
|
+
)
|
|
171
|
+
if "provided_mtime" in params and not isinstance(
|
|
172
|
+
params["provided_mtime"], str
|
|
173
|
+
):
|
|
174
|
+
raise InvalidParameterError(
|
|
175
|
+
"Bad parameter: provided_mtime must be an str"
|
|
176
|
+
)
|
|
177
|
+
if "path" not in params:
|
|
178
|
+
raise MissingParameterError("Parameter missing: path")
|
|
179
|
+
response, options = Api.send_request(
|
|
180
|
+
"POST", "/folders/{path}".format(path=params["path"]), params, options
|
|
181
|
+
)
|
|
182
|
+
return File(response.data, options)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def new(*args, **kwargs):
|
|
186
|
+
return Folder(*args, **kwargs)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.error import ( # noqa: F401
|
|
4
|
+
InvalidParameterError,
|
|
5
|
+
MissingParameterError,
|
|
6
|
+
NotImplementedError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class FormField:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"id": None, # int64 - Form field id
|
|
13
|
+
"label": None, # string - Label to be displayed
|
|
14
|
+
"required": None, # boolean - Is this a required field?
|
|
15
|
+
"help_text": None, # string - Help text to be displayed
|
|
16
|
+
"field_type": None, # string - Type of Field
|
|
17
|
+
"options_for_select": None, # array(string) - Options to display for radio and dropdown
|
|
18
|
+
"default_option": None, # string - Default option for radio and dropdown
|
|
19
|
+
"form_field_set_id": None, # int64 - Form field set id
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def __init__(self, attributes=None, options=None):
|
|
23
|
+
if not isinstance(attributes, dict):
|
|
24
|
+
attributes = {}
|
|
25
|
+
if not isinstance(options, dict):
|
|
26
|
+
options = {}
|
|
27
|
+
self.set_attributes(attributes)
|
|
28
|
+
self.options = options
|
|
29
|
+
|
|
30
|
+
def set_attributes(self, attributes):
|
|
31
|
+
for attribute, default_value in FormField.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 FormField.default_attributes
|
|
38
|
+
if getattr(self, k, None) is not None
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def new(*args, **kwargs):
|
|
43
|
+
return FormField(*args, **kwargs)
|
|
@@ -0,0 +1,265 @@
|
|
|
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 FormFieldSet:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Form field set id
|
|
14
|
+
"title": None, # string - Title to be displayed
|
|
15
|
+
"form_layout": None, # array(int64) - Layout of the form
|
|
16
|
+
"form_fields": None, # array(object) - Associated form fields
|
|
17
|
+
"skip_name": None, # boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing name
|
|
18
|
+
"skip_email": None, # boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing email
|
|
19
|
+
"skip_company": None, # boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing company
|
|
20
|
+
"in_use": None, # boolean - Form Field Set is in use by an active Inbox / Bundle / Inbox Registration / Bundle Registration
|
|
21
|
+
"user_id": None, # int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def __init__(self, attributes=None, options=None):
|
|
25
|
+
if not isinstance(attributes, dict):
|
|
26
|
+
attributes = {}
|
|
27
|
+
if not isinstance(options, dict):
|
|
28
|
+
options = {}
|
|
29
|
+
self.set_attributes(attributes)
|
|
30
|
+
self.options = options
|
|
31
|
+
|
|
32
|
+
def set_attributes(self, attributes):
|
|
33
|
+
for (
|
|
34
|
+
attribute,
|
|
35
|
+
default_value,
|
|
36
|
+
) in FormFieldSet.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 FormFieldSet.default_attributes
|
|
43
|
+
if getattr(self, k, None) is not None
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Parameters:
|
|
47
|
+
# title - string - Title to be displayed
|
|
48
|
+
# skip_email - boolean - Skip validating form email
|
|
49
|
+
# skip_name - boolean - Skip validating form name
|
|
50
|
+
# skip_company - boolean - Skip validating company
|
|
51
|
+
# form_fields - array(object)
|
|
52
|
+
def update(self, params=None):
|
|
53
|
+
if not isinstance(params, dict):
|
|
54
|
+
params = {}
|
|
55
|
+
|
|
56
|
+
if hasattr(self, "id") and self.id:
|
|
57
|
+
params["id"] = self.id
|
|
58
|
+
else:
|
|
59
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
60
|
+
if "id" not in params:
|
|
61
|
+
raise MissingParameterError("Parameter missing: id")
|
|
62
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
63
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
64
|
+
if "title" in params and not isinstance(params["title"], str):
|
|
65
|
+
raise InvalidParameterError("Bad parameter: title must be an str")
|
|
66
|
+
if "form_fields" in params and not isinstance(
|
|
67
|
+
params["form_fields"], builtins.list
|
|
68
|
+
):
|
|
69
|
+
raise InvalidParameterError(
|
|
70
|
+
"Bad parameter: form_fields must be an list"
|
|
71
|
+
)
|
|
72
|
+
response, _options = Api.send_request(
|
|
73
|
+
"PATCH",
|
|
74
|
+
"/form_field_sets/{id}".format(id=params["id"]),
|
|
75
|
+
params,
|
|
76
|
+
self.options,
|
|
77
|
+
)
|
|
78
|
+
return response.data
|
|
79
|
+
|
|
80
|
+
def delete(self, params=None):
|
|
81
|
+
if not isinstance(params, dict):
|
|
82
|
+
params = {}
|
|
83
|
+
|
|
84
|
+
if hasattr(self, "id") and self.id:
|
|
85
|
+
params["id"] = self.id
|
|
86
|
+
else:
|
|
87
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
88
|
+
if "id" not in params:
|
|
89
|
+
raise MissingParameterError("Parameter missing: id")
|
|
90
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
91
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
92
|
+
Api.send_request(
|
|
93
|
+
"DELETE",
|
|
94
|
+
"/form_field_sets/{id}".format(id=params["id"]),
|
|
95
|
+
params,
|
|
96
|
+
self.options,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def destroy(self, params=None):
|
|
100
|
+
self.delete(params)
|
|
101
|
+
|
|
102
|
+
def save(self):
|
|
103
|
+
if hasattr(self, "id") and self.id:
|
|
104
|
+
new_obj = self.update(self.get_attributes())
|
|
105
|
+
self.set_attributes(new_obj.get_attributes())
|
|
106
|
+
return True
|
|
107
|
+
else:
|
|
108
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
109
|
+
self.set_attributes(new_obj.get_attributes())
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Parameters:
|
|
114
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
115
|
+
# 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.
|
|
116
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
117
|
+
def list(params=None, options=None):
|
|
118
|
+
if not isinstance(params, dict):
|
|
119
|
+
params = {}
|
|
120
|
+
if not isinstance(options, dict):
|
|
121
|
+
options = {}
|
|
122
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
123
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
124
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
125
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
126
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
127
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
128
|
+
return ListObj(FormFieldSet, "GET", "/form_field_sets", params, options)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def all(params=None, options=None):
|
|
132
|
+
list(params, options)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# Parameters:
|
|
136
|
+
# id (required) - int64 - Form Field Set ID.
|
|
137
|
+
def find(id, params=None, options=None):
|
|
138
|
+
if not isinstance(params, dict):
|
|
139
|
+
params = {}
|
|
140
|
+
if not isinstance(options, dict):
|
|
141
|
+
options = {}
|
|
142
|
+
params["id"] = id
|
|
143
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
144
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
145
|
+
if "id" not in params:
|
|
146
|
+
raise MissingParameterError("Parameter missing: id")
|
|
147
|
+
response, options = Api.send_request(
|
|
148
|
+
"GET", "/form_field_sets/{id}".format(id=params["id"]), params, options
|
|
149
|
+
)
|
|
150
|
+
return FormFieldSet(response.data, options)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def get(id, params=None, options=None):
|
|
154
|
+
find(id, params, options)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# Parameters:
|
|
158
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
159
|
+
# title - string - Title to be displayed
|
|
160
|
+
# skip_email - boolean - Skip validating form email
|
|
161
|
+
# skip_name - boolean - Skip validating form name
|
|
162
|
+
# skip_company - boolean - Skip validating company
|
|
163
|
+
# form_fields - array(object)
|
|
164
|
+
def create(params=None, options=None):
|
|
165
|
+
if not isinstance(params, dict):
|
|
166
|
+
params = {}
|
|
167
|
+
if not isinstance(options, dict):
|
|
168
|
+
options = {}
|
|
169
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
170
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
171
|
+
if "title" in params and not isinstance(params["title"], str):
|
|
172
|
+
raise InvalidParameterError("Bad parameter: title must be an str")
|
|
173
|
+
if "skip_email" in params and not isinstance(params["skip_email"], bool):
|
|
174
|
+
raise InvalidParameterError(
|
|
175
|
+
"Bad parameter: skip_email must be an bool"
|
|
176
|
+
)
|
|
177
|
+
if "skip_name" in params and not isinstance(params["skip_name"], bool):
|
|
178
|
+
raise InvalidParameterError("Bad parameter: skip_name must be an bool")
|
|
179
|
+
if "skip_company" in params and not isinstance(
|
|
180
|
+
params["skip_company"], bool
|
|
181
|
+
):
|
|
182
|
+
raise InvalidParameterError(
|
|
183
|
+
"Bad parameter: skip_company must be an bool"
|
|
184
|
+
)
|
|
185
|
+
if "form_fields" in params and not isinstance(
|
|
186
|
+
params["form_fields"], builtins.list
|
|
187
|
+
):
|
|
188
|
+
raise InvalidParameterError(
|
|
189
|
+
"Bad parameter: form_fields must be an list"
|
|
190
|
+
)
|
|
191
|
+
response, options = Api.send_request(
|
|
192
|
+
"POST", "/form_field_sets", params, options
|
|
193
|
+
)
|
|
194
|
+
return FormFieldSet(response.data, options)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
# Parameters:
|
|
198
|
+
# title - string - Title to be displayed
|
|
199
|
+
# skip_email - boolean - Skip validating form email
|
|
200
|
+
# skip_name - boolean - Skip validating form name
|
|
201
|
+
# skip_company - boolean - Skip validating company
|
|
202
|
+
# form_fields - array(object)
|
|
203
|
+
def update(id, params=None, options=None):
|
|
204
|
+
if not isinstance(params, dict):
|
|
205
|
+
params = {}
|
|
206
|
+
if not isinstance(options, dict):
|
|
207
|
+
options = {}
|
|
208
|
+
params["id"] = id
|
|
209
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
210
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
211
|
+
if "title" in params and not isinstance(params["title"], str):
|
|
212
|
+
raise InvalidParameterError("Bad parameter: title must be an str")
|
|
213
|
+
if "skip_email" in params and not isinstance(params["skip_email"], bool):
|
|
214
|
+
raise InvalidParameterError(
|
|
215
|
+
"Bad parameter: skip_email must be an bool"
|
|
216
|
+
)
|
|
217
|
+
if "skip_name" in params and not isinstance(params["skip_name"], bool):
|
|
218
|
+
raise InvalidParameterError("Bad parameter: skip_name must be an bool")
|
|
219
|
+
if "skip_company" in params and not isinstance(
|
|
220
|
+
params["skip_company"], bool
|
|
221
|
+
):
|
|
222
|
+
raise InvalidParameterError(
|
|
223
|
+
"Bad parameter: skip_company must be an bool"
|
|
224
|
+
)
|
|
225
|
+
if "form_fields" in params and not isinstance(
|
|
226
|
+
params["form_fields"], builtins.list
|
|
227
|
+
):
|
|
228
|
+
raise InvalidParameterError(
|
|
229
|
+
"Bad parameter: form_fields must be an list"
|
|
230
|
+
)
|
|
231
|
+
if "id" not in params:
|
|
232
|
+
raise MissingParameterError("Parameter missing: id")
|
|
233
|
+
response, options = Api.send_request(
|
|
234
|
+
"PATCH",
|
|
235
|
+
"/form_field_sets/{id}".format(id=params["id"]),
|
|
236
|
+
params,
|
|
237
|
+
options,
|
|
238
|
+
)
|
|
239
|
+
return FormFieldSet(response.data, options)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def delete(id, params=None, options=None):
|
|
243
|
+
if not isinstance(params, dict):
|
|
244
|
+
params = {}
|
|
245
|
+
if not isinstance(options, dict):
|
|
246
|
+
options = {}
|
|
247
|
+
params["id"] = id
|
|
248
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
249
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
250
|
+
if "id" not in params:
|
|
251
|
+
raise MissingParameterError("Parameter missing: id")
|
|
252
|
+
Api.send_request(
|
|
253
|
+
"DELETE",
|
|
254
|
+
"/form_field_sets/{id}".format(id=params["id"]),
|
|
255
|
+
params,
|
|
256
|
+
options,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def destroy(id, params=None, options=None):
|
|
261
|
+
delete(id, params, options)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def new(*args, **kwargs):
|
|
265
|
+
return FormFieldSet(*args, **kwargs)
|