Добавлен эндпоинт get_channel_emotes
This commit is contained in:
@ -745,3 +745,20 @@ 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_channel_emotes(self, access_token: str, broadcaster_id: int):
|
||||||
|
req = await self.get(
|
||||||
|
'/emotes',
|
||||||
|
headers={'Authorization': f'Bearer {access_token}'},
|
||||||
|
params={'broadcaster_id': broadcaster_id},
|
||||||
|
)
|
||||||
|
|
||||||
|
match req.status_code:
|
||||||
|
case st.OK:
|
||||||
|
return s.ChannelEmotes.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')
|
||||||
|
|||||||
@ -475,3 +475,31 @@ class Chatters(BaseModel):
|
|||||||
data: list[ChattersData]
|
data: list[ChattersData]
|
||||||
pagination: Pagination | dict[Any, Any] | None = None
|
pagination: Pagination | dict[Any, Any] | None = None
|
||||||
total: int
|
total: int
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelEmoteImages(BaseModel):
|
||||||
|
model_config = ConfigDict(extra='forbid')
|
||||||
|
|
||||||
|
url_1x: str
|
||||||
|
url_2x: str
|
||||||
|
url_4x: str
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelEmote(BaseModel):
|
||||||
|
model_config = ConfigDict(extra='forbid')
|
||||||
|
|
||||||
|
id: int
|
||||||
|
name: str
|
||||||
|
images: ChannelEmoteImages
|
||||||
|
tier: int
|
||||||
|
emote_type: Literal['bitstier', 'follower', 'subscriptions']
|
||||||
|
format: list[Literal['animated', 'static']]
|
||||||
|
scale: list[Literal['1.0', '2.0', '3.0']]
|
||||||
|
theme_mode: list[Literal['dark', 'light']]
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelEmotes(BaseModel):
|
||||||
|
model_config = ConfigDict(extra='forbid')
|
||||||
|
|
||||||
|
data: list[ChannelEmote]
|
||||||
|
template: str
|
||||||
|
|||||||
Reference in New Issue
Block a user