gazu 1.0.3__py2.py3-none-any.whl → 1.1.1__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/task.py CHANGED
@@ -1,8 +1,9 @@
1
- import string
1
+ from __future__ import annotations
2
2
 
3
3
  import json
4
+ import string
4
5
 
5
- from deprecated import deprecated
6
+ import requests
6
7
 
7
8
  from gazu.exception import (
8
9
  TaskStatusNotFoundException,
@@ -10,6 +11,7 @@ from gazu.exception import (
10
11
  )
11
12
 
12
13
  from . import client as raw
14
+ from .client import KitsuClient
13
15
  from .sorting import sort_by_name
14
16
  from .helpers import (
15
17
  download_file,
@@ -23,7 +25,7 @@ default = raw.default_client
23
25
 
24
26
 
25
27
  @cache
26
- def all_task_statuses(client=default):
28
+ def all_task_statuses(client: KitsuClient = default) -> list[dict]:
27
29
  """
28
30
  Returns:
29
31
  list: Task statuses stored in database.
@@ -33,7 +35,7 @@ def all_task_statuses(client=default):
33
35
 
34
36
 
35
37
  @cache
36
- def all_task_types(client=default):
38
+ def all_task_types(client: KitsuClient = default) -> list[dict]:
37
39
  """
38
40
  Returns:
39
41
  list: Task types stored in database.
@@ -43,7 +45,9 @@ def all_task_types(client=default):
43
45
 
44
46
 
45
47
  @cache
46
- def all_task_types_for_project(project, client=default):
48
+ def all_task_types_for_project(
49
+ project: str | dict, client: KitsuClient = default
50
+ ) -> list[dict]:
47
51
  """
48
52
  Returns:
49
53
  list: Task types stored in database.
@@ -56,7 +60,9 @@ def all_task_types_for_project(project, client=default):
56
60
 
57
61
 
58
62
  @cache
59
- def all_task_statuses_for_project(project, client=default):
63
+ def all_task_statuses_for_project(
64
+ project: str | dict, client: KitsuClient = default
65
+ ) -> list[dict]:
60
66
  """
61
67
  Returns:
62
68
  list: Task status stored in database.
@@ -69,7 +75,9 @@ def all_task_statuses_for_project(project, client=default):
69
75
 
70
76
 
71
77
  @cache
72
- def all_tasks_for_shot(shot, relations=False, client=default):
78
+ def all_tasks_for_shot(
79
+ shot: str | dict, relations: bool = False, client: KitsuClient = default
80
+ ) -> list[dict]:
73
81
  """
74
82
  Args:
75
83
  shot (str / dict): The shot dict or the shot ID.
@@ -86,7 +94,9 @@ def all_tasks_for_shot(shot, relations=False, client=default):
86
94
 
87
95
 
88
96
  @cache
89
- def all_tasks_for_concept(concept, relations=False, client=default):
97
+ def all_tasks_for_concept(
98
+ concept: str | dict, relations: bool = False, client: KitsuClient = default
99
+ ) -> list[dict]:
90
100
  """
91
101
  Args:
92
102
  concept (str / dict): The concept dict or the concept ID.
@@ -105,7 +115,9 @@ def all_tasks_for_concept(concept, relations=False, client=default):
105
115
 
106
116
 
107
117
  @cache
108
- def all_tasks_for_edit(edit, relations=False, client=default):
118
+ def all_tasks_for_edit(
119
+ edit: str | dict, relations: bool = False, client: KitsuClient = default
120
+ ) -> list[dict]:
109
121
  """
110
122
  Args:
111
123
  edit (str / dict): The edit dict or the edit ID.
@@ -122,7 +134,11 @@ def all_tasks_for_edit(edit, relations=False, client=default):
122
134
 
123
135
 
124
136
  @cache
125
- def all_tasks_for_sequence(sequence, relations=False, client=default):
137
+ def all_tasks_for_sequence(
138
+ sequence: str | dict,
139
+ relations: bool = False,
140
+ client: KitsuClient = default,
141
+ ) -> list[dict]:
126
142
  """
127
143
  Args:
128
144
  sequence (str / dict): The sequence dict or the sequence ID.
@@ -140,7 +156,9 @@ def all_tasks_for_sequence(sequence, relations=False, client=default):
140
156
 
141
157
 
142
158
  @cache
143
- def all_tasks_for_scene(scene, relations=False, client=default):
159
+ def all_tasks_for_scene(
160
+ scene: str | dict, relations: bool = False, client: KitsuClient = default
161
+ ) -> list[dict]:
144
162
  """
145
163
  Args:
146
164
  sequence (str / dict): The scene dict or the scene ID.
@@ -158,7 +176,9 @@ def all_tasks_for_scene(scene, relations=False, client=default):
158
176
 
159
177
 
160
178
  @cache
161
- def all_tasks_for_asset(asset, relations=False, client=default):
179
+ def all_tasks_for_asset(
180
+ asset: str | dict, relations: bool = False, client: KitsuClient = default
181
+ ) -> list[dict]:
162
182
  """
163
183
  Args:
164
184
  asset (str / dict): The asset dict or the asset ID.
@@ -176,7 +196,9 @@ def all_tasks_for_asset(asset, relations=False, client=default):
176
196
 
177
197
 
178
198
  @cache
179
- def all_tasks_for_episode(episode, relations=False, client=default):
199
+ def all_tasks_for_episode(
200
+ episode: str | dict, relations: bool = False, client: KitsuClient = default
201
+ ) -> list[dict]:
180
202
  """
181
203
  Retrieve all tasks directly linked to given episode.
182
204
  """
@@ -190,7 +212,11 @@ def all_tasks_for_episode(episode, relations=False, client=default):
190
212
 
191
213
 
192
214
  @cache
193
- def all_shot_tasks_for_sequence(sequence, relations=False, client=default):
215
+ def all_shot_tasks_for_sequence(
216
+ sequence: str | dict,
217
+ relations: bool = False,
218
+ client: KitsuClient = default,
219
+ ) -> list[dict]:
194
220
  """
195
221
  Retrieve all tasks directly linked to all shots of given sequence.
196
222
  """
@@ -204,7 +230,9 @@ def all_shot_tasks_for_sequence(sequence, relations=False, client=default):
204
230
 
205
231
 
206
232
  @cache
207
- def all_shot_tasks_for_episode(episode, relations=False, client=default):
233
+ def all_shot_tasks_for_episode(
234
+ episode: str | dict, relations: bool = False, client: KitsuClient = default
235
+ ) -> list[dict]:
208
236
  """
209
237
  Retrieve all tasks directly linked to all shots of given episode.
210
238
  """
@@ -218,7 +246,9 @@ def all_shot_tasks_for_episode(episode, relations=False, client=default):
218
246
 
219
247
 
220
248
  @cache
221
- def all_assets_tasks_for_episode(episode, relations=False, client=default):
249
+ def all_assets_tasks_for_episode(
250
+ episode: str | dict, relations: bool = False, client: KitsuClient = default
251
+ ) -> list[dict]:
222
252
  """
223
253
  Retrieve all tasks directly linked to all assets of given episode.
224
254
  """
@@ -232,7 +262,12 @@ def all_assets_tasks_for_episode(episode, relations=False, client=default):
232
262
 
233
263
 
234
264
  @cache
235
- def all_tasks_for_task_status(project, task_type, task_status, client=default):
265
+ def all_tasks_for_task_status(
266
+ project: str | dict,
267
+ task_type: str | dict,
268
+ task_status: str | dict,
269
+ client: KitsuClient = default,
270
+ ) -> list[dict]:
236
271
  """
237
272
  Args:
238
273
  project (str / dict): The project dict or the project ID.
@@ -257,7 +292,12 @@ def all_tasks_for_task_status(project, task_type, task_status, client=default):
257
292
 
258
293
 
259
294
  @cache
260
- def all_tasks_for_task_type(project, task_type, episode=None, client=default):
295
+ def all_tasks_for_task_type(
296
+ project: str | dict,
297
+ task_type: str | dict,
298
+ episode: str | dict | None = None,
299
+ client: KitsuClient = default,
300
+ ) -> list[dict]:
261
301
  """
262
302
  Args:
263
303
  project (str / dict): The project dict or the project ID.
@@ -280,7 +320,9 @@ def all_tasks_for_task_type(project, task_type, episode=None, client=default):
280
320
 
281
321
 
282
322
  @cache
283
- def all_task_types_for_shot(shot, client=default):
323
+ def all_task_types_for_shot(
324
+ shot: str | dict, client: KitsuClient = default
325
+ ) -> list[dict]:
284
326
  """
285
327
  Args:
286
328
  shot (str / dict): The shot dict or the shot ID.
@@ -295,7 +337,9 @@ def all_task_types_for_shot(shot, client=default):
295
337
 
296
338
 
297
339
  @cache
298
- def all_task_types_for_concept(concept, client=default):
340
+ def all_task_types_for_concept(
341
+ concept: str | dict, client: KitsuClient = default
342
+ ) -> list[dict]:
299
343
  """
300
344
  Args:
301
345
  concept (str / dict): The concept dict or the concept ID.
@@ -310,7 +354,9 @@ def all_task_types_for_concept(concept, client=default):
310
354
 
311
355
 
312
356
  @cache
313
- def all_task_types_for_asset(asset, client=default):
357
+ def all_task_types_for_asset(
358
+ asset: str | dict, client: KitsuClient = default
359
+ ) -> list[dict]:
314
360
  """
315
361
  Args:
316
362
  asset (str / dict): The asset dict or the asset ID.
@@ -326,7 +372,9 @@ def all_task_types_for_asset(asset, client=default):
326
372
 
327
373
 
328
374
  @cache
329
- def all_task_types_for_scene(scene, client=default):
375
+ def all_task_types_for_scene(
376
+ scene: str | dict, client: KitsuClient = default
377
+ ) -> list[dict]:
330
378
  """
331
379
  Args:
332
380
  scene (str / dict): The scene dict or the scene ID.
@@ -341,7 +389,9 @@ def all_task_types_for_scene(scene, client=default):
341
389
 
342
390
 
343
391
  @cache
344
- def all_task_types_for_sequence(sequence, client=default):
392
+ def all_task_types_for_sequence(
393
+ sequence: str | dict, client: KitsuClient = default
394
+ ) -> list[dict]:
345
395
  """
346
396
  Args:
347
397
  sequence (str / dict): The sequence dict or the sequence ID.
@@ -356,7 +406,9 @@ def all_task_types_for_sequence(sequence, client=default):
356
406
 
357
407
 
358
408
  @cache
359
- def all_task_types_for_episode(episode, client=default):
409
+ def all_task_types_for_episode(
410
+ episode: str | dict, client: KitsuClient = default
411
+ ) -> list[dict]:
360
412
  """
361
413
  Returns:
362
414
  list: Task types of tasks linked directly to given episode.
@@ -368,7 +420,9 @@ def all_task_types_for_episode(episode, client=default):
368
420
 
369
421
 
370
422
  @cache
371
- def all_tasks_for_entity_and_task_type(entity, task_type, client=default):
423
+ def all_tasks_for_entity_and_task_type(
424
+ entity: str | dict, task_type: str | dict, client: KitsuClient = default
425
+ ) -> list[dict]:
372
426
  """
373
427
  Args:
374
428
  entity (str / dict): The entity dict or the entity ID.
@@ -386,7 +440,9 @@ def all_tasks_for_entity_and_task_type(entity, task_type, client=default):
386
440
 
387
441
 
388
442
  @cache
389
- def all_tasks_for_person(person, client=default):
443
+ def all_tasks_for_person(
444
+ person: str | dict, client: KitsuClient = default
445
+ ) -> list[dict]:
390
446
  """
391
447
  Returns:
392
448
  list: Tasks that are not done for given person (only for open projects).
@@ -396,7 +452,9 @@ def all_tasks_for_person(person, client=default):
396
452
 
397
453
 
398
454
  @cache
399
- def all_done_tasks_for_person(person, client=default):
455
+ def all_done_tasks_for_person(
456
+ person: str | dict, client: KitsuClient = default
457
+ ) -> list[dict]:
400
458
  """
401
459
  Returns:
402
460
  list: Tasks that are done for given person (only for open projects).
@@ -406,7 +464,12 @@ def all_done_tasks_for_person(person, client=default):
406
464
 
407
465
 
408
466
  @cache
409
- def get_task_by_entity(entity, task_type, name="main", client=default):
467
+ def get_task_by_entity(
468
+ entity: str | dict,
469
+ task_type: str | dict,
470
+ name: str = "main",
471
+ client: KitsuClient = default,
472
+ ) -> dict | None:
410
473
  """
411
474
  Args:
412
475
  entity (str / dict): The entity dict or the entity ID.
@@ -430,7 +493,7 @@ def get_task_by_entity(entity, task_type, name="main", client=default):
430
493
 
431
494
 
432
495
  @cache
433
- def get_task_type(task_type_id, client=default):
496
+ def get_task_type(task_type_id: str, client: KitsuClient = default) -> dict:
434
497
  """
435
498
  Args:
436
499
  task_type_id (str): ID of claimed task type.
@@ -443,16 +506,19 @@ def get_task_type(task_type_id, client=default):
443
506
 
444
507
  @cache
445
508
  def get_task_type_by_name(
446
- task_type_name, for_entity=None, department=None, client=default
447
- ):
509
+ task_type_name: str,
510
+ for_entity: str | None = None,
511
+ department: str | dict | None = None,
512
+ client: KitsuClient = default,
513
+ ) -> dict | None:
448
514
  """
449
515
  Args:
450
516
  task_type_name (str): Name of claimed task type.
451
517
  for_entity (str): The entity type for which the task type is created.
452
- department (str): The department for which the task type is created.
518
+ department (str / dict): The department for which the task type is created.
453
519
 
454
520
  Returns:
455
- dict: Task type object for given name.
521
+ dict: Task type object for given name, or None if none found.
456
522
  """
457
523
  params = {"name": task_type_name}
458
524
  if for_entity is not None:
@@ -464,16 +530,19 @@ def get_task_type_by_name(
464
530
 
465
531
  @cache
466
532
  def get_task_type_by_short_name(
467
- task_type_short_name, for_entity=None, department=None, client=default
468
- ):
533
+ task_type_short_name: str,
534
+ for_entity: str | None = None,
535
+ department: str | dict | None = None,
536
+ client: KitsuClient = default,
537
+ ) -> dict | None:
469
538
  """
470
539
  Args:
471
540
  task_type_short_name (str): Short name of claimed task type.
472
541
  for_entity (str): The entity type for which the task type is created.
473
- department (str): The department for which the task type is created.
542
+ department (str /dict): The department for which the task type is created.
474
543
 
475
544
  Returns:
476
- dict: Task type object for given name.
545
+ dict: Task type object for given name, or None if none found.
477
546
  """
478
547
  params = {"short_name": task_type_short_name}
479
548
  if for_entity is not None:
@@ -484,7 +553,12 @@ def get_task_type_by_short_name(
484
553
 
485
554
 
486
555
  @cache
487
- def get_task_by_path(project, file_path, entity_type="shot", client=default):
556
+ def get_task_by_path(
557
+ project: str | dict,
558
+ file_path: str,
559
+ entity_type: str = "shot",
560
+ client: KitsuClient = default,
561
+ ) -> dict:
488
562
  """
489
563
  Args:
490
564
  project (str / dict): The project dict or the project ID.
@@ -505,7 +579,7 @@ def get_task_by_path(project, file_path, entity_type="shot", client=default):
505
579
 
506
580
 
507
581
  @cache
508
- def get_default_task_status(client=default):
582
+ def get_default_task_status(client: KitsuClient = default) -> dict:
509
583
  """
510
584
  Returns:
511
585
  dict: The unique task status flagged with `is_default`.
@@ -516,7 +590,9 @@ def get_default_task_status(client=default):
516
590
 
517
591
 
518
592
  @cache
519
- def get_task_status(task_status_id, client=default):
593
+ def get_task_status(
594
+ task_status_id: str, client: KitsuClient = default
595
+ ) -> dict:
520
596
  """
521
597
  Args:
522
598
  task_status_id (str): ID of claimed task status.
@@ -528,7 +604,9 @@ def get_task_status(task_status_id, client=default):
528
604
 
529
605
 
530
606
  @cache
531
- def get_task_status_by_name(name, client=default):
607
+ def get_task_status_by_name(
608
+ name: str, client: KitsuClient = default
609
+ ) -> dict | None:
532
610
  """
533
611
  Args:
534
612
  name (str / dict): The name of claimed task status.
@@ -540,7 +618,9 @@ def get_task_status_by_name(name, client=default):
540
618
 
541
619
 
542
620
  @cache
543
- def get_task_status_by_short_name(task_status_short_name, client=default):
621
+ def get_task_status_by_short_name(
622
+ task_status_short_name: str, client: KitsuClient = default
623
+ ) -> dict | None:
544
624
  """
545
625
  Args:
546
626
  short_name (str / dict): The short name of claimed task status.
@@ -553,7 +633,9 @@ def get_task_status_by_short_name(task_status_short_name, client=default):
553
633
  )
554
634
 
555
635
 
556
- def remove_task_type(task_type, client=default):
636
+ def remove_task_type(
637
+ task_type: str | dict, client: KitsuClient = default
638
+ ) -> str:
557
639
  """
558
640
  Remove given task type from database.
559
641
 
@@ -568,7 +650,9 @@ def remove_task_type(task_type, client=default):
568
650
  )
569
651
 
570
652
 
571
- def remove_task_status(task_status, client=default):
653
+ def remove_task_status(
654
+ task_status: str | dict, client: KitsuClient = default
655
+ ) -> str:
572
656
  """
573
657
  Remove given task status from database.
574
658
 
@@ -583,7 +667,7 @@ def remove_task_status(task_status, client=default):
583
667
  )
