files-com 1.6.2__py3-none-any.whl → 1.6.3__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.

_VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.2
1
+ 1.6.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: files_com
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: Python bindings for the Files.com API
5
5
  License: MIT
6
6
  Requires-Python: >=3.5
@@ -1,14 +1,14 @@
1
1
  README.md,sha256=GQCCzxqH5x0hd1fryYAQ16MHbnFHYN-GcppNTTCe3x4,28381
2
- _VERSION,sha256=otXiaP5wl5yszYlRVrPTO9YaPMfmYKt6WwcGaEmz4kg,6
3
- files_com-1.6.2.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
- files_sdk/__init__.py,sha256=R7CbGLxT3p2BHkS1u-w9b9u0MpJRtAL1paknpg9ZXGc,12329
2
+ _VERSION,sha256=hvj6gyp2NYIB1uL88LtHcn7-LbI69zDbZM6tZSd3a-o,6
3
+ files_com-1.6.3.dist-info/licenses/LICENSE,sha256=ziANl9OTD-5-iE8XYIZNm6IYBDxOCHwQ-mdhci7lNew,1102
4
+ files_sdk/__init__.py,sha256=uKs0F1HAM1n7KIQBUZ_fH3uHmanZkEOMGUef4zXSlrM,12463
5
5
  files_sdk/api.py,sha256=HOLk50HLQCbnHwnAr9OElQEWvdA_BABBSEvvFSt1S4A,1846
6
6
  files_sdk/api_client.py,sha256=cfFvm-o4Ao8SWADiJv7t7qnJfG_LJmWV3l6ALTC-Opo,11264
7
7
  files_sdk/error.py,sha256=lZKht6lYj9i99CzRbHschmdSs6T2Y51-YrZX_5Y_o7A,64945
8
8
  files_sdk/list_obj.py,sha256=MWgmESLAmfh1uaSw76PWxmnf9f6_08TLUHe8_mCYKL4,1157
9
9
  files_sdk/path_util.py,sha256=7x8X3JLoMkcqNefCaBeHYXD8MGvPby4AOy-xnBX_LNk,1694
10
10
  files_sdk/util.py,sha256=6aA4N0Wq_ykINW7eMrs2ntFAL2hRLM6IvJf6n_yP34c,962
11
- files_sdk/models/__init__.py,sha256=EMUJH1Czex_D7fflGe6S6_xHGGy0Ka8gt9pGmErqYkw,5542
11
+ files_sdk/models/__init__.py,sha256=1kGlrFYXRNv6LCEAMgYrPBb1lZ9_AIUm5HZFn3wV8bI,5609
12
12
  files_sdk/models/account_line_item.py,sha256=8FLg83Aqpz4y_QYy3fZ_KZsZFWv1f1KGD9T5CH1WSGs,1929
13
13
  files_sdk/models/action.py,sha256=M1lyMybE7SKht2nGXtYWp2l8b4oVkeImo6KF8DLiCos,2034
14
14
  files_sdk/models/action_notification_export.py,sha256=4cdEo2ZCDV3RH3GLSqHV7RWyJ2ONRSUq0glCEi94zd0,6636
@@ -103,11 +103,12 @@ files_sdk/models/usage_daily_snapshot.py,sha256=rWf6GaTlN9spkUPwfF4IJ0Y6z-JTV9TA
103
103
  files_sdk/models/usage_snapshot.py,sha256=3GzMIxBjKelgNP7ksWq4XlrRlAFcYxzd_J6vAgb52qc,4005
104
104
  files_sdk/models/user.py,sha256=o_9dCTD658FFNjUDSVgvZSsAMmJWwgKJi3uflkJGaCg,58958
105
105
  files_sdk/models/user_cipher_use.py,sha256=FugKNQhWaRuqxLiYabpXeskk9DcWVVCN2iL7A3xY-pM,3011
106
+ files_sdk/models/user_lifecycle_rule.py,sha256=g6ftdNU3uvU48We6jH3GbLCvvzJ8KBHONgdX3bsrddA,7321
106
107
  files_sdk/models/user_request.py,sha256=ykA5Lq0MYB7qTDOMMFBuyKa_R_LgQwGVorC-q-6qxgU,6187
107
108
  files_sdk/models/user_sftp_client_use.py,sha256=VnOo3ll6fwSc8grG5ZqGK8o3grYKg5P9b5B_hGS4vCs,2827
108
109
  files_sdk/models/web_dav_action_log.py,sha256=jPX4sOmR9TbYnsU8DU3b0-KQ8E2cHNaqdmFZKTjzpwE,56358
109
110
  files_sdk/models/webhook_test.py,sha256=AWGH8ULsgltBJL2YtTYGnAJ80cCVekrjZ2sUP0UlWgc,5018
