Ayon-Python-Api 0.1.17__tar.gz → 0.2.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.1.17 → ayon-python-api-0.2.0}/PKG-INFO +1 -1
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/__init__.py +32 -20
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/_api.py +49 -24
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/constants.py +11 -4
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/entity_hub.py +14 -4
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/graphql_queries.py +73 -29
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/operations.py +61 -44
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/server_api.py +557 -467
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/utils.py +1 -1
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/version.py +1 -1
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/pyproject.toml +3 -2
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/LICENSE +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/README.md +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/events.py +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/graphql.py +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_api/thumbnails.py +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/setup.cfg +0 -0
- {ayon-python-api-0.1.17 → ayon-python-api-0.2.0}/setup.py +0 -0
|
@@ -99,22 +99,24 @@ from ._api import (
|
|
|
99
99
|
|
|
100
100
|
get_tasks,
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
get_folder_ids_with_products,
|
|
103
|
+
get_product_by_id,
|
|
104
|
+
get_product_by_name,
|
|
105
|
+
get_products,
|
|
106
|
+
get_product_types,
|
|
107
|
+
get_project_product_types,
|
|
108
|
+
get_product_type_names,
|
|
107
109
|
|
|
108
110
|
get_version_by_id,
|
|
109
111
|
get_version_by_name,
|
|
110
112
|
version_is_latest,
|
|
111
113
|
get_versions,
|
|
112
|
-
|
|
114
|
+
get_hero_version_by_product_id,
|
|
113
115
|
get_hero_version_by_id,
|
|
114
116
|
get_hero_versions,
|
|
115
117
|
get_last_versions,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
get_last_version_by_product_id,
|
|
119
|
+
get_last_version_by_product_name,
|
|
118
120
|
get_representation_by_id,
|
|
119
121
|
get_representation_by_name,
|
|
120
122
|
get_representations,
|
|
@@ -122,6 +124,10 @@ from ._api import (
|
|
|
122
124
|
get_representation_parents,
|
|
123
125
|
get_repre_ids_by_context_filters,
|
|
124
126
|
|
|
127
|
+
get_workfiles_info,
|
|
128
|
+
get_workfile_info,
|
|
129
|
+
get_workfile_info_by_id,
|
|
130
|
+
|
|
125
131
|
get_thumbnail,
|
|
126
132
|
get_folder_thumbnail,
|
|
127
133
|
get_version_thumbnail,
|
|
@@ -143,8 +149,8 @@ from ._api import (
|
|
|
143
149
|
get_folders_links,
|
|
144
150
|
get_task_links,
|
|
145
151
|
get_tasks_links,
|
|
146
|
-
|
|
147
|
-
|
|
152
|
+
get_product_links,
|
|
153
|
+
get_products_links,
|
|
148
154
|
get_version_links,
|
|
149
155
|
get_versions_links,
|
|
150
156
|
get_representations_links,
|
|
@@ -251,22 +257,24 @@ __all__ = (
|
|
|
251
257
|
|
|
252
258
|
"get_tasks",
|
|
253
259
|
|
|
254
|
-
"
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"
|
|
258
|
-
"
|
|
260
|
+
"get_folder_ids_with_products",
|
|
261
|
+
"get_product_by_id",
|
|
262
|
+
"get_product_by_name",
|
|
263
|
+
"get_products",
|
|
264
|
+
"get_product_types",
|
|
265
|
+
"get_project_product_types",
|
|
266
|
+
"get_product_type_names",
|
|
259
267
|
|
|
260
268
|
"get_version_by_id",
|
|
261
269
|
"get_version_by_name",
|
|
262
270
|
"version_is_latest",
|
|
263
271
|
"get_versions",
|
|
264
|
-
"
|
|
272
|
+
"get_hero_version_by_product_id",
|
|
265
273
|
"get_hero_version_by_id",
|
|
266
274
|
"get_hero_versions",
|
|
267
275
|
"get_last_versions",
|
|
268
|
-
"
|
|
269
|
-
"
|
|
276
|
+
"get_last_version_by_product_id",
|
|
277
|
+
"get_last_version_by_product_name",
|
|
270
278
|
"get_representation_by_id",
|
|
271
279
|
"get_representation_by_name",
|
|
272
280
|
"get_representations",
|
|
@@ -274,6 +282,10 @@ __all__ = (
|
|
|
274
282
|
"get_representation_parents",
|
|
275
283
|
"get_repre_ids_by_context_filters",
|
|
276
284
|
|
|
285
|
+
"get_workfiles_info",
|
|
286
|
+
"get_workfile_info",
|
|
287
|
+
"get_workfile_info_by_id",
|
|
288
|
+
|
|
277
289
|
"get_thumbnail",
|
|
278
290
|
"get_folder_thumbnail",
|
|
279
291
|
"get_version_thumbnail",
|
|
@@ -295,8 +307,8 @@ __all__ = (
|
|
|
295
307
|
"get_folders_links",
|
|
296
308
|
"get_task_links",
|
|
297
309
|
"get_tasks_links",
|
|
298
|
-
"
|
|
299
|
-
"
|
|
310
|
+
"get_product_links",
|
|
311
|
+
"get_products_links",
|
|
300
312
|
"get_version_links",
|
|
301
313
|
"get_versions_links",
|
|
302
314
|
"get_representations_links",
|
|
@@ -656,29 +656,39 @@ def get_folder_by_name(*args, **kwargs):
|
|
|
656
656
|
return con.get_folder_by_name(*args, **kwargs)
|
|
657
657
|
|
|
658
658
|
|
|
659
|
-
def
|
|
659
|
+
def get_folder_ids_with_products(*args, **kwargs):
|
|
660
660
|
con = get_server_api_connection()
|
|
661
|
-
return con.
|
|
661
|
+
return con.get_folder_ids_with_products(*args, **kwargs)
|
|
662
662
|
|
|
663
663
|
|
|
664
|
-
def
|
|
664
|
+
def get_product_types(*args, **kwargs):
|
|
665
665
|
con = get_server_api_connection()
|
|
666
|
-
return con.
|
|
666
|
+
return con.get_product_types(*args, **kwargs)
|
|
667
667
|
|
|
668
668
|
|
|
669
|
-
def
|
|
669
|
+
def get_project_product_types(*args, **kwargs):
|
|
670
670
|
con = get_server_api_connection()
|
|
671
|
-
return con.
|
|
671
|
+
return con.get_project_product_types(*args, **kwargs)
|
|
672
672
|
|
|
673
673
|
|
|
674
|
-
def
|
|
674
|
+
def get_product_type_names(*args, **kwargs):
|
|
675
675
|
con = get_server_api_connection()
|
|
676
|
-
return con.
|
|
676
|
+
return con.get_product_type_names(*args, **kwargs)
|
|
677
677
|
|
|
678
678
|
|
|
679
|
-
def
|
|
679
|
+
def get_products(*args, **kwargs):
|
|
680
680
|
con = get_server_api_connection()
|
|
681
|
-
return con.
|
|
681
|
+
return con.get_products(*args, **kwargs)
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
def get_product_by_id(*args, **kwargs):
|
|
685
|
+
con = get_server_api_connection()
|
|
686
|
+
return con.get_product_by_id(*args, **kwargs)
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
def get_product_by_name(*args, **kwargs):
|
|
690
|
+
con = get_server_api_connection()
|
|
691
|
+
return con.get_product_by_name(*args, **kwargs)
|
|
682
692
|
|
|
683
693
|
|
|
684
694
|
def get_versions(*args, **kwargs):
|
|
@@ -701,9 +711,9 @@ def get_hero_version_by_id(*args, **kwargs):
|
|
|
701
711
|
return con.get_hero_version_by_id(*args, **kwargs)
|
|
702
712
|
|
|
703
713
|
|
|
704
|
-
def
|
|
714
|
+
def get_hero_version_by_product_id(*args, **kwargs):
|
|
705
715
|
con = get_server_api_connection()
|
|
706
|
-
return con.
|
|
716
|
+
return con.get_hero_version_by_product_id(*args, **kwargs)
|
|
707
717
|
|
|
708
718
|
|
|
709
719
|
def get_hero_versions(*args, **kwargs):
|
|
@@ -716,14 +726,14 @@ def get_last_versions(*args, **kwargs):
|
|
|
716
726
|
return con.get_last_versions(*args, **kwargs)
|
|
717
727
|
|
|
718
728
|
|
|
719
|
-
def
|
|
729
|
+
def get_last_version_by_product_id(*args, **kwargs):
|
|
720
730
|
con = get_server_api_connection()
|
|
721
|
-
return con.
|
|
731
|
+
return con.get_last_version_by_product_id(*args, **kwargs)
|
|
722
732
|
|
|
723
733
|
|
|
724
|
-
def
|
|
734
|
+
def get_last_version_by_product_name(*args, **kwargs):
|
|
725
735
|
con = get_server_api_connection()
|
|
726
|
-
return con.
|
|
736
|
+
return con.get_last_version_by_product_name(*args, **kwargs)
|
|
727
737
|
|
|
728
738
|
|
|
729
739
|
def version_is_latest(*args, **kwargs):
|
|
@@ -761,6 +771,21 @@ def get_repre_ids_by_context_filters(*args, **kwargs):
|
|
|
761
771
|
return con.get_repre_ids_by_context_filters(*args, **kwargs)
|
|
762
772
|
|
|
763
773
|
|
|
774
|
+
def get_workfiles_info(*args, **kwargs):
|
|
775
|
+
con = get_server_api_connection()
|
|
776
|
+
return con.get_workfiles_info(*args, **kwargs)
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
def get_workfile_info(*args, **kwargs):
|
|
780
|
+
con = get_server_api_connection()
|
|
781
|
+
return con.get_workfile_info(*args, **kwargs)
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
def get_workfile_info_by_id(*args, **kwargs):
|
|
785
|
+
con = get_server_api_connection()
|
|
786
|
+
return con.get_workfile_info_by_id(*args, **kwargs)
|
|
787
|
+
|
|
788
|
+
|
|
764
789
|
def create_project(
|
|
765
790
|
project_name,
|
|
766
791
|
project_code,
|
|
@@ -954,31 +979,31 @@ def get_task_links(
|
|
|
954
979
|
)
|
|
955
980
|
|
|
956
981
|
|
|
957
|
-
def
|
|
982
|
+
def get_products_links(
|
|
958
983
|
project_name,
|
|
959
|
-
|
|
984
|
+
product_ids=None,
|
|
960
985
|
link_types=None,
|
|
961
986
|
link_direction=None
|
|
962
987
|
):
|
|
963
988
|
con = get_server_api_connection()
|
|
964
|
-
return con.
|
|
989
|
+
return con.get_products_links(
|
|
965
990
|
project_name,
|
|
966
|
-
|
|
991
|
+
product_ids,
|
|
967
992
|
link_types,
|
|
968
993
|
link_direction
|
|
969
994
|
)
|
|
970
995
|
|
|
971
996
|
|
|
972
|
-
def
|
|
997
|
+
def get_product_links(
|
|
973
998
|
project_name,
|
|
974
|
-
|
|
999
|
+
product_id,
|
|
975
1000
|
link_types=None,
|
|
976
1001
|
link_direction=None
|
|
977
1002
|
):
|
|
978
1003
|
con = get_server_api_connection()
|
|
979
|
-
return con.
|
|
1004
|
+
return con.get_product_links(
|
|
980
1005
|
project_name,
|
|
981
|
-
|
|
1006
|
+
product_id,
|
|
982
1007
|
link_types,
|
|
983
1008
|
link_direction
|
|
984
1009
|
)
|
|
@@ -4,6 +4,13 @@ SERVER_API_ENV_KEY = "AYON_API_KEY"
|
|
|
4
4
|
# Backwards compatibility
|
|
5
5
|
SERVER_TOKEN_ENV_KEY = SERVER_API_ENV_KEY
|
|
6
6
|
|
|
7
|
+
# --- Product types ---
|
|
8
|
+
DEFAULT_PRODUCT_TYPE_FIELDS = {
|
|
9
|
+
"name",
|
|
10
|
+
"icon",
|
|
11
|
+
"color",
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
# --- Project ---
|
|
8
15
|
DEFAULT_PROJECT_FIELDS = {
|
|
9
16
|
"active",
|
|
@@ -36,13 +43,13 @@ DEFAULT_TASK_FIELDS = {
|
|
|
36
43
|
"assignees",
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
# ---
|
|
40
|
-
|
|
46
|
+
# --- Products ---
|
|
47
|
+
DEFAULT_PRODUCT_FIELDS = {
|
|
41
48
|
"id",
|
|
42
49
|
"name",
|
|
43
50
|
"folderId",
|
|
44
51
|
"active",
|
|
45
|
-
"
|
|
52
|
+
"productType",
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
# --- Versions ---
|
|
@@ -50,7 +57,7 @@ DEFAULT_VERSION_FIELDS = {
|
|
|
50
57
|
"id",
|
|
51
58
|
"name",
|
|
52
59
|
"version",
|
|
53
|
-
"
|
|
60
|
+
"productId",
|
|
54
61
|
"taskId",
|
|
55
62
|
"active",
|
|
56
63
|
"author",
|
|
@@ -558,7 +558,7 @@ class EntityHub(object):
|
|
|
558
558
|
folder_fields = set(
|
|
559
559
|
self._connection.get_default_fields_for_type("folder")
|
|
560
560
|
)
|
|
561
|
-
folder_fields.add("
|
|
561
|
+
folder_fields.add("hasProducts")
|
|
562
562
|
if self._allow_data_changes:
|
|
563
563
|
folder_fields.add("data")
|
|
564
564
|
return folder_fields
|
|
@@ -589,25 +589,34 @@ class EntityHub(object):
|
|
|
589
589
|
parent_id = task["folderId"]
|
|
590
590
|
tasks_by_parent_id[parent_id].append(task)
|
|
591
591
|
|
|
592
|
+
lock_queue = collections.deque()
|
|
592
593
|
hierarchy_queue = collections.deque()
|
|
593
594
|
hierarchy_queue.append((None, project_entity))
|
|
594
595
|
while hierarchy_queue:
|
|
595
596
|
item = hierarchy_queue.popleft()
|
|
596
597
|
parent_id, parent_entity = item
|
|
597
598
|
|
|
599
|
+
lock_queue.append(parent_entity)
|
|
600
|
+
|
|
598
601
|
children_ids = set()
|
|
599
602
|
for folder in folders_by_parent_id[parent_id]:
|
|
600
603
|
folder_entity = self.add_folder(folder)
|
|
601
604
|
children_ids.add(folder_entity.id)
|
|
602
|
-
folder_entity.has_published_content = folder["
|
|
605
|
+
folder_entity.has_published_content = folder["hasProducts"]
|
|
603
606
|
hierarchy_queue.append((folder_entity.id, folder_entity))
|
|
604
607
|
|
|
605
608
|
for task in tasks_by_parent_id[parent_id]:
|
|
606
609
|
task_entity = self.add_task(task)
|
|
610
|
+
lock_queue.append(task_entity)
|
|
607
611
|
children_ids.add(task_entity.id)
|
|
608
612
|
|
|
609
613
|
parent_entity.fill_children_ids(children_ids)
|
|
610
|
-
|
|
614
|
+
|
|
615
|
+
# Lock entities when all are added to hub
|
|
616
|
+
# - lock only entities added in this method
|
|
617
|
+
while lock_queue:
|
|
618
|
+
entity = lock_queue.popleft()
|
|
619
|
+
entity.lock()
|
|
611
620
|
|
|
612
621
|
def lock(self):
|
|
613
622
|
if self._project_entity is None:
|
|
@@ -1198,6 +1207,7 @@ class BaseEntity(object):
|
|
|
1198
1207
|
self._attribs.lock()
|
|
1199
1208
|
|
|
1200
1209
|
self._immutable_for_hierarchy_cache = None
|
|
1210
|
+
self._created = False
|
|
1201
1211
|
|
|
1202
1212
|
def _get_entity_by_id(self, entity_id):
|
|
1203
1213
|
return self._entity_hub.get_entity_by_id(entity_id)
|
|
@@ -1554,7 +1564,7 @@ class FolderEntity(BaseEntity):
|
|
|
1554
1564
|
|
|
1555
1565
|
self._orig_folder_type = folder_type
|
|
1556
1566
|
self._orig_label = label
|
|
1557
|
-
# Know if folder has any
|
|
1567
|
+
# Know if folder has any products
|
|
1558
1568
|
# - is used to know if folder allows hierarchy changes
|
|
1559
1569
|
self._has_published_content = False
|
|
1560
1570
|
self._path = path
|
|
@@ -123,6 +123,51 @@ def projects_graphql_query(fields):
|
|
|
123
123
|
return query
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
def product_types_query(fields):
|
|
127
|
+
query = GraphQlQuery("ProductTypes")
|
|
128
|
+
product_types_field = query.add_field("productTypes")
|
|
129
|
+
|
|
130
|
+
nested_fields = fields_to_dict(fields)
|
|
131
|
+
|
|
132
|
+
query_queue = collections.deque()
|
|
133
|
+
for key, value in nested_fields.items():
|
|
134
|
+
query_queue.append((key, value, product_types_field))
|
|
135
|
+
|
|
136
|
+
while query_queue:
|
|
137
|
+
item = query_queue.popleft()
|
|
138
|
+
key, value, parent = item
|
|
139
|
+
field = parent.add_field(key)
|
|
140
|
+
if value is FIELD_VALUE:
|
|
141
|
+
continue
|
|
142
|
+
|
|
143
|
+
for k, v in value.items():
|
|
144
|
+
query_queue.append((k, v, field))
|
|
145
|
+
return query
|
|
146
|
+
|
|
147
|
+
def project_product_types_query(fields):
|
|
148
|
+
query = GraphQlQuery("ProjectProductTypes")
|
|
149
|
+
project_query = query.add_field("project")
|
|
150
|
+
project_name_var = query.add_variable("projectName", "String!")
|
|
151
|
+
project_query.set_filter("name", project_name_var)
|
|
152
|
+
product_types_field = project_query.add_field("productTypes")
|
|
153
|
+
nested_fields = fields_to_dict(fields)
|
|
154
|
+
|
|
155
|
+
query_queue = collections.deque()
|
|
156
|
+
for key, value in nested_fields.items():
|
|
157
|
+
query_queue.append((key, value, product_types_field))
|
|
158
|
+
|
|
159
|
+
while query_queue:
|
|
160
|
+
item = query_queue.popleft()
|
|
161
|
+
key, value, parent = item
|
|
162
|
+
field = parent.add_field(key)
|
|
163
|
+
if value is FIELD_VALUE:
|
|
164
|
+
continue
|
|
165
|
+
|
|
166
|
+
for k, v in value.items():
|
|
167
|
+
query_queue.append((k, v, field))
|
|
168
|
+
return query
|
|
169
|
+
|
|
170
|
+
|
|
126
171
|
def folders_graphql_query(fields):
|
|
127
172
|
query = GraphQlQuery("FoldersQuery")
|
|
128
173
|
project_name_var = query.add_variable("projectName", "String!")
|
|
@@ -130,7 +175,7 @@ def folders_graphql_query(fields):
|
|
|
130
175
|
parent_folder_ids_var = query.add_variable("parentFolderIds", "[String!]")
|
|
131
176
|
folder_paths_var = query.add_variable("folderPaths", "[String!]")
|
|
132
177
|
folder_names_var = query.add_variable("folderNames", "[String!]")
|
|
133
|
-
|
|
178
|
+
has_products_var = query.add_variable("folderHasProducts", "Boolean!")
|
|
134
179
|
|
|
135
180
|
project_field = query.add_field("project")
|
|
136
181
|
project_field.set_filter("name", project_name_var)
|
|
@@ -140,7 +185,7 @@ def folders_graphql_query(fields):
|
|
|
140
185
|
folders_field.set_filter("parentIds", parent_folder_ids_var)
|
|
141
186
|
folders_field.set_filter("names", folder_names_var)
|
|
142
187
|
folders_field.set_filter("paths", folder_paths_var)
|
|
143
|
-
folders_field.set_filter("
|
|
188
|
+
folders_field.set_filter("hasProducts", has_products_var)
|
|
144
189
|
|
|
145
190
|
nested_fields = fields_to_dict(fields)
|
|
146
191
|
add_links_fields(folders_field, nested_fields)
|
|
@@ -198,28 +243,28 @@ def tasks_graphql_query(fields):
|
|
|
198
243
|
return query
|
|
199
244
|
|
|
200
245
|
|
|
201
|
-
def
|
|
202
|
-
query = GraphQlQuery("
|
|
246
|
+
def products_graphql_query(fields):
|
|
247
|
+
query = GraphQlQuery("ProductsQuery")
|
|
203
248
|
|
|
204
249
|
project_name_var = query.add_variable("projectName", "String!")
|
|
205
250
|
folder_ids_var = query.add_variable("folderIds", "[String!]")
|
|
206
|
-
|
|
207
|
-
|
|
251
|
+
product_ids_var = query.add_variable("productIds", "[String!]")
|
|
252
|
+
product_names_var = query.add_variable("productNames", "[String!]")
|
|
208
253
|
|
|
209
254
|
project_field = query.add_field("project")
|
|
210
255
|
project_field.set_filter("name", project_name_var)
|
|
211
256
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
257
|
+
products_field = project_field.add_field_with_edges("products")
|
|
258
|
+
products_field.set_filter("ids", product_ids_var)
|
|
259
|
+
products_field.set_filter("names", product_names_var)
|
|
260
|
+
products_field.set_filter("folderIds", folder_ids_var)
|
|
216
261
|
|
|
217
262
|
nested_fields = fields_to_dict(set(fields))
|
|
218
|
-
add_links_fields(
|
|
263
|
+
add_links_fields(products_field, nested_fields)
|
|
219
264
|
|
|
220
265
|
query_queue = collections.deque()
|
|
221
266
|
for key, value in nested_fields.items():
|
|
222
|
-
query_queue.append((key, value,
|
|
267
|
+
query_queue.append((key, value, products_field))
|
|
223
268
|
|
|
224
269
|
while query_queue:
|
|
225
270
|
item = query_queue.popleft()
|
|
@@ -237,7 +282,7 @@ def versions_graphql_query(fields):
|
|
|
237
282
|
query = GraphQlQuery("VersionsQuery")
|
|
238
283
|
|
|
239
284
|
project_name_var = query.add_variable("projectName", "String!")
|
|
240
|
-
|
|
285
|
+
product_ids_var = query.add_variable("productIds", "[String!]")
|
|
241
286
|
version_ids_var = query.add_variable("versionIds", "[String!]")
|
|
242
287
|
versions_var = query.add_variable("versions", "[Int!]")
|
|
243
288
|
hero_only_var = query.add_variable("heroOnly", "Boolean")
|
|
@@ -249,20 +294,20 @@ def versions_graphql_query(fields):
|
|
|
249
294
|
project_field = query.add_field("project")
|
|
250
295
|
project_field.set_filter("name", project_name_var)
|
|
251
296
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
297
|
+
products_field = project_field.add_field_with_edges("versions")
|
|
298
|
+
products_field.set_filter("ids", version_ids_var)
|
|
299
|
+
products_field.set_filter("productIds", product_ids_var)
|
|
300
|
+
products_field.set_filter("versions", versions_var)
|
|
301
|
+
products_field.set_filter("heroOnly", hero_only_var)
|
|
302
|
+
products_field.set_filter("latestOnly", latest_only_var)
|
|
303
|
+
products_field.set_filter("heroOrLatestOnly", hero_or_latest_only_var)
|
|
259
304
|
|
|
260
305
|
nested_fields = fields_to_dict(set(fields))
|
|
261
|
-
add_links_fields(
|
|
306
|
+
add_links_fields(products_field, nested_fields)
|
|
262
307
|
|
|
263
308
|
query_queue = collections.deque()
|
|
264
309
|
for key, value in nested_fields.items():
|
|
265
|
-
query_queue.append((key, value,
|
|
310
|
+
query_queue.append((key, value, products_field))
|
|
266
311
|
|
|
267
312
|
while query_queue:
|
|
268
313
|
item = query_queue.popleft()
|
|
@@ -312,9 +357,8 @@ def representations_graphql_query(fields):
|
|
|
312
357
|
|
|
313
358
|
|
|
314
359
|
def representations_parents_qraphql_query(
|
|
315
|
-
version_fields,
|
|
360
|
+
version_fields, product_fields, folder_fields
|
|
316
361
|
):
|
|
317
|
-
|
|
318
362
|
query = GraphQlQuery("RepresentationsParentsQuery")
|
|
319
363
|
|
|
320
364
|
project_name_var = query.add_variable("projectName", "String!")
|
|
@@ -332,11 +376,11 @@ def representations_parents_qraphql_query(
|
|
|
332
376
|
for key, value in fields_to_dict(version_fields).items():
|
|
333
377
|
fields_queue.append((key, value, version_field))
|
|
334
378
|
|
|
335
|
-
|
|
336
|
-
for key, value in fields_to_dict(
|
|
337
|
-
fields_queue.append((key, value,
|
|
379
|
+
product_field = version_field.add_field("product")
|
|
380
|
+
for key, value in fields_to_dict(product_fields).items():
|
|
381
|
+
fields_queue.append((key, value, product_field))
|
|
338
382
|
|
|
339
|
-
folder_field =
|
|
383
|
+
folder_field = product_field.add_field("folder")
|
|
340
384
|
for key, value in fields_to_dict(folder_fields).items():
|
|
341
385
|
fields_queue.append((key, value, folder_field))
|
|
342
386
|
|
|
@@ -388,7 +432,7 @@ def workfiles_info_graphql_query(fields):
|
|
|
388
432
|
|
|
389
433
|
|
|
390
434
|
def events_graphql_query(fields):
|
|
391
|
-
query = GraphQlQuery("
|
|
435
|
+
query = GraphQlQuery("Events")
|
|
392
436
|
topics_var = query.add_variable("eventTopics", "[String!]")
|
|
393
437
|
projects_var = query.add_variable("projectNames", "[String!]")
|
|
394
438
|
states_var = query.add_variable("eventStates", "[String!]")
|