584
668
 
585
669
 
586
- def update_task_type(task_type, client=default):
670
+ def update_task_type(task_type: dict, client: KitsuClient = default) -> dict:
587
671
  """
588
672
  Update given task type into the API.
589
673
 
@@ -600,7 +684,9 @@ def update_task_type(task_type, client=default):
600
684
  )
601
685
 
602
686
 
603
- def update_task_status(task_status, client=default):
687
+ def update_task_status(
688
+ task_status: dict, client: KitsuClient = default
689
+ ) -> dict:
604
690
  """
605
691
  Update given task status into the API.
606
692
 
@@ -618,7 +704,7 @@ def update_task_status(task_status, client=default):
618
704
 
619
705
 
620
706
  @cache
621
- def get_task(task_id, client=default):
707
+ def get_task(task_id: str | dict, client: KitsuClient = default) -> dict:
622
708
  """
623
709
  Args:
624
710
  task_id (str): ID of claimed task.
@@ -631,14 +717,14 @@ def get_task(task_id, client=default):
631
717
 
632
718
 
633
719
  def new_task(
634
- entity,
635
- task_type,
636
- name="main",
637
- task_status=None,
638
- assigner=None,
639
- assignees=[],
640
- client=default,
641
- ):
720
+ entity: str | dict,
721
+ task_type: str | dict,
722
+ name: str = "main",
723
+ task_status: dict | None = None,
724
+ assigner: str | dict | None = None,
725
+ assignees: list[str | dict] = [],
726
+ client: KitsuClient = default,
727
+ ) -> dict:
642
728
  """
