ayon-python-api 1.0.4__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.4 → ayon-python-api-1.0.5}/PKG-INFO +1 -1
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/__init__.py +2 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/_api.py +51 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/entity_hub.py +36 -8
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/server_api.py +63 -14
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/version.py +1 -1
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/pyproject.toml +2 -2
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/LICENSE +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/README.md +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/constants.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/events.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/graphql.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/operations.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_api/utils.py +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-1.0.4 → ayon-python-api-1.0.5}/setup.cfg +0 -0
- {ayon-python-api-1.0.4 → 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
|
|
@@ -2585,6 +2585,7 @@ class FolderEntity(BaseEntity):
|
|
|
2585
2585
|
|
|
2586
2586
|
def lock(self):
|
|
2587
2587
|
super(FolderEntity, self).lock()
|
|
2588
|
+
self._orig_label = self._get_label_value()
|
|
2588
2589
|
self._orig_folder_type = self._folder_type
|
|
2589
2590
|
self._orig_status = self._status
|
|
2590
2591
|
self._orig_tags = copy.deepcopy(self._tags)
|
|
@@ -2608,10 +2609,7 @@ class FolderEntity(BaseEntity):
|
|
|
2608
2609
|
if self._orig_tags != self._tags:
|
|
2609
2610
|
changes["tags"] = self._tags
|
|
2610
2611
|
|
|
2611
|
-
label = self.
|
|
2612
|
-
if self._name == label:
|
|
2613
|
-
label = None
|
|
2614
|
-
|
|
2612
|
+
label = self._get_label_value()
|
|
2615
2613
|
if label != self._orig_label:
|
|
2616
2614
|
changes["label"] = label
|
|
2617
2615
|
|
|
@@ -2655,6 +2653,10 @@ class FolderEntity(BaseEntity):
|
|
|
2655
2653
|
"folderType": self.folder_type,
|
|
2656
2654
|
"parentId": parent_id,
|
|
2657
2655
|
}
|
|
2656
|
+
label = self._get_label_value()
|
|
2657
|
+
if label:
|
|
2658
|
+
output["label"] = label
|
|
2659
|
+
|
|
2658
2660
|
attrib = self.attribs.to_dict()
|
|
2659
2661
|
if attrib:
|
|
2660
2662
|
output["attrib"] = attrib
|
|
@@ -2679,6 +2681,18 @@ class FolderEntity(BaseEntity):
|
|
|
2679
2681
|
output["data"] = self._data
|
|
2680
2682
|
return output
|
|
2681
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
|
+
|
|
2682
2696
|
|
|
2683
2697
|
class TaskEntity(BaseEntity):
|
|
2684
2698
|
"""Entity representing a task on AYON server.
|
|
@@ -2734,6 +2748,7 @@ class TaskEntity(BaseEntity):
|
|
|
2734
2748
|
|
|
2735
2749
|
def lock(self):
|
|
2736
2750
|
super(TaskEntity, self).lock()
|
|
2751
|
+
self._orig_label = self._get_label_value()
|
|
2737
2752
|
self._orig_task_type = self._task_type
|
|
2738
2753
|
self._orig_status = self._status
|
|
2739
2754
|
self._orig_tags = copy.deepcopy(self._tags)
|
|
@@ -2819,10 +2834,7 @@ class TaskEntity(BaseEntity):
|
|
|
2819
2834
|
if self._orig_tags != self._tags:
|
|
2820
2835
|
changes["tags"] = self._tags
|
|
2821
2836
|
|
|
2822
|
-
label = self.
|
|
2823
|
-
if self._name == label:
|
|
2824
|
-
label = None
|
|
2825
|
-
|
|
2837
|
+
label = self._get_label_value()
|
|
2826
2838
|
if label != self._orig_label:
|
|
2827
2839
|
changes["label"] = label
|
|
2828
2840
|
|
|
@@ -2855,6 +2867,10 @@ class TaskEntity(BaseEntity):
|
|
|
2855
2867
|
"folderId": self.parent_id,
|
|
2856
2868
|
"attrib": self.attribs.to_dict(),
|
|
2857
2869
|
}
|
|
2870
|
+
label = self._get_label_value()
|
|
2871
|
+
if label:
|
|
2872
|
+
output["label"] = label
|
|
2873
|
+
|
|
2858
2874
|
attrib = self.attribs.to_dict()
|
|
2859
2875
|
if attrib:
|
|
2860
2876
|
output["attrib"] = attrib
|
|
@@ -2874,3 +2890,15 @@ class TaskEntity(BaseEntity):
|
|
|
2874
2890
|
):
|
|
2875
2891
|
output["data"] = self._data
|
|
2876
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
|
|
File without changes
|
{ayon-python-api-1.0.4 → 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
|