From 501e1d36c1a8a7d0af59d91453199b5d5527755d Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:21:00 +0200 Subject: [PATCH 01/15] added assignees to folder graphql query --- ayon_api/graphql_queries.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ayon_api/graphql_queries.py b/ayon_api/graphql_queries.py index 4cb6bd637..09e322c9c 100644 --- a/ayon_api/graphql_queries.py +++ b/ayon_api/graphql_queries.py @@ -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") @@ -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) From d1e844e625b5224fcbe6e835aaa8d1baaeec7dac Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:21:12 +0200 Subject: [PATCH 02/15] added event ids to graphql filters --- ayon_api/graphql_queries.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ayon_api/graphql_queries.py b/ayon_api/graphql_queries.py index 09e322c9c..25d303463 100644 --- a/ayon_api/graphql_queries.py +++ b/ayon_api/graphql_queries.py @@ -571,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!]") @@ -580,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) From b5b2a55c34c0b61163e094106d5970f7bddc2040 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:33:19 +0200 Subject: [PATCH 03/15] allow to update user on event --- ayon_api/server_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 6f1b06ead..fa9e73a71 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -1472,6 +1472,7 @@ def update_event( event_id, sender=None, project_name=None, + username=None, status=None, description=None, summary=None, @@ -1484,6 +1485,7 @@ def update_event( for key, value in ( ("sender", sender), ("project", project_name), + ("user", username), ("status", status), ("description", description), ("summary", summary), From e7406566823ddd0d3cc5f9fa9a461e624c56aebe Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:34:02 +0200 Subject: [PATCH 04/15] dispatch event support dependsOn --- ayon_api/server_api.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index fa9e73a71..9453ab3cd 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -1524,12 +1524,13 @@ def dispatch_event( event_hash=None, project_name=None, username=None, - dependencies=None, + depends_on=None, description=None, summary=None, payload=None, finished=True, store=True, + dependencies=None, ): """Dispatch event to server. @@ -1538,8 +1539,8 @@ def dispatch_event( sender (Optional[str]): Sender of event. event_hash (Optional[str]): Event hash. project_name (Optional[str]): Project name. + depends_on (Optional[str]): Add dependency to another event. username (Optional[str]): Username which triggered event. - dependencies (Optional[list[str]]): List of event id dependencies. description (Optional[str]): Description of event. summary (Optional[dict[str, Any]]): Summary of event that can be used for simple filtering on listeners. @@ -1549,6 +1550,8 @@ def dispatch_event( 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. @@ -1564,13 +1567,23 @@ def dispatch_event( "hash": event_hash, "project": project_name, "user": username, - "dependencies": dependencies, "description": description, "summary": summary, "payload": payload, "finished": finished, "store": store, } + if depends_on: + event_data["dependsOn"] = depends_on + + if dependencies: + warnings.warn( + ( + "Used deprecated argument 'dependencies' in" + " 'dispatch_event'. Use 'depends_on' instead." + ), + DeprecationWarning + ) response = self.post("events", **event_data) response.raise_for_status() @@ -1652,6 +1665,7 @@ def enroll_event_job( kwargs["description"] = description if events_filter is not None: kwargs["filter"] = events_filter + response = self.post("enroll", **kwargs) if response.status_code == 204: return None From 8419b298025d2a90e6584fdc1ce417462ad1ed7c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:43:06 +0200 Subject: [PATCH 05/15] simplify filters handling --- ayon_api/server_api.py | 331 +++++++++++++---------------------------- 1 file changed, 106 insertions(+), 225 deletions(-) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 9453ab3cd..c55deb223 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -111,6 +111,29 @@ ) +def _convert_list_filter_value(value): + if value is None: + return None + + if isinstance(value, PatternType): + return [value.pattern] + + if isinstance(value, (int, float, str, bool)): + return [value] + return list(set(value)) + + +def _prepare_list_filters(output, *args, **kwargs): + for key, value in itertools.chain(args, kwargs.items()): + value = _convert_list_filter_value(value) + if value is None: + continue + if not value: + return False + output[key] = value + return True + + def _get_description(response): if HTTPStatus is None: return str(response.orig_response) @@ -1419,42 +1442,26 @@ def get_events( """ filters = {} - if topics is not None: - topics = set(topics) - if not topics: - return - filters["eventTopics"] = list(topics) - - if project_names is not None: - project_names = set(project_names) - if not project_names: - return - filters["projectNames"] = list(project_names) - - if states is not None: - states = set(states) - if not states: - return - filters["eventStates"] = list(states) - - if users is not None: - users = set(users) - if not users: - return - filters["eventUsers"] = list(users) + if not _prepare_list_filters( + filters, + ("eventTopics", topics), + ("projectNames", project_names), + ("eventStates", states), + ("eventUsers", users), + ): + return if include_logs is None: include_logs = False - filters["includeLogsFilter"] = include_logs - - if has_children is not None: - filters["hasChildrenFilter"] = has_children - if newer_than is not None: - filters["newerThanFilter"] = newer_than - - if older_than is not None: - filters["olderThanFilter"] = older_than + for filter_key, filter_value in ( + ("includeLogsFilter", include_logs), + ("hasChildrenFilter", has_children), + ("newerThanFilter", newer_than), + ("olderThanFilter", older_than), + ): + if filter_value is not None: + filters[filter_key] = filter_value if not fields: fields = self.get_default_fields_for_type("event") @@ -4158,41 +4165,26 @@ def get_folders( filters = { "projectName": project_name } - if folder_ids is not None: - folder_ids = set(folder_ids) - if not folder_ids: - return - filters["folderIds"] = list(folder_ids) - - if folder_paths is not None: - folder_paths = set(folder_paths) - if not folder_paths: - return - filters["folderPaths"] = list(folder_paths) - - if folder_names is not None: - folder_names = set(folder_names) - if not folder_names: - return - filters["folderNames"] = list(folder_names) - - if folder_types is not None: - folder_types = set(folder_types) - if not folder_types: - return - filters["folderTypes"] = list(folder_types) - - if statuses is not None: - statuses = set(statuses) - if not statuses: - return - filters["folderStatuses"] = list(statuses) + if not _prepare_list_filters( + filters, + ("folderIds", folder_ids), + ("folderPaths", folder_paths), + ("folderNames", folder_names), + ("folderTypes", folder_types), + ("folderStatuses", statuses), + ("folderTags", tags), + ): + return - if tags is not None: - tags = set(tags) - if not tags: - return - filters["folderTags"] = list(tags) + for filter_key, filter_value in ( + ("folderPathRegex", folder_path_regex), + ("folderHasProducts", has_products), + ("folderHasTasks", has_tasks), + ("folderHasLinks", has_links), + ("folderHasChildren", has_children), + ): + if filter_value is not None: + filters[filter_key] = filter_value if parent_ids is not None: parent_ids = set(parent_ids) @@ -4214,21 +4206,6 @@ def get_folders( filters["parentFolderIds"] = list(parent_ids) - if folder_path_regex is not None: - filters["folderPathRegex"] = folder_path_regex - - if has_products is not None: - filters["folderHasProducts"] = has_products - - if has_tasks is not None: - filters["folderHasTasks"] = has_tasks - - if has_links is not None: - filters["folderHasLinks"] = has_links.upper() - - if has_children is not None: - filters["folderHasChildren"] = has_children - if not fields: fields = self.get_default_fields_for_type("folder") else: @@ -4606,54 +4583,18 @@ def get_tasks( filters = { "projectName": project_name } - - if task_ids is not None: - task_ids = set(task_ids) - if not task_ids: - return - filters["taskIds"] = list(task_ids) - - if task_names is not None: - task_names = set(task_names) - if not task_names: - return - filters["taskNames"] = list(task_names) - - if task_types is not None: - task_types = set(task_types) - if not task_types: - return - filters["taskTypes"] = list(task_types) - - if folder_ids is not None: - folder_ids = set(folder_ids) - if not folder_ids: - return - filters["folderIds"] = list(folder_ids) - - if assignees is not None: - assignees = set(assignees) - if not assignees: - return - filters["taskAssigneesAny"] = list(assignees) - - if assignees_all is not None: - assignees_all = set(assignees_all) - if not assignees_all: - return - filters["taskAssigneesAll"] = list(assignees_all) - - if statuses is not None: - statuses = set(statuses) - if not statuses: - return - filters["taskStatuses"] = list(statuses) - - if tags is not None: - tags = set(tags) - if not tags: - return - filters["taskTags"] = list(tags) + if not _prepare_list_filters( + filters, + ("taskIds", task_ids), + ("taskNames", task_names), + ("taskTypes", task_types), + ("folderIds", folder_ids), + ("taskAssigneesAny", assignees), + ("taskAssigneesAll", assignees_all), + ("taskStatuses", statuses), + ("taskTags", tags), + ): + return if not fields: fields = self.get_default_fields_for_type("task") @@ -4811,42 +4752,16 @@ def get_tasks_by_folder_paths( "projectName": project_name, "folderPaths": list(folder_paths), } - - if task_names is not None: - task_names = set(task_names) - if not task_names: - return - filters["taskNames"] = list(task_names) - - if task_types is not None: - task_types = set(task_types) - if not task_types: - return - filters["taskTypes"] = list(task_types) - - if assignees is not None: - assignees = set(assignees) - if not assignees: - return - filters["taskAssigneesAny"] = list(assignees) - - if assignees_all is not None: - assignees_all = set(assignees_all) - if not assignees_all: - return - filters["taskAssigneesAll"] = list(assignees_all) - - if statuses is not None: - statuses = set(statuses) - if not statuses: - return - filters["taskStatuses"] = list(statuses) - - if tags is not None: - tags = set(tags) - if not tags: - return - filters["taskTags"] = list(tags) + if not _prepare_list_filters( + filters, + ("taskNames", task_names), + ("taskTypes", task_types), + ("taskAssigneesAny", assignees), + ("taskAssigneesAll", assignees_all), + ("taskStatuses", statuses), + ("taskTags", tags), + ): + return if not fields: fields = self.get_default_fields_for_type("task") @@ -5266,35 +5181,21 @@ def get_products( if filter_product_names: filters["productNames"] = list(filter_product_names) - if product_ids is not None: - product_ids = set(product_ids) - if not product_ids: - return - filters["productIds"] = list(product_ids) - - if product_types is not None: - product_types = set(product_types) - if not product_types: - return - filters["productTypes"] = list(product_types) - - if statuses is not None: - statuses = set(statuses) - if not statuses: - return - filters["productStatuses"] = list(statuses) - - if tags is not None: - tags = set(tags) - if not tags: - return - filters["productTags"] = list(tags) - - if product_name_regex: - filters["productNameRegex"] = product_name_regex + if not _prepare_list_filters( + filters, + ("productIds", product_ids), + ("productTypes", product_types), + ("productStatuses", statuses), + ("productTags", tags), + ): + return - if product_path_regex: - filters["productPathRegex"] = product_path_regex + for filter_key, filter_value in ( + ("productNameRegex", product_name_regex), + ("productPathRegex", product_path_regex), + ): + if filter_value: + filters[filter_key] = filter_value query = products_graphql_query(fields) for attr, filter_value in filters.items(): @@ -5673,41 +5574,21 @@ def get_versions( " (apx. version 1.0.10 or 1.1.0)." ) + if not hero and not standard: + return + filters = { "projectName": project_name } - if version_ids is not None: - version_ids = set(version_ids) - if not version_ids: - return - filters["versionIds"] = list(version_ids) - - if product_ids is not None: - product_ids = set(product_ids) - if not product_ids: - return - filters["productIds"] = list(product_ids) - - # TODO versions can't be used as filter at this moment! - if versions is not None: - versions = set(versions) - if not versions: - return - filters["versions"] = list(versions) - - if statuses is not None: - statuses = set(statuses) - if not statuses: - return - filters["versionStatuses"] = list(statuses) - - if tags is not None: - tags = set(tags) - if not tags: - return - filters["versionTags"] = list(tags) - - if not hero and not standard: + if not _prepare_list_filters( + filters, + ("taskIds", task_ids), + ("versionIds", version_ids), + ("productIds", product_ids), + ("versions", versions), + ("versionStatuses", statuses), + ("versionTags", tags), + ): return queries = [] From 96c970b413ed857ac2201b008c7e412d0a83e881 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:43:24 +0200 Subject: [PATCH 06/15] better docstring for hero and standard --- ayon_api/server_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index c55deb223..b783b1dce 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -5526,9 +5526,9 @@ def get_versions( product_ids (Optional[Iterable[str]]): Product 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. From b38a0393a7dc078e43c1c6d34e1ccabe345acc6a Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:43:58 +0200 Subject: [PATCH 07/15] added deprecation warning for 'get_folders_rest' --- ayon_api/server_api.py | 43 ++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index b783b1dce..90e861b52 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -4092,6 +4092,13 @@ def get_folders_rest(self, project_name, include_attrib=False): list[dict[str, Any]]: List of folder entities. """ + warnings.warn( + ( + "DEPRECATION: Used deprecated 'get_folders_rest'," + " use 'get_rest_folders' instead." + ), + DeprecationWarning + ) return self.get_rest_folders(project_name, include_attrib) def get_folders( @@ -5160,9 +5167,12 @@ def get_products( if own_attributes is not _PLACEHOLDER: warnings.warn( - "'own_attributes' is not supported for products. The argument" - " will be removed form function signature in future" - " (apx. version 1.0.10 or 1.1.0)." + ( + "'own_attributes' is not supported for products. The" + " argument will be removed form function signature in" + " future (apx. version 1.0.10 or 1.1.0)." + ), + DeprecationWarning ) # Add 'name' and 'folderId' if 'names_by_folder_ids' filter is entered @@ -5569,9 +5579,12 @@ def get_versions( if own_attributes is not _PLACEHOLDER: warnings.warn( - "'own_attributes' is not supported for versions. The argument" - " will be removed form function signature in future" - " (apx. version 1.0.10 or 1.1.0)." + ( + "'own_attributes' is not supported for versions. The" + " argument will be removed form function signature in" + " future (apx. version 1.0.10 or 1.1.0)." + ), + DeprecationWarning ) if not hero and not standard: @@ -6200,9 +6213,12 @@ def get_representations( if own_attributes is not _PLACEHOLDER: warnings.warn( - "'own_attributes' is not supported for representations. " - "The argument will be removed form function signature in " - "future (apx. version 1.0.10 or 1.1.0)." + ( + "'own_attributes' is not supported for representations. " + "The argument will be removed form function signature in " + "future (apx. version 1.0.10 or 1.1.0)." + ), + DeprecationWarning ) if "files" in fields: @@ -6901,9 +6917,12 @@ def get_workfiles_info( if own_attributes is not _PLACEHOLDER: warnings.warn( - "'own_attributes' is not supported for workfiles. The argument" - " will be removed form function signature in future" - " (apx. version 1.0.10 or 1.1.0)." + ( + "'own_attributes' is not supported for workfiles. The" + " argument will be removed form function signature in" + " future (apx. version 1.0.10 or 1.1.0)." + ), + DeprecationWarning ) query = workfiles_info_graphql_query(fields) From eef8493710245691e4d37e005eea6135b8bb4472 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:44:19 +0200 Subject: [PATCH 08/15] events can be filtered by ids --- ayon_api/server_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 90e861b52..e61e7c037 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -1406,6 +1406,7 @@ def get_event(self, event_id): def get_events( self, topics=None, + event_ids=None, project_names=None, states=None, users=None, @@ -1422,6 +1423,7 @@ def get_events( 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. @@ -1445,6 +1447,7 @@ def get_events( if not _prepare_list_filters( filters, ("eventTopics", topics), + ("eventIds", event_ids), ("projectNames", project_names), ("eventStates", states), ("eventUsers", users), From bb7534358e4645efd3be9450379c89b38b9d7c73 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:44:31 +0200 Subject: [PATCH 09/15] added assignees filter for folders --- ayon_api/server_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index e61e7c037..5e3a0a702 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -4117,6 +4117,7 @@ def get_folders( has_tasks=None, has_children=None, statuses=None, + assignees_all=None, tags=None, active=True, has_links=None, @@ -4153,6 +4154,8 @@ def get_folders( 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. @@ -4183,6 +4186,7 @@ def get_folders( ("folderTypes", folder_types), ("folderStatuses", statuses), ("folderTags", tags), + ("folderAssigneesAll", assignees_all), ): return From 6331246576106597b123d0cd06107b184103be58 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:44:44 +0200 Subject: [PATCH 10/15] added task ids filter for versions --- ayon_api/server_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 5e3a0a702..f9920b63f 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -5524,6 +5524,7 @@ def get_versions( project_name, version_ids=None, product_ids=None, + task_ids=None, versions=None, hero=True, standard=True, @@ -5542,6 +5543,8 @@ def get_versions( 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]): Skip hero versions when set to False. standard (Optional[bool]): Skip standard (non-hero) when @@ -5605,6 +5608,7 @@ def get_versions( ("taskIds", task_ids), ("versionIds", version_ids), ("productIds", product_ids), + ("taskIds", task_ids), ("versions", versions), ("versionStatuses", statuses), ("versionTags", tags), From d98a404a2c53121022b715617e364841822d5885 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:45:03 +0200 Subject: [PATCH 11/15] version support update of author --- ayon_api/server_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index f9920b63f..9ffb2e964 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -6064,6 +6064,7 @@ def update_version( version=None, product_id=None, task_id=NOT_SET, + author=None, attrib=None, data=None, tags=None, @@ -6088,6 +6089,7 @@ def update_version( 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. @@ -6106,6 +6108,7 @@ def update_version( ("tags", tags), ("status", status), ("active", active), + ("author", author), ): if value is not None: update_data[key] = value From 345d18debfa73805e56d421b6b277fd142a4eb8e Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:45:12 +0200 Subject: [PATCH 12/15] update event has docstring --- ayon_api/server_api.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 9ffb2e964..659a42a26 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -1490,6 +1490,22 @@ def update_event( progress=None, retries=None ): + """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. + + """ kwargs = { key: value for key, value in ( From 5089eccab031654f2fad0d82fe10ff4b226dce70 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:45:20 +0200 Subject: [PATCH 13/15] added missing import --- ayon_api/server_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 659a42a26..abd686202 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -14,6 +14,7 @@ import copy import uuid import warnings +import itertools from contextlib import contextmanager try: From 509c176b32986523efe7b1fb2e4247018452483f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:45:45 +0200 Subject: [PATCH 14/15] updated '_api.py' --- ayon_api/_api.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/ayon_api/_api.py b/ayon_api/_api.py index 9c85bdd84..38c36df38 100644 --- a/ayon_api/_api.py +++ b/ayon_api/_api.py @@ -722,6 +722,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. @@ -746,6 +747,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) @@ -758,8 +775,8 @@ def dispatch_event(*args, **kwargs): sender (Optional[str]): Sender of event. event_hash (Optional[str]): Event hash. project_name (Optional[str]): Project name. + depends_on (Optional[str]): Add dependency to another event. username (Optional[str]): Username which triggered event. - dependencies (Optional[list[str]]): List of event id dependencies. description (Optional[str]): Description of event. summary (Optional[dict[str, Any]]): Summary of event that can be used for simple filtering on listeners. @@ -769,6 +786,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. @@ -2370,6 +2389,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. @@ -2992,10 +3013,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. @@ -3250,6 +3273,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. From 5f1142d685c86df3fcce3c863c7d712d6e867bb2 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 3 Sep 2024 17:46:02 +0200 Subject: [PATCH 15/15] change order in docstring --- ayon_api/_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ayon_api/_api.py b/ayon_api/_api.py index 38c36df38..8e9cd0736 100644 --- a/ayon_api/_api.py +++ b/ayon_api/_api.py @@ -775,8 +775,8 @@ def dispatch_event(*args, **kwargs): sender (Optional[str]): Sender of event. event_hash (Optional[str]): Event hash. project_name (Optional[str]): Project name. - depends_on (Optional[str]): Add dependency to another event. username (Optional[str]): Username which triggered event. + 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.