643
729
  Create a new task for given entity and task type.
644
730
 
@@ -676,7 +762,7 @@ def new_task(
676
762
  return task
677
763
 
678
764
 
679
- def remove_task(task, client=default):
765
+ def remove_task(task: str | dict, client: KitsuClient = default) -> str:
680
766
  """
681
767
  Remove given task from database.
682
768
 
@@ -687,7 +773,12 @@ def remove_task(task, client=default):
687
773
  raw.delete("data/tasks/%s" % task["id"], {"force": True}, client=client)
688
774
 
689
775
 
690
- def start_task(task, started_task_status=None, person=None, client=default):
776
+ def start_task(
777
+ task: str | dict,
778
+ started_task_status: str | dict | None = None,
779
+ person: str | dict | None = None,
780
+ client: KitsuClient = default,
781
+ ) -> dict:
691
782
  """
692
783
  Create a comment to change task status to started_task_status
693
784
  (by default WIP) and set its real start date to now.
@@ -718,8 +809,13 @@ def start_task(task, started_task_status=None, person=None, client=default):
718
809
 
719
810
 
720
811
  def task_to_review(
721
- task, person, comment, revision=1, change_status=True, client=default
722
- ):
812
+ task: str | dict,
813
+ person: str | dict,
814
+ comment: str,
815
+ revision: int = 1,
816
+ change_status: bool = True,
817
+ client: KitsuClient = default,
818
+ ) -> dict:
723
819
  """
724
820
  Deprecated.
725
821
  Mark given task as pending, waiting for approval. Author is given through
@@ -749,7 +845,9 @@ def task_to_review(
749
845
 
750
846
 
751
847
  @cache
752
- def get_time_spent(task, date=None, client=default):
848
+ def get_time_spent(
849
+ task: str | dict, date: str | None = None, client: KitsuClient = default
850
+ ) -> dict:
753
851
  """
754
852
  Get the time spent by CG artists on a task at a given date if given. A field contains
755
853
  the total time spent. Durations are given in minutes. Date format is
@@ -769,7 +867,13 @@ def get_time_spent(task, date=None, client=default):
769
867
  return raw.get(path, client=client)
770
868
 
771
869
 
772
- def set_time_spent(task, person, date, duration, client=default):
870
+ def set_time_spent(
871
+ task: str | dict,
872
+ person: str | dict,
873
+ date: str,
874
+ duration: int,
875
+ client: KitsuClient = default,
876
+ ) -> dict:
773
877
  """
774
878
  Set the time spent by a CG artist on a given task at a given date.
775
879
 
@@ -792,7 +896,13 @@ def set_time_spent(task, person, date, duration, client=default):
792
896
  return raw.post(path, {"duration": duration}, client=client)
793
897
 
794
898
 
795
- def add_time_spent(task, person, date, duration, client=default):
899
+ def add_time_spent(
900
+ task: str | dict,
901
+ person: str | dict,
902
+ date: str,
903
+ duration: int,
904
+ client: KitsuClient = default,
905
+ ) -> dict:
796
906
  """
