tikdataapi 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.
- tikdataapi/__init__.py +8 -0
- tikdataapi/api/__init__.py +1 -0
- tikdataapi/api/account/__init__.py +1 -0
- tikdataapi/api/account/get_me.py +144 -0
- tikdataapi/api/billing/__init__.py +1 -0
- tikdataapi/api/billing/create_checkout.py +215 -0
- tikdataapi/api/billing/list_packs.py +144 -0
- tikdataapi/api/hashtags/__init__.py +1 -0
- tikdataapi/api/hashtags/get_hashtag.py +220 -0
- tikdataapi/api/hashtags/get_hashtag_videos.py +250 -0
- tikdataapi/api/music/__init__.py +1 -0
- tikdataapi/api/music/get_music.py +234 -0
- tikdataapi/api/music/get_music_videos.py +254 -0
- tikdataapi/api/playlists/__init__.py +1 -0
- tikdataapi/api/playlists/get_playlist_videos.py +258 -0
- tikdataapi/api/search/__init__.py +1 -0
- tikdataapi/api/search/search_hashtags.py +261 -0
- tikdataapi/api/search/search_live.py +258 -0
- tikdataapi/api/search/search_music.py +260 -0
- tikdataapi/api/search/search_users.py +276 -0
- tikdataapi/api/search/search_videos.py +260 -0
- tikdataapi/api/users/__init__.py +1 -0
- tikdataapi/api/users/get_user.py +222 -0
- tikdataapi/api/users/get_user_followers.py +266 -0
- tikdataapi/api/users/get_user_following.py +266 -0
- tikdataapi/api/users/get_user_live.py +236 -0
- tikdataapi/api/users/get_user_playlists.py +276 -0
- tikdataapi/api/users/get_user_reposts.py +266 -0
- tikdataapi/api/users/get_user_videos.py +254 -0
- tikdataapi/api/users/get_users.py +247 -0
- tikdataapi/api/users/get_users_videos.py +259 -0
- tikdataapi/api/videos/__init__.py +1 -0
- tikdataapi/api/videos/get_comment_replies.py +260 -0
- tikdataapi/api/videos/get_comments.py +258 -0
- tikdataapi/api/videos/get_related_videos.py +247 -0
- tikdataapi/api/videos/get_trending_videos.py +238 -0
- tikdataapi/api/videos/get_video.py +218 -0
- tikdataapi/api/videos/get_video_transcript.py +247 -0
- tikdataapi/api/videos/get_videos.py +235 -0
- tikdataapi/client.py +268 -0
- tikdataapi/errors.py +16 -0
- tikdataapi/models/__init__.py +117 -0
- tikdataapi/models/batch_error.py +104 -0
- tikdataapi/models/batch_error_code.py +15 -0
- tikdataapi/models/batch_meta.py +127 -0
- tikdataapi/models/batch_meta_cache.py +11 -0
- tikdataapi/models/comment.py +163 -0
- tikdataapi/models/comment_author.py +97 -0
- tikdataapi/models/comment_page.py +130 -0
- tikdataapi/models/create_checkout_body.py +63 -0
- tikdataapi/models/create_checkout_body_pack.py +11 -0
- tikdataapi/models/create_checkout_response_200.py +97 -0
- tikdataapi/models/error.py +78 -0
- tikdataapi/models/error_body.py +107 -0
- tikdataapi/models/error_body_code.py +22 -0
- tikdataapi/models/get_me_response_200.py +88 -0
- tikdataapi/models/get_users_body.py +61 -0
- tikdataapi/models/get_users_videos_body.py +72 -0
- tikdataapi/models/get_videos_body.py +61 -0
- tikdataapi/models/hashtag.py +124 -0
- tikdataapi/models/hashtag_response.py +122 -0
- tikdataapi/models/hashtag_summary.py +98 -0
- tikdataapi/models/hashtag_summary_page.py +130 -0
- tikdataapi/models/list_packs_response_200.py +103 -0
- tikdataapi/models/list_packs_response_200_data_item.py +88 -0
- tikdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
- tikdataapi/models/live_room.py +142 -0
- tikdataapi/models/live_room_author.py +90 -0
- tikdataapi/models/live_room_page.py +130 -0
- tikdataapi/models/live_room_response.py +124 -0
- tikdataapi/models/meta.py +108 -0
- tikdataapi/models/meta_cache.py +10 -0
- tikdataapi/models/music.py +107 -0
- tikdataapi/models/music_detail.py +172 -0
- tikdataapi/models/music_response.py +124 -0
- tikdataapi/models/music_summary.py +137 -0
- tikdataapi/models/music_summary_page.py +130 -0
- tikdataapi/models/not_found_reason.py +12 -0
- tikdataapi/models/playlist.py +114 -0
- tikdataapi/models/playlist_author.py +86 -0
- tikdataapi/models/playlist_page.py +130 -0
- tikdataapi/models/problem.py +131 -0
- tikdataapi/models/transcript.py +128 -0
- tikdataapi/models/transcript_response.py +124 -0
- tikdataapi/models/transcript_segment.py +77 -0
- tikdataapi/models/user.py +207 -0
- tikdataapi/models/user_batch.py +145 -0
- tikdataapi/models/user_page.py +130 -0
- tikdataapi/models/user_response.py +126 -0
- tikdataapi/models/user_summary.py +152 -0
- tikdataapi/models/user_summary_page.py +130 -0
- tikdataapi/models/user_videos.py +96 -0
- tikdataapi/models/user_videos_batch.py +145 -0
- tikdataapi/models/video.py +297 -0
- tikdataapi/models/video_batch.py +145 -0
- tikdataapi/models/video_page.py +130 -0
- tikdataapi/models/video_response.py +122 -0
- tikdataapi/models/video_type.py +9 -0
- tikdataapi/py.typed +1 -0
- tikdataapi/types.py +54 -0
- tikdataapi-0.1.0.dist-info/METADATA +148 -0
- tikdataapi-0.1.0.dist-info/RECORD +103 -0
- tikdataapi-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ..models.comment_author import CommentAuthor
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="Comment")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class Comment:
|
|
21
|
+
"""
|
|
22
|
+
Attributes:
|
|
23
|
+
id (str): Example: 7444093498376454914.
|
|
24
|
+
video_id (str):
|
|
25
|
+
text (str):
|
|
26
|
+
created_at (datetime.datetime):
|
|
27
|
+
likes (int):
|
|
28
|
+
replies (int): Replies to this comment. 0 on a reply.
|
|
29
|
+
author (CommentAuthor):
|
|
30
|
+
collected_at (datetime.datetime): When we read this comment from TikTok. A comment from cache keeps the time of
|
|
31
|
+
its own read. Example: 2026-12-02T08:55:12Z.
|
|
32
|
+
reply_to_id (str | Unset): On a reply: the id of the comment that it answers. Absent on a comment of the video.
|
|
33
|
+
lang (str | Unset): The language of the text, when TikTok sends it.
|
|
34
|
+
liked_by_author (bool | Unset): `true`: the author of the video liked this comment.
|
|
35
|
+
pinned (bool | Unset): `true`: the author of the video pinned this comment on top.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
id: str
|
|
39
|
+
video_id: str
|
|
40
|
+
text: str
|
|
41
|
+
created_at: datetime.datetime
|
|
42
|
+
likes: int
|
|
43
|
+
replies: int
|
|
44
|
+
author: CommentAuthor
|
|
45
|
+
collected_at: datetime.datetime
|
|
46
|
+
reply_to_id: str | Unset = UNSET
|
|
47
|
+
lang: str | Unset = UNSET
|
|
48
|
+
liked_by_author: bool | Unset = UNSET
|
|
49
|
+
pinned: bool | Unset = UNSET
|
|
50
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> dict[str, Any]:
|
|
53
|
+
id = self.id
|
|
54
|
+
|
|
55
|
+
video_id = self.video_id
|
|
56
|
+
|
|
57
|
+
text = self.text
|
|
58
|
+
|
|
59
|
+
created_at = self.created_at.isoformat()
|
|
60
|
+
|
|
61
|
+
likes = self.likes
|
|
62
|
+
|
|
63
|
+
replies = self.replies
|
|
64
|
+
|
|
65
|
+
author = self.author.to_dict()
|
|
66
|
+
|
|
67
|
+
collected_at = self.collected_at.isoformat()
|
|
68
|
+
|
|
69
|
+
reply_to_id = self.reply_to_id
|
|
70
|
+
|
|
71
|
+
lang = self.lang
|
|
72
|
+
|
|
73
|
+
liked_by_author = self.liked_by_author
|
|
74
|
+
|
|
75
|
+
pinned = self.pinned
|
|
76
|
+
|
|
77
|
+
field_dict: dict[str, Any] = {}
|
|
78
|
+
field_dict.update(self.additional_properties)
|
|
79
|
+
field_dict.update(
|
|
80
|
+
{
|
|
81
|
+
"id": id,
|
|
82
|
+
"video_id": video_id,
|
|
83
|
+
"text": text,
|
|
84
|
+
"created_at": created_at,
|
|
85
|
+
"likes": likes,
|
|
86
|
+
"replies": replies,
|
|
87
|
+
"author": author,
|
|
88
|
+
"collected_at": collected_at,
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
if reply_to_id is not UNSET:
|
|
92
|
+
field_dict["reply_to_id"] = reply_to_id
|
|
93
|
+
if lang is not UNSET:
|
|
94
|
+
field_dict["lang"] = lang
|
|
95
|
+
if liked_by_author is not UNSET:
|
|
96
|
+
field_dict["liked_by_author"] = liked_by_author
|
|
97
|
+
if pinned is not UNSET:
|
|
98
|
+
field_dict["pinned"] = pinned
|
|
99
|
+
|
|
100
|
+
return field_dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
104
|
+
from ..models.comment_author import CommentAuthor # noqa: PLC0415
|
|
105
|
+
|
|
106
|
+
d = dict(src_dict)
|
|
107
|
+
id = d.pop("id")
|
|
108
|
+
|
|
109
|
+
video_id = d.pop("video_id")
|
|
110
|
+
|
|
111
|
+
text = d.pop("text")
|
|
112
|
+
|
|
113
|
+
created_at = datetime.datetime.fromisoformat(d.pop("created_at"))
|
|
114
|
+
|
|
115
|
+
likes = d.pop("likes")
|
|
116
|
+
|
|
117
|
+
replies = d.pop("replies")
|
|
118
|
+
|
|
119
|
+
author = CommentAuthor.from_dict(d.pop("author"))
|
|
120
|
+
|
|
121
|
+
collected_at = datetime.datetime.fromisoformat(d.pop("collected_at"))
|
|
122
|
+
|
|
123
|
+
reply_to_id = d.pop("reply_to_id", UNSET)
|
|
124
|
+
|
|
125
|
+
lang = d.pop("lang", UNSET)
|
|
126
|
+
|
|
127
|
+
liked_by_author = d.pop("liked_by_author", UNSET)
|
|
128
|
+
|
|
129
|
+
pinned = d.pop("pinned", UNSET)
|
|
130
|
+
|
|
131
|
+
comment = cls(
|
|
132
|
+
id=id,
|
|
133
|
+
video_id=video_id,
|
|
134
|
+
text=text,
|
|
135
|
+
created_at=created_at,
|
|
136
|
+
likes=likes,
|
|
137
|
+
replies=replies,
|
|
138
|
+
author=author,
|
|
139
|
+
collected_at=collected_at,
|
|
140
|
+
reply_to_id=reply_to_id,
|
|
141
|
+
lang=lang,
|
|
142
|
+
liked_by_author=liked_by_author,
|
|
143
|
+
pinned=pinned,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
comment.additional_properties = d
|
|
147
|
+
return comment
|
|
148
|
+
|
|
149
|
+
@property
|
|
150
|
+
def additional_keys(self) -> list[str]:
|
|
151
|
+
return list(self.additional_properties.keys())
|
|
152
|
+
|
|
153
|
+
def __getitem__(self, key: str) -> Any:
|
|
154
|
+
return self.additional_properties[key]
|
|
155
|
+
|
|
156
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
157
|
+
self.additional_properties[key] = value
|
|
158
|
+
|
|
159
|
+
def __delitem__(self, key: str) -> None:
|
|
160
|
+
del self.additional_properties[key]
|
|
161
|
+
|
|
162
|
+
def __contains__(self, key: str) -> bool:
|
|
163
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="CommentAuthor")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class CommentAuthor:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
id (str):
|
|
19
|
+
username (str):
|
|
20
|
+
nickname (str):
|
|
21
|
+
sec_uid (str | Unset):
|
|
22
|
+
avatar_url (str | Unset): Signed address; it stops working after some days.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
id: str
|
|
26
|
+
username: str
|
|
27
|
+
nickname: str
|
|
28
|
+
sec_uid: str | Unset = UNSET
|
|
29
|
+
avatar_url: str | Unset = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
id = self.id
|
|
34
|
+
|
|
35
|
+
username = self.username
|
|
36
|
+
|
|
37
|
+
nickname = self.nickname
|
|
38
|
+
|
|
39
|
+
sec_uid = self.sec_uid
|
|
40
|
+
|
|
41
|
+
avatar_url = self.avatar_url
|
|
42
|
+
|
|
43
|
+
field_dict: dict[str, Any] = {}
|
|
44
|
+
field_dict.update(self.additional_properties)
|
|
45
|
+
field_dict.update(
|
|
46
|
+
{
|
|
47
|
+
"id": id,
|
|
48
|
+
"username": username,
|
|
49
|
+
"nickname": nickname,
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
if sec_uid is not UNSET:
|
|
53
|
+
field_dict["sec_uid"] = sec_uid
|
|
54
|
+
if avatar_url is not UNSET:
|
|
55
|
+
field_dict["avatar_url"] = avatar_url
|
|
56
|
+
|
|
57
|
+
return field_dict
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
61
|
+
d = dict(src_dict)
|
|
62
|
+
id = d.pop("id")
|
|
63
|
+
|
|
64
|
+
username = d.pop("username")
|
|
65
|
+
|
|
66
|
+
nickname = d.pop("nickname")
|
|
67
|
+
|
|
68
|
+
sec_uid = d.pop("sec_uid", UNSET)
|
|
69
|
+
|
|
70
|
+
avatar_url = d.pop("avatar_url", UNSET)
|
|
71
|
+
|
|
72
|
+
comment_author = cls(
|
|
73
|
+
id=id,
|
|
74
|
+
username=username,
|
|
75
|
+
nickname=nickname,
|
|
76
|
+
sec_uid=sec_uid,
|
|
77
|
+
avatar_url=avatar_url,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
comment_author.additional_properties = d
|
|
81
|
+
return comment_author
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def additional_keys(self) -> list[str]:
|
|
85
|
+
return list(self.additional_properties.keys())
|
|
86
|
+
|
|
87
|
+
def __getitem__(self, key: str) -> Any:
|
|
88
|
+
return self.additional_properties[key]
|
|
89
|
+
|
|
90
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
91
|
+
self.additional_properties[key] = value
|
|
92
|
+
|
|
93
|
+
def __delitem__(self, key: str) -> None:
|
|
94
|
+
del self.additional_properties[key]
|
|
95
|
+
|
|
96
|
+
def __contains__(self, key: str) -> bool:
|
|
97
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.meta_cache import MetaCache
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.comment import Comment
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="CommentPage")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class CommentPage:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
items (int): Objects returned.
|
|
25
|
+
credits_charged (float): Example: 16.
|
|
26
|
+
balance_remaining (float): Example: 79984.
|
|
27
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
28
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
29
|
+
price of its own source; `hit` means all of it came from cache.
|
|
30
|
+
request_id (UUID):
|
|
31
|
+
data (list[Comment]):
|
|
32
|
+
next_cursor (str | Unset):
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
items: int
|
|
36
|
+
credits_charged: float
|
|
37
|
+
balance_remaining: float
|
|
38
|
+
cache: MetaCache
|
|
39
|
+
request_id: UUID
|
|
40
|
+
data: list[Comment]
|
|
41
|
+
next_cursor: str | Unset = UNSET
|
|
42
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
43
|
+
|
|
44
|
+
def to_dict(self) -> dict[str, Any]:
|
|
45
|
+
items = self.items
|
|
46
|
+
|
|
47
|
+
credits_charged = self.credits_charged
|
|
48
|
+
|
|
49
|
+
balance_remaining = self.balance_remaining
|
|
50
|
+
|
|
51
|
+
cache = self.cache.value
|
|
52
|
+
|
|
53
|
+
request_id = str(self.request_id)
|
|
54
|
+
|
|
55
|
+
data = []
|
|
56
|
+
for data_item_data in self.data:
|
|
57
|
+
data_item = data_item_data.to_dict()
|
|
58
|
+
data.append(data_item)
|
|
59
|
+
|
|
60
|
+
next_cursor = self.next_cursor
|
|
61
|
+
|
|
62
|
+
field_dict: dict[str, Any] = {}
|
|
63
|
+
field_dict.update(self.additional_properties)
|
|
64
|
+
field_dict.update(
|
|
65
|
+
{
|
|
66
|
+
"items": items,
|
|
67
|
+
"credits_charged": credits_charged,
|
|
68
|
+
"balance_remaining": balance_remaining,
|
|
69
|
+
"cache": cache,
|
|
70
|
+
"request_id": request_id,
|
|
71
|
+
"data": data,
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
if next_cursor is not UNSET:
|
|
75
|
+
field_dict["next_cursor"] = next_cursor
|
|
76
|
+
|
|
77
|
+
return field_dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
81
|
+
from ..models.comment import Comment # noqa: PLC0415
|
|
82
|
+
|
|
83
|
+
d = dict(src_dict)
|
|
84
|
+
items = d.pop("items")
|
|
85
|
+
|
|
86
|
+
credits_charged = d.pop("credits_charged")
|
|
87
|
+
|
|
88
|
+
balance_remaining = d.pop("balance_remaining")
|
|
89
|
+
|
|
90
|
+
cache = MetaCache(d.pop("cache"))
|
|
91
|
+
|
|
92
|
+
request_id = UUID(d.pop("request_id"))
|
|
93
|
+
|
|
94
|
+
data = []
|
|
95
|
+
_data = d.pop("data")
|
|
96
|
+
for data_item_data in _data:
|
|
97
|
+
data_item = Comment.from_dict(data_item_data)
|
|
98
|
+
|
|
99
|
+
data.append(data_item)
|
|
100
|
+
|
|
101
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
102
|
+
|
|
103
|
+
comment_page = cls(
|
|
104
|
+
items=items,
|
|
105
|
+
credits_charged=credits_charged,
|
|
106
|
+
balance_remaining=balance_remaining,
|
|
107
|
+
cache=cache,
|
|
108
|
+
request_id=request_id,
|
|
109
|
+
data=data,
|
|
110
|
+
next_cursor=next_cursor,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
comment_page.additional_properties = d
|
|
114
|
+
return comment_page
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def additional_keys(self) -> list[str]:
|
|
118
|
+
return list(self.additional_properties.keys())
|
|
119
|
+
|
|
120
|
+
def __getitem__(self, key: str) -> Any:
|
|
121
|
+
return self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
124
|
+
self.additional_properties[key] = value
|
|
125
|
+
|
|
126
|
+
def __delitem__(self, key: str) -> None:
|
|
127
|
+
del self.additional_properties[key]
|
|
128
|
+
|
|
129
|
+
def __contains__(self, key: str) -> bool:
|
|
130
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.create_checkout_body_pack import CreateCheckoutBodyPack
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="CreateCheckoutBody")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class CreateCheckoutBody:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
pack (CreateCheckoutBodyPack):
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
pack: CreateCheckoutBodyPack
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
pack = self.pack.value
|
|
26
|
+
|
|
27
|
+
field_dict: dict[str, Any] = {}
|
|
28
|
+
field_dict.update(self.additional_properties)
|
|
29
|
+
field_dict.update(
|
|
30
|
+
{
|
|
31
|
+
"pack": pack,
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return field_dict
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
39
|
+
d = dict(src_dict)
|
|
40
|
+
pack = CreateCheckoutBodyPack(d.pop("pack"))
|
|
41
|
+
|
|
42
|
+
create_checkout_body = cls(
|
|
43
|
+
pack=pack,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
create_checkout_body.additional_properties = d
|
|
47
|
+
return create_checkout_body
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def additional_keys(self) -> list[str]:
|
|
51
|
+
return list(self.additional_properties.keys())
|
|
52
|
+
|
|
53
|
+
def __getitem__(self, key: str) -> Any:
|
|
54
|
+
return self.additional_properties[key]
|
|
55
|
+
|
|
56
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
57
|
+
self.additional_properties[key] = value
|
|
58
|
+
|
|
59
|
+
def __delitem__(self, key: str) -> None:
|
|
60
|
+
del self.additional_properties[key]
|
|
61
|
+
|
|
62
|
+
def __contains__(self, key: str) -> bool:
|
|
63
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="CreateCheckoutResponse200")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class CreateCheckoutResponse200:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
url (str | Unset):
|
|
19
|
+
pack (str | Unset):
|
|
20
|
+
usd (int | Unset):
|
|
21
|
+
credits_ (int | Unset):
|
|
22
|
+
request_id (str | Unset):
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
url: str | Unset = UNSET
|
|
26
|
+
pack: str | Unset = UNSET
|
|
27
|
+
usd: int | Unset = UNSET
|
|
28
|
+
credits_: int | Unset = UNSET
|
|
29
|
+
request_id: str | Unset = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
url = self.url
|
|
34
|
+
|
|
35
|
+
pack = self.pack
|
|
36
|
+
|
|
37
|
+
usd = self.usd
|
|
38
|
+
|
|
39
|
+
credits_ = self.credits_
|
|
40
|
+
|
|
41
|
+
request_id = self.request_id
|
|
42
|
+
|
|
43
|
+
field_dict: dict[str, Any] = {}
|
|
44
|
+
field_dict.update(self.additional_properties)
|
|
45
|
+
field_dict.update({})
|
|
46
|
+
if url is not UNSET:
|
|
47
|
+
field_dict["url"] = url
|
|
48
|
+
if pack is not UNSET:
|
|
49
|
+
field_dict["pack"] = pack
|
|
50
|
+
if usd is not UNSET:
|
|
51
|
+
field_dict["usd"] = usd
|
|
52
|
+
if credits_ is not UNSET:
|
|
53
|
+
field_dict["credits"] = credits_
|
|
54
|
+
if request_id is not UNSET:
|
|
55
|
+
field_dict["request_id"] = request_id
|
|
56
|
+
|
|
57
|
+
return field_dict
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
61
|
+
d = dict(src_dict)
|
|
62
|
+
url = d.pop("url", UNSET)
|
|
63
|
+
|
|
64
|
+
pack = d.pop("pack", UNSET)
|
|
65
|
+
|
|
66
|
+
usd = d.pop("usd", UNSET)
|
|
67
|
+
|
|
68
|
+
credits_ = d.pop("credits", UNSET)
|
|
69
|
+
|
|
70
|
+
request_id = d.pop("request_id", UNSET)
|
|
71
|
+
|
|
72
|
+
create_checkout_response_200 = cls(
|
|
73
|
+
url=url,
|
|
74
|
+
pack=pack,
|
|
75
|
+
usd=usd,
|
|
76
|
+
credits_=credits_,
|
|
77
|
+
request_id=request_id,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
create_checkout_response_200.additional_properties = d
|
|
81
|
+
return create_checkout_response_200
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def additional_keys(self) -> list[str]:
|
|
85
|
+
return list(self.additional_properties.keys())
|
|
86
|
+
|
|
87
|
+
def __getitem__(self, key: str) -> Any:
|
|
88
|
+
return self.additional_properties[key]
|
|
89
|
+
|
|
90
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
91
|
+
self.additional_properties[key] = value
|
|
92
|
+
|
|
93
|
+
def __delitem__(self, key: str) -> None:
|
|
94
|
+
del self.additional_properties[key]
|
|
95
|
+
|
|
96
|
+
def __contains__(self, key: str) -> bool:
|
|
97
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.error_body import ErrorBody
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="Error")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class Error:
|
|
18
|
+
"""Every failure from this API, in one shape. Charged nothing, always carries a
|
|
19
|
+
`request_id`. The same failure is available as RFC 9457 `application/problem+json`
|
|
20
|
+
to callers that ask for it.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
error (ErrorBody): The failure itself. `code` is stable; match on it, never on `message`.
|
|
24
|
+
request_id (str):
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
error: ErrorBody
|
|
28
|
+
request_id: str
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
error = self.error.to_dict()
|
|
33
|
+
|
|
34
|
+
request_id = self.request_id
|
|
35
|
+
|
|
36
|
+
field_dict: dict[str, Any] = {}
|
|
37
|
+
field_dict.update(self.additional_properties)
|
|
38
|
+
field_dict.update(
|
|
39
|
+
{
|
|
40
|
+
"error": error,
|
|
41
|
+
"request_id": request_id,
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return field_dict
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
49
|
+
from ..models.error_body import ErrorBody # noqa: PLC0415
|
|
50
|
+
|
|
51
|
+
d = dict(src_dict)
|
|
52
|
+
error = ErrorBody.from_dict(d.pop("error"))
|
|
53
|
+
|
|
54
|
+
request_id = d.pop("request_id")
|
|
55
|
+
|
|
56
|
+
error = cls(
|
|
57
|
+
error=error,
|
|
58
|
+
request_id=request_id,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
error.additional_properties = d
|
|
62
|
+
return error
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def additional_keys(self) -> list[str]:
|
|
66
|
+
return list(self.additional_properties.keys())
|
|
67
|
+
|
|
68
|
+
def __getitem__(self, key: str) -> Any:
|
|
69
|
+
return self.additional_properties[key]
|
|
70
|
+
|
|
71
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
72
|
+
self.additional_properties[key] = value
|
|
73
|
+
|
|
74
|
+
def __delitem__(self, key: str) -> None:
|
|
75
|
+
del self.additional_properties[key]
|
|
76
|
+
|
|
77
|
+
def __contains__(self, key: str) -> bool:
|
|
78
|
+
return key in self.additional_properties
|