mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-24 21:03:48 +08:00
refactor(types): govern TMDb network response contract
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
from ..tmdb import TMDb
|
||||
from ..tmdb import TMDb, TMDbJson
|
||||
|
||||
|
||||
class Network(TMDb):
|
||||
"""提供电视网络详情、别名和图像查询。"""
|
||||
|
||||
_urls = {
|
||||
"details": "/network/%s",
|
||||
"alternative_names": "/network/%s/alternative_names",
|
||||
"images": "/network/%s/images"
|
||||
}
|
||||
|
||||
def details(self, network_id):
|
||||
def details(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get a networks details by id.
|
||||
:param network_id: int
|
||||
@@ -16,7 +18,7 @@ class Network(TMDb):
|
||||
"""
|
||||
return self._request_obj(self._urls["details"] % network_id)
|
||||
|
||||
async def async_details(self, network_id):
|
||||
async def async_details(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get a networks details by id.(异步版本)
|
||||
:param network_id: int
|
||||
@@ -24,7 +26,7 @@ class Network(TMDb):
|
||||
"""
|
||||
return await self._async_request_obj(self._urls["details"] % network_id)
|
||||
|
||||
def alternative_names(self, network_id):
|
||||
def alternative_names(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get the alternative names of a network.
|
||||
:param network_id: int
|
||||
@@ -35,7 +37,7 @@ class Network(TMDb):
|
||||
key="results"
|
||||
)
|
||||
|
||||
async def async_alternative_names(self, network_id):
|
||||
async def async_alternative_names(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get the alternative names of a network.(异步版本)
|
||||
:param network_id: int
|
||||
@@ -46,7 +48,7 @@ class Network(TMDb):
|
||||
key="results"
|
||||
)
|
||||
|
||||
def images(self, network_id):
|
||||
def images(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get the TV network logos by id.
|
||||
:param network_id: int
|
||||
@@ -57,7 +59,7 @@ class Network(TMDb):
|
||||
key="logos"
|
||||
)
|
||||
|
||||
async def async_images(self, network_id):
|
||||
async def async_images(self, network_id: int | str) -> TMDbJson:
|
||||
"""
|
||||
Get the TV network logos by id.(异步版本)
|
||||
:param network_id: int
|
||||
|
||||
Reference in New Issue
Block a user