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
2 changes: 2 additions & 0 deletions ayon_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
get_thumbnail_by_id,
get_thumbnail,
get_folder_thumbnail,
get_task_thumbnail,
get_version_thumbnail,
get_workfile_thumbnail,
create_thumbnail,
Expand Down Expand Up @@ -459,6 +460,7 @@
"get_thumbnail_by_id",
"get_thumbnail",
"get_folder_thumbnail",
"get_task_thumbnail",
"get_version_thumbnail",
"get_workfile_thumbnail",
"create_thumbnail",
Expand Down
31 changes: 27 additions & 4 deletions ayon_api/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5698,9 +5698,10 @@ def get_thumbnail_by_id(
) -> ThumbnailContent:
"""Get thumbnail from server by id.

Permissions of thumbnails are related to entities so thumbnails must
be queried per entity. So an entity type and entity type is required
to be passed.
Warnings:
Please keep in mind that used endpoint is allowed only for admins
and managers. Use 'get_thumbnail' with entity type and id
to allow access for artists.

Notes:
It is recommended to use one of prepared entity type specific
Expand Down Expand Up @@ -5736,7 +5737,7 @@ def get_thumbnail(
"""Get thumbnail from server.

Permissions of thumbnails are related to entities so thumbnails must
be queried per entity. So an entity type and entity type is required
be queried per entity. So an entity type and entity id is required
to be passed.

Notes:
Expand Down Expand Up @@ -5794,6 +5795,28 @@ def get_folder_thumbnail(
)


def get_task_thumbnail(
project_name: str,
task_id: str,
) -> ThumbnailContent:
"""Prepared method to receive thumbnail for task entity.

Args:
project_name (str): Project under which the entity is located.
task_id (str): Folder id for which thumbnail should be returned.

Returns:
ThumbnailContent: Thumbnail content wrapper. Does not have to be
valid.

"""
con = get_server_api_connection()
return con.get_task_thumbnail(
project_name=project_name,
task_id=task_id,
)


def get_version_thumbnail(
project_name: str,
version_id: str,
Expand Down
66 changes: 58 additions & 8 deletions ayon_api/server_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7769,9 +7769,10 @@ def get_thumbnail_by_id(
) -> ThumbnailContent:
"""Get thumbnail from server by id.

Permissions of thumbnails are related to entities so thumbnails must
be queried per entity. So an entity type and entity type is required
to be passed.
Warnings:
Please keep in mind that used endpoint is allowed only for admins
and managers. Use 'get_thumbnail' with entity type and id
to allow access for artists.

Notes:
It is recommended to use one of prepared entity type specific
Expand Down Expand Up @@ -7806,7 +7807,7 @@ def get_thumbnail(
"""Get thumbnail from server.

Permissions of thumbnails are related to entities so thumbnails must
be queried per entity. So an entity type and entity type is required
be queried per entity. So an entity type and entity id is required
to be passed.

Notes:
Expand All @@ -7830,7 +7831,13 @@ def get_thumbnail(

"""
if thumbnail_id:
return self.get_thumbnail_by_id(project_name, thumbnail_id)
warnings.warn(
(
"Function 'get_thumbnail' got 'thumbnail_id' which"
" is deprecated and will be removed in future version."
),
DeprecationWarning
)

if entity_type in (
"folder",
Expand Down Expand Up @@ -7864,10 +7871,36 @@ def get_folder_thumbnail(
valid.

"""
if thumbnail_id:
warnings.warn(
(
"Function 'get_folder_thumbnail' got 'thumbnail_id' which"
" is deprecated and will be removed in future version."
),
DeprecationWarning
)
return self.get_thumbnail(
project_name, "folder", folder_id, thumbnail_id
project_name, "folder", folder_id
)

def get_task_thumbnail(
self,
project_name: str,
task_id: str,
) -> ThumbnailContent:
"""Prepared method to receive thumbnail for task entity.

Args:
project_name (str): Project under which the entity is located.
task_id (str): Folder id for which thumbnail should be returned.

Returns:
ThumbnailContent: Thumbnail content wrapper. Does not have to be
valid.

"""
return self.get_thumbnail(project_name, "task", task_id)

def get_version_thumbnail(
self,
project_name: str,
Expand All @@ -7888,8 +7921,16 @@ def get_version_thumbnail(
valid.

"""
if thumbnail_id:
warnings.warn(
(
"Function 'get_version_thumbnail' got 'thumbnail_id' which"
" is deprecated and will be removed in future version."
),
DeprecationWarning
)
return self.get_thumbnail(
project_name, "version", version_id, thumbnail_id
project_name, "version", version_id
)

def get_workfile_thumbnail(
Expand All @@ -7912,8 +7953,17 @@ def get_workfile_thumbnail(
valid.

"""
if thumbnail_id:
warnings.warn(
(
"Function 'get_workfile_thumbnail' got 'thumbnail_id'"
" which is deprecated and will be removed in future"
" version."
),
DeprecationWarning
)
return self.get_thumbnail(
project_name, "workfile", workfile_id, thumbnail_id
project_name, "workfile", workfile_id
)

def create_thumbnail(
Expand Down