Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ayon_api/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4481,12 +4481,12 @@ def get_project_product_types(
project_name: str,
fields: Optional[Iterable[str]] = None,
) -> List["ProductTypeDict"]:
"""Types of products available on a project.
"""DEPRECATED Types of products available in a project.

Filter only product types available on project.
Filter only product types available in a project.

Args:
project_name (str): Name of project where to look for
project_name (str): Name of the project where to look for
product types.
fields (Optional[Iterable[str]]): Product types fields to query.

Expand All @@ -4505,7 +4505,7 @@ def get_product_type_names(
project_name: Optional[str] = None,
product_ids: Optional[Iterable[str]] = None,
) -> Set[str]:
"""Product type names.
"""DEPRECATED Product type names.

Warnings:
This function will be probably removed. Matters if 'products_id'
Expand Down
37 changes: 34 additions & 3 deletions ayon_api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,43 @@
"attrib.fullName",
}

# --- Folder types ---
# --- Project folder types ---
DEFAULT_FOLDER_TYPE_FIELDS = {
"name",
"icon",
}

# --- Task types ---
# --- Project task types ---
DEFAULT_TASK_TYPE_FIELDS = {
"name",
}

# --- Project tags ---
DEFAULT_PROJECT_TAGS_FIELDS = {
"name",
"color",
}

# --- Project statuses ---
DEFAULT_PROJECT_STATUSES_FIELDS = {
"color",
"icon",
"name",
"scope",
"shortName",
"state",
}

# --- Project link types ---
DEFAULT_PROJECT_LINK_TYPES_FIELDS = {
"color",
"inputType",
"linkType",
"name",
"outputType",
"style",
}

# --- Product types ---
DEFAULT_PRODUCT_TYPE_FIELDS = {
"name",
Expand All @@ -51,14 +77,19 @@
# --- Project ---
DEFAULT_PROJECT_FIELDS = {
"active",
"library",
"name",
"code",
"config",
"createdAt",
"updatedAt",
"data",
"folderTypes",
"taskTypes",
"productTypes",
"linkTypes",
"statuses",
"tags",
"attrib",
}

# --- Folders ---
Expand Down
26 changes: 2 additions & 24 deletions ayon_api/graphql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def project_graphql_query(fields):

def projects_graphql_query(fields):
query = GraphQlQuery("ProjectsQuery")
project_name_var = query.add_variable("projectName", "String!")
projects_field = query.add_field_with_edges("projects")
projects_field.set_filter("name", project_name_var)

nested_fields = fields_to_dict(fields)

Expand Down Expand Up @@ -119,30 +121,6 @@ def product_types_query(fields):
return query


def project_product_types_query(fields):
query = GraphQlQuery("ProjectProductTypes")
project_query = query.add_field("project")
project_name_var = query.add_variable("projectName", "String!")
project_query.set_filter("name", project_name_var)
product_types_field = project_query.add_field("productTypes")
nested_fields = fields_to_dict(fields)

query_queue = collections.deque()
for key, value in nested_fields.items():
query_queue.append((key, value, product_types_field))

while query_queue:
item = query_queue.popleft()
key, value, parent = item
field = parent.add_field(key)
if value is FIELD_VALUE:
continue

for k, v in value.items():
query_queue.append((k, v, field))
return query


def folders_graphql_query(fields):
query = GraphQlQuery("FoldersQuery")
project_name_var = query.add_variable("projectName", "String!")
Expand Down
Loading