ayon-python-api 1.0.3__tar.gz → 1.0.5__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-1.0.3 → ayon-python-api-1.0.5}/PKG-INFO +1 -1
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/__init__.py +2 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/_api.py +51 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/constants.py +12 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/entity_hub.py +38 -12
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/server_api.py +63 -14
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/version.py +1 -1
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/pyproject.toml +2 -2
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/LICENSE +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/README.md +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/events.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/graphql.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/operations.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_api/utils.py +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/setup.cfg +0 -0
- {ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/setup.py +0 -0
|
@@ -118,6 +118,7 @@ from ._api import (
|
|
|
118
118
|
get_rest_projects,
|
|
119
119
|
get_rest_entity_by_id,
|
|
120
120
|
get_rest_folder,
|
|
121
|
+
get_rest_folders,
|
|
121
122
|
get_rest_task,
|
|
122
123
|
get_rest_product,
|
|
123
124
|
get_rest_version,
|
|
@@ -329,6 +330,7 @@ __all__ = (
|
|
|
329
330
|
"get_rest_projects",
|
|
330
331
|
"get_rest_entity_by_id",
|
|
331
332
|
"get_rest_folder",
|
|
333
|
+
"get_rest_folders",
|
|
332
334
|
"get_rest_task",
|
|
333
335
|
"get_rest_product",
|
|
334
336
|
"get_rest_version",
|
|
@@ -1917,6 +1917,51 @@ def get_rest_folder(*args, **kwargs):
|
|
|
1917
1917
|
return con.get_rest_folder(*args, **kwargs)
|
|
1918
1918
|
|
|
1919
1919
|
|
|
1920
|
+
def get_rest_folders(*args, **kwargs):
|
|
1921
|
+
"""Get simplified flat list of all project folders.
|
|
1922
|
+
|
|
1923
|
+
Get all project folders in single REST call. This can be faster than
|
|
1924
|
+
using 'get_folders' method which is using GraphQl, but does not
|
|
1925
|
+
allow any filtering, and set of fields is defined
|
|
1926
|
+
by server backend.
|
|
1927
|
+
|
|
1928
|
+
Example::
|
|
1929
|
+
|
|
1930
|
+
[
|
|
1931
|
+
{
|
|
1932
|
+
"id": "112233445566",
|
|
1933
|
+
"parentId": "112233445567",
|
|
1934
|
+
"path": "/root/parent/child",
|
|
1935
|
+
"parents": ["root", "parent"],
|
|
1936
|
+
"name": "child",
|
|
1937
|
+
"label": "Child",
|
|
1938
|
+
"folderType": "Folder",
|
|
1939
|
+
"hasTasks": False,
|
|
1940
|
+
"hasChildren": False,
|
|
1941
|
+
"taskNames": [
|
|
1942
|
+
"Compositing",
|
|
1943
|
+
],
|
|
1944
|
+
"status": "In Progress",
|
|
1945
|
+
"attrib": {},
|
|
1946
|
+
"ownAttrib": [],
|
|
1947
|
+
"updatedAt": "2023-06-12T15:37:02.420260",
|
|
1948
|
+
},
|
|
1949
|
+
...
|
|
1950
|
+
]
|
|
1951
|
+
|
|
1952
|
+
Args:
|
|
1953
|
+
project_name (str): Project name.
|
|
1954
|
+
include_attrib (Optional[bool]): Include attribute values
|
|
1955
|
+
in output. Slower to query.
|
|
1956
|
+
|
|
1957
|
+
Returns:
|
|
1958
|
+
list[dict[str, Any]]: List of folder entities.
|
|
1959
|
+
|
|
1960
|
+
"""
|
|
1961
|
+
con = get_server_api_connection()
|
|
1962
|
+
return con.get_rest_folders(*args, **kwargs)
|
|
1963
|
+
|
|
1964
|
+
|
|
1920
1965
|
def get_rest_task(*args, **kwargs):
|
|
1921
1966
|
con = get_server_api_connection()
|
|
1922
1967
|
return con.get_rest_task(*args, **kwargs)
|
|
@@ -2065,6 +2110,12 @@ def get_folders_rest(*args, **kwargs):
|
|
|
2065
2110
|
...
|
|
2066
2111
|
]
|
|
2067
2112
|
|
|
2113
|
+
Deprecated:
|
|
2114
|
+
Use 'get_rest_folders' instead. Function was renamed to match
|
|
2115
|
+
other rest functions, like 'get_rest_folder',
|
|
2116
|
+
'get_rest_project' etc. .
|
|
2117
|
+
Will be removed in '1.0.7' or '1.1.0'.
|
|
2118
|
+
|
|
2068
2119
|
Args:
|
|
2069
2120
|
project_name (str): Project name.
|
|
2070
2121
|
include_attrib (Optional[bool]): Include attribute values
|
|
@@ -72,6 +72,8 @@ DEFAULT_FOLDER_FIELDS = {
|
|
|
72
72
|
"active",
|
|
73
73
|
"thumbnailId",
|
|
74
74
|
"data",
|
|
75
|
+
"status",
|
|
76
|
+
"tags",
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
# --- Tasks ---
|
|
@@ -84,6 +86,8 @@ DEFAULT_TASK_FIELDS = {
|
|
|
84
86
|
"active",
|
|
85
87
|
"assignees",
|
|
86
88
|
"data",
|
|
89
|
+
"status",
|
|
90
|
+
"tags",
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
# --- Products ---
|
|
@@ -94,6 +98,8 @@ DEFAULT_PRODUCT_FIELDS = {
|
|
|
94
98
|
"active",
|
|
95
99
|
"productType",
|
|
96
100
|
"data",
|
|
101
|
+
"status",
|
|
102
|
+
"tags",
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
# --- Versions ---
|
|
@@ -109,6 +115,8 @@ DEFAULT_VERSION_FIELDS = {
|
|
|
109
115
|
"createdAt",
|
|
110
116
|
"updatedAt",
|
|
111
117
|
"data",
|
|
118
|
+
"status",
|
|
119
|
+
"tags",
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
# --- Representations ---
|
|
@@ -120,6 +128,8 @@ DEFAULT_REPRESENTATION_FIELDS = {
|
|
|
120
128
|
"active",
|
|
121
129
|
"versionId",
|
|
122
130
|
"data",
|
|
131
|
+
"status",
|
|
132
|
+
"tags",
|
|
123
133
|
}
|
|
124
134
|
|
|
125
135
|
REPRESENTATION_FILES_FIELDS = {
|
|
@@ -144,6 +154,8 @@ DEFAULT_WORKFILE_INFO_FIELDS = {
|
|
|
144
154
|
"updatedAt",
|
|
145
155
|
"updatedBy",
|
|
146
156
|
"data",
|
|
157
|
+
"status",
|
|
158
|
+
"tags",
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
DEFAULT_EVENT_FIELDS = {
|
|
@@ -219,6 +219,7 @@ class EntityHub(object):
|
|
|
219
219
|
entity_data = self._connection.get_task_by_id(
|
|
220
220
|
self.project_name,
|
|
221
221
|
entity_id,
|
|
222
|
+
fields=self._get_task_fields(),
|
|
222
223
|
own_attributes=True
|
|
223
224
|
)
|
|
224
225
|
else:
|
|
@@ -604,15 +605,12 @@ class EntityHub(object):
|
|
|
604
605
|
folder_fields.add("hasProducts")
|
|
605
606
|
if self._allow_data_changes:
|
|
606
607
|
folder_fields.add("data")
|
|
607
|
-
folder_fields |= {"status", "tags"}
|
|
608
608
|
return folder_fields
|
|
609
609
|
|
|
610
610
|
def _get_task_fields(self):
|
|
611
|
-
|
|
611
|
+
return set(
|
|
612
612
|
self._connection.get_default_fields_for_type("task")
|
|
613
613
|
)
|
|
614
|
-
task_fields |= {"status", "tags"}
|
|
615
|
-
return task_fields
|
|
616
614
|
|
|
617
615
|
def query_entities_from_server(self):
|
|
618
616
|
"""Query whole project at once."""
|
|
@@ -2587,6 +2585,7 @@ class FolderEntity(BaseEntity):
|
|
|
2587
2585
|
|
|
2588
2586
|
def lock(self):
|
|
2589
2587
|
super(FolderEntity, self).lock()
|
|
2588
|
+
self._orig_label = self._get_label_value()
|
|
2590
2589
|
self._orig_folder_type = self._folder_type
|
|
2591
2590
|
self._orig_status = self._status
|
|
2592
2591
|
self._orig_tags = copy.deepcopy(self._tags)
|
|
@@ -2610,10 +2609,7 @@ class FolderEntity(BaseEntity):
|
|
|
2610
2609
|
if self._orig_tags != self._tags:
|
|
2611
2610
|
changes["tags"] = self._tags
|
|
2612
2611
|
|
|
2613
|
-
label = self.
|
|
2614
|
-
if self._name == label:
|
|
2615
|
-
label = None
|
|
2616
|
-
|
|
2612
|
+
label = self._get_label_value()
|
|
2617
2613
|
if label != self._orig_label:
|
|
2618
2614
|
changes["label"] = label
|
|
2619
2615
|
|
|
@@ -2657,6 +2653,10 @@ class FolderEntity(BaseEntity):
|
|
|
2657
2653
|
"folderType": self.folder_type,
|
|
2658
2654
|
"parentId": parent_id,
|
|
2659
2655
|
}
|
|
2656
|
+
label = self._get_label_value()
|
|
2657
|
+
if label:
|
|
2658
|
+
output["label"] = label
|
|
2659
|
+
|
|
2660
2660
|
attrib = self.attribs.to_dict()
|
|
2661
2661
|
if attrib:
|
|
2662
2662
|
output["attrib"] = attrib
|
|
@@ -2681,6 +2681,18 @@ class FolderEntity(BaseEntity):
|
|
|
2681
2681
|
output["data"] = self._data
|
|
2682
2682
|
return output
|
|
2683
2683
|
|
|
2684
|
+
def _get_label_value(self):
|
|
2685
|
+
"""Get label value that will be used for operations.
|
|
2686
|
+
|
|
2687
|
+
Returns:
|
|
2688
|
+
Union[str, None]: Label value.
|
|
2689
|
+
|
|
2690
|
+
"""
|
|
2691
|
+
label = self._label
|
|
2692
|
+
if not label or self._name == label:
|
|
2693
|
+
return None
|
|
2694
|
+
return label
|
|
2695
|
+
|
|
2684
2696
|
|
|
2685
2697
|
class TaskEntity(BaseEntity):
|
|
2686
2698
|
"""Entity representing a task on AYON server.
|
|
@@ -2736,6 +2748,7 @@ class TaskEntity(BaseEntity):
|
|
|
2736
2748
|
|
|
2737
2749
|
def lock(self):
|
|
2738
2750
|
super(TaskEntity, self).lock()
|
|
2751
|
+
self._orig_label = self._get_label_value()
|
|
2739
2752
|
self._orig_task_type = self._task_type
|
|
2740
2753
|
self._orig_status = self._status
|
|
2741
2754
|
self._orig_tags = copy.deepcopy(self._tags)
|
|
@@ -2821,10 +2834,7 @@ class TaskEntity(BaseEntity):
|
|
|
2821
2834
|
if self._orig_tags != self._tags:
|
|
2822
2835
|
changes["tags"] = self._tags
|
|
2823
2836
|
|
|
2824
|
-
label = self.
|
|
2825
|
-
if self._name == label:
|
|
2826
|
-
label = None
|
|
2827
|
-
|
|
2837
|
+
label = self._get_label_value()
|
|
2828
2838
|
if label != self._orig_label:
|
|
2829
2839
|
changes["label"] = label
|
|
2830
2840
|
|
|
@@ -2857,6 +2867,10 @@ class TaskEntity(BaseEntity):
|
|
|
2857
2867
|
"folderId": self.parent_id,
|
|
2858
2868
|
"attrib": self.attribs.to_dict(),
|
|
2859
2869
|
}
|
|
2870
|
+
label = self._get_label_value()
|
|
2871
|
+
if label:
|
|
2872
|
+
output["label"] = label
|
|
2873
|
+
|
|
2860
2874
|
attrib = self.attribs.to_dict()
|
|
2861
2875
|
if attrib:
|
|
2862
2876
|
output["attrib"] = attrib
|
|
@@ -2876,3 +2890,15 @@ class TaskEntity(BaseEntity):
|
|
|
2876
2890
|
):
|
|
2877
2891
|
output["data"] = self._data
|
|
2878
2892
|
return output
|
|
2893
|
+
|
|
2894
|
+
def _get_label_value(self):
|
|
2895
|
+
"""Get label value that will be used for operations.
|
|
2896
|
+
|
|
2897
|
+
Returns:
|
|
2898
|
+
Union[str, None]: Label value.
|
|
2899
|
+
|
|
2900
|
+
"""
|
|
2901
|
+
label = self._label
|
|
2902
|
+
if not label or self._name == label:
|
|
2903
|
+
return None
|
|
2904
|
+
return label
|
|
@@ -3383,6 +3383,62 @@ class ServerAPI(object):
|
|
|
3383
3383
|
def get_rest_folder(self, project_name, folder_id):
|
|
3384
3384
|
return self.get_rest_entity_by_id(project_name, "folder", folder_id)
|
|
3385
3385
|
|
|
3386
|
+
def get_rest_folders(self, project_name, include_attrib=False):
|
|
3387
|
+
"""Get simplified flat list of all project folders.
|
|
3388
|
+
|
|
3389
|
+
Get all project folders in single REST call. This can be faster than
|
|
3390
|
+
using 'get_folders' method which is using GraphQl, but does not
|
|
3391
|
+
allow any filtering, and set of fields is defined
|
|
3392
|
+
by server backend.
|
|
3393
|
+
|
|
3394
|
+
Example::
|
|
3395
|
+
|
|
3396
|
+
[
|
|
3397
|
+
{
|
|
3398
|
+
"id": "112233445566",
|
|
3399
|
+
"parentId": "112233445567",
|
|
3400
|
+
"path": "/root/parent/child",
|
|
3401
|
+
"parents": ["root", "parent"],
|
|
3402
|
+
"name": "child",
|
|
3403
|
+
"label": "Child",
|
|
3404
|
+
"folderType": "Folder",
|
|
3405
|
+
"hasTasks": False,
|
|
3406
|
+
"hasChildren": False,
|
|
3407
|
+
"taskNames": [
|
|
3408
|
+
"Compositing",
|
|
3409
|
+
],
|
|
3410
|
+
"status": "In Progress",
|
|
3411
|
+
"attrib": {},
|
|
3412
|
+
"ownAttrib": [],
|
|
3413
|
+
"updatedAt": "2023-06-12T15:37:02.420260",
|
|
3414
|
+
},
|
|
3415
|
+
...
|
|
3416
|
+
]
|
|
3417
|
+
|
|
3418
|
+
Args:
|
|
3419
|
+
project_name (str): Project name.
|
|
3420
|
+
include_attrib (Optional[bool]): Include attribute values
|
|
3421
|
+
in output. Slower to query.
|
|
3422
|
+
|
|
3423
|
+
Returns:
|
|
3424
|
+
list[dict[str, Any]]: List of folder entities.
|
|
3425
|
+
|
|
3426
|
+
"""
|
|
3427
|
+
major, minor, patch, _, _ = self.server_version_tuple
|
|
3428
|
+
if (major, minor, patch) < (1, 0, 8):
|
|
3429
|
+
raise UnsupportedServerVersion(
|
|
3430
|
+
"Function 'get_folders_rest' is supported"
|
|
3431
|
+
" for AYON server 1.0.8 and above."
|
|
3432
|
+
)
|
|
3433
|
+
query = "?attrib={}".format(
|
|
3434
|
+
"true" if include_attrib else "false"
|
|
3435
|
+
)
|
|
3436
|
+
response = self.get(
|
|
3437
|
+
"projects/{}/folders{}".format(project_name, query)
|
|
3438
|
+
)
|
|
3439
|
+
response.raise_for_status()
|
|
3440
|
+
return response.data["folders"]
|
|
3441
|
+
|
|
3386
3442
|
def get_rest_task(self, project_name, task_id):
|
|
3387
3443
|
return self.get_rest_entity_by_id(project_name, "task", task_id)
|
|
3388
3444
|
|
|
@@ -3647,6 +3703,12 @@ class ServerAPI(object):
|
|
|
3647
3703
|
...
|
|
3648
3704
|
]
|
|
3649
3705
|
|
|
3706
|
+
Deprecated:
|
|
3707
|
+
Use 'get_rest_folders' instead. Function was renamed to match
|
|
3708
|
+
other rest functions, like 'get_rest_folder',
|
|
3709
|
+
'get_rest_project' etc. .
|
|
3710
|
+
Will be removed in '1.0.7' or '1.1.0'.
|
|
3711
|
+
|
|
3650
3712
|
Args:
|
|
3651
3713
|
project_name (str): Project name.
|
|
3652
3714
|
include_attrib (Optional[bool]): Include attribute values
|
|
@@ -3656,20 +3718,7 @@ class ServerAPI(object):
|
|
|
3656
3718
|
list[dict[str, Any]]: List of folder entities.
|
|
3657
3719
|
|
|
3658
3720
|
"""
|
|
3659
|
-
|
|
3660
|
-
if (major, minor, patch) < (1, 0, 8):
|
|
3661
|
-
raise UnsupportedServerVersion(
|
|
3662
|
-
"Function 'get_folders_rest' is supported"
|
|
3663
|
-
" for AYON server 1.0.8 and above."
|
|
3664
|
-
)
|
|
3665
|
-
query = "?attrib={}".format(
|
|
3666
|
-
"true" if include_attrib else "false"
|
|
3667
|
-
)
|
|
3668
|
-
response = self.get(
|
|
3669
|
-
"projects/{}/folders{}".format(project_name, query)
|
|
3670
|
-
)
|
|
3671
|
-
response.raise_for_status()
|
|
3672
|
-
return response.data["folders"]
|
|
3721
|
+
return self.get_rest_folders(project_name, include_attrib)
|
|
3673
3722
|
|
|
3674
3723
|
def get_folders(
|
|
3675
3724
|
self,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Package declaring Python API for AYON server."""
|
|
2
|
-
__version__ = "1.0.
|
|
2
|
+
__version__ = "1.0.5"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ayon-python-api"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.5"
|
|
4
4
|
description = "AYON Python API"
|
|
5
5
|
license = {file = "LICENSE"}
|
|
6
6
|
readme = {file = "README.md", content-type = "text/markdown"}
|
|
@@ -31,7 +31,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
31
31
|
|
|
32
32
|
[tool.poetry]
|
|
33
33
|
name = "ayon-python-api"
|
|
34
|
-
version = "1.0.
|
|
34
|
+
version = "1.0.5"
|
|
35
35
|
description = "AYON Python API"
|
|
36
36
|
authors = [
|
|
37
37
|
"ynput.io <info@ynput.io>"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ayon-python-api-1.0.3 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|