chzzk-python 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
chzzk/models/live.py ADDED
@@ -0,0 +1,78 @@
1
+ """Pydantic models for Live API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from datetime import datetime
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+ from chzzk.models.common import CategoryType, Page
10
+
11
+
12
+ class LiveInfo(BaseModel):
13
+ """Live broadcast information."""
14
+
15
+ live_id: int = Field(alias="liveId")
16
+ live_title: str = Field(alias="liveTitle")
17
+ live_thumbnail_image_url: str | None = Field(default=None, alias="liveThumbnailImageUrl")
18
+ concurrent_user_count: int = Field(alias="concurrentUserCount")
19
+ open_date: datetime = Field(alias="openDate")
20
+ adult: bool
21
+ tags: list[str] = Field(default_factory=list)
22
+ category_type: CategoryType | None = Field(default=None, alias="categoryType")
23
+ live_category: str | None = Field(default=None, alias="liveCategory")
24
+ live_category_value: str | None = Field(default=None, alias="liveCategoryValue")
25
+ channel_id: str = Field(alias="channelId")
26
+ channel_name: str = Field(alias="channelName")
27
+ channel_image_url: str | None = Field(default=None, alias="channelImageUrl")
28
+
29
+ model_config = {"populate_by_name": True}
30
+
31
+
32
+ class LiveListResponse(BaseModel):
33
+ """Response model for live list endpoint."""
34
+
35
+ data: list[LiveInfo]
36
+ page: Page
37
+
38
+ model_config = {"populate_by_name": True}
39
+
40
+
41
+ class StreamKey(BaseModel):
42
+ """Stream key information."""
43
+
44
+ stream_key: str = Field(alias="streamKey")
45
+
46
+ model_config = {"populate_by_name": True}
47
+
48
+
49
+ class LiveSettingCategory(BaseModel):
50
+ """Category information in live setting."""
51
+
52
+ category_type: CategoryType = Field(alias="categoryType")
53
+ category_id: str = Field(alias="categoryId")
54
+ category_value: str = Field(alias="categoryValue")
55
+ poster_image_url: str | None = Field(default=None, alias="posterImageUrl")
56
+
57
+ model_config = {"populate_by_name": True}
58
+
59
+
60
+ class LiveSetting(BaseModel):
61
+ """Live broadcast setting information."""
62
+
63
+ default_live_title: str | None = Field(default=None, alias="defaultLiveTitle")
64
+ category: LiveSettingCategory | None = None
65
+ tags: list[str] = Field(default_factory=list)
66
+
67
+ model_config = {"populate_by_name": True}
68
+
69
+
70
+ class UpdateLiveSettingRequest(BaseModel):
71
+ """Request model for updating live setting."""
72
+
73
+ default_live_title: str | None = Field(default=None, serialization_alias="defaultLiveTitle")
74
+ category_type: CategoryType | None = Field(default=None, serialization_alias="categoryType")
75
+ category_id: str | None = Field(default=None, serialization_alias="categoryId")
76
+ tags: list[str] | None = None
77
+
78
+ model_config = {"populate_by_name": True}
@@ -0,0 +1,18 @@
1
+ """Pydantic models for Restriction API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from datetime import datetime
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+
10
+ class RestrictedChannel(BaseModel):
11
+ """Restricted channel information."""
12
+
13
+ restricted_channel_id: str = Field(alias="restrictedChannelId")
14
+ restricted_channel_name: str = Field(alias="restrictedChannelName")
15
+ release_date: datetime | None = Field(default=None, alias="releaseDate")
16
+ created_date: datetime = Field(alias="createdDate")
17
+
18
+ model_config = {"populate_by_name": True}
@@ -0,0 +1,161 @@
1
+ """Pydantic models for Session API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from datetime import datetime
6
+ from enum import StrEnum
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+
11
+ class EventType(StrEnum):
12
+ """Event type enumeration for session events."""
13
+
14
+ CHAT = "CHAT"
15
+ DONATION = "DONATION"
16
+ SUBSCRIPTION = "SUBSCRIPTION"
17
+
18
+
19
+ class SystemMessageType(StrEnum):
20
+ """System message type enumeration."""
21
+
22
+ CONNECTED = "connected"
23
+ SUBSCRIBED = "subscribed"
24
+ UNSUBSCRIBED = "unsubscribed"
25
+ REVOKED = "revoked"
26
+
27
+
28
+ class DonationType(StrEnum):
29
+ """Donation type enumeration."""
30
+
31
+ CHAT = "CHAT"
32
+ VIDEO = "VIDEO"
33
+
34
+
35
+ class UserRoleCode(StrEnum):
36
+ """User role code enumeration."""
37
+
38
+ STREAMER = "streamer"
39
+ COMMON_USER = "common_user"
40
+ STREAMING_CHANNEL_MANAGER = "streaming_channel_manager"
41
+ STREAMING_CHAT_MANAGER = "streaming_chat_manager"
42
+
43
+
44
+ # API Response Models
45
+
46
+
47
+ class SessionAuthResponse(BaseModel):
48
+ """Response model for session creation (auth)."""
49
+
50
+ url: str
51
+
52
+ model_config = {"populate_by_name": True}
53
+
54
+
55
+ class SubscribedEvent(BaseModel):
56
+ """Subscribed event information."""
57
+
58
+ event_type: EventType = Field(alias="eventType")
59
+ channel_id: str = Field(alias="channelId")
60
+
61
+ model_config = {"populate_by_name": True}
62
+
63
+
64
+ class SessionInfo(BaseModel):
65
+ """Session information."""
66
+
67
+ session_key: str = Field(alias="sessionKey")
68
+ connected_date: datetime = Field(alias="connectedDate")
69
+ disconnected_date: datetime | None = Field(default=None, alias="disconnectedDate")
70
+ subscribed_events: list[SubscribedEvent] = Field(default_factory=list, alias="subscribedEvents")
71
+
72
+ model_config = {"populate_by_name": True}
73
+
74
+
75
+ class SessionListResponse(BaseModel):
76
+ """Response model for session list."""
77
+
78
+ data: list[SessionInfo]
79
+
80
+ model_config = {"populate_by_name": True}
81
+
82
+
83
+ # Socket.IO Event Models
84
+
85
+
86
+ class Badge(BaseModel):
87
+ """Badge information for chat profile."""
88
+
89
+ image_url: str | None = Field(default=None, alias="imageUrl")
90
+
91
+ model_config = {"populate_by_name": True}
92
+
93
+
94
+ class ChatProfile(BaseModel):
95
+ """Chat message sender profile."""
96
+
97
+ nickname: str
98
+ badges: list[Badge] = Field(default_factory=list)
99
+ verified_mark: bool = Field(default=False, alias="verifiedMark")
100
+
101
+ model_config = {"populate_by_name": True}
102
+
103
+
104
+ class ChatEvent(BaseModel):
105
+ """Chat event message from Socket.IO."""
106
+
107
+ channel_id: str = Field(alias="channelId")
108
+ sender_channel_id: str = Field(alias="senderChannelId")
109
+ profile: ChatProfile
110
+ content: str
111
+ emojis: dict[str, str] = Field(default_factory=dict)
112
+ message_time: int = Field(alias="messageTime")
113
+ user_role_code: UserRoleCode | None = Field(default=None, alias="userRoleCode")
114
+
115
+ model_config = {"populate_by_name": True}
116
+
117
+
118
+ class DonationEvent(BaseModel):
119
+ """Donation event message from Socket.IO."""
120
+
121
+ channel_id: str = Field(alias="channelId")
122
+ donation_type: DonationType = Field(alias="donationType")
123
+ donator_channel_id: str = Field(alias="donatorChannelId")
124
+ donator_nickname: str = Field(alias="donatorNickname")
125
+ pay_amount: str = Field(alias="payAmount")
126
+ donation_text: str = Field(alias="donationText")
127
+ emojis: dict[str, str] = Field(default_factory=dict)
128
+
129
+ model_config = {"populate_by_name": True}
130
+
131
+
132
+ class SubscriptionEvent(BaseModel):
133
+ """Subscription event message from Socket.IO."""
134
+
135
+ channel_id: str = Field(alias="channelId")
136
+ subscriber_channel_id: str = Field(alias="subscriberChannelId")
137
+ subscriber_nickname: str = Field(alias="subscriberNickname")
138
+ month: int
139
+ tier_no: int = Field(alias="tierNo")
140
+ tier_name: str = Field(alias="tierName")
141
+
142
+ model_config = {"populate_by_name": True}
143
+
144
+
145
+ class SystemEventData(BaseModel):
146
+ """System event data."""
147
+
148
+ session_key: str | None = Field(default=None, alias="sessionKey")
149
+ event_type: EventType | None = Field(default=None, alias="eventType")
150
+ channel_id: str | None = Field(default=None, alias="channelId")
151
+
152
+ model_config = {"populate_by_name": True}
153
+
154
+
155
+ class SystemEvent(BaseModel):
156
+ """System event message from Socket.IO."""
157
+
158
+ type: SystemMessageType
159
+ data: SystemEventData | None = None
160
+
161
+ model_config = {"populate_by_name": True}
chzzk/models/user.py ADDED
@@ -0,0 +1,14 @@
1
+ """Pydantic models for User API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+
8
+ class UserInfo(BaseModel):
9
+ """User information returned from /users/me endpoint."""
10
+
11
+ channel_id: str = Field(alias="channelId")
12
+ channel_name: str = Field(alias="channelName")
13
+
14
+ model_config = {"populate_by_name": True}
chzzk/py.typed ADDED
File without changes
@@ -0,0 +1,8 @@
1
+ """Realtime event client for Chzzk SDK."""
2
+
3
+ from chzzk.realtime.client import AsyncChzzkEventClient, ChzzkEventClient
4
+
5
+ __all__ = [
6
+ "AsyncChzzkEventClient",
7
+ "ChzzkEventClient",
8
+ ]