797
907
  Add given duration to the already logged duration for given task and person
798
908
  at a given date.
@@ -817,16 +927,16 @@ def add_time_spent(task, person, date, duration, client=default):
817
927
 
818
928
 
819
929
  def add_comment(
820
- task,
821
- task_status,
822
- comment="",
823
- person=None,
824
- checklist=[],
825
- attachments=[],
826
- created_at=None,
827
- links=[],
828
- client=default,
829
- ):
930
+ task: str | dict,
931
+ task_status: str | dict,
932
+ comment: str = "",
933
+ person: str | dict | None = None,
934
+ checklist: list[dict] = [],
935
+ attachments: list[str] = [],
936
+ created_at: str | None = None,
937
+ links: list[str] = [],
938
+ client: KitsuClient = default,
939
+ ) -> dict:
830
940
  """
831
941
  Add comment to given task. Each comment requires a task_status. Since the
832
942
  addition of comment triggers a task status change. Comment text can be
@@ -837,10 +947,10 @@ def add_comment(
837
947
  task_status (str / dict): The task status dict or ID.
838
948
  comment (str): Comment text
839
949
  person (str / dict): Comment author
840
- checklist (list): Comment checklist
950
+ checklist (list): Comment checklist, e.g [{"text": "Item 1", "checked": false}]
841
951
  attachments (list[file_path]): Attachments file paths
842
952
  created_at (str): Comment date
843
- links (list): List of links to add to the comment
953
+ links (list): List of URL links to add to the comment
844
954
 
845
955
  Returns:
846
956
  dict: Created comment.
@@ -878,14 +988,17 @@ def add_comment(
878
988
 
879
989
 
880
990
  def add_attachment_files_to_comment(
881
- task, comment, attachments=[], client=default
882
- ):
991
+ task: str | dict,
992
+ comment: str | dict,
993
+ attachments: str | list[str] = [],
994
+ client: KitsuClient = default,
995
+ ) -> dict:
883
996
  """
884
997
  Add attachments files to a given comment.
885
998
 
886
999
  Args:
887
- task (dict / ID): The task dict or the task ID.
888
- comment (dict / ID): The comment dict or the comment ID.
1000
+ task (str / dict): The task dict or the task ID.
1001
+ comment (str / dict): The comment dict or the comment ID.
889
1002
  attachments (list / str) : A list of path for attachments or directly the path.
890
1003
 
891
1004
  Returns:
@@ -907,7 +1020,7 @@ def add_attachment_files_to_comment(
907
1020
  )
908
1021
 
909
1022
 
910
- def get_comment(comment_id, client=default):
1023
+ def get_comment(comment_id: str, client: KitsuClient = default) -> dict:
911
1024
  """
912
1025
  Get comment instance
913
1026
 
@@ -920,7 +1033,7 @@ def get_comment(comment_id, client=default):
920
1033
  return raw.fetch_one("comments", comment_id, client=client)
921
1034
 
922
1035
 
923
- def remove_comment(comment, client=default):
1036
+ def remove_comment(comment: str | dict, client: KitsuClient = default) -> str:
924
1037
  """
925
1038
  Remove given comment and related (previews, news, notifications) from
926
1039
  database.
@@ -932,7 +1045,12 @@ def remove_comment(comment, client=default):
932
1045
  return raw.delete("data/comments/%s" % (comment["id"]), client=client)
933
1046
 
934
1047
 
935
- def create_preview(task, comment, revision=None, client=default):
1048
+ def create_preview(
1049
+ task: str | dict,
1050
+ comment: str | dict,
1051
+ revision: int | None = None,
1052
+ client: KitsuClient = default,
1053
+ ) -> dict:
936
1054
  """
937
1055
  Create a preview into given comment.
938
1056
 
@@ -957,8 +1075,11 @@ def create_preview(task, comment, revision=None, client=default):
957
1075
 
958
1076
 
959
1077
  def upload_preview_file(
960
- preview_file, file_path, normalize_movie=True, client=default
961
- ):
1078
+ preview_file: str | dict,
1079
+ file_path: str,
1080
+ normalize_movie: bool = True,
1081
+ client: KitsuClient = default,
1082
+ ) -> dict:
962
1083
  """
963
1084
  Create a preview into given comment.
964
1085
 
@@ -976,14 +1097,14 @@ def upload_preview_file(
976
1097
 
977
1098
 
978
1099
  def add_preview(
979
- task,
980
- comment,
981
- preview_file_path=None,
982
- preview_file_url=None,
983
- normalize_movie=True,
984
- revision=None,
985
- client=default,
986
- ):
1100
+ task: str | dict,
1101
+ comment: str | dict,
1102
+ preview_file_path: str | None = None,
1103
+ preview_file_url: str | None = None,
1104
+ normalize_movie: bool = True,
1105
+ revision: int | None = None,
1106
+ client: KitsuClient = default,
1107
+ ) -> dict:
987
1108
  """
988
1109
  Add a preview to given comment.
989
1110
 
@@ -995,6 +1116,7 @@ def add_preview(
995
1116
  given.
996
1117
  normalize_movie (bool): Normalize the movie or not.
997
1118
  revision (int): Revision number.
1119
+
998
1120
  Returns:
999
1121
  dict: Created preview file model.
1000
1122
  """
@@ -1015,21 +1137,21 @@ def add_preview(
1015
1137
 
1016
1138
 
1017
1139
  def publish_preview(
1018
- task,
1019
- task_status,
1020
- comment="",
1021
- person=None,
1022
- checklist=[],
1023
- attachments=[],
1024
- created_at=None,
1025
- preview_file_path=None,
1026
- preview_file_url=None,
1027
- normalize_movie=True,
1028
- revision=None,
1029
- set_thumbnail=False,
1030
- links=[],
1031
- client=default,
1032
- ):
1140
+ task: str | dict,
1141
+ task_status: str | dict,
1142
+ comment: str = "",
1143
+ person: str | dict | None = None,
1144
+ checklist: list[dict] = [],
1145
+ attachments: list[str] = [],
1146
+ created_at: str | None = None,
1147
+ preview_file_path: str | None = None,
1148
+ preview_file_url: str | None = None,
1149
+ normalize_movie: bool = True,
1150
+ revision: int | None = None,
1151
+ set_thumbnail: bool = False,
1152
+ links: list[str] = [],
1153
+ client: KitsuClient = default,
1154
+ ) -> tuple[dict, dict]:
1033
1155
  """
1034
1156
  Publish a comment and include given preview for given task and set given
1035
1157
  task status.
@@ -1050,6 +1172,7 @@ def publish_preview(
1050
1172
  revision (int): Revision number.
1051
1173
  set_thumbnail (bool): Set the preview as thumbnail of the entity.
1052
1174
  links (list): List of links to add to the comment
1175
+
1053
1176
  Returns:
1054
1177
  tuple(dict, dict): Created comment model and created preview file
1055
1178
  model.
@@ -1079,7 +1202,11 @@ def publish_preview(
1079
1202
  return new_comment, preview_file
1080
1203
 
1081
1204
 
1082
- def batch_comments(comments=[], task=None, client=default):
1205
+ def batch_comments(
1206
+ comments: list[dict] = [],
1207
+ task: str | dict | None = None,
1208
+ client: KitsuClient = default,
1209
+ ) -> list[dict]:
1083
1210
  """
1084
1211
  Publish a list of comments (with attachments and previews) for given task.