110
- files_com-1.6.2.dist-info/METADATA,sha256=zI3gEQ4sRKiu5NpQFspXhwPSfCDOvL_Py5knoGFsAYQ,28672
111
- files_com-1.6.2.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
112
- files_com-1.6.2.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
113
- files_com-1.6.2.dist-info/RECORD,,
111
+ files_com-1.6.3.dist-info/METADATA,sha256=T39kulaXBf_iSBVXSgAg_DEjZ5IUpo9U1nxA7SU-HkM,28672
112
+ files_com-1.6.3.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
113
+ files_com-1.6.3.dist-info/top_level.txt,sha256=p_2P-gluT_8boeXQNixTP3x-tFd1-la2NedKOiln21I,10
114
+ files_com-1.6.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
files_sdk/__init__.py CHANGED
@@ -93,6 +93,7 @@ import files_sdk.models.usage_daily_snapshot as usage_daily_snapshot
93
93
  import files_sdk.models.usage_snapshot as usage_snapshot
94
94
  import files_sdk.models.user as user
95
95
  import files_sdk.models.user_cipher_use as user_cipher_use
96
+ import files_sdk.models.user_lifecycle_rule as user_lifecycle_rule
96
97
  import files_sdk.models.user_request as user_request
97
98
  import files_sdk.models.user_sftp_client_use as user_sftp_client_use
98
99
  import files_sdk.models.web_dav_action_log as web_dav_action_log
@@ -198,6 +199,7 @@ from files_sdk.models.usage_daily_snapshot import UsageDailySnapshot
198
199
  from files_sdk.models.usage_snapshot import UsageSnapshot
199
200
  from files_sdk.models.user import User
200
201
  from files_sdk.models.user_cipher_use import UserCipherUse
202
+ from files_sdk.models.user_lifecycle_rule import UserLifecycleRule
201
203
  from files_sdk.models.user_request import UserRequest
202
204
  from files_sdk.models.user_sftp_client_use import UserSftpClientUse
203
205
  from files_sdk.models.web_dav_action_log import WebDavActionLog
@@ -213,7 +215,7 @@ session_id = None
213
215
  source_ip = None
214
216
  base_url = "https://app.files.com"
215
217
  base_path = "api/rest/v1"
216
- version = "1.6.2"
218
+ version = "1.6.3"
217
219
 
218
220
  __version__ = version
219
221
 
@@ -98,6 +98,7 @@ from files_sdk.models.usage_daily_snapshot import UsageDailySnapshot
98
98
  from files_sdk.models.usage_snapshot import UsageSnapshot
99
99
  from files_sdk.models.user import User
100
100
  from files_sdk.models.user_cipher_use import UserCipherUse
101
+ from files_sdk.models.user_lifecycle_rule import UserLifecycleRule
101
102
  from files_sdk.models.user_request import UserRequest
102
103
  from files_sdk.models.user_sftp_client_use import UserSftpClientUse
103
104
  from files_sdk.models.web_dav_action_log import WebDavActionLog
