1.0.0: Релиз #1

Merged
Miwory merged 15 commits from dev into latest 2025-12-17 06:31:42 +03:00
2 changed files with 45 additions and 0 deletions
Showing only changes of commit 947f19afbc - Show all commits

View File

@ -745,3 +745,20 @@ class TwitchAPIClient(AioHTTPXClient):
case _:
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')

View File

@ -475,3 +475,31 @@ class Chatters(BaseModel):
data: list[ChattersData]
pagination: Pagination | dict[Any, Any] | None = None
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