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,90 @@
|
|
|
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="LiveRoomAuthor")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class LiveRoomAuthor:
|
|
16
|
+
"""The account that hosts a live room.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
id (str): Example: 107955.
|
|
20
|
+
username (str): Example: tiktok.
|
|
21
|
+
nickname (str): Example: TikTok.
|
|
22
|
+
sec_uid (str | Unset): Absent when TikTok does not send it. Example:
|
|
23
|
+
MS4wLjABAAAAv7iSuuXDJGDvJkmH_vz1qkDZYo1apxgzaxdBSeIuPiM.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
id: str
|
|
27
|
+
username: str
|
|
28
|
+
nickname: str
|
|
29
|
+
sec_uid: 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
|
+
field_dict: dict[str, Any] = {}
|
|
42
|
+
field_dict.update(self.additional_properties)
|
|
43
|
+
field_dict.update(
|
|
44
|
+
{
|
|
45
|
+
"id": id,
|
|
46
|
+
"username": username,
|
|
47
|
+
"nickname": nickname,
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
if sec_uid is not UNSET:
|
|
51
|
+
field_dict["sec_uid"] = sec_uid
|
|
52
|
+
|
|
53
|
+
return field_dict
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
57
|
+
d = dict(src_dict)
|
|
58
|
+
id = d.pop("id")
|
|
59
|
+
|
|
60
|
+
username = d.pop("username")
|
|
61
|
+
|
|
62
|
+
nickname = d.pop("nickname")
|
|
63
|
+
|
|
64
|
+
sec_uid = d.pop("sec_uid", UNSET)
|
|
65
|
+
|
|
66
|
+
live_room_author = cls(
|
|
67
|
+
id=id,
|
|
68
|
+
username=username,
|
|
69
|
+
nickname=nickname,
|
|
70
|
+
sec_uid=sec_uid,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
live_room_author.additional_properties = d
|
|
74
|
+
return live_room_author
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def additional_keys(self) -> list[str]:
|
|
78
|
+
return list(self.additional_properties.keys())
|
|
79
|
+
|
|
80
|
+
def __getitem__(self, key: str) -> Any:
|
|
81
|
+
return self.additional_properties[key]
|
|
82
|
+
|
|
83
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
84
|
+
self.additional_properties[key] = value
|
|
85
|
+
|
|
86
|
+
def __delitem__(self, key: str) -> None:
|
|
87
|
+
del self.additional_properties[key]
|
|
88
|
+
|
|
89
|
+
def __contains__(self, key: str) -> bool:
|
|
90
|
+
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.live_room import LiveRoom
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="LiveRoomPage")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class LiveRoomPage:
|
|
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[LiveRoom]):
|
|
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[LiveRoom]
|
|
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.live_room import LiveRoom # 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 = LiveRoom.from_dict(data_item_data)
|
|
98
|
+
|
|
99
|
+
data.append(data_item)
|
|
100
|
+
|
|
101
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
102
|
+
|
|
103
|
+
live_room_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
|
+
live_room_page.additional_properties = d
|
|
114
|
+
return live_room_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,124 @@
|
|
|
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.live_room import LiveRoom
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="LiveRoomResponse")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class LiveRoomResponse:
|
|
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 (LiveRoom): A live room of TikTok: an entry of a live search, or the live state of an account. No stream
|
|
32
|
+
addresses. For an account that is not live, `live` is `false` and the room fields (`room_id`,
|
|
33
|
+
`title`, `viewers`, `started_at`, `cover_url`) are absent.
|
|
34
|
+
next_cursor (str | Unset):
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
items: int
|
|
38
|
+
credits_charged: float
|
|
39
|
+
balance_remaining: float
|
|
40
|
+
cache: MetaCache
|
|
41
|
+
request_id: UUID
|
|
42
|
+
data: LiveRoom
|
|
43
|
+
next_cursor: str | Unset = UNSET
|
|
44
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
45
|
+
|
|
46
|
+
def to_dict(self) -> dict[str, Any]:
|
|
47
|
+
items = self.items
|
|
48
|
+
|
|
49
|
+
credits_charged = self.credits_charged
|
|
50
|
+
|
|
51
|
+
balance_remaining = self.balance_remaining
|
|
52
|
+
|
|
53
|
+
cache = self.cache.value
|
|
54
|
+
|
|
55
|
+
request_id = str(self.request_id)
|
|
56
|
+
|
|
57
|
+
data = self.data.to_dict()
|
|
58
|
+
|
|
59
|
+
next_cursor = self.next_cursor
|
|
60
|
+
|
|
61
|
+
field_dict: dict[str, Any] = {}
|
|
62
|
+
field_dict.update(self.additional_properties)
|
|
63
|
+
field_dict.update(
|
|
64
|
+
{
|
|
65
|
+
"items": items,
|
|
66
|
+
"credits_charged": credits_charged,
|
|
67
|
+
"balance_remaining": balance_remaining,
|
|
68
|
+
"cache": cache,
|
|
69
|
+
"request_id": request_id,
|
|
70
|
+
"data": data,
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
if next_cursor is not UNSET:
|
|
74
|
+
field_dict["next_cursor"] = next_cursor
|
|
75
|
+
|
|
76
|
+
return field_dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
80
|
+
from ..models.live_room import LiveRoom # noqa: PLC0415
|
|
81
|
+
|
|
82
|
+
d = dict(src_dict)
|
|
83
|
+
items = d.pop("items")
|
|
84
|
+
|
|
85
|
+
credits_charged = d.pop("credits_charged")
|
|
86
|
+
|
|
87
|
+
balance_remaining = d.pop("balance_remaining")
|
|
88
|
+
|
|
89
|
+
cache = MetaCache(d.pop("cache"))
|
|
90
|
+
|
|
91
|
+
request_id = UUID(d.pop("request_id"))
|
|
92
|
+
|
|
93
|
+
data = LiveRoom.from_dict(d.pop("data"))
|
|
94
|
+
|
|
95
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
96
|
+
|
|
97
|
+
live_room_response = cls(
|
|
98
|
+
items=items,
|
|
99
|
+
credits_charged=credits_charged,
|
|
100
|
+
balance_remaining=balance_remaining,
|
|
101
|
+
cache=cache,
|
|
102
|
+
request_id=request_id,
|
|
103
|
+
data=data,
|
|
104
|
+
next_cursor=next_cursor,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
live_room_response.additional_properties = d
|
|
108
|
+
return live_room_response
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def additional_keys(self) -> list[str]:
|
|
112
|
+
return list(self.additional_properties.keys())
|
|
113
|
+
|
|
114
|
+
def __getitem__(self, key: str) -> Any:
|
|
115
|
+
return self.additional_properties[key]
|
|
116
|
+
|
|
117
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
118
|
+
self.additional_properties[key] = value
|
|
119
|
+
|
|
120
|
+
def __delitem__(self, key: str) -> None:
|
|
121
|
+
del self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __contains__(self, key: str) -> bool:
|
|
124
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import 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
|
+
T = TypeVar("T", bound="Meta")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class Meta:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
items (int): Objects returned.
|
|
21
|
+
credits_charged (float): Example: 16.
|
|
22
|
+
balance_remaining (float): Example: 79984.
|
|
23
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
24
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
25
|
+
price of its own source; `hit` means all of it came from cache.
|
|
26
|
+
request_id (UUID):
|
|
27
|
+
next_cursor (str | Unset):
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
items: int
|
|
31
|
+
credits_charged: float
|
|
32
|
+
balance_remaining: float
|
|
33
|
+
cache: MetaCache
|
|
34
|
+
request_id: UUID
|
|
35
|
+
next_cursor: str | Unset = UNSET
|
|
36
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
37
|
+
|
|
38
|
+
def to_dict(self) -> dict[str, Any]:
|
|
39
|
+
items = self.items
|
|
40
|
+
|
|
41
|
+
credits_charged = self.credits_charged
|
|
42
|
+
|
|
43
|
+
balance_remaining = self.balance_remaining
|
|
44
|
+
|
|
45
|
+
cache = self.cache.value
|
|
46
|
+
|
|
47
|
+
request_id = str(self.request_id)
|
|
48
|
+
|
|
49
|
+
next_cursor = self.next_cursor
|
|
50
|
+
|
|
51
|
+
field_dict: dict[str, Any] = {}
|
|
52
|
+
field_dict.update(self.additional_properties)
|
|
53
|
+
field_dict.update(
|
|
54
|
+
{
|
|
55
|
+
"items": items,
|
|
56
|
+
"credits_charged": credits_charged,
|
|
57
|
+
"balance_remaining": balance_remaining,
|
|
58
|
+
"cache": cache,
|
|
59
|
+
"request_id": request_id,
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
if next_cursor is not UNSET:
|
|
63
|
+
field_dict["next_cursor"] = next_cursor
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
69
|
+
d = dict(src_dict)
|
|
70
|
+
items = d.pop("items")
|
|
71
|
+
|
|
72
|
+
credits_charged = d.pop("credits_charged")
|
|
73
|
+
|
|
74
|
+
balance_remaining = d.pop("balance_remaining")
|
|
75
|
+
|
|
76
|
+
cache = MetaCache(d.pop("cache"))
|
|
77
|
+
|
|
78
|
+
request_id = UUID(d.pop("request_id"))
|
|
79
|
+
|
|
80
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
81
|
+
|
|
82
|
+
meta = cls(
|
|
83
|
+
items=items,
|
|
84
|
+
credits_charged=credits_charged,
|
|
85
|
+
balance_remaining=balance_remaining,
|
|
86
|
+
cache=cache,
|
|
87
|
+
request_id=request_id,
|
|
88
|
+
next_cursor=next_cursor,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
meta.additional_properties = d
|
|
92
|
+
return meta
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def additional_keys(self) -> list[str]:
|
|
96
|
+
return list(self.additional_properties.keys())
|
|
97
|
+
|
|
98
|
+
def __getitem__(self, key: str) -> Any:
|
|
99
|
+
return self.additional_properties[key]
|
|
100
|
+
|
|
101
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
102
|
+
self.additional_properties[key] = value
|
|
103
|
+
|
|
104
|
+
def __delitem__(self, key: str) -> None:
|
|
105
|
+
del self.additional_properties[key]
|
|
106
|
+
|
|
107
|
+
def __contains__(self, key: str) -> bool:
|
|
108
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,107 @@
|
|
|
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="Music")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class Music:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
id (str):
|
|
19
|
+
title (str):
|
|
20
|
+
author (str | Unset): The name of the artist or of the account that made the sound.
|
|
21
|
+
original (bool | Unset): `true`: a sound that an account made, not a published track.
|
|
22
|
+
duration (int | Unset): Seconds.
|
|
23
|
+
cover_url (str | Unset): Signed image address; it stops working after some days.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
id: str
|
|
27
|
+
title: str
|
|
28
|
+
author: str | Unset = UNSET
|
|
29
|
+
original: bool | Unset = UNSET
|
|
30
|
+
duration: int | Unset = UNSET
|
|
31
|
+
cover_url: str | Unset = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
id = self.id
|
|
36
|
+
|
|
37
|
+
title = self.title
|
|
38
|
+
|
|
39
|
+
author = self.author
|
|
40
|
+
|
|
41
|
+
original = self.original
|
|
42
|
+
|
|
43
|
+
duration = self.duration
|
|
44
|
+
|
|
45
|
+
cover_url = self.cover_url
|
|
46
|
+
|
|
47
|
+
field_dict: dict[str, Any] = {}
|
|
48
|
+
field_dict.update(self.additional_properties)
|
|
49
|
+
field_dict.update(
|
|
50
|
+
{
|
|
51
|
+
"id": id,
|
|
52
|
+
"title": title,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
if author is not UNSET:
|
|
56
|
+
field_dict["author"] = author
|
|
57
|
+
if original is not UNSET:
|
|
58
|
+
field_dict["original"] = original
|
|
59
|
+
if duration is not UNSET:
|
|
60
|
+
field_dict["duration"] = duration
|
|
61
|
+
if cover_url is not UNSET:
|
|
62
|
+
field_dict["cover_url"] = cover_url
|
|
63
|
+
|
|
64
|
+
return field_dict
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
68
|
+
d = dict(src_dict)
|
|
69
|
+
id = d.pop("id")
|
|
70
|
+
|
|
71
|
+
title = d.pop("title")
|
|
72
|
+
|
|
73
|
+
author = d.pop("author", UNSET)
|
|
74
|
+
|
|
75
|
+
original = d.pop("original", UNSET)
|
|
76
|
+
|
|
77
|
+
duration = d.pop("duration", UNSET)
|
|
78
|
+
|
|
79
|
+
cover_url = d.pop("cover_url", UNSET)
|
|
80
|
+
|
|
81
|
+
music = cls(
|
|
82
|
+
id=id,
|
|
83
|
+
title=title,
|
|
84
|
+
author=author,
|
|
85
|
+
original=original,
|
|
86
|
+
duration=duration,
|
|
87
|
+
cover_url=cover_url,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
music.additional_properties = d
|
|
91
|
+
return music
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def additional_keys(self) -> list[str]:
|
|
95
|
+
return list(self.additional_properties.keys())
|
|
96
|
+
|
|
97
|
+
def __getitem__(self, key: str) -> Any:
|
|
98
|
+
return self.additional_properties[key]
|
|
99
|
+
|
|
100
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
101
|
+
self.additional_properties[key] = value
|
|
102
|
+
|
|
103
|
+
def __delitem__(self, key: str) -> None:
|
|
104
|
+
del self.additional_properties[key]
|
|
105
|
+
|
|
106
|
+
def __contains__(self, key: str) -> bool:
|
|
107
|
+
return key in self.additional_properties
|