Добавлен get_global_chat_badges

This commit is contained in:
2025-12-11 16:24:43 +03:00
parent 035a87e0c5
commit 0d9ac981b8
2 changed files with 27 additions and 0 deletions

View File

@ -857,3 +857,26 @@ 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_global_chat_badges(
self, access_token: str, cache_time: int | None = None
):
req = await self.get(
'/chat/badges/global',
headers=self.clean_dict(
{
'Authorization': f'Bearer {access_token}',
'X-Cache-TTL': cache_time,
}
),
)
match req.status_code:
case st.OK:
return s.GlobalChatBadges.model_validate(req.json())
case st.UNAUTHORIZED:
raise s.Error(req.status_code, req.json()['message'])
case _:
raise s.Error(req.status_code, 'Internal Server Error')

View File

@ -537,3 +537,7 @@ class ChannelChatBadges(BaseModel):
model_config = ConfigDict(extra='forbid') model_config = ConfigDict(extra='forbid')
data: list[ChannelChatBadgesData] data: list[ChannelChatBadgesData]
class GlobalChatBadges(ChannelChatBadges):
pass