fix(types): type TMDB collection methods

This commit is contained in:
jxxghp
2026-10-17 07:40:18 +08:00
parent f259f9d54c
commit 17bc52239d

View File

@@ -1,4 +1,4 @@
from ..tmdb import TMDb
from ..tmdb import TMDb, TMDbJson
class Collection(TMDb):
@@ -8,7 +8,7 @@ class Collection(TMDb):
"translations": "/collection/%s/translations"
}
def details(self, collection_id):
def details(self, collection_id: int | str) -> TMDbJson:
"""
Get collection details by id.
:param collection_id: int
@@ -16,7 +16,7 @@ class Collection(TMDb):
"""
return self._request_obj(self._urls["details"] % collection_id, key="parts")
def images(self, collection_id):
def images(self, collection_id: int | str) -> TMDbJson:
"""
Get the images for a collection by id.
:param collection_id: int
@@ -24,7 +24,7 @@ class Collection(TMDb):
"""
return self._request_obj(self._urls["images"] % collection_id)
def translations(self, collection_id):
def translations(self, collection_id: int | str) -> TMDbJson:
"""
Get the list translations for a collection by id.
:param collection_id: int
@@ -33,7 +33,7 @@ class Collection(TMDb):
return self._request_obj(self._urls["translations"] % collection_id, key="translations")
# 异步版本方法
async def async_details(self, collection_id):
async def async_details(self, collection_id: int | str) -> TMDbJson:
"""
Get collection details by id.(异步版本)
:param collection_id: int
@@ -41,7 +41,7 @@ class Collection(TMDb):
"""
return await self._async_request_obj(self._urls["details"] % collection_id, key="parts")
async def async_images(self, collection_id):
async def async_images(self, collection_id: int | str) -> TMDbJson:
"""
Get the images for a collection by id.(异步版本)
:param collection_id: int
@@ -49,7 +49,7 @@ class Collection(TMDb):
"""
return await self._async_request_obj(self._urls["images"] % collection_id)
async def async_translations(self, collection_id):
async def async_translations(self, collection_id: int | str) -> TMDbJson:
"""
Get the list translations for a collection by id.(异步版本)
:param collection_id: int