gazu 1.0.0__py2.py3-none-any.whl → 1.0.2__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/project.py CHANGED
@@ -446,3 +446,408 @@ def remove_person_from_team(project, person, client=default):
446
446
  "data/projects/%s/team/%s" % (project["id"], person["id"]),
447
447
  client=client,
448
448
  )
449
+
450
+
451
+ @cache
452
+ def get_project_task_types(project, client=default):
453
+ """
454
+ Get task types configured for a project.
455
+
456
+ Args:
457
+ project (dict / ID): The project dict or id.
458
+
459
+ Returns:
460
+ list: The task types.
461
+ """
462
+ project = normalize_model_parameter(project)
463
+ return raw.fetch_all(
464
+ "projects/%s/settings/task-types" % project["id"], client=client
465
+ )
466
+
467
+
468
+ @cache
469
+ def get_project_task_statuses(project, client=default):
470
+ """
471
+ Get task statuses configured for a project.
472
+
473
+ Args:
474
+ project (dict / ID): The project dict or id.
475
+
476
+ Returns:
477
+ list: The task statuses.
478
+ """
479
+ project = normalize_model_parameter(project)
480
+ return raw.fetch_all(
481
+ "projects/%s/settings/task-status" % project["id"], client=client
482
+ )
483
+
484
+
485
+ @cache
486
+ def all_status_automations(project, client=default):
487
+ """
488
+ Get status automations configured for a project.
489
+
490
+ Args:
491
+ project (dict / ID): The project dict or id.
492
+
493
+ Returns:
494
+ list: The status automations.
495
+ """
496
+ project = normalize_model_parameter(project)
497
+ return raw.fetch_all(
498
+ "projects/%s/settings/status-automations" % project["id"],
499
+ client=client,
500
+ )
501
+
502
+
503
+ def add_status_automation(project, automation, client=default):
504
+ """
505
+ Add a status automation to the project.
506
+
507
+ Args:
508
+ project (dict / ID): The project dict or id.
509
+ automation (dict): The automation payload (e.g. from/to status, task_type, rules).
510
+ """
511
+ project = normalize_model_parameter(project)
512
+ return raw.post(
513
+ "data/projects/%s/settings/status-automations" % project["id"],
514
+ automation,
515
+ client=client,
516
+ )
517
+
518
+
519
+ def remove_status_automation(project, automation, client=default):
520
+ """
521
+ Remove a status automation from the project.
522
+
523
+ Args:
524
+ project (dict / ID): The project dict or id.
525
+ automation (dict / ID): The automation dict or id.
526
+ """
527
+ project = normalize_model_parameter(project)
528
+ automation = normalize_model_parameter(automation)
529
+ return raw.delete(
530
+ "data/projects/%s/settings/status-automations/%s"
531
+ % (project["id"], automation["id"]),
532
+ client=client,
533
+ )
534
+
535
+
536
+ @cache
537
+ def get_preview_background_files(project, client=default):
538
+ """
539
+ Get preview background files configured for a project.
540
+
541
+ Args:
542
+ project (dict / ID): The project dict or id.
543
+ """
544
+ project = normalize_model_parameter(project)
545
+ return raw.fetch_all(
546
+ "projects/%s/preview-background-files" % project["id"], client=client
547
+ )
548
+
549
+
550
+ def add_preview_background_file(project, background_file, client=default):
551
+ """
552
+ Add a preview background file to a project.
553
+
554
+ Args:
555
+ project (dict / ID): The project dict or id.
556
+ background_file (dict): Payload describing the background file to add.
557
+ """
558
+ project = normalize_model_parameter(project)
559
+ return raw.post(
560
+ "data/projects/%s/preview-background-files" % project["id"],
561
+ background_file,
562
+ client=client,
563
+ )
564
+
565
+
566
+ def remove_preview_background_file(project, background_file, client=default):
567
+ """
568
+ Remove a preview background file from a project.
569
+
570
+ Args:
571
+ project (dict / ID): The project dict or id.
572
+ background_file (dict / ID): The background file dict or id.
573
+ """
574
+ project = normalize_model_parameter(project)
575
+ background_file = normalize_model_parameter(background_file)
576
+ return raw.delete(
577
+ "data/projects/%s/preview-background-files/%s"
578
+ % (project["id"], background_file["id"]),
579
+ client=client,
580
+ )
581
+
582
+
583
+ @cache
584
+ def get_milestones(project, client=default):
585
+ """
586
+ Get production milestones for a project.
587
+
588
+ Args:
589
+ project (dict / ID): The project dict or id.
590
+ """
591
+ project = normalize_model_parameter(project)
592
+ return raw.fetch_all(
593
+ "projects/%s/milestones" % project["id"], client=client
594
+ )
595
+
596
+
597
+ @cache
598
+ def get_project_quotas(project, client=default):
599
+ """
600
+ Get quotas for a project.
601
+
602
+ Args:
603
+ project (dict / ID): The project dict or id.
604
+ """
605
+ project = normalize_model_parameter(project)
606
+ return raw.fetch_all(
607
+ "projects/%s/quotas" % project["id"], client=client
608
+ )
609
+
610
+
611
+ @cache
612
+ def get_project_person_quotas(project, person, client=default):
613
+ """
614
+ Get quotas for a person within a project.
615
+
616
+ Args:
617
+ project (dict / ID): The project dict or id.
618
+ person (dict / ID): The person dict or id.
619
+ """
620
+ project = normalize_model_parameter(project)
621
+ person = normalize_model_parameter(person)
622
+ return raw.fetch_all(
623
+ "projects/%s/person-quotas" % project["id"],
624
+ params={"person_id": person["id"]},
625
+ client=client,
626
+ )
627
+
628
+
629
+ @cache
630
+ def get_budgets(project, client=default):
631
+ """
632
+ Get budgets for a project.
633
+
634
+ Args:
635
+ project (dict / ID): The project dict or id.
636
+ """
637
+ project = normalize_model_parameter(project)
638
+ return raw.fetch_all("projects/%s/budgets" % project["id"], client=client)
639
+
640
+
641
+ def create_budget(
642
+ project,
643
+ name,
644
+ description=None,
645
+ currency=None,
646
+ start_date=None,
647
+ end_date=None,
648
+ amount=None,
649
+ client=default,
650
+ ):
651
+ """
652
+ Create a budget for a project.
653
+
654
+ Args:
655
+ project (dict / ID): The project dict or id.
656
+ name (str): Budget name. Required.
657
+ description (str, optional): Human description.
658
+ currency (str, optional): Currency code (e.g. "USD", "EUR").
659
+ start_date (str, optional): Start date ISO format (YYYY-MM-DD).
660
+ end_date (str, optional): End date ISO format (YYYY-MM-DD).
661
+ amount (number, optional): Overall budget amount.
662
+ """
663
+ project = normalize_model_parameter(project)
664
+ data = {"name": name}
665
+ if description is not None:
666
+ data["description"] = description
667
+ if currency is not None:
668
+ data["currency"] = currency
669
+ if start_date is not None:
670
+ data["start_date"] = start_date
671
+ if end_date is not None:
672
+ data["end_date"] = end_date
673
+ if amount is not None:
674
+ data["amount"] = amount
675
+ return raw.post(
676
+ "data/projects/%s/budgets" % project["id"], data, client=client
677
+ )
678
+
679
+
680
+ @cache
681
+ def get_budget(project, budget, client=default):
682
+ """
683
+ Get a specific budget.
684
+
685
+ Args:
686
+ project (dict / ID): The project dict or id.
687
+ budget (dict / ID): The budget dict or id.
688
+ """
689
+ project = normalize_model_parameter(project)
690
+ budget = normalize_model_parameter(budget)
691
+ return raw.fetch_one(
692
+ "projects/%s/budgets" % project["id"], budget["id"], client=client
693
+ )
694
+
695
+
696
+ def update_budget(project, budget, data, client=default):
697
+ """
698
+ Update a specific budget.
699
+
700
+ Args:
701
+ project (dict / ID): The project dict or id.
702
+ budget (dict / ID): The budget dict or id.
703
+ data (dict): The updated budget payload.
704
+ """
705
+ project = normalize_model_parameter(project)
706
+ budget = normalize_model_parameter(budget)
707
+ return raw.put(
708
+ "data/projects/%s/budgets/%s" % (project["id"], budget["id"]),
709
+ data,
710
+ client=client,
711
+ )
712
+
713
+
714
+ def remove_budget(project, budget, client=default):
715
+ """
716
+ Delete a specific budget.
717
+
718
+ Args:
719
+ project (dict / ID): The project dict or id.
720
+ budget (dict / ID): The budget dict or id.
721
+ """
722
+ project = normalize_model_parameter(project)
723
+ budget = normalize_model_parameter(budget)
724
+ return raw.delete(
725
+ "data/projects/%s/budgets/%s" % (project["id"], budget["id"]),
726
+ client=client,
727
+ )
728
+
729
+
730
+ @cache
731
+ def get_budget_entries(project, budget, client=default):
732
+ """
733
+ Get entries for a specific budget.
734
+
735
+ Args:
736
+ project (dict / ID): The project dict or id.
737
+ budget (dict / ID): The budget dict or id.
738
+ """
739
+ project = normalize_model_parameter(project)
740
+ budget = normalize_model_parameter(budget)
741
+ return raw.fetch_all(
742
+ "projects/%s/budgets/%s/entries" % (project["id"], budget["id"]),
743
+ client=client,
744
+ )
745
+
746
+
747
+ def create_budget_entry(
748
+ project,
749
+ budget,
750
+ name,
751
+ date=None,
752
+ amount=None,
753
+ quantity=None,
754
+ unit_price=None,
755
+ description=None,
756
+ category=None,
757
+ client=default,
758
+ ):
759
+ """
760
+ Create a budget entry for a specific budget.
761
+
762
+ Args:
763
+ project (dict / ID): The project dict or id.
764
+ budget (dict / ID): The budget dict or id.
765
+ name (str): Entry name. Required.
766
+ date (str, optional): Entry date in ISO format (YYYY-MM-DD).
767
+ amount (number, optional): Total amount for the entry.
768
+ quantity (number, optional): Quantity used to compute amount.
769
+ unit_price (number, optional): Unit price used with quantity.
770
+ description (str, optional): Human description for the entry.
771
+ category (str, optional): Category label for the entry.
772
+ """
773
+ project = normalize_model_parameter(project)
774
+ budget = normalize_model_parameter(budget)
775
+ data = {"name": name}
776
+ if date is not None:
777
+ data["date"] = date
778
+ if amount is not None:
779
+ data["amount"] = amount
780
+ if quantity is not None:
781
+ data["quantity"] = quantity
782
+ if unit_price is not None:
783
+ data["unit_price"] = unit_price
784
+ if description is not None:
785
+ data["description"] = description
786
+ if category is not None:
787
+ data["category"] = category
788
+ return raw.post(
789
+ "data/projects/%s/budgets/%s/entries"
790
+ % (project["id"], budget["id"]),
791
+ data,
792
+ client=client,
793
+ )
794
+
795
+
796
+ @cache
797
+ def get_budget_entry(project, budget, entry, client=default):
798
+ """
799
+ Get a specific budget entry.
800
+
801
+ Args:
802
+ project (dict / ID): The project dict or id.
803
+ budget (dict / ID): The budget dict or id.
804
+ entry (dict / ID): The budget entry dict or id.
805
+ """
806
+ project = normalize_model_parameter(project)
807
+ budget = normalize_model_parameter(budget)
808
+ entry = normalize_model_parameter(entry)
809
+ return raw.fetch_one(
810
+ "projects/%s/budgets/%s/entries" % (project["id"], budget["id"]),
811
+ entry["id"],
812
+ client=client,
813
+ )
814
+
815
+
816
+ def update_budget_entry(project, budget, entry, data, client=default):
817
+ """
818
+ Update a specific budget entry.
819
+
820
+ Args:
821
+ project (dict / ID): The project dict or id.
822
+ budget (dict / ID): The budget dict or id.
823
+ entry (dict / ID): The budget entry dict or id.
824
+ data (dict): The updated budget entry payload.
825
+ """
826
+ project = normalize_model_parameter(project)
827
+ budget = normalize_model_parameter(budget)
828
+ entry = normalize_model_parameter(entry)
829
+ return raw.put(
830
+ "data/projects/%s/budgets/%s/entries/%s"
831
+ % (project["id"], budget["id"], entry["id"]),
832
+ data,
833
+ client=client,
834
+ )
835
+
836
+
837
+ def remove_budget_entry(project, budget, entry, client=default):
838
+ """
839
+ Delete a specific budget entry.
840
+
841
+ Args:
842
+ project (dict / ID): The project dict or id.
843
+ budget (dict / ID): The budget dict or id.
844
+ entry (dict / ID): The budget entry dict or id.
845
+ """
846
+ project = normalize_model_parameter(project)
847
+ budget = normalize_model_parameter(budget)
848
+ entry = normalize_model_parameter(entry)
849
+ return raw.delete(
850
+ "data/projects/%s/budgets/%s/entries/%s"
851
+ % (project["id"], budget["id"], entry["id"]),
852
+ client=client,
853
+ )
gazu/search.py ADDED
@@ -0,0 +1,35 @@
1
+ from . import client as raw
2
+
3
+ from .helpers import normalize_model_parameter
4
+
5
+ default = raw.default_client
6
+
7
+
8
+ def search_entities(query, project=None, entity_types=None, client=default):
9
+ """
10
+ Search for entities matching the given query.
11
+
12
+ Args:
13
+ query (str): Search query string.
14
+ project (dict / ID): Optional project to limit search to.
15
+ entity_types (list): Optional list of entity type dicts or IDs to filter by.
16
+
17
+ Returns:
18
+ dict: Dictionary with entity type keys ("persons", "assets", "shots")
19
+ containing lists of matching entities for each type.
20
+ """
21
+ data = {"query": query}
22
+
23
+ if project is not None:
24
+ project = normalize_model_parameter(project)
25
+ data["project_id"] = project["id"]
26
+
27
+ if entity_types is not None:
28
+ entity_type_ids = [
29
+ normalize_model_parameter(entity_type)["id"]
30
+ for entity_type in entity_types
31
+ ]
32
+ data["entity_types"] = entity_type_ids
33
+
34
+ return raw.post("data/search", data, client=client)
35
+