1085
1212
  Each dict comments may contain a list of attachment files path and preview
@@ -1114,7 +1241,72 @@ def batch_comments(comments=[], task=None, client=default):
1114
1241
  )
1115
1242
 
1116
1243
 
1117
- def set_main_preview(preview_file, frame_number=None, client=default):
1244
+ def create_multiple_comments(
1245
+ project: str | dict,
1246
+ comments: list[dict] = [],
1247
+ client: KitsuClient = default,
1248
+ ) -> list[dict]:
1249
+ """
1250
+ Create multiple comments at once for a specific project.
1251
+ Each comment updates the respective task status.
1252
+ Each dict comments may contain a list of attachment files path and preview
1253
+ files path in the keys "attachment_files" and "preview_files".
1254
+
1255
+ Args:
1256
+ project (str / dict): The project dict or the project ID.
1257
+ comments (list): List of comments to publish. Each comment must have
1258
+ a task_id key.
1259
+
1260
+ Returns:
1261
+ list: List of created comments.
1262
+ """
1263
+ project = normalize_model_parameter(project)
1264
+
1265
+ files = {}
1266
+ for x, comment in enumerate(comments):
1267
+ if comment.get("attachment_files"):
1268
+ for y, file_path in enumerate(comment["attachment_files"]):
1269
+ files["attachment_file-%i-%i" % (x, y)] = open(file_path, "rb")
1270
+ if comment.get("preview_files"):
1271
+ for y, file_path in enumerate(comment["preview_files"]):
1272
+ files["preview_file-%i-%i" % (x, y)] = open(file_path, "rb")
1273
+
1274
+ files["comments"] = (None, json.dumps(comments), "application/json")
1275
+ return raw.upload(
1276
+ "actions/projects/%s/tasks/comment-many" % project["id"],
1277
+ file_path=None,
1278
+ files=files,
1279
+ client=client,
1280
+ )
1281
+
1282
+
1283
+ def add_tasks_batch_comments(
1284
+ tasks: list[str | dict],
1285
+ comments_data: dict,
1286
+ client: KitsuClient = default,
1287
+ ) -> list[dict]:
1288
+ """
1289
+ Add comments to multiple tasks in a batch operation.
1290
+
1291
+ Args:
1292
+ tasks (list): List of task dicts or IDs.
1293
+ comments_data (dict): Comment data to apply to all tasks. Should contain
1294
+ task_status_id, comment text, and optionally person_id, checklist,
1295
+ attachments, etc.
1296
+
1297
+ Returns:
1298
+ list: List of created comments.
1299
+ """
1300
+ task_ids = [normalize_model_parameter(task)["id"] for task in tasks]
1301
+ data = {"task_ids": task_ids, **comments_data}
1302
+ return raw.post("actions/tasks/batch-comment", data, client=client)
1303
+
1304
+
1305
+ def set_main_preview(
1306
+ preview_file: str | dict,
1307
+ frame_number: int | None = None,
1308
+ client: KitsuClient = default,
1309
+ ) -> dict:
1118
1310
  """
1119
1311
  Set given preview as thumbnail of given entity.
1120
1312
 
@@ -1134,7 +1326,9 @@ def set_main_preview(preview_file, frame_number=None, client=default):
1134
1326
 
1135
1327
 
1136
1328
  @cache
1137
- def all_comments_for_task(task, client=default):
1329
+ def all_comments_for_task(
1330
+ task: str | dict, client: KitsuClient = default
1331
+ ) -> list[dict]:
1138
1332
  """
1139
1333
  Args:
1140
1334
  task (str / dict): The task dict or the task ID.
@@ -1147,7 +1341,9 @@ def all_comments_for_task(task, client=default):
1147
1341
 
1148
1342
 
1149
1343
  @cache
1150
- def get_last_comment_for_task(task, client=default):
1344
+ def get_last_comment_for_task(
1345
+ task: str | dict, client: KitsuClient = default
1346
+ ) -> dict | None:
1151
1347
  """
1152
1348
  Args:
1153
1349
  task (str / dict): The task dict or the task ID.
@@ -1160,7 +1356,9 @@ def get_last_comment_for_task(task, client=default):
1160
1356
 
1161
1357
 
1162
1358
  @cache
1163
- def assign_task(task, person, client=default):
1359
+ def assign_task(
1360
+ task: str | dict, person: str | dict, client: KitsuClient = default
1361
+ ) -> dict:
1164
1362
  """
1165
1363
  Assign one Person to a Task.
1166
1364
  Args:
@@ -1176,16 +1374,21 @@ def assign_task(task, person, client=default):
1176
1374
  return raw.put(path, {"task_ids": task["id"]}, client=client)
1177
1375
 
1178
1376
 
1179
- def clear_assignations(tasks, person=None, client=default):
1377
+ def clear_assignations(
1378
+ tasks: str | dict | list[str | dict],
1379
+ person: str | dict | None = None,
1380
+ client: KitsuClient = default,
1381
+ ) -> list[str]:
1180
1382
  """
1181
1383
  Clear assignations for a single or multiple tasks.
1182
1384
  If no person is given, all assignations are cleared.
1385
+
1183
1386
  Args:
1184
1387
  tasks (list / str / dict): Task dict or the task ID, single or list.
1185
1388
  person (str / dict): The person dict or the person ID.
1186
1389
 
1187
1390
  Returns:
1188
- (dict) List of affected Task IDs
1391
+ (list[str]) List of affected Task IDs
1189
1392
  """
1190
1393
  if not isinstance(tasks, list):
1191
1394
  tasks = [tasks]
@@ -1201,10 +1404,18 @@ def clear_assignations(tasks, person=None, client=default):
1201
1404
  )
1202
1405
 
1203
1406
 
1204
- def new_task_type(name, color="#000000", for_entity="Asset", client=default):
1407
+ def new_task_type(
1408
+ name: str,
1409
+ color: str = "#000000",
1410
+ for_entity: str = "Asset",
1411
+ client: KitsuClient = default,
1412
+ ) -> dict:
1205
1413
  """
1206
1414
  Create a new task type with the given name.
1207
1415
 
1416
+ If a Task Type with the given name already exists within Kitsu, it will
1417
+ be returned.
1418
+
1208
1419
  Args:
1209
1420
  name (str): The name of the task type
1210
1421
  color (str): The color of the task type as an hexadecimal string
@@ -1221,7 +1432,9 @@ def new_task_type(name, color="#000000", for_entity="Asset", client=default):
1221
1432
  return task_type
1222
1433
 
1223
1434
 
1224
- def new_task_status(name, short_name, color, client=default):
1435
+ def new_task_status(
1436
+ name: str, short_name: str, color: str, client: KitsuClient = default
1437
+ ) -> dict:
1225
1438
  """
1226
1439
  Create a new task status with the given name, short name and color.
1227
1440
 
@@ -1241,7 +1454,7 @@ def new_task_status(name, short_name, color, client=default):
1241
1454
  return raw.post("data/task-status", data, client=client)
1242
1455
 
1243
1456
 
1244
- def update_task(task, client=default):
1457
+ def update_task(task: dict, client: KitsuClient = default) -> dict:
1245
1458
  """
1246
1459
  Update given task into the API. Metadata are fully replaced by the ones
1247
1460
  set on given task.
@@ -1259,13 +1472,15 @@ def update_task(task, client=default):
1259
1472
  return raw.put("data/tasks/%s" % task["id"], task, client=client)
1260
1473
 
1261
1474
 
1262
- def update_task_data(task, data={}, client=default):
1475
+ def update_task_data(
1476
+ task: str | dict, data: dict = {}, client: KitsuClient = default
1477
+ ) -> dict:
1263
1478
  """
