Ayon-Python-Api 0.2.0__tar.gz → 0.2.2__tar.gz
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.
- {ayon-python-api-0.2.0/ayon_python_api.egg-info → ayon-python-api-0.2.2}/PKG-INFO +1 -1
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/__init__.py +43 -2
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/_api.py +97 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/entity_hub.py +88 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/server_api.py +655 -55
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/version.py +1 -1
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2/ayon_python_api.egg-info}/PKG-INFO +1 -1
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/pyproject.toml +2 -2
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/LICENSE +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/README.md +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/constants.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/events.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/graphql.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/operations.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/thumbnails.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_api/utils.py +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/setup.cfg +0 -0
- {ayon-python-api-0.2.0 → ayon-python-api-0.2.2}/setup.py +0 -0
|
@@ -59,13 +59,31 @@ from ._api import (
|
|
|
59
59
|
get_addon_url,
|
|
60
60
|
download_addon_private_file,
|
|
61
61
|
|
|
62
|
+
get_installers,
|
|
63
|
+
create_installer,
|
|
64
|
+
update_installer,
|
|
65
|
+
delete_installer,
|
|
66
|
+
download_installer,
|
|
67
|
+
upload_installer,
|
|
68
|
+
|
|
62
69
|
get_dependencies_info,
|
|
63
70
|
update_dependency_info,
|
|
71
|
+
get_dependency_packages,
|
|
72
|
+
create_dependency_package,
|
|
73
|
+
update_dependency_package,
|
|
74
|
+
delete_dependency_package,
|
|
64
75
|
|
|
65
76
|
download_dependency_package,
|
|
66
77
|
upload_dependency_package,
|
|
67
|
-
delete_dependency_package,
|
|
68
78
|
|
|
79
|
+
get_bundles,
|
|
80
|
+
create_bundle,
|
|
81
|
+
update_bundle,
|
|
82
|
+
delete_bundle,
|
|
83
|
+
|
|
84
|
+
get_info,
|
|
85
|
+
get_server_version,
|
|
86
|
+
get_server_version_tuple,
|
|
69
87
|
get_user,
|
|
70
88
|
get_users,
|
|
71
89
|
|
|
@@ -87,15 +105,18 @@ from ._api import (
|
|
|
87
105
|
get_addons_project_settings,
|
|
88
106
|
get_addons_settings,
|
|
89
107
|
|
|
108
|
+
get_project_names,
|
|
90
109
|
get_projects,
|
|
91
110
|
get_project,
|
|
92
111
|
create_project,
|
|
112
|
+
update_project,
|
|
93
113
|
delete_project,
|
|
94
114
|
|
|
95
115
|
get_folder_by_id,
|
|
96
116
|
get_folder_by_name,
|
|
97
117
|
get_folder_by_path,
|
|
98
118
|
get_folders,
|
|
119
|
+
get_folders_hierarchy,
|
|
99
120
|
|
|
100
121
|
get_tasks,
|
|
101
122
|
|
|
@@ -218,13 +239,31 @@ __all__ = (
|
|
|
218
239
|
"get_addon_url",
|
|
219
240
|
"download_addon_private_file",
|
|
220
241
|
|
|
242
|
+
"get_installers",
|
|
243
|
+
"create_installer",
|
|
244
|
+
"update_installer",
|
|
245
|
+
"delete_installer",
|
|
246
|
+
"download_installer",
|
|
247
|
+
"upload_installer",
|
|
248
|
+
|
|
221
249
|
"get_dependencies_info",
|
|
222
250
|
"update_dependency_info",
|
|
251
|
+
"get_dependency_packages",
|
|
252
|
+
"create_dependency_package",
|
|
253
|
+
"update_dependency_package",
|
|
254
|
+
"delete_dependency_package",
|
|
223
255
|
|
|
224
256
|
"download_dependency_package",
|
|
225
257
|
"upload_dependency_package",
|
|
226
|
-
"delete_dependency_package",
|
|
227
258
|
|
|
259
|
+
"get_bundles",
|
|
260
|
+
"create_bundle",
|
|
261
|
+
"update_bundle",
|
|
262
|
+
"delete_bundle",
|
|
263
|
+
|
|
264
|
+
"get_info",
|
|
265
|
+
"get_server_version",
|
|
266
|
+
"get_server_version_tuple",
|
|
228
267
|
"get_user",
|
|
229
268
|
"get_users",
|
|
230
269
|
|
|
@@ -245,9 +284,11 @@ __all__ = (
|
|
|
245
284
|
"get_addons_project_settings",
|
|
246
285
|
"get_addons_settings",
|
|
247
286
|
|
|
287
|
+
"get_project_names",
|
|
248
288
|
"get_projects",
|
|
249
289
|
"get_project",
|
|
250
290
|
"create_project",
|
|
291
|
+
"update_project",
|
|
251
292
|
"delete_project",
|
|
252
293
|
|
|
253
294
|
"get_folder_by_id",
|
|
@@ -531,6 +531,53 @@ def download_addon_private_file(*args, **kwargs):
|
|
|
531
531
|
return con.download_addon_private_file(*args, **kwargs)
|
|
532
532
|
|
|
533
533
|
|
|
534
|
+
def get_info(*args, **kwargs):
|
|
535
|
+
con = get_server_api_connection()
|
|
536
|
+
return con.get_info(*args, **kwargs)
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
def get_server_version(*args, **kwargs):
|
|
540
|
+
con = get_server_api_connection()
|
|
541
|
+
return con.get_server_version(*args, **kwargs)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
def get_server_version_tuple(*args, **kwargs):
|
|
545
|
+
con = get_server_api_connection()
|
|
546
|
+
return con.get_server_version_tuple(*args, **kwargs)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
# Installers
|
|
550
|
+
def get_installers(*args, **kwargs):
|
|
551
|
+
con = get_server_api_connection()
|
|
552
|
+
return con.get_installers(*args, **kwargs)
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
def create_installer(*args, **kwargs):
|
|
556
|
+
con = get_server_api_connection()
|
|
557
|
+
return con.create_installer(*args, **kwargs)
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def update_installer(*args, **kwargs):
|
|
561
|
+
con = get_server_api_connection()
|
|
562
|
+
return con.update_installer(*args, **kwargs)
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
def delete_installer(*args, **kwargs):
|
|
566
|
+
con = get_server_api_connection()
|
|
567
|
+
return con.delete_installer(*args, **kwargs)
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
def download_installer(*args, **kwargs):
|
|
571
|
+
con = get_server_api_connection()
|
|
572
|
+
con.download_installer(*args, **kwargs)
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
def upload_installer(*args, **kwargs):
|
|
576
|
+
con = get_server_api_connection()
|
|
577
|
+
con.upload_installer(*args, **kwargs)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
# Dependency packages
|
|
534
581
|
def get_dependencies_info(*args, **kwargs):
|
|
535
582
|
con = get_server_api_connection()
|
|
536
583
|
return con.get_dependencies_info(*args, **kwargs)
|
|
@@ -551,6 +598,21 @@ def upload_dependency_package(*args, **kwargs):
|
|
|
551
598
|
return con.upload_dependency_package(*args, **kwargs)
|
|
552
599
|
|
|
553
600
|
|
|
601
|
+
def get_dependency_packages(*args, **kwargs):
|
|
602
|
+
con = get_server_api_connection()
|
|
603
|
+
return con.get_dependency_packages(*args, **kwargs)
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def create_dependency_package(*args, **kwargs):
|
|
607
|
+
con = get_server_api_connection()
|
|
608
|
+
return con.create_dependency_package(*args, **kwargs)
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
def update_dependency_package(*args, **kwargs):
|
|
612
|
+
con = get_server_api_connection()
|
|
613
|
+
return con.update_dependency_package(*args, **kwargs)
|
|
614
|
+
|
|
615
|
+
|
|
554
616
|
def delete_dependency_package(*args, **kwargs):
|
|
555
617
|
con = get_server_api_connection()
|
|
556
618
|
return con.delete_dependency_package(*args, **kwargs)
|
|
@@ -561,6 +623,26 @@ def get_project_anatomy_presets(*args, **kwargs):
|
|
|
561
623
|
return con.get_project_anatomy_presets(*args, **kwargs)
|
|
562
624
|
|
|
563
625
|
|
|
626
|
+
def get_bundles(*args, **kwargs):
|
|
627
|
+
con = get_server_api_connection()
|
|
628
|
+
return con.get_bundles(*args, **kwargs)
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def create_bundle(*args, **kwargs):
|
|
632
|
+
con = get_server_api_connection()
|
|
633
|
+
return con.create_bundle(*args, **kwargs)
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
def update_bundle(*args, **kwargs):
|
|
637
|
+
con = get_server_api_connection()
|
|
638
|
+
return con.update_bundle(*args, **kwargs)
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
def delete_bundle(*args, **kwargs):
|
|
642
|
+
con = get_server_api_connection()
|
|
643
|
+
return con.delete_bundle(*args, **kwargs)
|
|
644
|
+
|
|
645
|
+
|
|
564
646
|
def get_project_anatomy_preset(*args, **kwargs):
|
|
565
647
|
con = get_server_api_connection()
|
|
566
648
|
return con.get_project_anatomy_preset(*args, **kwargs)
|
|
@@ -621,6 +703,11 @@ def get_addons_settings(*args, **kwargs):
|
|
|
621
703
|
return con.get_addons_settings(*args, **kwargs)
|
|
622
704
|
|
|
623
705
|
|
|
706
|
+
def get_project_names(*args, **kwargs):
|
|
707
|
+
con = get_server_api_connection()
|
|
708
|
+
return con.get_project_names(*args, **kwargs)
|
|
709
|
+
|
|
710
|
+
|
|
624
711
|
def get_project(*args, **kwargs):
|
|
625
712
|
con = get_server_api_connection()
|
|
626
713
|
return con.get_project(*args, **kwargs)
|
|
@@ -636,6 +723,11 @@ def get_folders(*args, **kwargs):
|
|
|
636
723
|
return con.get_folders(*args, **kwargs)
|
|
637
724
|
|
|
638
725
|
|
|
726
|
+
def get_folders_hierarchy(*args, **kwargs):
|
|
727
|
+
con = get_server_api_connection()
|
|
728
|
+
return con.get_folders_hierarchy(*args, **kwargs)
|
|
729
|
+
|
|
730
|
+
|
|
639
731
|
def get_tasks(*args, **kwargs):
|
|
640
732
|
con = get_server_api_connection()
|
|
641
733
|
return con.get_tasks(*args, **kwargs)
|
|
@@ -801,6 +893,11 @@ def create_project(
|
|
|
801
893
|
)
|
|
802
894
|
|
|
803
895
|
|
|
896
|
+
def update_project(project_name, *args, **kwargs):
|
|
897
|
+
con = get_server_api_connection()
|
|
898
|
+
return con.update_project(project_name, *args, **kwargs)
|
|
899
|
+
|
|
900
|
+
|
|
804
901
|
def delete_project(project_name):
|
|
805
902
|
con = get_server_api_connection()
|
|
806
903
|
return con.delete_project(project_name)
|
|
@@ -683,6 +683,82 @@ class EntityHub(object):
|
|
|
683
683
|
"entityId": entity.id
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
def _pre_commit_types_changes(
|
|
687
|
+
self, project_changes, orig_types, changes_key, post_changes
|
|
688
|
+
):
|
|
689
|
+
"""Compare changes of types on a project.
|
|
690
|
+
|
|
691
|
+
Compare old and new types. Change project changes content if some old
|
|
692
|
+
types were removed. In that case the final change of types will
|
|
693
|
+
happen when all other entities have changed.
|
|
694
|
+
|
|
695
|
+
Args:
|
|
696
|
+
project_changes (dict[str, Any]): Project changes.
|
|
697
|
+
orig_types (list[dict[str, Any]]): Original types.
|
|
698
|
+
changes_key (Literal[folderTypes, taskTypes]): Key of type changes
|
|
699
|
+
in project changes.
|
|
700
|
+
post_changes (dict[str, Any]): An object where post changes will
|
|
701
|
+
be stored.
|
|
702
|
+
"""
|
|
703
|
+
|
|
704
|
+
if changes_key not in project_changes:
|
|
705
|
+
return
|
|
706
|
+
|
|
707
|
+
new_types = project_changes[changes_key]
|
|
708
|
+
|
|
709
|
+
orig_types_by_name = {
|
|
710
|
+
type_info["name"]: type_info
|
|
711
|
+
for type_info in orig_types
|
|
712
|
+
}
|
|
713
|
+
new_names = {
|
|
714
|
+
type_info["name"]
|
|
715
|
+
for type_info in new_types
|
|
716
|
+
}
|
|
717
|
+
diff_names = set(orig_types_by_name) - new_names
|
|
718
|
+
if not diff_names:
|
|
719
|
+
return
|
|
720
|
+
|
|
721
|
+
# Create copy of folder type changes to post changes
|
|
722
|
+
# - post changes will be commited at the end
|
|
723
|
+
post_changes[changes_key] = copy.deepcopy(new_types)
|
|
724
|
+
|
|
725
|
+
for type_name in diff_names:
|
|
726
|
+
new_types.append(orig_types_by_name[type_name])
|
|
727
|
+
|
|
728
|
+
def _pre_commit_project(self):
|
|
729
|
+
"""Some project changes cannot be committed before hierarchy changes.
|
|
730
|
+
|
|
731
|
+
It is not possible to change folder types or task types if there are
|
|
732
|
+
existing hierarchy items using the removed types. For that purposes
|
|
733
|
+
is first committed union of all old and new types and post changes
|
|
734
|
+
are prepared when all existing entities are changed.
|
|
735
|
+
|
|
736
|
+
Returns:
|
|
737
|
+
dict[str, Any]: Changes that will be committed after hierarchy
|
|
738
|
+
changes.
|
|
739
|
+
"""
|
|
740
|
+
|
|
741
|
+
project_changes = self.project_entity.changes
|
|
742
|
+
|
|
743
|
+
post_changes = {}
|
|
744
|
+
if not project_changes:
|
|
745
|
+
return post_changes
|
|
746
|
+
|
|
747
|
+
self._pre_commit_types_changes(
|
|
748
|
+
project_changes,
|
|
749
|
+
self.project_entity.get_orig_folder_types(),
|
|
750
|
+
"folderType",
|
|
751
|
+
post_changes
|
|
752
|
+
)
|
|
753
|
+
self._pre_commit_types_changes(
|
|
754
|
+
project_changes,
|
|
755
|
+
self.project_entity.get_orig_task_types(),
|
|
756
|
+
"taskType",
|
|
757
|
+
post_changes
|
|
758
|
+
)
|
|
759
|
+
self._connection.update_project(self.project_name, **project_changes)
|
|
760
|
+
return post_changes
|
|
761
|
+
|
|
686
762
|
def commit_changes(self):
|
|
687
763
|
"""Commit any changes that happened on entities.
|
|
688
764
|
|
|
@@ -690,6 +766,9 @@ class EntityHub(object):
|
|
|
690
766
|
Use Operations Session instead of known operations body.
|
|
691
767
|
"""
|
|
692
768
|
|
|
769
|
+
post_project_changes = self._pre_commit_project()
|
|
770
|
+
self.project_entity.lock()
|
|
771
|
+
|
|
693
772
|
project_changes = self.project_entity.changes
|
|
694
773
|
if project_changes:
|
|
695
774
|
response = self._connection.patch(
|
|
@@ -760,6 +839,9 @@ class EntityHub(object):
|
|
|
760
839
|
self._connection.send_batch_operations(
|
|
761
840
|
self.project_name, operations_body
|
|
762
841
|
)
|
|
842
|
+
if post_project_changes:
|
|
843
|
+
self._connection.update_project(
|
|
844
|
+
self.project_name, **post_project_changes)
|
|
763
845
|
|
|
764
846
|
self.lock()
|
|
765
847
|
|
|
@@ -1463,6 +1545,9 @@ class ProjectEntity(BaseEntity):
|
|
|
1463
1545
|
|
|
1464
1546
|
parent = property(get_parent, set_parent)
|
|
1465
1547
|
|
|
1548
|
+
def get_orig_folder_types(self):
|
|
1549
|
+
return copy.deepcopy(self._orig_folder_types)
|
|
1550
|
+
|
|
1466
1551
|
def get_folder_types(self):
|
|
1467
1552
|
return copy.deepcopy(self._folder_types)
|
|
1468
1553
|
|
|
@@ -1474,6 +1559,9 @@ class ProjectEntity(BaseEntity):
|
|
|
1474
1559
|
new_folder_types.append(folder_type)
|
|
1475
1560
|
self._folder_types = new_folder_types
|
|
1476
1561
|
|
|
1562
|
+
def get_orig_task_types(self):
|
|
1563
|
+
return copy.deepcopy(self._orig_task_types)
|
|
1564
|
+
|
|
1477
1565
|
def get_task_types(self):
|
|
1478
1566
|
return copy.deepcopy(self._task_types)
|
|
1479
1567
|
|