ayon-python-api 1.0.7__tar.gz → 1.0.9__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.7 → ayon-python-api-1.0.9}/PKG-INFO +1 -1
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/__init__.py +10 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/_api.py +67 -11
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/entity_hub.py +9 -6
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/graphql_queries.py +6 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/server_api.py +288 -259
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/utils.py +148 -15
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/version.py +1 -1
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/pyproject.toml +2 -2
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/LICENSE +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/README.md +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/constants.py +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/events.py +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/graphql.py +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_api/operations.py +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/setup.cfg +0 -0
- {ayon-python-api-1.0.7 → ayon-python-api-1.0.9}/setup.py +0 -0
|
@@ -3,6 +3,10 @@ from .utils import (
|
|
|
3
3
|
TransferProgress,
|
|
4
4
|
slugify_string,
|
|
5
5
|
create_dependency_package_basename,
|
|
6
|
+
get_user_by_token,
|
|
7
|
+
is_token_valid,
|
|
8
|
+
validate_url,
|
|
9
|
+
login_to_server,
|
|
6
10
|
)
|
|
7
11
|
from .server_api import (
|
|
8
12
|
RequestTypes,
|
|
@@ -67,6 +71,7 @@ from ._api import (
|
|
|
67
71
|
download_file,
|
|
68
72
|
upload_file_from_stream,
|
|
69
73
|
upload_file,
|
|
74
|
+
upload_reviewable,
|
|
70
75
|
trigger_server_restart,
|
|
71
76
|
query_graphql,
|
|
72
77
|
get_graphql_schema,
|
|
@@ -229,6 +234,10 @@ __all__ = (
|
|
|
229
234
|
"TransferProgress",
|
|
230
235
|
"slugify_string",
|
|
231
236
|
"create_dependency_package_basename",
|
|
237
|
+
"get_user_by_token",
|
|
238
|
+
"is_token_valid",
|
|
239
|
+
"validate_url",
|
|
240
|
+
"login_to_server",
|
|
232
241
|
|
|
233
242
|
"RequestTypes",
|
|
234
243
|
"ServerAPI",
|
|
@@ -290,6 +299,7 @@ __all__ = (
|
|
|
290
299
|
"download_file",
|
|
291
300
|
"upload_file_from_stream",
|
|
292
301
|
"upload_file",
|
|
302
|
+
"upload_reviewable",
|
|
293
303
|
"trigger_server_restart",
|
|
294
304
|
"query_graphql",
|
|
295
305
|
"get_graphql_schema",
|
|
@@ -18,6 +18,9 @@ from .constants import (
|
|
|
18
18
|
)
|
|
19
19
|
from .server_api import ServerAPI
|
|
20
20
|
from .exceptions import FailedServiceInit
|
|
21
|
+
from .utils import (
|
|
22
|
+
get_default_settings_variant as _get_default_settings_variant
|
|
23
|
+
)
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
class GlobalServerAPI(ServerAPI):
|
|
@@ -502,6 +505,8 @@ def get_default_settings_variant():
|
|
|
502
505
|
Union[str, None]: name of variant or None.
|
|
503
506
|
|
|
504
507
|
"""
|
|
508
|
+
if not GlobalContext.is_connection_created():
|
|
509
|
+
return _get_default_settings_variant()
|
|
505
510
|
con = get_server_api_connection()
|
|
506
511
|
return con.get_default_settings_variant()
|
|
507
512
|
|
|
@@ -722,6 +727,7 @@ def get_events(*args, **kwargs):
|
|
|
722
727
|
|
|
723
728
|
Args:
|
|
724
729
|
topics (Optional[Iterable[str]]): Name of topics.
|
|
730
|
+
event_ids (Optional[Iterable[str]]): Event ids.
|
|
725
731
|
project_names (Optional[Iterable[str]]): Project on which
|
|
726
732
|
event happened.
|
|
727
733
|
states (Optional[Iterable[str]]): Filtering by states.
|
|
@@ -746,6 +752,22 @@ def get_events(*args, **kwargs):
|
|
|
746
752
|
|
|
747
753
|
|
|
748
754
|
def update_event(*args, **kwargs):
|
|
755
|
+
"""Update event data.
|
|
756
|
+
|
|
757
|
+
Args:
|
|
758
|
+
event_id (str): Event id.
|
|
759
|
+
sender (Optional[str]): New sender of event.
|
|
760
|
+
project_name (Optional[str]): New project name.
|
|
761
|
+
username (Optional[str]): New username.
|
|
762
|
+
status (Optional[str]): New event status. Enum: "pending",
|
|
763
|
+
"in_progress", "finished", "failed", "aborted", "restarted"
|
|
764
|
+
description (Optional[str]): New description.
|
|
765
|
+
summary (Optional[dict[str, Any]]): New summary.
|
|
766
|
+
payload (Optional[dict[str, Any]]): New payload.
|
|
767
|
+
progress (Optional[int]): New progress. Range [0-100].
|
|
768
|
+
retries (Optional[int]): New retries.
|
|
769
|
+
|
|
770
|
+
"""
|
|
749
771
|
con = get_server_api_connection()
|
|
750
772
|
return con.update_event(*args, **kwargs)
|
|
751
773
|
|
|
@@ -759,7 +781,7 @@ def dispatch_event(*args, **kwargs):
|
|
|
759
781
|
event_hash (Optional[str]): Event hash.
|
|
760
782
|
project_name (Optional[str]): Project name.
|
|
761
783
|
username (Optional[str]): Username which triggered event.
|
|
762
|
-
|
|
784
|
+
depends_on (Optional[str]): Add dependency to another event.
|
|
763
785
|
description (Optional[str]): Description of event.
|
|
764
786
|
summary (Optional[dict[str, Any]]): Summary of event that can be used
|
|
765
787
|
for simple filtering on listeners.
|
|
@@ -769,6 +791,8 @@ def dispatch_event(*args, **kwargs):
|
|
|
769
791
|
store (Optional[bool]): Store event in event queue for possible
|
|
770
792
|
future processing otherwise is event send only
|
|
771
793
|
to active listeners.
|
|
794
|
+
dependencies (Optional[list[str]]): Deprecated.
|
|
795
|
+
List of event id dependencies.
|
|
772
796
|
|
|
773
797
|
Returns:
|
|
774
798
|
RestApiResponse: Response from server.
|
|
@@ -938,6 +962,29 @@ def upload_file(*args, **kwargs):
|
|
|
938
962
|
return con.upload_file(*args, **kwargs)
|
|
939
963
|
|
|
940
964
|
|
|
965
|
+
def upload_reviewable(*args, **kwargs):
|
|
966
|
+
"""Upload reviewable file to server.
|
|
967
|
+
|
|
968
|
+
Args:
|
|
969
|
+
project_name (str): Project name.
|
|
970
|
+
version_id (str): Version id.
|
|
971
|
+
filepath (str): Reviewable file path to upload.
|
|
972
|
+
label (Optional[str]): Reviewable label. Filled automatically
|
|
973
|
+
server side with filename.
|
|
974
|
+
content_type (Optional[str]): MIME type of the file.
|
|
975
|
+
filename (Optional[str]): User as original filename. Filename from
|
|
976
|
+
'filepath' is used when not filled.
|
|
977
|
+
progress (Optional[TransferProgress]): Progress.
|
|
978
|
+
headers (Optional[Dict[str, Any]]): Headers.
|
|
979
|
+
|
|
980
|
+
Returns:
|
|
981
|
+
RestApiResponse: Server response.
|
|
982
|
+
|
|
983
|
+
"""
|
|
984
|
+
con = get_server_api_connection()
|
|
985
|
+
return con.upload_reviewable(*args, **kwargs)
|
|
986
|
+
|
|
987
|
+
|
|
941
988
|
def trigger_server_restart():
|
|
942
989
|
"""Trigger server restart.
|
|
943
990
|
|
|
@@ -2347,6 +2394,8 @@ def get_folders(*args, **kwargs):
|
|
|
2347
2394
|
children. Ignored when None, default behavior.
|
|
2348
2395
|
statuses (Optional[Iterable[str]]): Folder statuses used
|
|
2349
2396
|
for filtering.
|
|
2397
|
+
assignees_all (Optional[Iterable[str]]): Filter by assigness
|
|
2398
|
+
on children tasks. Task must have all of passed assignees.
|
|
2350
2399
|
tags (Optional[Iterable[str]]): Folder tags used
|
|
2351
2400
|
for filtering.
|
|
2352
2401
|
active (Optional[bool]): Filter active/inactive folders.
|
|
@@ -2969,10 +3018,12 @@ def get_versions(*args, **kwargs):
|
|
|
2969
3018
|
version filtering.
|
|
2970
3019
|
product_ids (Optional[Iterable[str]]): Product ids used for
|
|
2971
3020
|
version filtering.
|
|
3021
|
+
task_ids (Optional[Iterable[str]]): Task ids used for
|
|
3022
|
+
version filtering.
|
|
2972
3023
|
versions (Optional[Iterable[int]]): Versions we're interested in.
|
|
2973
|
-
hero (Optional[bool]):
|
|
2974
|
-
standard (Optional[bool]):
|
|
2975
|
-
set to
|
|
3024
|
+
hero (Optional[bool]): Skip hero versions when set to False.
|
|
3025
|
+
standard (Optional[bool]): Skip standard (non-hero) when
|
|
3026
|
+
set to False.
|
|
2976
3027
|
latest (Optional[bool]): Return only latest version of standard
|
|
2977
3028
|
versions. This can be combined only with 'standard' attribute
|
|
2978
3029
|
set to True.
|
|
@@ -3227,6 +3278,7 @@ def update_version(*args, **kwargs):
|
|
|
3227
3278
|
version (Optional[int]): New version.
|
|
3228
3279
|
product_id (Optional[str]): New product id.
|
|
3229
3280
|
task_id (Optional[Union[str, None]]): New task id.
|
|
3281
|
+
author (Optional[str]): New author username.
|
|
3230
3282
|
attrib (Optional[dict[str, Any]]): New attributes.
|
|
3231
3283
|
data (Optional[dict[str, Any]]): New data.
|
|
3232
3284
|
tags (Optional[Iterable[str]]): New tags.
|
|
@@ -3254,9 +3306,10 @@ def delete_version(*args, **kwargs):
|
|
|
3254
3306
|
def get_representations(*args, **kwargs):
|
|
3255
3307
|
"""Get representation entities based on passed filters from server.
|
|
3256
3308
|
|
|
3257
|
-
|
|
3309
|
+
.. todo::
|
|
3310
|
+
|
|
3258
3311
|
Add separated function for 'names_by_version_ids' filtering.
|
|
3259
|
-
|
|
3312
|
+
Because can't be combined with others.
|
|
3260
3313
|
|
|
3261
3314
|
Args:
|
|
3262
3315
|
project_name (str): Name of project where to look for versions.
|
|
@@ -3266,7 +3319,7 @@ def get_representations(*args, **kwargs):
|
|
|
3266
3319
|
names used for representation filtering.
|
|
3267
3320
|
version_ids (Optional[Iterable[str]]): Version ids used for
|
|
3268
3321
|
representation filtering. Versions are parents of
|
|
3269
|
-
|
|
3322
|
+
representations.
|
|
3270
3323
|
names_by_version_ids (Optional[bool]): Find representations
|
|
3271
3324
|
by names and version ids. This filter discard all
|
|
3272
3325
|
other filters.
|
|
@@ -4005,7 +4058,10 @@ def delete_link(*args, **kwargs):
|
|
|
4005
4058
|
def get_entities_links(*args, **kwargs):
|
|
4006
4059
|
"""Helper method to get links from server for entity types.
|
|
4007
4060
|
|
|
4008
|
-
|
|
4061
|
+
.. highlight:: text
|
|
4062
|
+
.. code-block:: text
|
|
4063
|
+
|
|
4064
|
+
Example output:
|
|
4009
4065
|
{
|
|
4010
4066
|
"59a212c0d2e211eda0e20242ac120001": [
|
|
4011
4067
|
{
|
|
@@ -4026,12 +4082,12 @@ def get_entities_links(*args, **kwargs):
|
|
|
4026
4082
|
Args:
|
|
4027
4083
|
project_name (str): Project where links are.
|
|
4028
4084
|
entity_type (Literal["folder", "task", "product",
|
|
4029
|
-
|
|
4085
|
+
| "version", "representations"]): Entity type.
|
|
4030
4086
|
entity_ids (Optional[Iterable[str]]): Ids of entities for which
|
|
4031
|
-
|
|
4087
|
+
| links should be received.
|
|
4032
4088
|
link_types (Optional[Iterable[str]]): Link type filters.
|
|
4033
4089
|
link_direction (Optional[Literal["in", "out"]]): Link direction
|
|
4034
|
-
|
|
4090
|
+
| filter.
|
|
4035
4091
|
link_names (Optional[Iterable[str]]): Link name filters.
|
|
4036
4092
|
link_name_regex (Optional[str]): Regex filter for link name.
|
|
4037
4093
|
|
|
@@ -1029,14 +1029,17 @@ class EntityData(dict):
|
|
|
1029
1029
|
|
|
1030
1030
|
It is not possible to store 'None' to root key. In that case the key is
|
|
1031
1031
|
not stored, and removed if existed on entity.
|
|
1032
|
-
|
|
1033
1032
|
To be able to store 'None' value use nested data structure:
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1033
|
+
|
|
1034
|
+
.. highlight:: text
|
|
1035
|
+
.. code-block:: text
|
|
1036
|
+
|
|
1037
|
+
{
|
|
1038
|
+
"sceneInfo": {
|
|
1039
|
+
"description": None,
|
|
1040
|
+
"camera": "camera1"
|
|
1041
|
+
}
|
|
1038
1042
|
}
|
|
1039
|
-
}
|
|
1040
1043
|
|
|
1041
1044
|
"""
|
|
1042
1045
|
def __init__(self, *args, **kwargs):
|
|
@@ -157,6 +157,9 @@ def folders_graphql_query(fields):
|
|
|
157
157
|
has_links_var = query.add_variable("folderHasLinks", "HasLinksFilter")
|
|
158
158
|
has_children_var = query.add_variable("folderHasChildren", "Boolean!")
|
|
159
159
|
statuses_var = query.add_variable("folderStatuses", "[String!]")
|
|
160
|
+
folder_assignees_all_var = query.add_variable(
|
|
161
|
+
"folderAssigneesAll", "[String!]"
|
|
162
|
+
)
|
|
160
163
|
tags_var = query.add_variable("folderTags", "[String!]")
|
|
161
164
|
|
|
162
165
|
project_field = query.add_field("project")
|
|
@@ -170,6 +173,7 @@ def folders_graphql_query(fields):
|
|
|
170
173
|
folders_field.set_filter("pathEx", folder_path_regex_var)
|
|
171
174
|
folders_field.set_filter("folderTypes", folder_types_var)
|
|
172
175
|
folders_field.set_filter("statuses", statuses_var)
|
|
176
|
+
folders_field.set_filter("assignees", folder_assignees_all_var)
|
|
173
177
|
folders_field.set_filter("tags", tags_var)
|
|
174
178
|
folders_field.set_filter("hasProducts", has_products_var)
|
|
175
179
|
folders_field.set_filter("hasTasks", has_tasks_var)
|
|
@@ -567,6 +571,7 @@ def workfiles_info_graphql_query(fields):
|
|
|
567
571
|
def events_graphql_query(fields):
|
|
568
572
|
query = GraphQlQuery("Events")
|
|
569
573
|
topics_var = query.add_variable("eventTopics", "[String!]")
|
|
574
|
+
ids_var = query.add_variable("eventIds", "[String!]")
|
|
570
575
|
projects_var = query.add_variable("projectNames", "[String!]")
|
|
571
576
|
states_var = query.add_variable("eventStates", "[String!]")
|
|
572
577
|
users_var = query.add_variable("eventUsers", "[String!]")
|
|
@@ -576,6 +581,7 @@ def events_graphql_query(fields):
|
|
|
576
581
|
older_than_var = query.add_variable("olderThanFilter", "String!")
|
|
577
582
|
|
|
578
583
|
events_field = query.add_field_with_edges("events")
|
|
584
|
+
events_field.set_filter("ids", ids_var)
|
|
579
585
|
events_field.set_filter("topics", topics_var)
|
|
580
586
|
events_field.set_filter("projects", projects_var)
|
|
581
587
|
events_field.set_filter("states", states_var)
|