1264
1479
  Update the metadata for the provided task. Keys that are not provided are
1265
1480
  not changed.
1266
1481
 
1267
1482
  Args:
1268
- task (dict / ID): The task dict or ID to save in database.
1483
+ task (str / dict): The task dict or ID to save in database.
1269
1484
  data (dict): Free field to set metadata of any kind.
1270
1485
 
1271
1486
  Returns:
@@ -1282,7 +1497,7 @@ def update_task_data(task, data={}, client=default):
1282
1497
 
1283
1498
 
1284
1499
  @cache
1285
- def get_task_url(task, client=default):
1500
+ def get_task_url(task: dict, client: KitsuClient = default) -> str:
1286
1501
  """
1287
1502
  Args:
1288
1503
  task (dict): The task dict.
@@ -1301,8 +1516,11 @@ def get_task_url(task, client=default):
1301
1516
 
1302
1517
 
1303
1518
  def all_tasks_for_project(
1304
- project, task_type=None, episode=None, client=default
1305
- ):
1519
+ project: str | dict,
1520
+ task_type: str | dict | None = None,
1521
+ episode: str | dict | None = None,
1522
+ client: KitsuClient = default,
1523
+ ) -> list[dict]:
1306
1524
  """
1307
1525
  Args:
1308
1526
  project (str / dict): The project (or its ID) to get tasks from.
@@ -1310,7 +1528,7 @@ def all_tasks_for_project(
1310
1528
  episode (str / dict): The episode (or its ID) to filter tasks.
1311
1529
 
1312
1530
  Returns:
1313
- dict: Tasks related to given project.
1531
+ list[dict]: Tasks related to given project.
1314
1532
  """
1315
1533
  project = normalize_model_parameter(project)
1316
1534
  path = "/data/projects/%s/tasks" % project["id"]
@@ -1324,7 +1542,7 @@ def all_tasks_for_project(
1324
1542
  return raw.get(path, params=params, client=client)
1325
1543
 
1326
1544
 
1327
- def update_comment(comment, client=default):
1545
+ def update_comment(comment: dict, client: KitsuClient = default) -> dict:
1328
1546
  """
1329
1547
  Save given comment data into the API. Metadata are fully replaced by the ones
1330
1548
  set on given comment.
@@ -1339,7 +1557,7 @@ def update_comment(comment, client=default):
1339
1557
 
1340
1558
 
1341
1559
  @cache
1342
- def all_open_tasks(client=default):
1560
+ def all_open_tasks(client: KitsuClient = default) -> list[dict]:
1343
1561
  """
1344
1562
  Get all open tasks.
1345
1563
 
@@ -1350,7 +1568,7 @@ def all_open_tasks(client=default):
1350
1568
 
1351
1569
 
1352
1570
  @cache
1353
- def get_open_tasks_stats(client=default):
1571
+ def get_open_tasks_stats(client: KitsuClient = default) -> dict:
1354
1572
  """
1355
1573
  Get statistics for open tasks.
1356
1574
 
@@ -1361,12 +1579,14 @@ def get_open_tasks_stats(client=default):
1361
1579
 
1362
1580
 
1363
1581
  @cache
1364
- def all_previews_for_task(task, client=default):
1582
+ def all_previews_for_task(
1583
+ task: str | dict, client: KitsuClient = default
1584
+ ) -> list[dict]:
1365
1585
  """
1366
1586
  Get all previews for a task.
1367
1587
 
1368
1588
  Args:
1369
- task (dict / ID): The task dict or id.
1589
+ task (str / dict): The task dict or id.
1370
1590
 
1371
1591
  Returns:
1372
1592
  list: Previews for the task.
@@ -1376,12 +1596,14 @@ def all_previews_for_task(task, client=default):
1376
1596
 
1377
1597
 
1378
1598
  @cache
1379
- def all_open_tasks_for_person(person, client=default):
1599
+ def all_open_tasks_for_person(
1600
+ person: str | dict, client: KitsuClient = default
1601
+ ) -> list[dict]:
1380
1602
  """
1381
1603
  Get all open tasks for a person.
1382
1604
 
1383
1605
  Args:
1384
- person (dict / ID): The person dict or id.
1606
+ person (str / dict): The person dict or id.
1385
1607
 
1386
1608
  Returns:
1387
1609
  list: Open tasks for the person.
@@ -1391,13 +1613,15 @@ def all_open_tasks_for_person(person, client=default):
1391
1613
 
1392
1614
 
1393
1615
  @cache
1394
- def all_tasks_for_person_and_type(person, task_type, client=default):
1616
+ def all_tasks_for_person_and_type(
1617
+ person: str | dict, task_type: str | dict, client: KitsuClient = default
1618
+ ) -> list[dict]:
1395
1619
  """
1396
1620
  Get all tasks for a person and task type.
1397
1621
 
1398
1622
  Args:
1399
- person (dict / ID): The person dict or id.
1400
- task_type (dict / ID): The task type dict or id.
1623
+ person (str / dict): The person dict or id.
1624
+ task_type (str / dict): The task type dict or id.
1401
1625
 
1402
1626
  Returns:
1403
1627
  list: Tasks for the person and task type.
@@ -1411,29 +1635,31 @@ def all_tasks_for_person_and_type(person, task_type, client=default):
1411
1635
 
1412
1636
 
1413
1637
  @cache
1414
- def all_comments_for_project(project, client=default):
1638
+ def all_comments_for_project(
1639
+ project: str | dict, client: KitsuClient = default
1640
+ ) -> list[dict]:
1415
1641
  """
1416
1642
  Get all comments for a project.
1417
1643
 
1418
1644
  Args:
1419
- project (dict / ID): The project dict or id.
1645
+ project (str / dict): The project dict or id.
1420
1646
 
1421
1647
  Returns:
1422
1648
  list: Comments for the project.
1423
1649
  """
1424
1650
  project = normalize_model_parameter(project)
1425
- return raw.fetch_all(
1426
- "projects/%s/comments" % project["id"], client=client
1427
- )
1651
+ return raw.fetch_all("projects/%s/comments" % project["id"], client=client)
1428
1652
 
1429
1653
 
1430
1654
  @cache
1431
- def all_notifications_for_project(project, client=default):
1655
+ def all_notifications_for_project(
1656
+ project: str | dict, client: KitsuClient = default
1657
+ ) -> list[dict]:
1432
1658
  """
1433
1659
  Get all notifications for a project.
1434
1660
 
1435
1661
  Args:
1436
- project (dict / ID): The project dict or id.
1662
+ project (str / dict): The project dict or id.
1437
1663
 
1438
1664
  Returns:
1439
1665
  list: Notifications for the project.
@@ -1445,12 +1671,14 @@ def all_notifications_for_project(project, client=default):
1445
1671
 
1446
1672
 
1447
1673
  @cache
1448
- def all_preview_files_for_project(project, client=default):
1674
+ def all_preview_files_for_project(
1675
+ project: str | dict, client: KitsuClient = default
1676
+ ) -> list[dict]:
1449
1677
  """
1450
1678
  Get all preview files for a project.
1451
1679
 
1452
1680
  Args:
1453
- project (dict / ID): The project dict or id.
1681
+ project (str / dict): The project dict or id.
1454
1682
 
1455
1683
  Returns:
1456
1684
  list: Preview files for the project.
@@ -1462,12 +1690,14 @@ def all_preview_files_for_project(project, client=default):
1462
1690
 
1463
1691
 
1464
1692
  @cache
1465
- def all_subscriptions_for_project(project, client=default):
1693
+ def all_subscriptions_for_project(
1694
+ project: str | dict, client: KitsuClient = default
1695
+ ) -> list[dict]:
1466
1696
  """
1467
1697
  Get all subscriptions for a project.
1468
1698
 
1469
1699
  Args:
1470
- project (dict / ID): The project dict or id.
1700
+ project (str / dict): The project dict or id.
1471
1701
 
1472
1702
  Returns:
1473
1703
  list: Subscriptions for the project.
@@ -1479,12 +1709,14 @@ def all_subscriptions_for_project(project, client=default):
1479
1709
 
1480
1710
 
1481
1711
  @cache
1482
- def get_persons_tasks_dates(project, client=default):
1712
+ def get_persons_tasks_dates(
1713
+ project: str | dict, client: KitsuClient = default
1714
+ ) -> dict:
1483
1715
  """
1484
1716
  Get tasks dates for persons in a project.
1485
1717
 
1486
1718
  Args:
1487
- project (dict / ID): The project dict or id.
1719
+ project (str / dict): The project dict or id.
1488
1720
 
1489
1721
  Returns:
1490
1722
  dict: Tasks dates for persons.
@@ -1495,16 +1727,15 @@ def get_persons_tasks_dates(project, client=default):
1495
1727
  )
1496
1728
 
1497
1729
 
1498
- def remove_tasks_for_type(project, task_type, client=default):
1730
+ def remove_tasks_for_type(
1731
+ project: str | dict, task_type: str | dict, client: KitsuClient = default
1732
+ ) -> str:
1499
1733
  """
1500
1734
  Delete all tasks for a task type in a project.
1501
1735
 
1502
1736
  Args:
1503
- project (dict / ID): The project dict or id.
1504
- task_type (dict / ID): The task type dict or id.
1505
-
1506
- Returns:
1507
- Response: Request response object.
1737
+ project (str / dict): The project dict or id.
1738
+ task_type (str / dict): The task type dict or id.
1508
1739
  """
1509
1740
  project = normalize_model_parameter(project)
1510
1741
  task_type = normalize_model_parameter(task_type)
@@ -1515,7 +1746,9 @@ def remove_tasks_for_type(project, task_type, client=default):
1515
1746
  )
1516
1747
 
1517
1748
 
1518
- def remove_tasks_batch(tasks, client=default):
1749
+ def remove_tasks_batch(
1750
+ tasks: list[str | dict], client: KitsuClient = default
1751
+ ) -> requests.Response:
1519
1752
  """
1520
1753
  Delete multiple tasks in batch.
1521
1754
 
@@ -1525,29 +1758,27 @@ def remove_tasks_batch(tasks, client=default):
1525
1758
  Returns:
1526
1759
  Response: Request response object.
1527
1760
  """
1528
- task_ids = [
1529
- normalize_model_parameter(task)["id"] for task in tasks
1530
- ]
1761
+ task_ids = [normalize_model_parameter(task)["id"] for task in tasks]
1531
1762
  return raw.post(
1532
1763
  "data/tasks/delete-batch", {"task_ids": task_ids}, client=client
1533
1764
  )
1534
1765
 
1535
1766
 
1536
- def assign_tasks_to_person(tasks, person, client=default):
1767
+ def assign_tasks_to_person(
1768
+ tasks: list[str | dict], person: str | dict, client: KitsuClient = default
1769
+ ) -> dict:
1537
1770
  """
1538
1771
  Assign multiple tasks to a person.
1539
1772
 
1540
1773
  Args:
1541
1774
  tasks (list): List of task dicts or IDs.
1542
- person (dict / ID): The person dict or id.
1775
+ person (str / dict): The person dict or id.
1543
1776
 
1544
1777
  Returns:
1545
1778
  dict: Response information.
1546
1779
  """
1547
1780
  person = normalize_model_parameter(person)
1548
- task_ids = [
1549
- normalize_model_parameter(task)["id"] for task in tasks
1550
- ]
1781
+ task_ids = [normalize_model_parameter(task)["id"] for task in tasks]
1551
1782
  return raw.put(
1552
1783
  "data/tasks/assign",
1553
1784
  {"person_id": person["id"], "task_ids": task_ids},
@@ -1556,12 +1787,14 @@ def assign_tasks_to_person(tasks, person, client=default):
1556
1787
 
1557
1788
 
1558
1789
  @cache
1559
- def get_task_time_spent_for_date(task, date, client=default):
1790
+ def get_task_time_spent_for_date(
1791
+ task: str | dict, date: str, client: KitsuClient = default
1792
+ ) -> dict:
1560
1793
  """
1561
1794
  Get time spent for a task on a specific date.
1562
1795
 
1563
1796
  Args:
1564
- task (dict / ID): The task dict or id.
1797
+ task (str / dict): The task dict or id.
1565
1798
  date (str): Date in YYYY-MM-DD format.
1566
1799
 
1567
1800
  Returns:
@@ -1575,29 +1808,33 @@ def get_task_time_spent_for_date(task, date, client=default):
1575
1808
  )
