Skip to content

Commit 25fd9f7

Browse files
authored
Merge pull request #258 from ynput/enhancement/small-fixes
Project fetching updates
2 parents fe76bc9 + 7e73064 commit 25fd9f7

File tree

4 files changed

+257
-143
lines changed

4 files changed

+257
-143
lines changed

ayon_api/_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4481,12 +4481,12 @@ def get_project_product_types(
44814481
project_name: str,
44824482
fields: Optional[Iterable[str]] = None,
44834483
) -> List["ProductTypeDict"]:
4484-
"""Types of products available on a project.
4484+
"""DEPRECATED Types of products available in a project.
44854485
4486-
Filter only product types available on project.
4486+
Filter only product types available in a project.
44874487
44884488
Args:
4489-
project_name (str): Name of project where to look for
4489+
project_name (str): Name of the project where to look for
44904490
product types.
44914491
fields (Optional[Iterable[str]]): Product types fields to query.
44924492
@@ -4505,7 +4505,7 @@ def get_product_type_names(
45054505
project_name: Optional[str] = None,
45064506
product_ids: Optional[Iterable[str]] = None,
45074507
) -> Set[str]:
4508-
"""Product type names.
4508+
"""DEPRECATED Product type names.
45094509
45104510
Warnings:
45114511
This function will be probably removed. Matters if 'products_id'

ayon_api/constants.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,43 @@
3030
"attrib.fullName",
3131
}
3232

33-
# --- Folder types ---
33+
# --- Project folder types ---
3434
DEFAULT_FOLDER_TYPE_FIELDS = {
3535
"name",
3636
"icon",
3737
}
3838

39-
# --- Task types ---
39+
# --- Project task types ---
4040
DEFAULT_TASK_TYPE_FIELDS = {
4141
"name",
4242
}
4343

44+
# --- Project tags ---
45+
DEFAULT_PROJECT_TAGS_FIELDS = {
46+
"name",
47+
"color",
48+
}
49+
50+
# --- Project statuses ---
51+
DEFAULT_PROJECT_STATUSES_FIELDS = {
52+
"color",
53+
"icon",
54+
"name",
55+
"scope",
56+
"shortName",
57+
"state",
58+
}
59+
60+
# --- Project link types ---
61+
DEFAULT_PROJECT_LINK_TYPES_FIELDS = {
62+
"color",
63+
"inputType",
64+
"linkType",
65+
"name",
66+
"outputType",
67+
"style",
68+
}
69+
4470
# --- Product types ---
4571
DEFAULT_PRODUCT_TYPE_FIELDS = {
4672
"name",
@@ -51,14 +77,19 @@
5177
# --- Project ---
5278
DEFAULT_PROJECT_FIELDS = {
5379
"active",
80+
"library",
5481
"name",
5582
"code",
5683
"config",
5784
"createdAt",
85+
"updatedAt",
5886
"data",
5987
"folderTypes",
6088
"taskTypes",
61-
"productTypes",
89+
"linkTypes",
90+
"statuses",
91+
"tags",
92+
"attrib",
6293
}
6394

6495
# --- Folders ---

ayon_api/graphql_queries.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ def project_graphql_query(fields):
7777

7878
def projects_graphql_query(fields):
7979
query = GraphQlQuery("ProjectsQuery")
80+
project_name_var = query.add_variable("projectName", "String!")
8081
projects_field = query.add_field_with_edges("projects")
82+
projects_field.set_filter("name", project_name_var)
8183

8284
nested_fields = fields_to_dict(fields)
8385

@@ -119,30 +121,6 @@ def product_types_query(fields):
119121
return query
120122

121123

122-
def project_product_types_query(fields):
123-
query = GraphQlQuery("ProjectProductTypes")
124-
project_query = query.add_field("project")
125-
project_name_var = query.add_variable("projectName", "String!")
126-
project_query.set_filter("name", project_name_var)
127-
product_types_field = project_query.add_field("productTypes")
128-
nested_fields = fields_to_dict(fields)
129-
130-
query_queue = collections.deque()
131-
for key, value in nested_fields.items():
132-
query_queue.append((key, value, product_types_field))
133-
134-
while query_queue:
135-
item = query_queue.popleft()
136-
key, value, parent = item
137-
field = parent.add_field(key)
138-
if value is FIELD_VALUE:
139-
continue
140-
141-
for k, v in value.items():
142-
query_queue.append((k, v, field))
143-
return query
144-
145-
146124
def folders_graphql_query(fields):
147125
query = GraphQlQuery("FoldersQuery")
148126
project_name_var = query.add_variable("projectName", "String!")

0 commit comments

Comments
 (0)