@@ -0,0 +1,195 @@
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 UserLifecycleRule:
12
+ default_attributes = {
13
+ "id": None, # int64 - User Lifecycle Rule ID
14
+ "authentication_method": None, # string - User authentication method for the rule
15
+ "inactivity_days": None, # int64 - Number of days of inactivity before the rule applies
16
+ "include_folder_admins": None, # boolean - Include folder admins in the rule
17
+ "include_site_admins": None, # boolean - Include site admins in the rule
18
+ "action": None, # string - Action to take on inactive users (disable or delete)
19
+ "site_id": None, # int64 - Site 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 (
32
+ attribute,
33
+ default_value,
34
+ ) in UserLifecycleRule.default_attributes.items():
35
+ setattr(self, attribute, attributes.get(attribute, default_value))
36
+
37
+ def get_attributes(self):
38
+ return {
39
+ k: getattr(self, k, None)
40
+ for k in UserLifecycleRule.default_attributes
41
+ if getattr(self, k, None) is not None
42
+ }
43
+
44
+ def delete(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 "id" in params and not isinstance(params["id"], int):
55
+ raise InvalidParameterError("Bad parameter: id must be an int")
56
+ Api.send_request(
57
+ "DELETE",
58
+ "/user_lifecycle_rules/{id}".format(id=params["id"]),
59
+ params,
60
+ self.options,
61
+ )
62
+
63
+ def destroy(self, params=None):
64
+ self.delete(params)
65
+
66
+ def save(self):
67
+ if hasattr(self, "id") and self.id:
68
+ raise NotImplementedError(
69
+ "The UserLifecycleRule object doesn't support updates."
70
+ )
71
+ else:
72
+ new_obj = create(self.get_attributes(), self.options)
73
+ self.set_attributes(new_obj.get_attributes())
74
+ return True
75
+
76
+
77
+ # Parameters:
78
+ # 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.
79
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
80
+ def list(params=None, options=None):
81
+ if not isinstance(params, dict):
82
+ params = {}
83
+ if not isinstance(options, dict):
84
+ options = {}
85
+ if "cursor" in params and not isinstance(params["cursor"], str):
86
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
87
+ if "per_page" in params and not isinstance(params["per_page"], int):
88
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
89
+ return ListObj(
90
+ UserLifecycleRule, "GET", "/user_lifecycle_rules", params, options
91
+ )
92
+
93
+
94
+ def all(params=None, options=None):
95
+ list(params, options)
96
+
97
+
98
+ # Parameters:
99
+ # id (required) - int64 - User Lifecycle Rule ID.
100
+ def find(id, params=None, options=None):
101
+ if not isinstance(params, dict):
102
+ params = {}
103
+ if not isinstance(options, dict):
104
+ options = {}
105
+ params["id"] = id
106
+ if "id" in params and not isinstance(params["id"], int):
107
+ raise InvalidParameterError("Bad parameter: id must be an int")
108
+ if "id" not in params:
109
+ raise MissingParameterError("Parameter missing: id")
110
+ response, options = Api.send_request(
111
+ "GET",
112
+ "/user_lifecycle_rules/{id}".format(id=params["id"]),
113
+ params,
114
+ options,
115
+ )
116
+ return UserLifecycleRule(response.data, options)
117
+
118
+
119
+ def get(id, params=None, options=None):
120
+ find(id, params, options)
121
+
122
+
123
+ # Parameters:
124
+ # action (required) - string - Action to take on inactive users (disable or delete)
125
+ # authentication_method (required) - string - User authentication method for the rule
126
+ # inactivity_days (required) - int64 - Number of days of inactivity before the rule applies
127
+ # include_site_admins - boolean - Include site admins in the rule
128
+ # include_folder_admins - boolean - Include folder admins in the rule
129
+ def create(params=None, options=None):
130
+ if not isinstance(params, dict):
131
+ params = {}
132
+ if not isinstance(options, dict):
133
+ options = {}
134
+ if "action" in params and not isinstance(params["action"], str):
135
+ raise InvalidParameterError("Bad parameter: action must be an str")
136
+ if "authentication_method" in params and not isinstance(
137
+ params["authentication_method"], str
138
+ ):
139
+ raise InvalidParameterError(
140
+ "Bad parameter: authentication_method must be an str"
141
+ )
142
+ if "inactivity_days" in params and not isinstance(
143
+ params["inactivity_days"], int
144
+ ):
145
+ raise InvalidParameterError(
146
+ "Bad parameter: inactivity_days must be an int"
147
+ )
148
+ if "include_site_admins" in params and not isinstance(
149
+ params["include_site_admins"], bool
150
+ ):
151
+ raise InvalidParameterError(
152
+ "Bad parameter: include_site_admins must be an bool"
153
+ )
154
+ if "include_folder_admins" in params and not isinstance(
155
+ params["include_folder_admins"], bool
156
+ ):
157
+ raise InvalidParameterError(
158
+ "Bad parameter: include_folder_admins must be an bool"
159
+ )
160
+ if "action" not in params:
161
+ raise MissingParameterError("Parameter missing: action")
162
+ if "authentication_method" not in params:
163
+ raise MissingParameterError("Parameter missing: authentication_method")
164
+ if "inactivity_days" not in params:
165
+ raise MissingParameterError("Parameter missing: inactivity_days")
166
+ response, options = Api.send_request(
167
+ "POST", "/user_lifecycle_rules", params, options
168
+ )
169
+ return UserLifecycleRule(response.data, options)
170
+
171
+
172
+ def delete(id, params=None, options=None):
173
+ if not isinstance(params, dict):
174
+ params = {}
175
+ if not isinstance(options, dict):
176
+ options = {}
177
+ params["id"] = id
178
+ if "id" in params and not isinstance(params["id"], int):
179
+ raise InvalidParameterError("Bad parameter: id must be an int")
180
+ if "id" not in params:
181
+ raise MissingParameterError("Parameter missing: id")
182
+ Api.send_request(
183
+ "DELETE",
184
+ "/user_lifecycle_rules/{id}".format(id=params["id"]),
185
+ params,
186
+ options,
187
+ )
188
+
189
+
190
+ def destroy(id, params=None, options=None):
191
+ delete(id, params, options)
192
+
193
+
194
+ def new(*args, **kwargs):
195
+ return UserLifecycleRule(*args, **kwargs)