1576
1809
 
1577
1810
 
1578
- def remove_time_spent(time_spent, client=default):
1811
+ def remove_time_spent(
1812
+ time_spent: str | dict, client: KitsuClient = default
1813
+ ) -> str:
1579
1814
  """
1580
1815
  Delete a time spent entry.
1581
1816
 
1582
1817
  Args:
1583
- time_spent (dict / ID): The time spent dict or id.
1818
+ time_spent (str / dict): The time spent dict or id.
1584
1819
 
1585
1820
  Returns:
1586
1821
  Response: Request response object.
1587
1822
  """
1588
1823
  time_spent = normalize_model_parameter(time_spent)
1589
- return raw.delete(
1590
- "data/time-spents/%s" % time_spent["id"], client=client
1591
- )
1824
+ return raw.delete("data/time-spents/%s" % time_spent["id"], client=client)
1592
1825
 
1593
1826
 
1594
- def add_preview_to_comment(comment, preview_file, client=default):
1827
+ def add_preview_to_comment(
1828
+ comment: str | dict,
1829
+ preview_file: str | dict,
1830
+ client: KitsuClient = default,
1831
+ ) -> dict:
1595
1832
  """
1596
1833
  Add a preview to a comment.
1597
1834
 
1598
1835
  Args:
1599
- comment (dict / ID): The comment dict or id.
1600
- preview_file (dict / ID): The preview file dict or id.
1836
+ comment (str / dict): The comment dict or id.
1837
+ preview_file (str / dict): The preview file dict or id.
1601
1838
 
1602
1839
  Returns:
1603
1840
  dict: Updated comment.
@@ -1611,16 +1848,17 @@ def add_preview_to_comment(comment, preview_file, client=default):
1611
1848
  )
1612
1849
 
1613
1850
 
1614
- def remove_preview_from_comment(comment, preview_file, client=default):
1851
+ def remove_preview_from_comment(
1852
+ comment: str | dict,
1853
+ preview_file: str | dict,
1854
+ client: KitsuClient = default,
1855
+ ) -> str:
1615
1856
  """
1616
1857
  Remove a preview from a comment.
1617
1858
 
1618
1859
  Args:
