Skip to content

Commit

Permalink
Merge pull request #177 from ynput/enhancement/small-api-update
Browse files Browse the repository at this point in the history
Chore: Small API update
  • Loading branch information
iLLiCiTiT authored Sep 4, 2024
2 parents dcfb95c + 5f1142d commit 7ff7e8c
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 247 deletions.
32 changes: 28 additions & 4 deletions ayon_api/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ def get_events(*args, **kwargs):
Args:
topics (Optional[Iterable[str]]): Name of topics.
event_ids (Optional[Iterable[str]]): Event ids.
project_names (Optional[Iterable[str]]): Project on which
event happened.
states (Optional[Iterable[str]]): Filtering by states.
Expand All @@ -751,6 +752,22 @@ def get_events(*args, **kwargs):


def update_event(*args, **kwargs):
"""Update event data.
Args:
event_id (str): Event id.
sender (Optional[str]): New sender of event.
project_name (Optional[str]): New project name.
username (Optional[str]): New username.
status (Optional[str]): New event status. Enum: "pending",
"in_progress", "finished", "failed", "aborted", "restarted"
description (Optional[str]): New description.
summary (Optional[dict[str, Any]]): New summary.
payload (Optional[dict[str, Any]]): New payload.
progress (Optional[int]): New progress. Range [0-100].
retries (Optional[int]): New retries.
"""
con = get_server_api_connection()
return con.update_event(*args, **kwargs)

Expand All @@ -764,7 +781,7 @@ def dispatch_event(*args, **kwargs):
event_hash (Optional[str]): Event hash.
project_name (Optional[str]): Project name.
username (Optional[str]): Username which triggered event.
dependencies (Optional[list[str]]): List of event id dependencies.
depends_on (Optional[str]): Add dependency to another event.
description (Optional[str]): Description of event.
summary (Optional[dict[str, Any]]): Summary of event that can be used
for simple filtering on listeners.
Expand All @@ -774,6 +791,8 @@ def dispatch_event(*args, **kwargs):
store (Optional[bool]): Store event in event queue for possible
future processing otherwise is event send only
to active listeners.
dependencies (Optional[list[str]]): Deprecated.
List of event id dependencies.
Returns:
RestApiResponse: Response from server.
Expand Down Expand Up @@ -2375,6 +2394,8 @@ def get_folders(*args, **kwargs):
children. Ignored when None, default behavior.
statuses (Optional[Iterable[str]]): Folder statuses used
for filtering.
assignees_all (Optional[Iterable[str]]): Filter by assigness
on children tasks. Task must have all of passed assignees.
tags (Optional[Iterable[str]]): Folder tags used
for filtering.
active (Optional[bool]): Filter active/inactive folders.
Expand Down Expand Up @@ -2997,10 +3018,12 @@ def get_versions(*args, **kwargs):
version filtering.
product_ids (Optional[Iterable[str]]): Product ids used for
version filtering.
task_ids (Optional[Iterable[str]]): Task ids used for
version filtering.
versions (Optional[Iterable[int]]): Versions we're interested in.
hero (Optional[bool]): Receive also hero versions when set to true.
standard (Optional[bool]): Receive versions which are not hero when
set to true.
hero (Optional[bool]): Skip hero versions when set to False.
standard (Optional[bool]): Skip standard (non-hero) when
set to False.
latest (Optional[bool]): Return only latest version of standard
versions. This can be combined only with 'standard' attribute
set to True.
Expand Down Expand Up @@ -3255,6 +3278,7 @@ def update_version(*args, **kwargs):
version (Optional[int]): New version.
product_id (Optional[str]): New product id.
task_id (Optional[Union[str, None]]): New task id.
author (Optional[str]): New author username.
attrib (Optional[dict[str, Any]]): New attributes.
data (Optional[dict[str, Any]]): New data.
tags (Optional[Iterable[str]]): New tags.
Expand Down
6 changes: 6 additions & 0 deletions ayon_api/graphql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def folders_graphql_query(fields):
has_links_var = query.add_variable("folderHasLinks", "HasLinksFilter")
has_children_var = query.add_variable("folderHasChildren", "Boolean!")
statuses_var = query.add_variable("folderStatuses", "[String!]")
folder_assignees_all_var = query.add_variable(
"folderAssigneesAll", "[String!]"
)
tags_var = query.add_variable("folderTags", "[String!]")

project_field = query.add_field("project")
Expand All @@ -170,6 +173,7 @@ def folders_graphql_query(fields):
folders_field.set_filter("pathEx", folder_path_regex_var)
folders_field.set_filter("folderTypes", folder_types_var)
folders_field.set_filter("statuses", statuses_var)
folders_field.set_filter("assignees", folder_assignees_all_var)
folders_field.set_filter("tags", tags_var)
folders_field.set_filter("hasProducts", has_products_var)
folders_field.set_filter("hasTasks", has_tasks_var)
Expand Down Expand Up @@ -567,6 +571,7 @@ def workfiles_info_graphql_query(fields):
def events_graphql_query(fields):
query = GraphQlQuery("Events")
topics_var = query.add_variable("eventTopics", "[String!]")
ids_var = query.add_variable("eventIds", "[String!]")
projects_var = query.add_variable("projectNames", "[String!]")
states_var = query.add_variable("eventStates", "[String!]")
users_var = query.add_variable("eventUsers", "[String!]")
Expand All @@ -576,6 +581,7 @@ def events_graphql_query(fields):
older_than_var = query.add_variable("olderThanFilter", "String!")

events_field = query.add_field_with_edges("events")
events_field.set_filter("ids", ids_var)
events_field.set_filter("topics", topics_var)
events_field.set_filter("projects", projects_var)
events_field.set_filter("states", states_var)
Expand Down
Loading

0 comments on commit 7ff7e8c

Please sign in to comment.