Упрощена типизация для broadcaster_id
This commit is contained in:
@ -29,7 +29,9 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
logger='Twitch API',
|
logger='Twitch API',
|
||||||
)
|
)
|
||||||
|
|
||||||
async def start_commercial(self, access_token: str, broadcaster_id: int):
|
async def start_commercial(
|
||||||
|
self, access_token: str, broadcaster_id: int | str
|
||||||
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/channels/commercial',
|
'/channels/commercial',
|
||||||
headers={'Authorization': f'Bearer {access_token}'},
|
headers={'Authorization': f'Bearer {access_token}'},
|
||||||
@ -53,7 +55,9 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
case _:
|
case _:
|
||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def get_ad_schedule(self, access_token: str, broadcaster_id: int):
|
async def get_ad_schedule(
|
||||||
|
self, access_token: str, broadcaster_id: int | str
|
||||||
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/channels/ads',
|
'/channels/ads',
|
||||||
headers={'Authorization': f'Bearer {access_token}'},
|
headers={'Authorization': f'Bearer {access_token}'},
|
||||||
@ -72,7 +76,9 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
case _:
|
case _:
|
||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def snooze_next_ad(self, access_token: str, broadcaster_id: int):
|
async def snooze_next_ad(
|
||||||
|
self, access_token: str, broadcaster_id: int | str
|
||||||
|
):
|
||||||
req = await self.post(
|
req = await self.post(
|
||||||
'/channels/ads/schedule/snooze',
|
'/channels/ads/schedule/snooze',
|
||||||
headers={'Authorization': f'Bearer {access_token}'},
|
headers={'Authorization': f'Bearer {access_token}'},
|
||||||
@ -193,7 +199,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def get_cheermotes(
|
async def get_cheermotes(
|
||||||
self, access_token: str, broadcaster_id: int | None = None
|
self, access_token: str, broadcaster_id: int | str | None = None
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/bits/cheermotes',
|
'/bits/cheermotes',
|
||||||
@ -243,7 +249,9 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def get_channel_information(
|
async def get_channel_information(
|
||||||
self, access_token: str, broadcaster_id: int | list[int]
|
self,
|
||||||
|
access_token: str,
|
||||||
|
broadcaster_id: int | list[int] | str | list[str],
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/channels',
|
'/channels',
|
||||||
@ -264,9 +272,9 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def modify_channel_information(
|
async def modify_channel_information(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
*,
|
*,
|
||||||
game_id: int | None = None,
|
game_id: int | str | None = None,
|
||||||
broadcaster_language: str | None = None,
|
broadcaster_language: str | None = None,
|
||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
delay: int | None = None,
|
delay: int | None = None,
|
||||||
@ -309,7 +317,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def get_channel_editors(
|
async def get_channel_editors(
|
||||||
self, access_token: str, broadcaster_id: int
|
self, access_token: str, broadcaster_id: int | str
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/channels/editors',
|
'/channels/editors',
|
||||||
@ -330,7 +338,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_followed_channels(
|
async def get_followed_channels(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
*,
|
*,
|
||||||
first: int = 20,
|
first: int = 20,
|
||||||
after: str | None = None,
|
after: str | None = None,
|
||||||
@ -360,7 +368,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_channel_followers(
|
async def get_channel_followers(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
*,
|
*,
|
||||||
user_id: int | None = None,
|
user_id: int | None = None,
|
||||||
first: int = 20,
|
first: int = 20,
|
||||||
@ -392,7 +400,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def create_custom_rewards(
|
async def create_custom_rewards(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
title: str,
|
title: str,
|
||||||
cost: int,
|
cost: int,
|
||||||
*,
|
*,
|
||||||
@ -451,7 +459,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def delete_custom_reward(
|
async def delete_custom_reward(
|
||||||
self, access_token: str, broadcaster_id: str, reward_id: str
|
self, access_token: str, broadcaster_id: int | str, reward_id: str
|
||||||
):
|
):
|
||||||
req = await self.delete(
|
req = await self.delete(
|
||||||
'/channel_points/custom_rewards',
|
'/channel_points/custom_rewards',
|
||||||
@ -478,7 +486,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_custom_rewards(
|
async def get_custom_rewards(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
*,
|
*,
|
||||||
reward_id: str | None = None,
|
reward_id: str | None = None,
|
||||||
only_manageable_rewards: bool = False,
|
only_manageable_rewards: bool = False,
|
||||||
@ -514,7 +522,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_custom_reward_redemption(
|
async def get_custom_reward_redemption(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
reward_id: str,
|
reward_id: str,
|
||||||
status: Literal['CANCELED', 'FULFILLED', 'UNFULFILLED'],
|
status: Literal['CANCELED', 'FULFILLED', 'UNFULFILLED'],
|
||||||
*,
|
*,
|
||||||
@ -559,7 +567,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def update_custom_reward(
|
async def update_custom_reward(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
reward_id: str,
|
reward_id: str,
|
||||||
*,
|
*,
|
||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
@ -623,7 +631,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def update_redemption_status(
|
async def update_redemption_status(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
reward_id: int,
|
reward_id: int,
|
||||||
redemption_id: int | list[int],
|
redemption_id: int | list[int],
|
||||||
status: Literal['CANCELED', 'FULFILLED'],
|
status: Literal['CANCELED', 'FULFILLED'],
|
||||||
@ -656,7 +664,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
raise s.Error(req.status_code, 'Internal Server Error')
|
raise s.Error(req.status_code, 'Internal Server Error')
|
||||||
|
|
||||||
async def get_charity_campaign(
|
async def get_charity_campaign(
|
||||||
self, access_token: str, broadcaster_id: int
|
self, access_token: str, broadcaster_id: int | str
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
'/charity/campaigns',
|
'/charity/campaigns',
|
||||||
@ -677,7 +685,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_charity_campaign_donations(
|
async def get_charity_campaign_donations(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
first: int = 20,
|
first: int = 20,
|
||||||
after: str | None = None,
|
after: str | None = None,
|
||||||
cache_time: int | None = None,
|
cache_time: int | None = None,
|
||||||
@ -712,7 +720,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_chatters(
|
async def get_chatters(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
moderator_id: int,
|
moderator_id: int,
|
||||||
first: int = 20,
|
first: int = 20,
|
||||||
after: str | None = None,
|
after: str | None = None,
|
||||||
@ -749,7 +757,7 @@ class TwitchAPIClient(AioHTTPXClient):
|
|||||||
async def get_channel_emotes(
|
async def get_channel_emotes(
|
||||||
self,
|
self,
|
||||||
access_token: str,
|
access_token: str,
|
||||||
broadcaster_id: int,
|
broadcaster_id: int | str,
|
||||||
cache_time: int | None = None,
|
cache_time: int | None = None,
|
||||||
):
|
):
|
||||||
req = await self.get(
|
req = await self.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user