diff --git a/src/twitchclient/api.py b/src/twitchclient/api.py index cd0e82b..00cdfb1 100644 --- a/src/twitchclient/api.py +++ b/src/twitchclient/api.py @@ -29,7 +29,9 @@ class TwitchAPIClient(AioHTTPXClient): 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( '/channels/commercial', headers={'Authorization': f'Bearer {access_token}'}, @@ -53,7 +55,9 @@ class TwitchAPIClient(AioHTTPXClient): case _: 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( '/channels/ads', headers={'Authorization': f'Bearer {access_token}'}, @@ -72,7 +76,9 @@ class TwitchAPIClient(AioHTTPXClient): case _: 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( '/channels/ads/schedule/snooze', headers={'Authorization': f'Bearer {access_token}'}, @@ -193,7 +199,7 @@ class TwitchAPIClient(AioHTTPXClient): raise s.Error(req.status_code, 'Internal Server Error') 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( '/bits/cheermotes', @@ -243,7 +249,9 @@ class TwitchAPIClient(AioHTTPXClient): raise s.Error(req.status_code, 'Internal Server Error') 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( '/channels', @@ -264,9 +272,9 @@ class TwitchAPIClient(AioHTTPXClient): async def modify_channel_information( self, 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, title: str | None = None, delay: int | None = None, @@ -309,7 +317,7 @@ class TwitchAPIClient(AioHTTPXClient): raise s.Error(req.status_code, 'Internal Server Error') async def get_channel_editors( - self, access_token: str, broadcaster_id: int + self, access_token: str, broadcaster_id: int | str ): req = await self.get( '/channels/editors', @@ -330,7 +338,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_followed_channels( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, *, first: int = 20, after: str | None = None, @@ -360,7 +368,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_channel_followers( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, *, user_id: int | None = None, first: int = 20, @@ -392,7 +400,7 @@ class TwitchAPIClient(AioHTTPXClient): async def create_custom_rewards( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, title: str, cost: int, *, @@ -451,7 +459,7 @@ class TwitchAPIClient(AioHTTPXClient): raise s.Error(req.status_code, 'Internal Server Error') 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( '/channel_points/custom_rewards', @@ -478,7 +486,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_custom_rewards( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, *, reward_id: str | None = None, only_manageable_rewards: bool = False, @@ -514,7 +522,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_custom_reward_redemption( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, reward_id: str, status: Literal['CANCELED', 'FULFILLED', 'UNFULFILLED'], *, @@ -559,7 +567,7 @@ class TwitchAPIClient(AioHTTPXClient): async def update_custom_reward( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, reward_id: str, *, title: str | None = None, @@ -623,7 +631,7 @@ class TwitchAPIClient(AioHTTPXClient): async def update_redemption_status( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, reward_id: int, redemption_id: int | list[int], status: Literal['CANCELED', 'FULFILLED'], @@ -656,7 +664,7 @@ class TwitchAPIClient(AioHTTPXClient): raise s.Error(req.status_code, 'Internal Server Error') async def get_charity_campaign( - self, access_token: str, broadcaster_id: int + self, access_token: str, broadcaster_id: int | str ): req = await self.get( '/charity/campaigns', @@ -677,7 +685,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_charity_campaign_donations( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, first: int = 20, after: str | None = None, cache_time: int | None = None, @@ -712,7 +720,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_chatters( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, moderator_id: int, first: int = 20, after: str | None = None, @@ -749,7 +757,7 @@ class TwitchAPIClient(AioHTTPXClient): async def get_channel_emotes( self, access_token: str, - broadcaster_id: int, + broadcaster_id: int | str, cache_time: int | None = None, ): req = await self.get(