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,154 @@
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_remote_server_sync_id": None, # int64 - ID of the Remote Server 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_remote_server_sync_id": None, # int64 - ID of the Remote Server 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 set, we will ignore the folder path provided and search the entire site. 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
+ def list_for(path, params=None, options=None):
89
+ if not isinstance(params, dict):
90
+ params = {}
91
+ if not isinstance(options, dict):
92
+ options = {}
93
+ params["path"] = path
94
+ if "cursor" in params and not isinstance(params["cursor"], str):
95
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
96
+ if "per_page" in params and not isinstance(params["per_page"], int):
97
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
98
+ if "path" in params and not isinstance(params["path"], str):
99
+ raise InvalidParameterError("Bad parameter: path must be an str")
100
+ if "preview_size" in params and not isinstance(
101
+ params["preview_size"], str
102
+ ):
103
+ raise InvalidParameterError(
104
+ "Bad parameter: preview_size must be an str"
105
+ )
106
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
107
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
108
+ if "search" in params and not isinstance(params["search"], str):
109
+ raise InvalidParameterError("Bad parameter: search must be an str")
110
+ if "search_custom_metadata_key" in params and not isinstance(
111
+ params["search_custom_metadata_key"], str
112
+ ):
113
+ raise InvalidParameterError(
114
+ "Bad parameter: search_custom_metadata_key must be an str"
115
+ )
116
+ if "path" not in params:
117
+ raise MissingParameterError("Parameter missing: path")
118
+ return ListObj(
119
+ File,
120
+ "GET",
121
+ "/folders/{path}".format(path=params["path"]),
122
+ params,
123
+ options,
124
+ )
125
+
126
+
127
+ # Parameters:
128
+ # path (required) - string - Path to operate on.
129
+ # mkdir_parents - boolean - Create parent directories if they do not exist?
130
+ # provided_mtime - string - User provided modification time.
131
+ def create(path, params=None, options=None):
132
+ if not isinstance(params, dict):
133
+ params = {}
134
+ if not isinstance(options, dict):
135
+ options = {}
136
+ params["path"] = path
137
+ if "path" in params and not isinstance(params["path"], str):
138
+ raise InvalidParameterError("Bad parameter: path must be an str")
139
+ if "provided_mtime" in params and not isinstance(
140
+ params["provided_mtime"], str
141
+ ):
142
+ raise InvalidParameterError(
143
+ "Bad parameter: provided_mtime must be an str"
144
+ )
145
+ if "path" not in params:
146
+ raise MissingParameterError("Parameter missing: path")
147
+ response, options = Api.send_request(
148
+ "POST", "/folders/{path}".format(path=params["path"]), params, options
149
+ )
150
+ return File(response.data, options)
151
+
152
+
153
+ def new(*args, **kwargs):
154
+ 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,240 @@
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
+ "user_id": None, # int64 - User ID. Provide a value of `0` to operate the current session's user.
21
+ }
22
+
23
+ def __init__(self, attributes=None, options=None):
24
+ if not isinstance(attributes, dict):
25
+ attributes = {}
26
+ if not isinstance(options, dict):
27
+ options = {}
28
+ self.set_attributes(attributes)
29
+ self.options = options
30
+
31
+ def set_attributes(self, attributes):
32
+ for (
33
+ attribute,
34
+ default_value,
35
+ ) in FormFieldSet.default_attributes.items():
36
+ setattr(self, attribute, attributes.get(attribute, default_value))
37
+
38
+ def get_attributes(self):
39
+ return {
40
+ k: getattr(self, k, None)
41
+ for k in FormFieldSet.default_attributes
42
+ if getattr(self, k, None) is not None
43
+ }
44
+
45
+ # Parameters:
46
+ # title - string - Title to be displayed
47
+ # skip_email - boolean - Skip validating form email
48
+ # skip_name - boolean - Skip validating form name
49
+ # skip_company - boolean - Skip validating company
50
+ # form_fields - array(object)
51
+ def update(self, params=None):
52
+ if not isinstance(params, dict):
53
+ params = {}
54
+
55
+ if hasattr(self, "id") and self.id:
56
+ params["id"] = self.id
57
+ else:
58
+ raise MissingParameterError("Current object doesn't have a id")
59
+ if "id" not in params:
60
+ raise MissingParameterError("Parameter missing: id")
61
+ if "id" in params and not isinstance(params["id"], int):
62
+ raise InvalidParameterError("Bad parameter: id must be an int")
63
+ if "title" in params and not isinstance(params["title"], str):
64
+ raise InvalidParameterError("Bad parameter: title must be an str")
65
+ if "form_fields" in params and not isinstance(
66
+ params["form_fields"], builtins.list
67
+ ):
68
+ raise InvalidParameterError(
69
+ "Bad parameter: form_fields must be an list"
70
+ )
71
+ response, _options = Api.send_request(
72
+ "PATCH",
73
+ "/form_field_sets/{id}".format(id=params["id"]),
74
+ params,
75
+ self.options,
76
+ )
77
+ return response.data
78
+
79
+ def delete(self, params=None):
80
+ if not isinstance(params, dict):
81
+ params = {}
82
+
83
+ if hasattr(self, "id") and self.id:
84
+ params["id"] = self.id
85
+ else:
86
+ raise MissingParameterError("Current object doesn't have a id")
87
+ if "id" not in params:
88
+ raise MissingParameterError("Parameter missing: id")
89
+ if "id" in params and not isinstance(params["id"], int):
90
+ raise InvalidParameterError("Bad parameter: id must be an int")
91
+ Api.send_request(
92
+ "DELETE",
93
+ "/form_field_sets/{id}".format(id=params["id"]),
94
+ params,
95
+ self.options,
96
+ )
97
+
98
+ def destroy(self, params=None):
99
+ self.delete(params)
100
+
101
+ def save(self):
102
+ if hasattr(self, "id") and self.id:
103
+ new_obj = self.update(self.get_attributes())
104
+ self.set_attributes(new_obj.get_attributes())
105
+ return True
106
+ else:
107
+ new_obj = create(self.get_attributes(), self.options)
108
+ self.set_attributes(new_obj.get_attributes())
109
+ return True
110
+
111
+
112
+ # Parameters:
113
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
114
+ # 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.
115
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
116
+ def list(params=None, options=None):
117
+ if not isinstance(params, dict):
118
+ params = {}
119
+ if not isinstance(options, dict):
120
+ options = {}
121
+ if "user_id" in params and not isinstance(params["user_id"], int):
122
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
123
+ if "cursor" in params and not isinstance(params["cursor"], str):
124
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
125
+ if "per_page" in params and not isinstance(params["per_page"], int):
126
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
127
+ return ListObj(FormFieldSet, "GET", "/form_field_sets", params, options)
128
+
129
+
130
+ def all(params=None, options=None):
131
+ list(params, options)
132
+
133
+
134
+ # Parameters:
135
+ # id (required) - int64 - Form Field Set ID.
136
+ def find(id, params=None, options=None):
137
+ if not isinstance(params, dict):
138
+ params = {}
139
+ if not isinstance(options, dict):
140
+ options = {}
141
+ params["id"] = id
142
+ if "id" in params and not isinstance(params["id"], int):
143
+ raise InvalidParameterError("Bad parameter: id must be an int")
144
+ if "id" not in params:
145
+ raise MissingParameterError("Parameter missing: id")
146
+ response, options = Api.send_request(
147
+ "GET", "/form_field_sets/{id}".format(id=params["id"]), params, options
148
+ )
149
+ return FormFieldSet(response.data, options)
150
+
151
+
152
+ def get(id, params=None, options=None):
153
+ find(id, params, options)
154
+
155
+
156
+ # Parameters:
157
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
158
+ # title - string - Title to be displayed
159
+ # skip_email - boolean - Skip validating form email
160
+ # skip_name - boolean - Skip validating form name
161
+ # skip_company - boolean - Skip validating company
162
+ # form_fields - array(object)
163
+ def create(params=None, options=None):
164
+ if not isinstance(params, dict):
165
+ params = {}
166
+ if not isinstance(options, dict):
167
+ options = {}
168
+ if "user_id" in params and not isinstance(params["user_id"], int):
169
+ raise InvalidParameterError("Bad parameter: user_id must be an int")
170
+ if "title" in params and not isinstance(params["title"], str):
171
+ raise InvalidParameterError("Bad parameter: title must be an str")
172
+ if "form_fields" in params and not isinstance(
173
+ params["form_fields"], builtins.list
174
+ ):
175
+ raise InvalidParameterError(
176
+ "Bad parameter: form_fields must be an list"
177
+ )
178
+ response, options = Api.send_request(
179
+ "POST", "/form_field_sets", params, options
180
+ )
181
+ return FormFieldSet(response.data, options)
182
+
183
+
184
+ # Parameters:
185
+ # title - string - Title to be displayed
186
+ # skip_email - boolean - Skip validating form email
187
+ # skip_name - boolean - Skip validating form name
188
+ # skip_company - boolean - Skip validating company
189
+ # form_fields - array(object)
190
+ def update(id, params=None, options=None):
191
+ if not isinstance(params, dict):
192
+ params = {}
193
+ if not isinstance(options, dict):
194
+ options = {}
195
+ params["id"] = id
196
+ if "id" in params and not isinstance(params["id"], int):
197
+ raise InvalidParameterError("Bad parameter: id must be an int")
198
+ if "title" in params and not isinstance(params["title"], str):
199
+ raise InvalidParameterError("Bad parameter: title must be an str")
200
+ if "form_fields" in params and not isinstance(
201
+ params["form_fields"], builtins.list
202
+ ):
203
+ raise InvalidParameterError(
204
+ "Bad parameter: form_fields must be an list"
205
+ )
206
+ if "id" not in params:
207
+ raise MissingParameterError("Parameter missing: id")
208
+ response, options = Api.send_request(
209
+ "PATCH",
210
+ "/form_field_sets/{id}".format(id=params["id"]),
211
+ params,
212
+ options,
213
+ )
214
+ return FormFieldSet(response.data, options)
215
+
216
+
217
+ def delete(id, params=None, options=None):
218
+ if not isinstance(params, dict):
219
+ params = {}
220
+ if not isinstance(options, dict):
221
+ options = {}
222
+ params["id"] = id
223
+ if "id" in params and not isinstance(params["id"], int):
224
+ raise InvalidParameterError("Bad parameter: id must be an int")
225
+ if "id" not in params:
226
+ raise MissingParameterError("Parameter missing: id")
227
+ Api.send_request(
228
+ "DELETE",
229
+ "/form_field_sets/{id}".format(id=params["id"]),
230
+ params,
231
+ options,
232
+ )
233
+
234
+
235
+ def destroy(id, params=None, options=None):
236
+ delete(id, params, options)
237
+
238
+
239
+ def new(*args, **kwargs):
240
+ return FormFieldSet(*args, **kwargs)