1619
- comment (dict / ID): The comment dict or id.
1620
- preview_file (dict / ID): The preview file dict or id.
1621
-
1622
- Returns:
1623
- Response: Request response object.
1860
+ comment (str / dict): The comment dict or id.
1861
+ preview_file (str / dict): The preview file dict or id.
1624
1862
  """
1625
1863
  comment = normalize_model_parameter(comment)
1626
1864
  preview_file = normalize_model_parameter(preview_file)
@@ -1631,12 +1869,116 @@ def remove_preview_from_comment(comment, preview_file, client=default):
1631
1869
  )
1632
1870
 
1633
1871
 
1634
- def create_shot_tasks(shot, task_types, client=default):
1872
+ def acknowledge_comment(
1873
+ task: str | dict,
1874
+ comment: str | dict,
1875
+ client: KitsuClient = default,
1876
+ ) -> dict:
1877
+ """
1878
+ Acknowledge a comment or remove the acknowledgment if it's already acknowledged.
1879
+
1880
+ Args:
1881
+ task (str / dict): The task dict or id.
1882
+ comment (str / dict): The comment dict or id.
1883
+
1884
+ Returns:
1885
+ dict: Updated comment.
1886
+ """
1887
+ task = normalize_model_parameter(task)
1888
+ comment = normalize_model_parameter(comment)
1889
+ return raw.post(
1890
+ "data/tasks/%s/comments/%s/ack" % (task["id"], comment["id"]),
1891
+ {},
1892
+ client=client,
1893
+ )
1894
+
1895
+
1896
+ def reply_to_comment(
1897
+ comment: str | dict,
1898
+ text: str,
1899
+ person: str | dict | None = None,
1900
+ client: KitsuClient = default,
1901
+ ) -> dict:
1902
+ """
1903
+ Reply to an existing comment.
1904
+
1905
+ Args:
1906
+ comment (str / dict): The comment dict or id to reply to.
1907
+ text (str): The reply text.
1908
+ person (str / dict): The person dict or id making the reply.
1909
+
1910
+ Returns:
1911
+ dict: Created reply comment.
1912
+ """
1913
+ comment = normalize_model_parameter(comment)
1914
+ data = {"text": text}
1915
+ if person is not None:
1916
+ person = normalize_model_parameter(person)
1917
+ data["person_id"] = person["id"]
1918
+ return raw.post(
1919
+ "data/comments/%s/replies" % comment["id"],
1920
+ data,
1921
+ client=client,
1922
+ )
1923
+
1924
+
1925
+ def delete_comment_attachment(
1926
+ comment: str | dict,
1927
+ attachment_file: str | dict,
1928
+ client: KitsuClient = default,
1929
+ ) -> str:
1930
+ """
1931
+ Delete an attachment from a comment.
1932
+
1933
+ Args:
1934
+ comment (str / dict): The comment dict or id.
1935
+ attachment_file (str / dict): The attachment file dict or id.
1936
+
1937
+ Returns:
1938
+ str: Request response object.
1939
+ """
1940
+ comment = normalize_model_parameter(comment)
1941
+ attachment_file = normalize_model_parameter(attachment_file)
1942
+ return raw.delete(
1943
+ "data/comments/%s/attachment-files/%s"
1944
+ % (comment["id"], attachment_file["id"]),
1945
+ client=client,
1946
+ )
1947
+
1948
+
1949
+ def delete_comment_reply(
1950
+ comment: str | dict,
1951
+ reply: str | dict,
1952
+ client: KitsuClient = default,
1953
+ ) -> str:
1954
+ """
1955
+ Delete a reply to a comment.
1956
+
1957
+ Args:
1958
+ comment (str / dict): The comment dict or id.
1959
+ reply (str / dict): The reply comment dict or id.
1960
+
1961
+ Returns:
1962
+ str: Request response object.
1963
+ """
1964
+ comment = normalize_model_parameter(comment)
1965
+ reply = normalize_model_parameter(reply)
1966
+ return raw.delete(
1967
+ "data/comments/%s/replies/%s" % (comment["id"], reply["id"]),
1968
+ client=client,
1969
+ )
1970
+
1971
+
1972
+ def create_shot_tasks(
1973
+ shot: str | dict,
1974
+ task_types: list[str | dict],
1975
+ client: KitsuClient = default,
1976
+ ) -> list[dict]:
1635
1977
  """
1636
1978
  Create tasks for a shot.
1637
1979
 
1638
1980
  Args:
1639
- shot (dict / ID): The shot dict or id.
1981
+ shot (str / dict): The shot dict or id.
1640
1982
  task_types (list): List of task type dicts or IDs.
1641
1983
 
1642
1984
  Returns:
@@ -1653,12 +1995,16 @@ def create_shot_tasks(shot, task_types, client=default):
1653
1995
  )
1654
1996
 
1655
1997
 
1656
- def create_asset_tasks(asset, task_types, client=default):
1998
+ def create_asset_tasks(
1999
+ asset: str | dict,
2000
+ task_types: list[str | dict],
2001
+ client: KitsuClient = default,
2002
+ ) -> list[dict]:
1657
2003
  """
1658
2004
  Create tasks for an asset.
1659
2005
 
1660
2006
  Args:
1661
- asset (dict / ID): The asset dict or id.
2007
+ asset (str / dict): The asset dict or id.
1662
2008
  task_types (list): List of task type dicts or IDs.
1663
2009
 
1664
2010
  Returns:
@@ -1675,12 +2021,16 @@ def create_asset_tasks(asset, task_types, client=default):
1675
2021
  )
1676
2022
 
1677
2023
 
1678
- def create_edit_tasks(edit, task_types, client=default):
2024
+ def create_edit_tasks(
2025
+ edit: str | dict,
2026
+ task_types: list[str | dict],
2027
+ client: KitsuClient = default,
2028
+ ) -> list[dict]:
1679
2029
  """
1680
2030
  Create tasks for an edit.
1681
2031
 
1682
2032
  Args:
1683
- edit (dict / ID): The edit dict or id.
2033
+ edit (str / dict): The edit dict or id.
1684
2034
  task_types (list): List of task type dicts or IDs.
1685
2035
 
1686
2036
  Returns:
@@ -1697,12 +2047,16 @@ def create_edit_tasks(edit, task_types, client=default):
1697
2047
  )
1698
2048
 
1699
2049
 
1700
- def create_concept_tasks(concept, task_types, client=default):
2050
+ def create_concept_tasks(
2051
+ concept: str | dict,
2052
+ task_types: list[str | dict],
2053
+ client: KitsuClient = default,
2054
+ ) -> list[dict]:
1701
2055
  """
1702
2056
  Create tasks for a concept.
1703
2057
 
1704
2058
  Args:
1705
- concept (dict / ID): The concept dict or id.
2059
+ concept (str / dict): The concept dict or id.
1706
2060
  task_types (list): List of task type dicts or IDs.
1707
2061
 
1708
2062
  Returns:
@@ -1719,12 +2073,16 @@ def create_concept_tasks(concept, task_types, client=default):
1719
2073
  )
1720
2074
 
1721
2075
 
1722
- def create_entity_tasks(entity, task_types, client=default):
2076
+ def create_entity_tasks(
2077
+ entity: str | dict,
2078
+ task_types: list[str | dict],
2079
+ client: KitsuClient = default,
2080
+ ) -> list[dict]:
1723
2081
  """
1724
2082
  Create tasks for an entity.
1725
2083
 
1726
2084
  Args:
1727
- entity (dict / ID): The entity dict or id.
2085
+ entity (str / dict): The entity dict or id.
1728
2086
  task_types (list): List of task type dicts or IDs.
1729
2087
 
1730
2088
  Returns: