gazu 1.0.2__py2.py3-none-any.whl → 1.1.0__py2.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.
- gazu/__version__.py +1 -1
- gazu/asset.py +157 -51
- gazu/cache.py +25 -17
- gazu/casting.py +178 -25
- gazu/client.py +124 -71
- gazu/concept.py +35 -17
- gazu/context.py +41 -15
- gazu/edit.py +36 -17
- gazu/encoder.py +3 -1
- gazu/entity.py +47 -18
- gazu/events.py +27 -22
- gazu/files.py +616 -220
- gazu/helpers.py +13 -5
- gazu/person.py +194 -86
- gazu/playlist.py +107 -53
- gazu/project.py +207 -92
- gazu/py.typed +0 -0
- gazu/scene.py +57 -17
- gazu/search.py +10 -3
- gazu/shot.py +195 -76
- gazu/sorting.py +4 -1
- gazu/sync.py +167 -97
- gazu/task.py +544 -186
- gazu/user.py +127 -63
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/METADATA +2 -1
- gazu-1.1.0.dist-info/RECORD +31 -0
- gazu-1.0.2.dist-info/RECORD +0 -30
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/WHEEL +0 -0
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/licenses/LICENSE +0 -0
- {gazu-1.0.2.dist-info → gazu-1.1.0.dist-info}/top_level.txt +0 -0
gazu/helpers.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import sys
|
|
2
4
|
import os
|
|
3
5
|
import re
|
|
@@ -19,7 +21,9 @@ _UUID_RE = re.compile(
|
|
|
19
21
|
)
|
|
20
22
|
|
|
21
23
|
|
|
22
|
-
def normalize_model_parameter(
|
|
24
|
+
def normalize_model_parameter(
|
|
25
|
+
model_parameter: str | dict | None,
|
|
26
|
+
) -> dict | None:
|
|
23
27
|
"""
|
|
24
28
|
Args:
|
|
25
29
|
model_parameter (str / dict): The parameter to convert.
|
|
@@ -45,7 +49,9 @@ def normalize_model_parameter(model_parameter):
|
|
|
45
49
|
raise ValueError("Wrong format: expected ID string or Data dict")
|
|
46
50
|
|
|
47
51
|
|
|
48
|
-
def normalize_list_of_models_for_links(
|
|
52
|
+
def normalize_list_of_models_for_links(
|
|
53
|
+
models: list[str | dict] = [],
|
|
54
|
+
) -> list[str]:
|
|
49
55
|
"""
|
|
50
56
|
Args:
|
|
51
57
|
models (list): The models to convert.
|
|
@@ -59,7 +65,7 @@ def normalize_list_of_models_for_links(models=[]):
|
|
|
59
65
|
return [normalize_model_parameter(model)["id"] for model in models]
|
|
60
66
|
|
|
61
67
|
|
|
62
|
-
def validate_date_format(date_text):
|
|
68
|
+
def validate_date_format(date_text: str) -> str:
|
|
63
69
|
try:
|
|
64
70
|
datetime.datetime.strptime(date_text, "%Y-%m-%dT%H:%M:%S")
|
|
65
71
|
except ValueError:
|
|
@@ -73,14 +79,16 @@ def validate_date_format(date_text):
|
|
|
73
79
|
return date_text
|
|
74
80
|
|
|
75
81
|
|
|
76
|
-
def sanitize_filename(filename):
|
|
82
|
+
def sanitize_filename(filename: str) -> str:
|
|
77
83
|
forbidden = "@|():%/,\\[]<>*?;`\n"
|
|
78
84
|
return "".join(
|
|
79
85
|
[c for c in filename.replace("..", "_") if c not in forbidden]
|
|
80
86
|
).strip()
|
|
81
87
|
|
|
82
88
|
|
|
83
|
-
def download_file(
|
|
89
|
+
def download_file(
|
|
90
|
+
url: str, file_path: str | None = None, headers: dict = {}
|
|
91
|
+
) -> str:
|
|
84
92
|
"""
|
|
85
93
|
Download file located at *file_path* to given url *url*.
|
|
86
94
|
|
gazu/person.py
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
1
6
|
from . import client as raw
|
|
2
7
|
|
|
3
8
|
from .sorting import sort_by_name
|
|
@@ -6,12 +11,14 @@ from .helpers import (
|
|
|
6
11
|
normalize_list_of_models_for_links,
|
|
7
12
|
)
|
|
8
13
|
from .cache import cache
|
|
14
|
+
from .client import KitsuClient
|
|
15
|
+
|
|
9
16
|
|
|
10
17
|
default = raw.default_client
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
@cache
|
|
14
|
-
def all_organisations(client=default):
|
|
21
|
+
def all_organisations(client: KitsuClient = default) -> list[dict]:
|
|
15
22
|
"""
|
|
16
23
|
Returns:
|
|
17
24
|
list: Organisations listed in database.
|
|
@@ -20,7 +27,7 @@ def all_organisations(client=default):
|
|
|
20
27
|
|
|
21
28
|
|
|
22
29
|
@cache
|
|
23
|
-
def all_departments(client=default):
|
|
30
|
+
def all_departments(client: KitsuClient = default) -> list[dict]:
|
|
24
31
|
"""
|
|
25
32
|
Returns:
|
|
26
33
|
list: Departments listed in database.
|
|
@@ -29,7 +36,7 @@ def all_departments(client=default):
|
|
|
29
36
|
|
|
30
37
|
|
|
31
38
|
@cache
|
|
32
|
-
def all_persons(client=default):
|
|
39
|
+
def all_persons(client: KitsuClient = default) -> list[dict]:
|
|
33
40
|
"""
|
|
34
41
|
Returns:
|
|
35
42
|
list: Persons listed in database.
|
|
@@ -38,7 +45,12 @@ def all_persons(client=default):
|
|
|
38
45
|
|
|
39
46
|
|
|
40
47
|
@cache
|
|
41
|
-
def get_time_spents_range(
|
|
48
|
+
def get_time_spents_range(
|
|
49
|
+
person_id: str,
|
|
50
|
+
start_date: str,
|
|
51
|
+
end_date: str,
|
|
52
|
+
client: KitsuClient = default,
|
|
53
|
+
) -> list:
|
|
42
54
|
"""
|
|
43
55
|
Gets the time spents of the current user for the given date range.
|
|
44
56
|
|
|
@@ -48,6 +60,7 @@ def get_time_spents_range(person_id, start_date, end_date, client=default):
|
|
|
48
60
|
the following format: YYYY-MM-DD
|
|
49
61
|
end_date (str): The last day of the date range as a date string with
|
|
50
62
|
the following format: YYYY-MM-DD
|
|
63
|
+
|
|
51
64
|
Returns:
|
|
52
65
|
list: All of the person's time spents
|
|
53
66
|
"""
|
|
@@ -62,7 +75,9 @@ def get_time_spents_range(person_id, start_date, end_date, client=default):
|
|
|
62
75
|
)
|
|
63
76
|
|
|
64
77
|
|
|
65
|
-
def get_all_month_time_spents(
|
|
78
|
+
def get_all_month_time_spents(
|
|
79
|
+
id: str, date: datetime.date, client: KitsuClient = default
|
|
80
|
+
) -> list:
|
|
66
81
|
"""
|
|
67
82
|
Args:
|
|
68
83
|
id (str): An uuid identifying a person.
|
|
@@ -79,7 +94,9 @@ def get_all_month_time_spents(id, date, client=default):
|
|
|
79
94
|
|
|
80
95
|
|
|
81
96
|
@cache
|
|
82
|
-
def get_department_by_name(
|
|
97
|
+
def get_department_by_name(
|
|
98
|
+
name: str, client: KitsuClient = default
|
|
99
|
+
) -> dict | None:
|
|
83
100
|
"""
|
|
84
101
|
Args:
|
|
85
102
|
name (str): Department name.
|
|
@@ -95,7 +112,7 @@ def get_department_by_name(name, client=default):
|
|
|
95
112
|
|
|
96
113
|
|
|
97
114
|
@cache
|
|
98
|
-
def get_department(department_id, client=default):
|
|
115
|
+
def get_department(department_id: str, client: KitsuClient = default) -> dict:
|
|
99
116
|
"""
|
|
100
117
|
Args:
|
|
101
118
|
department_id (str): An uuid identifying a department.
|
|
@@ -107,14 +124,17 @@ def get_department(department_id, client=default):
|
|
|
107
124
|
|
|
108
125
|
|
|
109
126
|
@cache
|
|
110
|
-
def get_person(
|
|
127
|
+
def get_person(
|
|
128
|
+
id: str, relations: bool = False, client: KitsuClient = default
|
|
129
|
+
) -> dict | None:
|
|
111
130
|
"""
|
|
112
131
|
Args:
|
|
113
132
|
id (str): An uuid identifying a person.
|
|
114
133
|
relations (bool): Whether to get the relations for the given person.
|
|
115
134
|
|
|
116
135
|
Returns:
|
|
117
|
-
dict: Person corresponding to given id
|
|
136
|
+
dict: Person corresponding to given id, or None if no Person exists
|
|
137
|
+
with that ID.
|
|
118
138
|
"""
|
|
119
139
|
params = {"id": id}
|
|
120
140
|
if relations:
|
|
@@ -124,7 +144,9 @@ def get_person(id, relations=False, client=default):
|
|
|
124
144
|
|
|
125
145
|
|
|
126
146
|
@cache
|
|
127
|
-
def get_person_by_desktop_login(
|
|
147
|
+
def get_person_by_desktop_login(
|
|
148
|
+
desktop_login: str, client: KitsuClient = default
|
|
149
|
+
) -> dict | None:
|
|
128
150
|
"""
|
|
129
151
|
Args:
|
|
130
152
|
desktop_login (str): Login used to sign in on the desktop computer.
|
|
@@ -140,7 +162,9 @@ def get_person_by_desktop_login(desktop_login, client=default):
|
|
|
140
162
|
|
|
141
163
|
|
|
142
164
|
@cache
|
|
143
|
-
def get_person_by_email(
|
|
165
|
+
def get_person_by_email(
|
|
166
|
+
email: str, client: KitsuClient = default
|
|
167
|
+
) -> dict | None:
|
|
144
168
|
"""
|
|
145
169
|
Args:
|
|
146
170
|
email (str): User's email.
|
|
@@ -155,8 +179,11 @@ def get_person_by_email(email, client=default):
|
|
|
155
179
|
|
|
156
180
|
@cache
|
|
157
181
|
def get_person_by_full_name(
|
|
158
|
-
full_name
|
|
159
|
-
|
|
182
|
+
full_name: str,
|
|
183
|
+
first_name: str | None = None,
|
|
184
|
+
last_name: str | None = None,
|
|
185
|
+
client: KitsuClient = default,
|
|
186
|
+
) -> dict | None:
|
|
160
187
|
"""
|
|
161
188
|
Args:
|
|
162
189
|
full_name (str): User's full name
|
|
@@ -164,7 +191,7 @@ def get_person_by_full_name(
|
|
|
164
191
|
last_name (str): User's last name
|
|
165
192
|
|
|
166
193
|
Returns:
|
|
167
|
-
dict: Person corresponding to given name.
|
|
194
|
+
dict: Person corresponding to given name, or None if not found.
|
|
168
195
|
"""
|
|
169
196
|
if first_name is not None and last_name is not None:
|
|
170
197
|
return raw.fetch_first(
|
|
@@ -185,7 +212,7 @@ def get_person_by_full_name(
|
|
|
185
212
|
|
|
186
213
|
|
|
187
214
|
@cache
|
|
188
|
-
def get_person_url(person, client=default):
|
|
215
|
+
def get_person_url(person: str | dict, client: KitsuClient = default) -> str:
|
|
189
216
|
"""
|
|
190
217
|
Args:
|
|
191
218
|
person (str / dict): The person dict or the person ID.
|
|
@@ -202,7 +229,7 @@ def get_person_url(person, client=default):
|
|
|
202
229
|
|
|
203
230
|
|
|
204
231
|
@cache
|
|
205
|
-
def get_organisation(client=default):
|
|
232
|
+
def get_organisation(client: KitsuClient = default) -> dict:
|
|
206
233
|
"""
|
|
207
234
|
Returns:
|
|
208
235
|
dict: Database information for organisation linked to auth tokens.
|
|
@@ -210,16 +237,22 @@ def get_organisation(client=default):
|
|
|
210
237
|
return raw.get("auth/authenticated", client=client)["organisation"]
|
|
211
238
|
|
|
212
239
|
|
|
213
|
-
def new_department(
|
|
240
|
+
def new_department(
|
|
241
|
+
name: str,
|
|
242
|
+
color: str = "",
|
|
243
|
+
archived: bool = False,
|
|
244
|
+
client: KitsuClient = default,
|
|
245
|
+
) -> dict:
|
|
214
246
|
"""
|
|
215
|
-
Create a new
|
|
247
|
+
Create a new department based on given parameters.
|
|
216
248
|
|
|
217
249
|
Args:
|
|
218
|
-
name (str): the name of the
|
|
219
|
-
color (str): the color of the
|
|
220
|
-
archived (bool): Whether the
|
|
250
|
+
name (str): the name of the department.
|
|
251
|
+
color (str): the color of the department as a Hex string, e.g "#00FF00".
|
|
252
|
+
archived (bool): Whether the department is archived or not.
|
|
253
|
+
|
|
221
254
|
Returns:
|
|
222
|
-
dict: Created
|
|
255
|
+
dict: Created department.
|
|
223
256
|
"""
|
|
224
257
|
department = get_department_by_name(name, client=client)
|
|
225
258
|
if department is None:
|
|
@@ -231,19 +264,53 @@ def new_department(name, color="", archived=False, client=default):
|
|
|
231
264
|
return department
|
|
232
265
|
|
|
233
266
|
|
|
267
|
+
def update_department(department, client=default):
|
|
268
|
+
"""
|
|
269
|
+
Update a department.
|
|
270
|
+
|
|
271
|
+
Args:
|
|
272
|
+
department (dict): The department dict that needs to be updated.
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
dict: The updated department.
|
|
276
|
+
"""
|
|
277
|
+
department = normalize_model_parameter(department)
|
|
278
|
+
return raw.put(
|
|
279
|
+
"data/departments/%s" % (department["id"]),
|
|
280
|
+
department,
|
|
281
|
+
client=client,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def remove_department(department, force=False, client=default):
|
|
286
|
+
"""
|
|
287
|
+
Remove given department from database.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
department (dict / ID): Department to remove.
|
|
291
|
+
force (bool): Whether to force deletion of the department.
|
|
292
|
+
"""
|
|
293
|
+
department = normalize_model_parameter(department)
|
|
294
|
+
path = "data/departments/%s" % department["id"]
|
|
295
|
+
params = {}
|
|
296
|
+
if force:
|
|
297
|
+
params = {"force": True}
|
|
298
|
+
return raw.delete(path, params, client=client)
|
|
299
|
+
|
|
300
|
+
|
|
234
301
|
def new_person(
|
|
235
|
-
first_name,
|
|
236
|
-
last_name,
|
|
237
|
-
email,
|
|
238
|
-
phone="",
|
|
239
|
-
role="user",
|
|
240
|
-
desktop_login="",
|
|
241
|
-
departments=[],
|
|
242
|
-
password=None,
|
|
243
|
-
active=True,
|
|
244
|
-
contract_type="open-ended",
|
|
245
|
-
client=default,
|
|
246
|
-
):
|
|
302
|
+
first_name: str,
|
|
303
|
+
last_name: str,
|
|
304
|
+
email: str,
|
|
305
|
+
phone: str = "",
|
|
306
|
+
role: str = "user",
|
|
307
|
+
desktop_login: str = "",
|
|
308
|
+
departments: list[str | dict] = [],
|
|
309
|
+
password: str | None = None,
|
|
310
|
+
active: bool = True,
|
|
311
|
+
contract_type: str = "open-ended",
|
|
312
|
+
client: KitsuClient = default,
|
|
313
|
+
) -> dict:
|
|
247
314
|
"""
|
|
248
315
|
Create a new person based on given parameters. His/her password will is
|
|
249
316
|
set automatically to default.
|
|
@@ -253,12 +320,13 @@ def new_person(
|
|
|
253
320
|
last_name (str): the last name of the person.
|
|
254
321
|
email (str): the email of the person.
|
|
255
322
|
phone (str): the phone number of the person.
|
|
256
|
-
role (str): user, manager, admin (
|
|
323
|
+
role (str): user, manager, admin (which match CG artist, Supervisor
|
|
257
324
|
and studio manager)
|
|
258
325
|
desktop_login (str): The login the users uses to log on its computer.
|
|
259
326
|
departments (list): The departments for the person.
|
|
260
327
|
password (str): The password for the person.
|
|
261
328
|
active (bool): Whether the person is active or not.
|
|
329
|
+
|
|
262
330
|
Returns:
|
|
263
331
|
dict: Created person.
|
|
264
332
|
"""
|
|
@@ -283,7 +351,7 @@ def new_person(
|
|
|
283
351
|
return person
|
|
284
352
|
|
|
285
353
|
|
|
286
|
-
def update_person(person, client=default):
|
|
354
|
+
def update_person(person: dict, client: KitsuClient = default) -> dict:
|
|
287
355
|
"""
|
|
288
356
|
Update a person.
|
|
289
357
|
|
|
@@ -307,7 +375,9 @@ def update_person(person, client=default):
|
|
|
307
375
|
)
|
|
308
376
|
|
|
309
377
|
|
|
310
|
-
def remove_person(
|
|
378
|
+
def remove_person(
|
|
379
|
+
person: str, force: bool = False, client: KitsuClient = default
|
|
380
|
+
) -> str:
|
|
311
381
|
"""
|
|
312
382
|
Remove given person from database.
|
|
313
383
|
|
|
@@ -323,14 +393,14 @@ def remove_person(person, force=False, client=default):
|
|
|
323
393
|
|
|
324
394
|
|
|
325
395
|
def new_bot(
|
|
326
|
-
name,
|
|
327
|
-
email,
|
|
328
|
-
role="user",
|
|
329
|
-
departments=[],
|
|
330
|
-
active=True,
|
|
331
|
-
expiration_date=None,
|
|
332
|
-
client=default,
|
|
333
|
-
):
|
|
396
|
+
name: str,
|
|
397
|
+
email: str,
|
|
398
|
+
role: str = "user",
|
|
399
|
+
departments: list[str | dict] = [],
|
|
400
|
+
active: bool = True,
|
|
401
|
+
expiration_date: str | None = None,
|
|
402
|
+
client: KitsuClient = default,
|
|
403
|
+
) -> dict:
|
|
334
404
|
"""
|
|
335
405
|
Create a new bot based on given parameters. His access token will be in the
|
|
336
406
|
return dict.
|
|
@@ -338,11 +408,12 @@ def new_bot(
|
|
|
338
408
|
Args:
|
|
339
409
|
name (str): the name of the bot.
|
|
340
410
|
email (str): the email of the bot.
|
|
341
|
-
role (str): user, manager, admin (
|
|
411
|
+
role (str): user, manager, admin (which match CG artist, Supervisor
|
|
342
412
|
and studio manager)
|
|
343
413
|
departments (list): The departments for the person.
|
|
344
414
|
active (bool): Whether the person is active or not.
|
|
345
415
|
expiration_date (str): The expiration date for the bot.
|
|
416
|
+
|
|
346
417
|
Returns:
|
|
347
418
|
dict: Created bot.
|
|
348
419
|
"""
|
|
@@ -363,7 +434,7 @@ def new_bot(
|
|
|
363
434
|
return bot
|
|
364
435
|
|
|
365
436
|
|
|
366
|
-
def update_bot(bot, client=default):
|
|
437
|
+
def update_bot(bot: dict, client: KitsuClient = default) -> dict:
|
|
367
438
|
"""
|
|
368
439
|
Update a bot.
|
|
369
440
|
|
|
@@ -376,7 +447,9 @@ def update_bot(bot, client=default):
|
|
|
376
447
|
return update_person(bot, client=client)
|
|
377
448
|
|
|
378
449
|
|
|
379
|
-
def remove_bot(
|
|
450
|
+
def remove_bot(
|
|
451
|
+
bot: dict, force: bool = False, client: KitsuClient = default
|
|
452
|
+
) -> str:
|
|
380
453
|
"""
|
|
381
454
|
Remove given bot from database.
|
|
382
455
|
|
|
@@ -386,7 +459,9 @@ def remove_bot(bot, force=False, client=default):
|
|
|
386
459
|
return remove_person(bot, force=force, client=client)
|
|
387
460
|
|
|
388
461
|
|
|
389
|
-
def set_avatar(
|
|
462
|
+
def set_avatar(
|
|
463
|
+
person: str | dict, file_path: str, client: KitsuClient = default
|
|
464
|
+
) -> dict[Literal["thumbnail_path"], str]:
|
|
390
465
|
"""
|
|
391
466
|
Upload picture and set it as avatar for given person.
|
|
392
467
|
|
|
@@ -394,6 +469,10 @@ def set_avatar(person, file_path, client=default):
|
|
|
394
469
|
person (str / dict): The person dict or the person ID.
|
|
395
470
|
file_path (str): Path where the avatar file is located on the hard
|
|
396
471
|
drive.
|
|
472
|
+
|
|
473
|
+
Returns:
|
|
474
|
+
dict: Dictionary with a key of 'thumbnail_path' and a value of the
|
|
475
|
+
path to the static image file, relative to the host url.
|
|
397
476
|
"""
|
|
398
477
|
person = normalize_model_parameter(person)
|
|
399
478
|
return raw.upload(
|
|
@@ -403,26 +482,32 @@ def set_avatar(person, file_path, client=default):
|
|
|
403
482
|
)
|
|
404
483
|
|
|
405
484
|
|
|
406
|
-
def get_presence_log(
|
|
485
|
+
def get_presence_log(
|
|
486
|
+
year: int, month: int, client: KitsuClient = default
|
|
487
|
+
) -> str:
|
|
407
488
|
"""
|
|
408
489
|
Args:
|
|
409
|
-
year (int):
|
|
410
|
-
month (int):
|
|
490
|
+
year (int): The number of the year to fetch logs during.
|
|
491
|
+
month (int): The index of the month to get presence logs for. Indexed
|
|
492
|
+
from 1, e.g 1 = January, 2 = February, ...
|
|
411
493
|
|
|
412
494
|
Returns:
|
|
413
|
-
The presence log table for given month and year.
|
|
495
|
+
str: The presence log table (in CSV) for given month and year.
|
|
414
496
|
"""
|
|
415
497
|
path = "data/persons/presence-logs/%s-%s" % (year, str(month).zfill(2))
|
|
416
498
|
return raw.get(path, json_response=False, client=client)
|
|
417
499
|
|
|
418
500
|
|
|
419
|
-
def change_password_for_person(
|
|
501
|
+
def change_password_for_person(
|
|
502
|
+
person: str | dict, password: str, client: KitsuClient = default
|
|
503
|
+
) -> dict[Literal["success"], bool]:
|
|
420
504
|
"""
|
|
421
505
|
Change the password for given person.
|
|
422
506
|
|
|
423
507
|
Args:
|
|
424
508
|
person (str / dict): The person dict or the person ID.
|
|
425
509
|
password (str): The new password.
|
|
510
|
+
|
|
426
511
|
Returns:
|
|
427
512
|
dict: success or not.
|
|
428
513
|
"""
|
|
@@ -434,12 +519,17 @@ def change_password_for_person(person, password, client=default):
|
|
|
434
519
|
)
|
|
435
520
|
|
|
436
521
|
|
|
437
|
-
def invite_person(
|
|
522
|
+
def invite_person(
|
|
523
|
+
person: str | dict, client: KitsuClient = default
|
|
524
|
+
) -> dict[str, str]:
|
|
438
525
|
"""
|
|
439
526
|
Sends an email to given person to invite him/her to connect to Kitsu.
|
|
440
527
|
|
|
441
528
|
Args:
|
|
442
|
-
person (dict): The person to invite.
|
|
529
|
+
person (str / dict): The person to invite.
|
|
530
|
+
|
|
531
|
+
Returns:
|
|
532
|
+
dict: Response dict with 'success' and 'message' keys.
|
|
443
533
|
"""
|
|
444
534
|
person = normalize_model_parameter(person)
|
|
445
535
|
return raw.get(
|
|
@@ -449,12 +539,14 @@ def invite_person(person, client=default):
|
|
|
449
539
|
|
|
450
540
|
|
|
451
541
|
@cache
|
|
452
|
-
def get_time_spents_by_date(
|
|
542
|
+
def get_time_spents_by_date(
|
|
543
|
+
person: str | dict, date: str, client: KitsuClient = default
|
|
544
|
+
) -> list[dict]:
|
|
453
545
|
"""
|
|
454
546
|
Get time spents for a person on a specific date.
|
|
455
547
|
|
|
456
548
|
Args:
|
|
457
|
-
person (
|
|
549
|
+
person (str / dict): The person dict or id.
|
|
458
550
|
date (str): Date in YYYY-MM-DD format.
|
|
459
551
|
|
|
460
552
|
Returns:
|
|
@@ -469,12 +561,14 @@ def get_time_spents_by_date(person, date, client=default):
|
|
|
469
561
|
|
|
470
562
|
|
|
471
563
|
@cache
|
|
472
|
-
def get_week_time_spents(
|
|
564
|
+
def get_week_time_spents(
|
|
565
|
+
person: str | dict, year: int, week: int, client: KitsuClient = default
|
|
566
|
+
) -> list[dict]:
|
|
473
567
|
"""
|
|
474
568
|
Get time spents for a person for a specific week.
|
|
475
569
|
|
|
476
570
|
Args:
|
|
477
|
-
person (
|
|
571
|
+
person (str / dict): The person dict or id.
|
|
478
572
|
year (int): Year.
|
|
479
573
|
week (int): Week number.
|
|
480
574
|
|
|
@@ -489,12 +583,14 @@ def get_week_time_spents(person, year, week, client=default):
|
|
|
489
583
|
|
|
490
584
|
|
|
491
585
|
@cache
|
|
492
|
-
def get_year_time_spents(
|
|
586
|
+
def get_year_time_spents(
|
|
587
|
+
person: str | dict, year: int, client: KitsuClient = default
|
|
588
|
+
) -> list[dict]:
|
|
493
589
|
"""
|
|
494
590
|
Get time spents for a person for a specific year.
|
|
495
591
|
|
|
496
592
|
Args:
|
|
497
|
-
person (
|
|
593
|
+
person (str / dict): The person dict or id.
|
|
498
594
|
year (int): Year.
|
|
499
595
|
|
|
500
596
|
Returns:
|
|
@@ -508,29 +604,31 @@ def get_year_time_spents(person, year, client=default):
|
|
|
508
604
|
|
|
509
605
|
|
|
510
606
|
@cache
|
|
511
|
-
def get_day_offs(
|
|
607
|
+
def get_day_offs(
|
|
608
|
+
person: str | dict, client: KitsuClient = default
|
|
609
|
+
) -> list[dict]:
|
|
512
610
|
"""
|
|
513
611
|
Get day offs for a person.
|
|
514
612
|
|
|
515
613
|
Args:
|
|
516
|
-
person (
|
|
614
|
+
person (str / dict): The person dict or id.
|
|
517
615
|
|
|
518
616
|
Returns:
|
|
519
617
|
list: Day offs for the person.
|
|
520
618
|
"""
|
|
521
619
|
person = normalize_model_parameter(person)
|
|
522
|
-
return raw.fetch_all(
|
|
523
|
-
"persons/%s/day-offs" % person["id"], client=client
|
|
524
|
-
)
|
|
620
|
+
return raw.fetch_all("persons/%s/day-offs" % person["id"], client=client)
|
|
525
621
|
|
|
526
622
|
|
|
527
623
|
@cache
|
|
528
|
-
def get_week_day_offs(
|
|
624
|
+
def get_week_day_offs(
|
|
625
|
+
person: str | dict, year: int, week: int, client: KitsuClient = default
|
|
626
|
+
) -> list[dict]:
|
|
529
627
|
"""
|
|
530
628
|
Get day offs for a person for a specific week.
|
|
531
629
|
|
|
532
630
|
Args:
|
|
533
|
-
person (
|
|
631
|
+
person (str / dict): The person dict or id.
|
|
534
632
|
year (int): Year.
|
|
535
633
|
week (int): Week number.
|
|
536
634
|
|
|
@@ -545,12 +643,14 @@ def get_week_day_offs(person, year, week, client=default):
|
|
|
545
643
|
|
|
546
644
|
|
|
547
645
|
@cache
|
|
548
|
-
def get_month_day_offs(
|
|
646
|
+
def get_month_day_offs(
|
|
647
|
+
person: str | dict, year: int, month: int, client: KitsuClient = default
|
|
648
|
+
) -> list[dict]:
|
|
549
649
|
"""
|
|
550
650
|
Get day offs for a person for a specific month.
|
|
551
651
|
|
|
552
652
|
Args:
|
|
553
|
-
person (
|
|
653
|
+
person (str / dict): The person dict or id.
|
|
554
654
|
year (int): Year.
|
|
555
655
|
month (int): Month number.
|
|
556
656
|
|
|
@@ -566,12 +666,14 @@ def get_month_day_offs(person, year, month, client=default):
|
|
|
566
666
|
|
|
567
667
|
|
|
568
668
|
@cache
|
|
569
|
-
def get_year_day_offs(
|
|
669
|
+
def get_year_day_offs(
|
|
670
|
+
person: str | dict, year: int, client: KitsuClient = default
|
|
671
|
+
) -> list[dict]:
|
|
570
672
|
"""
|
|
571
673
|
Get day offs for a person for a specific year.
|
|
572
674
|
|
|
573
675
|
Args:
|
|
574
|
-
person (
|
|
676
|
+
person (str / dict): The person dict or id.
|
|
575
677
|
year (int): Year.
|
|
576
678
|
|
|
577
679
|
Returns:
|
|
@@ -584,13 +686,15 @@ def get_year_day_offs(person, year, client=default):
|
|
|
584
686
|
)
|
|
585
687
|
|
|
586
688
|
|
|
587
|
-
def add_person_to_department(
|
|
689
|
+
def add_person_to_department(
|
|
690
|
+
person: str | dict, department: str | dict, client: KitsuClient = default
|
|
691
|
+
) -> dict:
|
|
588
692
|
"""
|
|
589
693
|
Add a person to a department.
|
|
590
694
|
|
|
591
695
|
Args:
|
|
592
|
-
person (
|
|
593
|
-
department (
|
|
696
|
+
person (str / dict): The person dict or id.
|
|
697
|
+
department (str / dict): The department dict or id.
|
|
594
698
|
|
|
595
699
|
Returns:
|
|
596
700
|
dict: Response information.
|
|
@@ -604,13 +708,15 @@ def add_person_to_department(person, department, client=default):
|
|
|
604
708
|
)
|
|
605
709
|
|
|
606
710
|
|
|
607
|
-
def remove_person_from_department(
|
|
711
|
+
def remove_person_from_department(
|
|
712
|
+
person: str | dict, department: str | dict, client: KitsuClient = default
|
|
713
|
+
) -> str:
|
|
608
714
|
"""
|
|
609
715
|
Remove a person from a department.
|
|
610
716
|
|
|
611
717
|
Args:
|
|
612
|
-
person (
|
|
613
|
-
department (
|
|
718
|
+
person (str / dict): The person dict or id.
|
|
719
|
+
department (str / dict): The department dict or id.
|
|
614
720
|
|
|
615
721
|
Returns:
|
|
616
722
|
Response: Request response object.
|
|
@@ -623,12 +729,14 @@ def remove_person_from_department(person, department, client=default):
|
|
|
623
729
|
)
|
|
624
730
|
|
|
625
731
|
|
|
626
|
-
def disable_two_factor_authentication(
|
|
732
|
+
def disable_two_factor_authentication(
|
|
733
|
+
person: str | dict, client: KitsuClient = default
|
|
734
|
+
) -> str:
|
|
627
735
|
"""
|
|
628
736
|
Disable two factor authentication for a person.
|
|
629
737
|
|
|
630
738
|
Args:
|
|
631
|
-
person (
|
|
739
|
+
person (str / dict): The person dict or id.
|
|
632
740
|
|
|
633
741
|
Returns:
|
|
634
742
|
Response: Request response object.
|
|
@@ -640,17 +748,17 @@ def disable_two_factor_authentication(person, client=default):
|
|
|
640
748
|
)
|
|
641
749
|
|
|
642
750
|
|
|
643
|
-
def clear_person_avatar(
|
|
751
|
+
def clear_person_avatar(
|
|
752
|
+
person: str | dict, client: KitsuClient = default
|
|
753
|
+
) -> str:
|
|
644
754
|
"""
|
|
645
755
|
Clear avatar for a person.
|
|
646
756
|
|
|
647
757
|
Args:
|
|
648
|
-
person (
|
|
758
|
+
person (str / dict): The person dict or id.
|
|
649
759
|
|
|
650
760
|
Returns:
|
|
651
761
|
Response: Request response object.
|
|
652
762
|
"""
|
|
653
763
|
person = normalize_model_parameter(person)
|
|
654
|
-
return raw.delete(
|
|
655
|
-
"data/persons/%s/avatar" % person["id"], client=client
|
|
656
|
-
)
|
|
764
|
+
return raw.delete("data/persons/%s/avatar" % person["id"], client=client)
|