mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 22:04:57 +08:00
fix(types): type TMDB collection parts
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from typing import cast
|
||||
|
||||
from ..tmdb import TMDb, TMDbJson
|
||||
|
||||
|
||||
@@ -8,13 +10,16 @@ class Collection(TMDb):
|
||||
"translations": "/collection/%s/translations"
|
||||
}
|
||||
|
||||
def details(self, collection_id: int | str) -> TMDbJson:
|
||||
def details(self, collection_id: int | str) -> list[dict[str, TMDbJson]]:
|
||||
"""
|
||||
Get collection details by id.
|
||||
:param collection_id: int
|
||||
:return:
|
||||
"""
|
||||
return self._request_obj(self._urls["details"] % collection_id, key="parts")
|
||||
return cast(
|
||||
list[dict[str, TMDbJson]],
|
||||
self._request_obj(self._urls["details"] % collection_id, key="parts"),
|
||||
)
|
||||
|
||||
def images(self, collection_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
@@ -33,13 +38,22 @@ class Collection(TMDb):
|
||||
return self._request_obj(self._urls["translations"] % collection_id, key="translations")
|
||||
|
||||
# 异步版本方法
|
||||
async def async_details(self, collection_id: int | str) -> TMDbJson:
|
||||
async def async_details(
|
||||
self,
|
||||
collection_id: int | str,
|
||||
) -> list[dict[str, TMDbJson]]:
|
||||
"""
|
||||
Get collection details by id.(异步版本)
|
||||
:param collection_id: int
|
||||
:return:
|
||||
"""
|
||||
return await self._async_request_obj(self._urls["details"] % collection_id, key="parts")
|
||||
return cast(
|
||||
list[dict[str, TMDbJson]],
|
||||
await self._async_request_obj(
|
||||
self._urls["details"] % collection_id,
|
||||
key="parts",
|
||||
),
|
||||
)
|
||||
|
||||
async def async_images(self, collection_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user