Ayon-Python-Api 0.5.4__tar.gz → 1.0.0__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.5.4 → ayon-python-api-1.0.0}/PKG-INFO +1 -1
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/__init__.py +0 -4
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/_api.py +0 -10
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/constants.py +12 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/entity_hub.py +30 -11
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/exceptions.py +4 -1
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/graphql.py +9 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/graphql_queries.py +69 -21
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/server_api.py +351 -266
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/version.py +1 -1
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/pyproject.toml +1 -1
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/LICENSE +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/README.md +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/events.py +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/operations.py +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_api/utils.py +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/setup.cfg +0 -0
- {ayon-python-api-0.5.4 → ayon-python-api-1.0.0}/setup.py +0 -0
|
@@ -75,8 +75,6 @@ from ._api import (
|
|
|
75
75
|
download_installer,
|
|
76
76
|
upload_installer,
|
|
77
77
|
|
|
78
|
-
get_dependencies_info,
|
|
79
|
-
update_dependency_info,
|
|
80
78
|
get_dependency_packages,
|
|
81
79
|
create_dependency_package,
|
|
82
80
|
update_dependency_package,
|
|
@@ -277,8 +275,6 @@ __all__ = (
|
|
|
277
275
|
"download_installer",
|
|
278
276
|
"upload_installer",
|
|
279
277
|
|
|
280
|
-
"get_dependencies_info",
|
|
281
|
-
"update_dependency_info",
|
|
282
278
|
"get_dependency_packages",
|
|
283
279
|
"create_dependency_package",
|
|
284
280
|
"update_dependency_package",
|
|
@@ -611,16 +611,6 @@ def upload_installer(*args, **kwargs):
|
|
|
611
611
|
|
|
612
612
|
|
|
613
613
|
# Dependency packages
|
|
614
|
-
def get_dependencies_info(*args, **kwargs):
|
|
615
|
-
con = get_server_api_connection()
|
|
616
|
-
return con.get_dependencies_info(*args, **kwargs)
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
def update_dependency_info(*args, **kwargs):
|
|
620
|
-
con = get_server_api_connection()
|
|
621
|
-
return con.update_dependency_info(*args, **kwargs)
|
|
622
|
-
|
|
623
|
-
|
|
624
614
|
def download_dependency_package(*args, **kwargs):
|
|
625
615
|
con = get_server_api_connection()
|
|
626
616
|
return con.download_dependency_package(*args, **kwargs)
|
|
@@ -7,9 +7,21 @@ import six
|
|
|
7
7
|
from ._api import get_server_api_connection
|
|
8
8
|
from .utils import create_entity_id, convert_entity_id, slugify_string
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
class _CustomNone(object):
|
|
12
|
+
def __init__(self, name=None):
|
|
13
|
+
self._name = name or "CustomNone"
|
|
14
|
+
|
|
15
|
+
def __repr__(self):
|
|
16
|
+
return "<{}>".format(self._name)
|
|
17
|
+
|
|
18
|
+
def __bool__(self):
|
|
19
|
+
return False
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
UNKNOWN_VALUE = _CustomNone("UNKNOWN_VALUE")
|
|
23
|
+
PROJECT_PARENT_ID = _CustomNone("PROJECT_PARENT_ID")
|
|
24
|
+
_NOT_SET = _CustomNone("_NOT_SET")
|
|
13
25
|
|
|
14
26
|
|
|
15
27
|
class EntityHub(object):
|
|
@@ -219,7 +231,10 @@ class EntityHub(object):
|
|
|
219
231
|
return None
|
|
220
232
|
|
|
221
233
|
if entity_type == "folder":
|
|
222
|
-
|
|
234
|
+
folder_entity = self.add_folder(entity_data)
|
|
235
|
+
folder_entity.has_published_content = entity_data["hasProducts"]
|
|
236
|
+
return folder_entity
|
|
237
|
+
|
|
223
238
|
elif entity_type == "task":
|
|
224
239
|
return self.add_task(entity_data)
|
|
225
240
|
|
|
@@ -471,13 +486,14 @@ class EntityHub(object):
|
|
|
471
486
|
}
|
|
472
487
|
for folder in folders:
|
|
473
488
|
folder_entity = self._entities_by_id.get(folder["id"])
|
|
474
|
-
if folder_entity is
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
continue
|
|
489
|
+
if folder_entity is None:
|
|
490
|
+
folder_entity = self.add_folder(folder)
|
|
491
|
+
children_ids.add(folder_entity.id)
|
|
478
492
|
|
|
479
|
-
folder_entity
|
|
480
|
-
|
|
493
|
+
elif folder_entity.parent_id == entity.id:
|
|
494
|
+
children_ids.add(folder_entity.id)
|
|
495
|
+
|
|
496
|
+
folder_entity.has_published_content = folder["hasProducts"]
|
|
481
497
|
|
|
482
498
|
for task in tasks:
|
|
483
499
|
task_entity = self._entities_by_id.get(task["id"])
|
|
@@ -1284,7 +1300,10 @@ class BaseEntity(object):
|
|
|
1284
1300
|
changes["name"] = self._name
|
|
1285
1301
|
|
|
1286
1302
|
if self._entity_hub.allow_data_changes:
|
|
1287
|
-
if
|
|
1303
|
+
if (
|
|
1304
|
+
self._data is not UNKNOWN_VALUE
|
|
1305
|
+
and self._orig_data != self._data
|
|
1306
|
+
):
|
|
1288
1307
|
changes["data"] = self._data
|
|
1289
1308
|
|
|
1290
1309
|
if self._orig_thumbnail_id != self._thumbnail_id:
|
|
@@ -53,7 +53,10 @@ class GraphQlQueryFailed(Exception):
|
|
|
53
53
|
msg = error["message"]
|
|
54
54
|
path = error.get("path")
|
|
55
55
|
if path:
|
|
56
|
-
msg += " on item '{}'".format("/".join(
|
|
56
|
+
msg += " on item '{}'".format("/".join(
|
|
57
|
+
# Convert to string
|
|
58
|
+
str(x) for x in path
|
|
59
|
+
))
|
|
57
60
|
locations = error.get("locations")
|
|
58
61
|
if locations:
|
|
59
62
|
_locations = [
|
|
@@ -202,6 +202,15 @@ class GraphQlQuery:
|
|
|
202
202
|
|
|
203
203
|
self._variables[key]["value"] = value
|
|
204
204
|
|
|
205
|
+
def get_variable_keys(self):
|
|
206
|
+
"""Get all variable keys.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
set[str]: Variable keys.
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
return set(self._variables.keys())
|
|
213
|
+
|
|
205
214
|
def get_variables_values(self):
|
|
206
215
|
"""Calculate variable values used that should be used in query.
|
|
207
216
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import collections
|
|
2
2
|
|
|
3
|
+
from .constants import DEFAULT_LINK_FIELDS
|
|
3
4
|
from .graphql import FIELD_VALUE, GraphQlQuery
|
|
4
5
|
|
|
5
6
|
|
|
@@ -30,16 +31,7 @@ def add_links_fields(entity_field, nested_fields):
|
|
|
30
31
|
return
|
|
31
32
|
links_fields = nested_fields.pop("links")
|
|
32
33
|
|
|
33
|
-
link_edge_fields =
|
|
34
|
-
"id",
|
|
35
|
-
"linkType",
|
|
36
|
-
"projectName",
|
|
37
|
-
"entityType",
|
|
38
|
-
"entityId",
|
|
39
|
-
"direction",
|
|
40
|
-
"description",
|
|
41
|
-
"author",
|
|
42
|
-
}
|
|
34
|
+
link_edge_fields = set(DEFAULT_LINK_FIELDS)
|
|
43
35
|
if isinstance(links_fields, dict):
|
|
44
36
|
simple_fields = set(links_fields)
|
|
45
37
|
simple_variant = len(simple_fields - link_edge_fields) == 0
|
|
@@ -49,8 +41,12 @@ def add_links_fields(entity_field, nested_fields):
|
|
|
49
41
|
|
|
50
42
|
link_field = entity_field.add_field_with_edges("links")
|
|
51
43
|
|
|
44
|
+
link_name_var = link_field.add_variable("linkNames", "[String!]")
|
|
45
|
+
link_name_regex_var = link_field.add_variable("linkNameRegex", "String!")
|
|
52
46
|
link_type_var = link_field.add_variable("linkTypes", "[String!]")
|
|
53
47
|
link_dir_var = link_field.add_variable("linkDirection", "String!")
|
|
48
|
+
link_field.set_filter("names", link_name_var)
|
|
49
|
+
link_field.set_filter("nameEx", link_name_regex_var)
|
|
54
50
|
link_field.set_filter("linkTypes", link_type_var)
|
|
55
51
|
link_field.set_filter("direction", link_dir_var)
|
|
56
52
|
|
|
@@ -175,10 +171,15 @@ def folders_graphql_query(fields):
|
|
|
175
171
|
folder_ids_var = query.add_variable("folderIds", "[String!]")
|
|
176
172
|
parent_folder_ids_var = query.add_variable("parentFolderIds", "[String!]")
|
|
177
173
|
folder_paths_var = query.add_variable("folderPaths", "[String!]")
|
|
174
|
+
folder_path_regex_var = query.add_variable("folderPathRegex", "String!")
|
|
178
175
|
folder_names_var = query.add_variable("folderNames", "[String!]")
|
|
179
176
|
folder_types_var = query.add_variable("folderTypes", "[String!]")
|
|
180
|
-
statuses_var = query.add_variable("folderStatuses", "[String!]")
|
|
181
177
|
has_products_var = query.add_variable("folderHasProducts", "Boolean!")
|
|
178
|
+
has_tasks_var = query.add_variable("folderHasTasks", "Boolean!")
|
|
179
|
+
has_links_var = query.add_variable("folderHasLinks", "HasLinksFilter")
|
|
180
|
+
has_children_var = query.add_variable("folderHasChildren", "Boolean!")
|
|
181
|
+
statuses_var = query.add_variable("folderStatuses", "[String!]")
|
|
182
|
+
tags_var = query.add_variable("folderTags", "[String!]")
|
|
182
183
|
|
|
183
184
|
project_field = query.add_field("project")
|
|
184
185
|
project_field.set_filter("name", project_name_var)
|
|
@@ -188,9 +189,14 @@ def folders_graphql_query(fields):
|
|
|
188
189
|
folders_field.set_filter("parentIds", parent_folder_ids_var)
|
|
189
190
|
folders_field.set_filter("names", folder_names_var)
|
|
190
191
|
folders_field.set_filter("paths", folder_paths_var)
|
|
192
|
+
folders_field.set_filter("pathEx", folder_path_regex_var)
|
|
191
193
|
folders_field.set_filter("folderTypes", folder_types_var)
|
|
192
194
|
folders_field.set_filter("statuses", statuses_var)
|
|
195
|
+
folders_field.set_filter("tags", tags_var)
|
|
193
196
|
folders_field.set_filter("hasProducts", has_products_var)
|
|
197
|
+
folders_field.set_filter("hasTasks", has_tasks_var)
|
|
198
|
+
folders_field.set_filter("hasLinks", has_links_var)
|
|
199
|
+
folders_field.set_filter("hasChildren", has_children_var)
|
|
194
200
|
|
|
195
201
|
nested_fields = fields_to_dict(fields)
|
|
196
202
|
add_links_fields(folders_field, nested_fields)
|
|
@@ -218,6 +224,10 @@ def tasks_graphql_query(fields):
|
|
|
218
224
|
task_names_var = query.add_variable("taskNames", "[String!]")
|
|
219
225
|
task_types_var = query.add_variable("taskTypes", "[String!]")
|
|
220
226
|
folder_ids_var = query.add_variable("folderIds", "[String!]")
|
|
227
|
+
assignees_any_var = query.add_variable("taskAssigneesAny", "[String!]")
|
|
228
|
+
assignees_all_var = query.add_variable("taskAssigneesAll", "[String!]")
|
|
229
|
+
statuses_var = query.add_variable("taskStatuses", "[String!]")
|
|
230
|
+
tags_var = query.add_variable("taskTags", "[String!]")
|
|
221
231
|
|
|
222
232
|
project_field = query.add_field("project")
|
|
223
233
|
project_field.set_filter("name", project_name_var)
|
|
@@ -228,6 +238,10 @@ def tasks_graphql_query(fields):
|
|
|
228
238
|
tasks_field.set_filter("names", task_names_var)
|
|
229
239
|
tasks_field.set_filter("taskTypes", task_types_var)
|
|
230
240
|
tasks_field.set_filter("folderIds", folder_ids_var)
|
|
241
|
+
tasks_field.set_filter("assigneesAny", assignees_any_var)
|
|
242
|
+
tasks_field.set_filter("assignees", assignees_all_var)
|
|
243
|
+
tasks_field.set_filter("statuses", statuses_var)
|
|
244
|
+
tasks_field.set_filter("tags", tags_var)
|
|
231
245
|
|
|
232
246
|
nested_fields = fields_to_dict(fields)
|
|
233
247
|
add_links_fields(tasks_field, nested_fields)
|
|
@@ -256,7 +270,10 @@ def products_graphql_query(fields):
|
|
|
256
270
|
product_names_var = query.add_variable("productNames", "[String!]")
|
|
257
271
|
folder_ids_var = query.add_variable("folderIds", "[String!]")
|
|
258
272
|
product_types_var = query.add_variable("productTypes", "[String!]")
|
|
259
|
-
|
|
273
|
+
product_name_regex_var = query.add_variable("productNameRegex", "String!")
|
|
274
|
+
product_path_regex_var = query.add_variable("productPathRegex", "String!")
|
|
275
|
+
statuses_var = query.add_variable("productStatuses.", "[String!]")
|
|
276
|
+
tags_var = query.add_variable("productTags.", "[String!]")
|
|
260
277
|
|
|
261
278
|
project_field = query.add_field("project")
|
|
262
279
|
project_field.set_filter("name", project_name_var)
|
|
@@ -267,6 +284,9 @@ def products_graphql_query(fields):
|
|
|
267
284
|
products_field.set_filter("folderIds", folder_ids_var)
|
|
268
285
|
products_field.set_filter("productTypes", product_types_var)
|
|
269
286
|
products_field.set_filter("statuses", statuses_var)
|
|
287
|
+
products_field.set_filter("tags", tags_var)
|
|
288
|
+
products_field.set_filter("nameEx", product_name_regex_var)
|
|
289
|
+
products_field.set_filter("pathEx", product_path_regex_var)
|
|
270
290
|
|
|
271
291
|
nested_fields = fields_to_dict(set(fields))
|
|
272
292
|
add_links_fields(products_field, nested_fields)
|
|
@@ -299,24 +319,28 @@ def versions_graphql_query(fields):
|
|
|
299
319
|
hero_or_latest_only_var = query.add_variable(
|
|
300
320
|
"heroOrLatestOnly", "Boolean"
|
|
301
321
|
)
|
|
322
|
+
statuses_var = query.add_variable("versionStatuses", "[String!]")
|
|
323
|
+
tags_var = query.add_variable("versionTags", "[String!]")
|
|
302
324
|
|
|
303
325
|
project_field = query.add_field("project")
|
|
304
326
|
project_field.set_filter("name", project_name_var)
|
|
305
327
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
328
|
+
versions_field = project_field.add_field_with_edges("versions")
|
|
329
|
+
versions_field.set_filter("ids", version_ids_var)
|
|
330
|
+
versions_field.set_filter("productIds", product_ids_var)
|
|
331
|
+
versions_field.set_filter("versions", versions_var)
|
|
332
|
+
versions_field.set_filter("heroOnly", hero_only_var)
|
|
333
|
+
versions_field.set_filter("latestOnly", latest_only_var)
|
|
334
|
+
versions_field.set_filter("heroOrLatestOnly", hero_or_latest_only_var)
|
|
335
|
+
versions_field.set_filter("statuses", statuses_var)
|
|
336
|
+
versions_field.set_filter("tags", tags_var)
|
|
313
337
|
|
|
314
338
|
nested_fields = fields_to_dict(set(fields))
|
|
315
|
-
add_links_fields(
|
|
339
|
+
add_links_fields(versions_field, nested_fields)
|
|
316
340
|
|
|
317
341
|
query_queue = collections.deque()
|
|
318
342
|
for key, value in nested_fields.items():
|
|
319
|
-
query_queue.append((key, value,
|
|
343
|
+
query_queue.append((key, value, versions_field))
|
|
320
344
|
|
|
321
345
|
while query_queue:
|
|
322
346
|
item = query_queue.popleft()
|
|
@@ -337,6 +361,13 @@ def representations_graphql_query(fields):
|
|
|
337
361
|
repre_ids_var = query.add_variable("representationIds", "[String!]")
|
|
338
362
|
repre_names_var = query.add_variable("representationNames", "[String!]")
|
|
339
363
|
version_ids_var = query.add_variable("versionIds", "[String!]")
|
|
364
|
+
has_links_var = query.add_variable("representationHasLinks", "HasLinksFilter")
|
|
365
|
+
statuses_var = query.add_variable(
|
|
366
|
+
"representationStatuses", "[String!]"
|
|
367
|
+
)
|
|
368
|
+
tags_var = query.add_variable(
|
|
369
|
+
"representationTags", "[String!]"
|
|
370
|
+
)
|
|
340
371
|
|
|
341
372
|
project_field = query.add_field("project")
|
|
342
373
|
project_field.set_filter("name", project_name_var)
|
|
@@ -345,6 +376,9 @@ def representations_graphql_query(fields):
|
|
|
345
376
|
repres_field.set_filter("ids", repre_ids_var)
|
|
346
377
|
repres_field.set_filter("versionIds", version_ids_var)
|
|
347
378
|
repres_field.set_filter("names", repre_names_var)
|
|
379
|
+
repres_field.set_filter("hasLinks", has_links_var)
|
|
380
|
+
repres_field.set_filter("statuses", statuses_var)
|
|
381
|
+
repres_field.set_filter("tags", tags_var)
|
|
348
382
|
|
|
349
383
|
nested_fields = fields_to_dict(set(fields))
|
|
350
384
|
add_links_fields(repres_field, nested_fields)
|
|
@@ -412,6 +446,10 @@ def workfiles_info_graphql_query(fields):
|
|
|
412
446
|
workfiles_info_ids = query.add_variable("workfileIds", "[String!]")
|
|
413
447
|
task_ids_var = query.add_variable("taskIds", "[String!]")
|
|
414
448
|
paths_var = query.add_variable("paths", "[String!]")
|
|
449
|
+
path_regex_var = query.add_variable("workfilePathRegex", "String!")
|
|
450
|
+
has_links_var = query.add_variable("workfilehasLinks", "HasLinksFilter")
|
|
451
|
+
statuses_var = query.add_variable("workfileStatuses", "[String!]")
|
|
452
|
+
tags_var = query.add_variable("workfileTags", "[String!]")
|
|
415
453
|
|
|
416
454
|
project_field = query.add_field("project")
|
|
417
455
|
project_field.set_filter("name", project_name_var)
|
|
@@ -420,6 +458,10 @@ def workfiles_info_graphql_query(fields):
|
|
|
420
458
|
workfiles_field.set_filter("ids", workfiles_info_ids)
|
|
421
459
|
workfiles_field.set_filter("taskIds", task_ids_var)
|
|
422
460
|
workfiles_field.set_filter("paths", paths_var)
|
|
461
|
+
workfiles_field.set_filter("pathEx", path_regex_var)
|
|
462
|
+
workfiles_field.set_filter("hasLinks", has_links_var)
|
|
463
|
+
workfiles_field.set_filter("statuses", statuses_var)
|
|
464
|
+
workfiles_field.set_filter("tags", tags_var)
|
|
423
465
|
|
|
424
466
|
nested_fields = fields_to_dict(set(fields))
|
|
425
467
|
add_links_fields(workfiles_field, nested_fields)
|
|
@@ -447,6 +489,9 @@ def events_graphql_query(fields):
|
|
|
447
489
|
states_var = query.add_variable("eventStates", "[String!]")
|
|
448
490
|
users_var = query.add_variable("eventUsers", "[String!]")
|
|
449
491
|
include_logs_var = query.add_variable("includeLogsFilter", "Boolean!")
|
|
492
|
+
has_children_var = query.add_variable("hasChildrenFilter", "Boolean!")
|
|
493
|
+
newer_than_var = query.add_variable("newerThanFilter", "String!")
|
|
494
|
+
older_than_var = query.add_variable("olderThanFilter", "String!")
|
|
450
495
|
|
|
451
496
|
events_field = query.add_field_with_edges("events")
|
|
452
497
|
events_field.set_filter("topics", topics_var)
|
|
@@ -454,6 +499,9 @@ def events_graphql_query(fields):
|
|
|
454
499
|
events_field.set_filter("states", states_var)
|
|
455
500
|
events_field.set_filter("users", users_var)
|
|
456
501
|
events_field.set_filter("includeLogs", include_logs_var)
|
|
502
|
+
events_field.set_filter("hasChildren", has_children_var)
|
|
503
|
+
events_field.set_filter("newerThan", newer_than_var)
|
|
504
|
+
events_field.set_filter("olderThan", older_than_var)
|
|
457
505
|
|
|
458
506
|
nested_fields = fields_to_dict(set(fields))
|
|
459
507
|
|