files-com 1.6.164__py3-none-any.whl → 1.6.219__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.
- _VERSION +1 -1
- {files_com-1.6.164.dist-info → files_com-1.6.219.dist-info}/METADATA +1 -1
- {files_com-1.6.164.dist-info → files_com-1.6.219.dist-info}/RECORD +29 -28
- files_sdk/__init__.py +3 -1
- files_sdk/models/__init__.py +1 -0
- files_sdk/models/api_key.py +7 -21
- files_sdk/models/as2_incoming_message.py +3 -2
- files_sdk/models/as2_outgoing_message.py +3 -2
- files_sdk/models/as2_partner.py +3 -2
- files_sdk/models/as2_station.py +15 -4
- files_sdk/models/automation.py +10 -2
- files_sdk/models/automation_run.py +2 -1
- files_sdk/models/behavior.py +11 -13
- files_sdk/models/bundle.py +31 -1
- files_sdk/models/gpg_key.py +28 -1
- files_sdk/models/group.py +10 -2
- files_sdk/models/key_lifecycle_rule.py +4 -1
- files_sdk/models/partner.py +12 -1
- files_sdk/models/public_key.py +3 -2
- files_sdk/models/remote_server.py +11 -2
- files_sdk/models/remote_server_credential.py +12 -1
- files_sdk/models/restore.py +20 -0
- files_sdk/models/sync.py +10 -2
- files_sdk/models/sync_run.py +3 -2
- files_sdk/models/user.py +26 -2
- files_sdk/models/workspace.py +202 -0
- {files_com-1.6.164.dist-info → files_com-1.6.219.dist-info}/WHEEL +0 -0
- {files_com-1.6.164.dist-info → files_com-1.6.219.dist-info}/licenses/LICENSE +0 -0
- {files_com-1.6.164.dist-info → files_com-1.6.219.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
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 Workspace:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Workspace ID
|
|
14
|
+
"name": None, # string - Workspace name
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def __init__(self, attributes=None, options=None):
|
|
18
|
+
if not isinstance(attributes, dict):
|
|
19
|
+
attributes = {}
|
|
20
|
+
if not isinstance(options, dict):
|
|
21
|
+
options = {}
|
|
22
|
+
self.set_attributes(attributes)
|
|
23
|
+
self.options = options
|
|
24
|
+
|
|
25
|
+
def set_attributes(self, attributes):
|
|
26
|
+
for attribute, default_value in Workspace.default_attributes.items():
|
|
27
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
28
|
+
|
|
29
|
+
def get_attributes(self):
|
|
30
|
+
return {
|
|
31
|
+
k: getattr(self, k, None)
|
|
32
|
+
for k in Workspace.default_attributes
|
|
33
|
+
if getattr(self, k, None) is not None
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Parameters:
|
|
37
|
+
# name - string - Workspace name
|
|
38
|
+
def update(self, params=None):
|
|
39
|
+
if not isinstance(params, dict):
|
|
40
|
+
params = {}
|
|
41
|
+
|
|
42
|
+
if hasattr(self, "id") and self.id:
|
|
43
|
+
params["id"] = self.id
|
|
44
|
+
else:
|
|
45
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
46
|
+
if "id" not in params:
|
|
47
|
+
raise MissingParameterError("Parameter missing: id")
|
|
48
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
49
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
50
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
51
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
52
|
+
response, _options = Api.send_request(
|
|
53
|
+
"PATCH",
|
|
54
|
+
"/workspaces/{id}".format(id=params["id"]),
|
|
55
|
+
params,
|
|
56
|
+
self.options,
|
|
57
|
+
)
|
|
58
|
+
return response.data
|
|
59
|
+
|
|
60
|
+
def delete(self, params=None):
|
|
61
|
+
if not isinstance(params, dict):
|
|
62
|
+
params = {}
|
|
63
|
+
|
|
64
|
+
if hasattr(self, "id") and self.id:
|
|
65
|
+
params["id"] = self.id
|
|
66
|
+
else:
|
|
67
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
68
|
+
if "id" not in params:
|
|
69
|
+
raise MissingParameterError("Parameter missing: id")
|
|
70
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
71
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
72
|
+
Api.send_request(
|
|
73
|
+
"DELETE",
|
|
74
|
+
"/workspaces/{id}".format(id=params["id"]),
|
|
75
|
+
params,
|
|
76
|
+
self.options,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def destroy(self, params=None):
|
|
80
|
+
self.delete(params)
|
|
81
|
+
|
|
82
|
+
def save(self):
|
|
83
|
+
if hasattr(self, "id") and self.id:
|
|
84
|
+
new_obj = self.update(self.get_attributes())
|
|
85
|
+
self.set_attributes(new_obj.get_attributes())
|
|
86
|
+
return True
|
|
87
|
+
else:
|
|
88
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
89
|
+
self.set_attributes(new_obj.get_attributes())
|
|
90
|
+
return True
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# Parameters:
|
|
94
|
+
# 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.
|
|
95
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
96
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `name`.
|
|
97
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name`.
|
|
98
|
+
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`.
|
|
99
|
+
def list(params=None, options=None):
|
|
100
|
+
if not isinstance(params, dict):
|
|
101
|
+
params = {}
|
|
102
|
+
if not isinstance(options, dict):
|
|
103
|
+
options = {}
|
|
104
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
105
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
106
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
107
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
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 "filter" in params and not isinstance(params["filter"], dict):
|
|
111
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
112
|
+
if "filter_prefix" in params and not isinstance(
|
|
113
|
+
params["filter_prefix"], dict
|
|
114
|
+
):
|
|
115
|
+
raise InvalidParameterError(
|
|
116
|
+
"Bad parameter: filter_prefix must be an dict"
|
|
117
|
+
)
|
|
118
|
+
return ListObj(Workspace, "GET", "/workspaces", params, options)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def all(params=None, options=None):
|
|
122
|
+
list(params, options)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# Parameters:
|
|
126
|
+
# id (required) - int64 - Workspace ID.
|
|
127
|
+
def find(id, params=None, options=None):
|
|
128
|
+
if not isinstance(params, dict):
|
|
129
|
+
params = {}
|
|
130
|
+
if not isinstance(options, dict):
|
|
131
|
+
options = {}
|
|
132
|
+
params["id"] = id
|
|
133
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
134
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
135
|
+
if "id" not in params:
|
|
136
|
+
raise MissingParameterError("Parameter missing: id")
|
|
137
|
+
response, options = Api.send_request(
|
|
138
|
+
"GET", "/workspaces/{id}".format(id=params["id"]), params, options
|
|
139
|
+
)
|
|
140
|
+
return Workspace(response.data, options)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def get(id, params=None, options=None):
|
|
144
|
+
find(id, params, options)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# Parameters:
|
|
148
|
+
# name - string - Workspace name
|
|
149
|
+
def create(params=None, options=None):
|
|
150
|
+
if not isinstance(params, dict):
|
|
151
|
+
params = {}
|
|
152
|
+
if not isinstance(options, dict):
|
|
153
|
+
options = {}
|
|
154
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
155
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
156
|
+
response, options = Api.send_request(
|
|
157
|
+
"POST", "/workspaces", params, options
|
|
158
|
+
)
|
|
159
|
+
return Workspace(response.data, options)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# Parameters:
|
|
163
|
+
# name - string - Workspace name
|
|
164
|
+
def update(id, params=None, options=None):
|
|
165
|
+
if not isinstance(params, dict):
|
|
166
|
+
params = {}
|
|
167
|
+
if not isinstance(options, dict):
|
|
168
|
+
options = {}
|
|
169
|
+
params["id"] = id
|
|
170
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
171
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
172
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
173
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
174
|
+
if "id" not in params:
|
|
175
|
+
raise MissingParameterError("Parameter missing: id")
|
|
176
|
+
response, options = Api.send_request(
|
|
177
|
+
"PATCH", "/workspaces/{id}".format(id=params["id"]), params, options
|
|
178
|
+
)
|
|
179
|
+
return Workspace(response.data, options)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def delete(id, params=None, options=None):
|
|
183
|
+
if not isinstance(params, dict):
|
|
184
|
+
params = {}
|
|
185
|
+
if not isinstance(options, dict):
|
|
186
|
+
options = {}
|
|
187
|
+
params["id"] = id
|
|
188
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
189
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
190
|
+
if "id" not in params:
|
|
191
|
+
raise MissingParameterError("Parameter missing: id")
|
|
192
|
+
Api.send_request(
|
|
193
|
+
"DELETE", "/workspaces/{id}".format(id=params["id"]), params, options
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def destroy(id, params=None, options=None):
|
|
198
|
+
delete(id, params, options)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def new(*args, **kwargs):
|
|
202
|
+
return Workspace(*args, **kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|