diff --git a/src/twitchclient/api.py b/src/twitchclient/api.py index bdf8db3..ccfd329 100644 --- a/src/twitchclient/api.py +++ b/src/twitchclient/api.py @@ -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') diff --git a/src/twitchclient/schema.py b/src/twitchclient/schema.py index fd9da2c..6c84e4c 100644 --- a/src/twitchclient/schema.py +++ b/src/twitchclient/schema.py @@ -507,3 +507,7 @@ class ChannelEmotes(BaseModel): class GlobalEmotes(ChannelEmotes): pass + + +class EmoteSets(ChannelEmotes): + pass