Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/check_global_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'

- name: Install dependencies
run: |
Expand Down
12 changes: 12 additions & 0 deletions automated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def _get_typehint(annotation, api_globals):
str(annotation)
.replace("NoneType", "None")
)

full_path_regex = re.compile(
r"(?P<full>(?P<name>[a-zA-Z0-9_\.]+))"
)
Expand Down Expand Up @@ -181,6 +182,17 @@ def _get_typehint(annotation, api_globals):
name = name.split(".")[-1]
typehint = typehint.replace(groups["full"], name)

if "Literal" in typehint:
for match in re.finditer(
r"(?P<fullcontent>Literal\[(?P<content>[^\]]*)\])", typehint
):
full_content = match.group("fullcontent")
content = match.group("content")
items = [f'"{i.strip()}"' for i in content.split(",")]
new_content = ", ".join(items)
new_full_content = full_content.replace(content, new_content)
typehint = typehint.replace(full_content, new_full_content)

try:
# Test if typehint is valid for known '_api' content
exec(f"_: {typehint} = None", api_globals)
Expand Down
48 changes: 48 additions & 0 deletions ayon_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
patch,
get,
delete,
get_server_config,
set_server_config,
get_server_config_overrides,
get_server_config_value,
download_server_config_file,
download_server_config_file_to_stream,
upload_server_config_file,
upload_server_config_file_from_stream,
download_file_to_stream,
download_file,
upload_project_file,
Expand Down Expand Up @@ -116,6 +124,14 @@
create_activity,
update_activity,
delete_activity,
get_raw_activity_categories,
get_activity_categories,
create_activity_reaction,
delete_activity_reaction,
suggest_entity_mention,
get_raw_entity_watchers,
get_entity_watchers,
set_entity_watchers,
send_activities_batch_operations,
get_bundles,
create_bundle,
Expand Down Expand Up @@ -151,6 +167,7 @@
reset_attributes_cache,
set_attributes_cache_timeout,
set_attribute_config,
delete_attribute_config,
remove_attribute_config,
get_attributes_for_type,
get_attributes_fields_for_type,
Expand All @@ -168,6 +185,13 @@
create_project,
update_project,
delete_project,
get_raw_project_folders,
get_project_folders,
create_project_folder,
update_project_folder,
set_project_folders_order,
assign_projects_to_project_folder,
delete_project_folder,
get_project_root_overrides,
get_project_roots_by_site,
get_project_root_overrides_by_site_id,
Expand Down Expand Up @@ -356,6 +380,14 @@
"patch",
"get",
"delete",
"get_server_config",
"set_server_config",
"get_server_config_overrides",
"get_server_config_value",
"download_server_config_file",
"download_server_config_file_to_stream",
"upload_server_config_file",
"upload_server_config_file_from_stream",
"download_file_to_stream",
"download_file",
"upload_project_file",
Expand Down Expand Up @@ -403,6 +435,14 @@
"create_activity",
"update_activity",
"delete_activity",
"get_raw_activity_categories",
"get_activity_categories",
"create_activity_reaction",
"delete_activity_reaction",
"suggest_entity_mention",
"get_raw_entity_watchers",
"get_entity_watchers",
"set_entity_watchers",
"send_activities_batch_operations",
"get_bundles",
"create_bundle",
Expand Down Expand Up @@ -438,6 +478,7 @@
"reset_attributes_cache",
"set_attributes_cache_timeout",
"set_attribute_config",
"delete_attribute_config",
"remove_attribute_config",
"get_attributes_for_type",
"get_attributes_fields_for_type",
Expand All @@ -455,6 +496,13 @@
"create_project",
"update_project",
"delete_project",
"get_raw_project_folders",
"get_project_folders",
"create_project_folder",
"update_project_folder",
"set_project_folders_order",
"assign_projects_to_project_folder",
"delete_project_folder",
"get_project_root_overrides",
"get_project_roots_by_site",
"get_project_root_overrides_by_site_id",
Expand Down
Loading
Loading