1.0.0: Релиз #1
@ -795,3 +795,30 @@ class TwitchAPIClient(AioHTTPXClient):
|
||||
|
||||
case _:
|
||||
raise s.Error(req.status_code, 'Internal Server Error')
|
||||
|
||||
async def get_emote_sets(
|
||||
self,
|
||||
access_token: str,
|
||||
emote_set_id: int,
|
||||
cache_time: int | None = None,
|
||||
):
|
||||
req = await self.get(
|
||||
'/chat/emotes/set',
|
||||
headers=self.clean_dict(
|
||||
{
|
||||
'Authorization': f'Bearer {access_token}',
|
||||
'X-Cache-TTL': cache_time,
|
||||
}
|
||||
),
|
||||
params={'emote_set_id': emote_set_id},
|
||||
)
|
||||
|
||||
match req.status_code:
|
||||
case st.OK:
|
||||
return s.EmoteSets.model_validate(req.json())
|
||||
|
||||
case st.BAD_REQUEST | st.UNAUTHORIZED:
|
||||
raise s.Error(req.status_code, req.json()['message'])
|
||||
|
||||
case _:
|
||||
raise s.Error(req.status_code, 'Internal Server Error')
|
||||
|
||||
@ -507,3 +507,7 @@ class ChannelEmotes(BaseModel):
|
||||
|
||||
class GlobalEmotes(ChannelEmotes):
|
||||
pass
|
||||
|
||||
|
||||
class EmoteSets(ChannelEmotes):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user