spotify-apimatic-sdk 1.0.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.
- spotify_apimatic_sdk-1.0.0.dist-info/METADATA +150 -0
- spotify_apimatic_sdk-1.0.0.dist-info/RECORD +186 -0
- spotify_apimatic_sdk-1.0.0.dist-info/WHEEL +5 -0
- spotify_apimatic_sdk-1.0.0.dist-info/licenses/LICENSE +30 -0
- spotify_apimatic_sdk-1.0.0.dist-info/top_level.txt +1 -0
- spotifywebapi/__init__.py +12 -0
- spotifywebapi/api_helper.py +19 -0
- spotifywebapi/configuration.py +318 -0
- spotifywebapi/controllers/__init__.py +20 -0
- spotifywebapi/controllers/albums_controller.py +498 -0
- spotifywebapi/controllers/artists_controller.py +327 -0
- spotifywebapi/controllers/audiobooks_controller.py +441 -0
- spotifywebapi/controllers/base_controller.py +67 -0
- spotifywebapi/controllers/categories_controller.py +161 -0
- spotifywebapi/controllers/chapters_controller.py +157 -0
- spotifywebapi/controllers/episodes_controller.py +390 -0
- spotifywebapi/controllers/genres_controller.py +84 -0
- spotifywebapi/controllers/markets_controller.py +82 -0
- spotifywebapi/controllers/o_auth_authorization_controller.py +156 -0
- spotifywebapi/controllers/player_controller.py +807 -0
- spotifywebapi/controllers/playlists_controller.py +851 -0
- spotifywebapi/controllers/search_controller.py +123 -0
- spotifywebapi/controllers/shows_controller.py +439 -0
- spotifywebapi/controllers/tracks_controller.py +821 -0
- spotifywebapi/controllers/users_controller.py +649 -0
- spotifywebapi/exceptions/__init__.py +11 -0
- spotifywebapi/exceptions/api_exception.py +36 -0
- spotifywebapi/exceptions/bad_request_exception.py +56 -0
- spotifywebapi/exceptions/forbidden_exception.py +56 -0
- spotifywebapi/exceptions/not_found_exception.py +56 -0
- spotifywebapi/exceptions/o_auth_provider_exception.py +73 -0
- spotifywebapi/exceptions/too_many_requests_exception.py +56 -0
- spotifywebapi/exceptions/unauthorized_exception.py +56 -0
- spotifywebapi/http/__init__.py +11 -0
- spotifywebapi/http/api_response.py +67 -0
- spotifywebapi/http/auth/__init__.py +5 -0
- spotifywebapi/http/auth/o_auth_2.py +336 -0
- spotifywebapi/http/http_call_back.py +20 -0
- spotifywebapi/http/http_client_provider.py +23 -0
- spotifywebapi/http/http_method_enum.py +25 -0
- spotifywebapi/http/http_request.py +55 -0
- spotifywebapi/http/http_response.py +45 -0
- spotifywebapi/http/proxy_settings.py +50 -0
- spotifywebapi/models/__init__.py +142 -0
- spotifywebapi/models/album_base.py +264 -0
- spotifywebapi/models/album_group_enum.py +51 -0
- spotifywebapi/models/album_object.py +375 -0
- spotifywebapi/models/album_restriction_object.py +109 -0
- spotifywebapi/models/album_type_enum.py +62 -0
- spotifywebapi/models/artist_discography_album_object.py +298 -0
- spotifywebapi/models/artist_object.py +335 -0
- spotifywebapi/models/audio_analysis_object.py +266 -0
- spotifywebapi/models/audio_features_object.py +518 -0
- spotifywebapi/models/audiobook_base.py +353 -0
- spotifywebapi/models/audiobook_object.py +369 -0
- spotifywebapi/models/author_object.py +85 -0
- spotifywebapi/models/categories.py +162 -0
- spotifywebapi/models/category_object.py +117 -0
- spotifywebapi/models/chapter_base.py +392 -0
- spotifywebapi/models/chapter_object.py +408 -0
- spotifywebapi/models/chapter_restriction_object.py +113 -0
- spotifywebapi/models/context_object.py +181 -0
- spotifywebapi/models/copyright_object.py +130 -0
- spotifywebapi/models/currently_playing_context_object.py +314 -0
- spotifywebapi/models/currently_playing_object.py +241 -0
- spotifywebapi/models/cursor_object.py +108 -0
- spotifywebapi/models/cursor_paged_artists.py +75 -0
- spotifywebapi/models/cursor_paging_object.py +183 -0
- spotifywebapi/models/cursor_paging_play_history_object.py +214 -0
- spotifywebapi/models/cursor_paging_simplified_artist_object.py +213 -0
- spotifywebapi/models/device_object.py +278 -0
- spotifywebapi/models/disallows_object.py +314 -0
- spotifywebapi/models/episode_base.py +394 -0
- spotifywebapi/models/episode_object.py +665 -0
- spotifywebapi/models/episode_restriction_object.py +112 -0
- spotifywebapi/models/error_object.py +85 -0
- spotifywebapi/models/explicit_content_settings_object.py +110 -0
- spotifywebapi/models/external_id_object.py +156 -0
- spotifywebapi/models/external_url_object.py +107 -0
- spotifywebapi/models/followers_object.py +134 -0
- spotifywebapi/models/image_object.py +168 -0
- spotifywebapi/models/include_external_enum.py +45 -0
- spotifywebapi/models/item_type_1_enum.py +56 -0
- spotifywebapi/models/item_type_2_enum.py +45 -0
- spotifywebapi/models/item_type_3_enum.py +45 -0
- spotifywebapi/models/item_type_enum.py +58 -0
- spotifywebapi/models/linked_track_object.py +205 -0
- spotifywebapi/models/many_albums.py +76 -0
- spotifywebapi/models/many_artists.py +76 -0
- spotifywebapi/models/many_audio_features.py +77 -0
- spotifywebapi/models/many_audiobooks.py +77 -0
- spotifywebapi/models/many_chapters.py +77 -0
- spotifywebapi/models/many_devices.py +76 -0
- spotifywebapi/models/many_episodes.py +77 -0
- spotifywebapi/models/many_genres.py +69 -0
- spotifywebapi/models/many_simplified_shows.py +74 -0
- spotifywebapi/models/many_tracks.py +76 -0
- spotifywebapi/models/markets.py +85 -0
- spotifywebapi/models/me_albums_request.py +90 -0
- spotifywebapi/models/me_episodes_request.py +73 -0
- spotifywebapi/models/me_episodes_request_1.py +89 -0
- spotifywebapi/models/me_following_request.py +74 -0
- spotifywebapi/models/me_following_request_1.py +90 -0
- spotifywebapi/models/me_player_play_request.py +165 -0
- spotifywebapi/models/me_player_request.py +103 -0
- spotifywebapi/models/me_shows_request.py +89 -0
- spotifywebapi/models/me_tracks_request.py +74 -0
- spotifywebapi/models/me_tracks_request_1.py +90 -0
- spotifywebapi/models/meta.py +227 -0
- spotifywebapi/models/mode_enum.py +52 -0
- spotifywebapi/models/narrator_object.py +85 -0
- spotifywebapi/models/o_auth_provider_error_enum.py +67 -0
- spotifywebapi/models/o_auth_scope_enum.py +98 -0
- spotifywebapi/models/o_auth_token.py +113 -0
- spotifywebapi/models/paged_albums.py +75 -0
- spotifywebapi/models/paged_categories.py +74 -0
- spotifywebapi/models/paging_artist_discography_album_object.py +163 -0
- spotifywebapi/models/paging_artist_object.py +162 -0
- spotifywebapi/models/paging_featured_playlist_object.py +113 -0
- spotifywebapi/models/paging_object.py +142 -0
- spotifywebapi/models/paging_playlist_object.py +163 -0
- spotifywebapi/models/paging_playlist_track_object.py +163 -0
- spotifywebapi/models/paging_saved_album_object.py +163 -0
- spotifywebapi/models/paging_saved_audiobook_object.py +163 -0
- spotifywebapi/models/paging_saved_episode_object.py +163 -0
- spotifywebapi/models/paging_saved_show_object.py +163 -0
- spotifywebapi/models/paging_saved_track_object.py +163 -0
- spotifywebapi/models/paging_simplified_album_object.py +163 -0
- spotifywebapi/models/paging_simplified_audiobook_object.py +162 -0
- spotifywebapi/models/paging_simplified_chapter_object.py +162 -0
- spotifywebapi/models/paging_simplified_episode_object.py +162 -0
- spotifywebapi/models/paging_simplified_show_object.py +160 -0
- spotifywebapi/models/paging_simplified_track_object.py +163 -0
- spotifywebapi/models/paging_track_object.py +162 -0
- spotifywebapi/models/play_history_object.py +141 -0
- spotifywebapi/models/playlist_object.py +425 -0
- spotifywebapi/models/playlist_owner_object.py +238 -0
- spotifywebapi/models/playlist_snapshot_id.py +85 -0
- spotifywebapi/models/playlist_track_object.py +171 -0
- spotifywebapi/models/playlist_tracks_ref_object.py +109 -0
- spotifywebapi/models/playlist_user_object.py +231 -0
- spotifywebapi/models/playlists_followers_request.py +86 -0
- spotifywebapi/models/playlists_request.py +160 -0
- spotifywebapi/models/playlists_tracks_request.py +121 -0
- spotifywebapi/models/playlists_tracks_request_1.py +188 -0
- spotifywebapi/models/playlists_tracks_request_2.py +109 -0
- spotifywebapi/models/private_user_object.py +379 -0
- spotifywebapi/models/public_user_object.py +268 -0
- spotifywebapi/models/queue_object.py +118 -0
- spotifywebapi/models/reason_enum.py +65 -0
- spotifywebapi/models/recommendation_seed_object.py +208 -0
- spotifywebapi/models/recommendations_object.py +96 -0
- spotifywebapi/models/release_date_precision_enum.py +62 -0
- spotifywebapi/models/resume_point_object.py +131 -0
- spotifywebapi/models/saved_album_object.py +118 -0
- spotifywebapi/models/saved_audiobook_object.py +118 -0
- spotifywebapi/models/saved_episode_object.py +116 -0
- spotifywebapi/models/saved_show_object.py +116 -0
- spotifywebapi/models/saved_track_object.py +118 -0
- spotifywebapi/models/search_items.py +256 -0
- spotifywebapi/models/section_object.py +362 -0
- spotifywebapi/models/segment_object.py +307 -0
- spotifywebapi/models/show_base.py +550 -0
- spotifywebapi/models/show_object.py +319 -0
- spotifywebapi/models/simplified_album_object.py +468 -0
- spotifywebapi/models/simplified_artist_object.py +228 -0
- spotifywebapi/models/simplified_playlist_object.py +398 -0
- spotifywebapi/models/simplified_track_object.py +494 -0
- spotifywebapi/models/time_interval_object.py +132 -0
- spotifywebapi/models/track.py +697 -0
- spotifywebapi/models/track_1.py +85 -0
- spotifywebapi/models/track_object.py +605 -0
- spotifywebapi/models/track_restriction_object.py +112 -0
- spotifywebapi/models/type_2_enum.py +56 -0
- spotifywebapi/models/type_3_enum.py +56 -0
- spotifywebapi/models/type_4_enum.py +56 -0
- spotifywebapi/models/type_5_enum.py +56 -0
- spotifywebapi/models/type_6_enum.py +56 -0
- spotifywebapi/models/type_8_enum.py +42 -0
- spotifywebapi/models/type_9_enum.py +42 -0
- spotifywebapi/models/type_enum.py +56 -0
- spotifywebapi/models/users_playlists_request.py +154 -0
- spotifywebapi/spotifywebapi_client.py +198 -0
- spotifywebapi/utilities/__init__.py +6 -0
- spotifywebapi/utilities/file_wrapper.py +45 -0
- spotifywebapi/utilities/union_type_lookup.py +113 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.models.image_object import (
|
|
8
|
+
ImageObject,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CategoryObject(object):
|
|
13
|
+
"""Implementation of the 'CategoryObject' model.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
href (str): A link to the Web API endpoint returning full details of the
|
|
17
|
+
category.
|
|
18
|
+
icons (List[ImageObject]): The category icon, in various sizes.
|
|
19
|
+
id (str): The [Spotify category
|
|
20
|
+
ID](/documentation/web-api/concepts/spotify-uris-ids) of the category.
|
|
21
|
+
name (str): The name of the category.
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# Create a mapping from Model property names to API property names
|
|
26
|
+
_names = {
|
|
27
|
+
"href": "href",
|
|
28
|
+
"icons": "icons",
|
|
29
|
+
"id": "id",
|
|
30
|
+
"name": "name",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
href=None,
|
|
36
|
+
icons=None,
|
|
37
|
+
id=None,
|
|
38
|
+
name=None):
|
|
39
|
+
"""Initialize a CategoryObject instance."""
|
|
40
|
+
# Initialize members of the class
|
|
41
|
+
self.href = href
|
|
42
|
+
self.icons = icons
|
|
43
|
+
self.id = id
|
|
44
|
+
self.name = name
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_dictionary(cls,
|
|
48
|
+
dictionary):
|
|
49
|
+
"""Create an instance of this model from a dictionary
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
53
|
+
as obtained from the deserialization of the server's response. The
|
|
54
|
+
keys MUST match property names in the API description.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
object: An instance of this structure class.
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
# Extract variables from the dictionary
|
|
64
|
+
href =\
|
|
65
|
+
dictionary.get("href")\
|
|
66
|
+
if dictionary.get("href")\
|
|
67
|
+
else None
|
|
68
|
+
icons = None
|
|
69
|
+
if dictionary.get("icons") is not None:
|
|
70
|
+
icons = [
|
|
71
|
+
ImageObject.from_dictionary(x)
|
|
72
|
+
for x in dictionary.get("icons")
|
|
73
|
+
]
|
|
74
|
+
id =\
|
|
75
|
+
dictionary.get("id")\
|
|
76
|
+
if dictionary.get("id")\
|
|
77
|
+
else None
|
|
78
|
+
name =\
|
|
79
|
+
dictionary.get("name")\
|
|
80
|
+
if dictionary.get("name")\
|
|
81
|
+
else None
|
|
82
|
+
|
|
83
|
+
# Return an object of this model
|
|
84
|
+
return cls(href,
|
|
85
|
+
icons,
|
|
86
|
+
id,
|
|
87
|
+
name)
|
|
88
|
+
|
|
89
|
+
def __repr__(self):
|
|
90
|
+
"""Return a unambiguous string representation."""
|
|
91
|
+
_href=self.href
|
|
92
|
+
_icons=self.icons
|
|
93
|
+
_id=self.id
|
|
94
|
+
_name=self.name
|
|
95
|
+
return (
|
|
96
|
+
f"{self.__class__.__name__}("
|
|
97
|
+
f"href={_href!r}, "
|
|
98
|
+
f"icons={_icons!r}, "
|
|
99
|
+
f"id={_id!r}, "
|
|
100
|
+
f"name={_name!r}, "
|
|
101
|
+
f")"
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def __str__(self):
|
|
105
|
+
"""Return a human-readable string representation."""
|
|
106
|
+
_href=self.href
|
|
107
|
+
_icons=self.icons
|
|
108
|
+
_id=self.id
|
|
109
|
+
_name=self.name
|
|
110
|
+
return (
|
|
111
|
+
f"{self.__class__.__name__}("
|
|
112
|
+
f"href={_href!s}, "
|
|
113
|
+
f"icons={_icons!s}, "
|
|
114
|
+
f"id={_id!s}, "
|
|
115
|
+
f"name={_name!s}, "
|
|
116
|
+
f")"
|
|
117
|
+
)
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.models.chapter_restriction_object import (
|
|
9
|
+
ChapterRestrictionObject,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.external_url_object import (
|
|
12
|
+
ExternalUrlObject,
|
|
13
|
+
)
|
|
14
|
+
from spotifywebapi.models.image_object import (
|
|
15
|
+
ImageObject,
|
|
16
|
+
)
|
|
17
|
+
from spotifywebapi.models.resume_point_object import (
|
|
18
|
+
ResumePointObject,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ChapterBase(object):
|
|
23
|
+
"""Implementation of the 'ChapterBase' model.
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
audio_preview_url (str): A URL to a 30 second preview (MP3 format) of the
|
|
27
|
+
chapter. `null` if not available.
|
|
28
|
+
available_markets (List[str]): A list of the countries in which the chapter
|
|
29
|
+
can be played, identified by their [ISO 3166-1
|
|
30
|
+
alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
|
|
31
|
+
chapter_number (int): The number of the chapter
|
|
32
|
+
description (str): A description of the chapter. HTML tags are stripped away
|
|
33
|
+
from this field, use `html_description` field in case HTML tags are
|
|
34
|
+
needed.
|
|
35
|
+
html_description (str): A description of the chapter. This field may contain
|
|
36
|
+
HTML tags.
|
|
37
|
+
duration_ms (int): The chapter length in milliseconds.
|
|
38
|
+
explicit (bool): Whether or not the chapter has explicit content (true = yes
|
|
39
|
+
it does; false = no it does not OR unknown).
|
|
40
|
+
external_urls (ExternalUrlObject): External URLs for this chapter.
|
|
41
|
+
href (str): A link to the Web API endpoint providing full details of the
|
|
42
|
+
chapter.
|
|
43
|
+
id (str): The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids)
|
|
44
|
+
for the chapter.
|
|
45
|
+
images (List[ImageObject]): The cover art for the chapter in various sizes,
|
|
46
|
+
widest first.
|
|
47
|
+
is_playable (bool): True if the chapter is playable in the given market.
|
|
48
|
+
Otherwise false.
|
|
49
|
+
languages (List[str]): A list of the languages used in the chapter,
|
|
50
|
+
identified by their [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639)
|
|
51
|
+
code.
|
|
52
|
+
name (str): The name of the chapter.
|
|
53
|
+
release_date (str): The date the chapter was first released, for example
|
|
54
|
+
`"1981-12-15"`. Depending on the precision, it might be shown as `"1981"`
|
|
55
|
+
or `"1981-12"`.
|
|
56
|
+
release_date_precision (ReleaseDatePrecisionEnum): The precision with which
|
|
57
|
+
`release_date` value is known.
|
|
58
|
+
resume_point (ResumePointObject): The user's most recent position in the
|
|
59
|
+
chapter. Set if the supplied access token is a user token and has the
|
|
60
|
+
scope 'user-read-playback-position'.
|
|
61
|
+
mtype (Type5Enum): The object type.
|
|
62
|
+
uri (str): The [Spotify
|
|
63
|
+
URI](/documentation/web-api/concepts/spotify-uris-ids) for the chapter.
|
|
64
|
+
restrictions (ChapterRestrictionObject): Included in the response when a
|
|
65
|
+
content restriction is applied.
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
# Create a mapping from Model property names to API property names
|
|
70
|
+
_names = {
|
|
71
|
+
"audio_preview_url": "audio_preview_url",
|
|
72
|
+
"chapter_number": "chapter_number",
|
|
73
|
+
"description": "description",
|
|
74
|
+
"html_description": "html_description",
|
|
75
|
+
"duration_ms": "duration_ms",
|
|
76
|
+
"explicit": "explicit",
|
|
77
|
+
"external_urls": "external_urls",
|
|
78
|
+
"href": "href",
|
|
79
|
+
"id": "id",
|
|
80
|
+
"images": "images",
|
|
81
|
+
"is_playable": "is_playable",
|
|
82
|
+
"languages": "languages",
|
|
83
|
+
"name": "name",
|
|
84
|
+
"release_date": "release_date",
|
|
85
|
+
"release_date_precision": "release_date_precision",
|
|
86
|
+
"mtype": "type",
|
|
87
|
+
"uri": "uri",
|
|
88
|
+
"available_markets": "available_markets",
|
|
89
|
+
"resume_point": "resume_point",
|
|
90
|
+
"restrictions": "restrictions",
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_optionals = [
|
|
94
|
+
"available_markets",
|
|
95
|
+
"resume_point",
|
|
96
|
+
"restrictions",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
_nullables = [
|
|
100
|
+
"audio_preview_url",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
def __init__(
|
|
104
|
+
self,
|
|
105
|
+
audio_preview_url=None,
|
|
106
|
+
chapter_number=None,
|
|
107
|
+
description=None,
|
|
108
|
+
html_description=None,
|
|
109
|
+
duration_ms=None,
|
|
110
|
+
explicit=None,
|
|
111
|
+
external_urls=None,
|
|
112
|
+
href=None,
|
|
113
|
+
id=None,
|
|
114
|
+
images=None,
|
|
115
|
+
is_playable=None,
|
|
116
|
+
languages=None,
|
|
117
|
+
name=None,
|
|
118
|
+
release_date=None,
|
|
119
|
+
release_date_precision=None,
|
|
120
|
+
mtype=None,
|
|
121
|
+
uri=None,
|
|
122
|
+
available_markets=APIHelper.SKIP,
|
|
123
|
+
resume_point=APIHelper.SKIP,
|
|
124
|
+
restrictions=APIHelper.SKIP):
|
|
125
|
+
"""Initialize a ChapterBase instance."""
|
|
126
|
+
# Initialize members of the class
|
|
127
|
+
self.audio_preview_url = audio_preview_url
|
|
128
|
+
if available_markets is not APIHelper.SKIP:
|
|
129
|
+
self.available_markets = available_markets
|
|
130
|
+
self.chapter_number = chapter_number
|
|
131
|
+
self.description = description
|
|
132
|
+
self.html_description = html_description
|
|
133
|
+
self.duration_ms = duration_ms
|
|
134
|
+
self.explicit = explicit
|
|
135
|
+
self.external_urls = external_urls
|
|
136
|
+
self.href = href
|
|
137
|
+
self.id = id
|
|
138
|
+
self.images = images
|
|
139
|
+
self.is_playable = is_playable
|
|
140
|
+
self.languages = languages
|
|
141
|
+
self.name = name
|
|
142
|
+
self.release_date = release_date
|
|
143
|
+
self.release_date_precision = release_date_precision
|
|
144
|
+
if resume_point is not APIHelper.SKIP:
|
|
145
|
+
self.resume_point = resume_point
|
|
146
|
+
self.mtype = mtype
|
|
147
|
+
self.uri = uri
|
|
148
|
+
if restrictions is not APIHelper.SKIP:
|
|
149
|
+
self.restrictions = restrictions
|
|
150
|
+
|
|
151
|
+
@classmethod
|
|
152
|
+
def from_dictionary(cls,
|
|
153
|
+
dictionary):
|
|
154
|
+
"""Create an instance of this model from a dictionary
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
158
|
+
as obtained from the deserialization of the server's response. The
|
|
159
|
+
keys MUST match property names in the API description.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
object: An instance of this structure class.
|
|
163
|
+
|
|
164
|
+
"""
|
|
165
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
166
|
+
return None
|
|
167
|
+
|
|
168
|
+
# Extract variables from the dictionary
|
|
169
|
+
audio_preview_url =\
|
|
170
|
+
dictionary.get("audio_preview_url")\
|
|
171
|
+
if dictionary.get("audio_preview_url")\
|
|
172
|
+
else None
|
|
173
|
+
chapter_number =\
|
|
174
|
+
dictionary.get("chapter_number")\
|
|
175
|
+
if dictionary.get("chapter_number")\
|
|
176
|
+
else None
|
|
177
|
+
description =\
|
|
178
|
+
dictionary.get("description")\
|
|
179
|
+
if dictionary.get("description")\
|
|
180
|
+
else None
|
|
181
|
+
html_description =\
|
|
182
|
+
dictionary.get("html_description")\
|
|
183
|
+
if dictionary.get("html_description")\
|
|
184
|
+
else None
|
|
185
|
+
duration_ms =\
|
|
186
|
+
dictionary.get("duration_ms")\
|
|
187
|
+
if dictionary.get("duration_ms")\
|
|
188
|
+
else None
|
|
189
|
+
explicit =\
|
|
190
|
+
dictionary.get("explicit")\
|
|
191
|
+
if "explicit" in dictionary.keys()\
|
|
192
|
+
else None
|
|
193
|
+
external_urls =\
|
|
194
|
+
ExternalUrlObject.from_dictionary(
|
|
195
|
+
dictionary.get("external_urls"))\
|
|
196
|
+
if dictionary.get("external_urls") else None
|
|
197
|
+
href =\
|
|
198
|
+
dictionary.get("href")\
|
|
199
|
+
if dictionary.get("href")\
|
|
200
|
+
else None
|
|
201
|
+
id =\
|
|
202
|
+
dictionary.get("id")\
|
|
203
|
+
if dictionary.get("id")\
|
|
204
|
+
else None
|
|
205
|
+
images = None
|
|
206
|
+
if dictionary.get("images") is not None:
|
|
207
|
+
images = [
|
|
208
|
+
ImageObject.from_dictionary(x)
|
|
209
|
+
for x in dictionary.get("images")
|
|
210
|
+
]
|
|
211
|
+
is_playable =\
|
|
212
|
+
dictionary.get("is_playable")\
|
|
213
|
+
if "is_playable" in dictionary.keys()\
|
|
214
|
+
else None
|
|
215
|
+
languages =\
|
|
216
|
+
dictionary.get("languages")\
|
|
217
|
+
if dictionary.get("languages")\
|
|
218
|
+
else None
|
|
219
|
+
name =\
|
|
220
|
+
dictionary.get("name")\
|
|
221
|
+
if dictionary.get("name")\
|
|
222
|
+
else None
|
|
223
|
+
release_date =\
|
|
224
|
+
dictionary.get("release_date")\
|
|
225
|
+
if dictionary.get("release_date")\
|
|
226
|
+
else None
|
|
227
|
+
release_date_precision =\
|
|
228
|
+
dictionary.get("release_date_precision")\
|
|
229
|
+
if dictionary.get("release_date_precision")\
|
|
230
|
+
else None
|
|
231
|
+
mtype =\
|
|
232
|
+
dictionary.get("type")\
|
|
233
|
+
if dictionary.get("type")\
|
|
234
|
+
else None
|
|
235
|
+
uri =\
|
|
236
|
+
dictionary.get("uri")\
|
|
237
|
+
if dictionary.get("uri")\
|
|
238
|
+
else None
|
|
239
|
+
available_markets =\
|
|
240
|
+
dictionary.get("available_markets")\
|
|
241
|
+
if dictionary.get("available_markets")\
|
|
242
|
+
else APIHelper.SKIP
|
|
243
|
+
resume_point =\
|
|
244
|
+
ResumePointObject.from_dictionary(
|
|
245
|
+
dictionary.get("resume_point"))\
|
|
246
|
+
if "resume_point" in dictionary.keys()\
|
|
247
|
+
else APIHelper.SKIP
|
|
248
|
+
restrictions =\
|
|
249
|
+
ChapterRestrictionObject.from_dictionary(
|
|
250
|
+
dictionary.get("restrictions"))\
|
|
251
|
+
if "restrictions" in dictionary.keys()\
|
|
252
|
+
else APIHelper.SKIP
|
|
253
|
+
|
|
254
|
+
# Return an object of this model
|
|
255
|
+
return cls(audio_preview_url,
|
|
256
|
+
chapter_number,
|
|
257
|
+
description,
|
|
258
|
+
html_description,
|
|
259
|
+
duration_ms,
|
|
260
|
+
explicit,
|
|
261
|
+
external_urls,
|
|
262
|
+
href,
|
|
263
|
+
id,
|
|
264
|
+
images,
|
|
265
|
+
is_playable,
|
|
266
|
+
languages,
|
|
267
|
+
name,
|
|
268
|
+
release_date,
|
|
269
|
+
release_date_precision,
|
|
270
|
+
mtype,
|
|
271
|
+
uri,
|
|
272
|
+
available_markets,
|
|
273
|
+
resume_point,
|
|
274
|
+
restrictions)
|
|
275
|
+
|
|
276
|
+
def __repr__(self):
|
|
277
|
+
"""Return a unambiguous string representation."""
|
|
278
|
+
_audio_preview_url=self.audio_preview_url
|
|
279
|
+
_available_markets=(
|
|
280
|
+
self.available_markets
|
|
281
|
+
if hasattr(self, "available_markets")
|
|
282
|
+
else None
|
|
283
|
+
)
|
|
284
|
+
_chapter_number=self.chapter_number
|
|
285
|
+
_description=self.description
|
|
286
|
+
_html_description=self.html_description
|
|
287
|
+
_duration_ms=self.duration_ms
|
|
288
|
+
_explicit=self.explicit
|
|
289
|
+
_external_urls=self.external_urls
|
|
290
|
+
_href=self.href
|
|
291
|
+
_id=self.id
|
|
292
|
+
_images=self.images
|
|
293
|
+
_is_playable=self.is_playable
|
|
294
|
+
_languages=self.languages
|
|
295
|
+
_name=self.name
|
|
296
|
+
_release_date=self.release_date
|
|
297
|
+
_release_date_precision=self.release_date_precision
|
|
298
|
+
_resume_point=(
|
|
299
|
+
self.resume_point
|
|
300
|
+
if hasattr(self, "resume_point")
|
|
301
|
+
else None
|
|
302
|
+
)
|
|
303
|
+
_mtype=self.mtype
|
|
304
|
+
_uri=self.uri
|
|
305
|
+
_restrictions=(
|
|
306
|
+
self.restrictions
|
|
307
|
+
if hasattr(self, "restrictions")
|
|
308
|
+
else None
|
|
309
|
+
)
|
|
310
|
+
return (
|
|
311
|
+
f"{self.__class__.__name__}("
|
|
312
|
+
f"audio_preview_url={_audio_preview_url!r}, "
|
|
313
|
+
f"available_markets={_available_markets!r}, "
|
|
314
|
+
f"chapter_number={_chapter_number!r}, "
|
|
315
|
+
f"description={_description!r}, "
|
|
316
|
+
f"html_description={_html_description!r}, "
|
|
317
|
+
f"duration_ms={_duration_ms!r}, "
|
|
318
|
+
f"explicit={_explicit!r}, "
|
|
319
|
+
f"external_urls={_external_urls!r}, "
|
|
320
|
+
f"href={_href!r}, "
|
|
321
|
+
f"id={_id!r}, "
|
|
322
|
+
f"images={_images!r}, "
|
|
323
|
+
f"is_playable={_is_playable!r}, "
|
|
324
|
+
f"languages={_languages!r}, "
|
|
325
|
+
f"name={_name!r}, "
|
|
326
|
+
f"release_date={_release_date!r}, "
|
|
327
|
+
f"release_date_precision={_release_date_precision!r}, "
|
|
328
|
+
f"resume_point={_resume_point!r}, "
|
|
329
|
+
f"mtype={_mtype!r}, "
|
|
330
|
+
f"uri={_uri!r}, "
|
|
331
|
+
f"restrictions={_restrictions!r}, "
|
|
332
|
+
f")"
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
def __str__(self):
|
|
336
|
+
"""Return a human-readable string representation."""
|
|
337
|
+
_audio_preview_url=self.audio_preview_url
|
|
338
|
+
_available_markets=(
|
|
339
|
+
self.available_markets
|
|
340
|
+
if hasattr(self, "available_markets")
|
|
341
|
+
else None
|
|
342
|
+
)
|
|
343
|
+
_chapter_number=self.chapter_number
|
|
344
|
+
_description=self.description
|
|
345
|
+
_html_description=self.html_description
|
|
346
|
+
_duration_ms=self.duration_ms
|
|
347
|
+
_explicit=self.explicit
|
|
348
|
+
_external_urls=self.external_urls
|
|
349
|
+
_href=self.href
|
|
350
|
+
_id=self.id
|
|
351
|
+
_images=self.images
|
|
352
|
+
_is_playable=self.is_playable
|
|
353
|
+
_languages=self.languages
|
|
354
|
+
_name=self.name
|
|
355
|
+
_release_date=self.release_date
|
|
356
|
+
_release_date_precision=self.release_date_precision
|
|
357
|
+
_resume_point=(
|
|
358
|
+
self.resume_point
|
|
359
|
+
if hasattr(self, "resume_point")
|
|
360
|
+
else None
|
|
361
|
+
)
|
|
362
|
+
_mtype=self.mtype
|
|
363
|
+
_uri=self.uri
|
|
364
|
+
_restrictions=(
|
|
365
|
+
self.restrictions
|
|
366
|
+
if hasattr(self, "restrictions")
|
|
367
|
+
else None
|
|
368
|
+
)
|
|
369
|
+
return (
|
|
370
|
+
f"{self.__class__.__name__}("
|
|
371
|
+
f"audio_preview_url={_audio_preview_url!s}, "
|
|
372
|
+
f"available_markets={_available_markets!s}, "
|
|
373
|
+
f"chapter_number={_chapter_number!s}, "
|
|
374
|
+
f"description={_description!s}, "
|
|
375
|
+
f"html_description={_html_description!s}, "
|
|
376
|
+
f"duration_ms={_duration_ms!s}, "
|
|
377
|
+
f"explicit={_explicit!s}, "
|
|
378
|
+
f"external_urls={_external_urls!s}, "
|
|
379
|
+
f"href={_href!s}, "
|
|
380
|
+
f"id={_id!s}, "
|
|
381
|
+
f"images={_images!s}, "
|
|
382
|
+
f"is_playable={_is_playable!s}, "
|
|
383
|
+
f"languages={_languages!s}, "
|
|
384
|
+
f"name={_name!s}, "
|
|
385
|
+
f"release_date={_release_date!s}, "
|
|
386
|
+
f"release_date_precision={_release_date_precision!s}, "
|
|
387
|
+
f"resume_point={_resume_point!s}, "
|
|
388
|
+
f"mtype={_mtype!s}, "
|
|
389
|
+
f"uri={_uri!s}, "
|
|
390
|
+
f"restrictions={_restrictions!s}, "
|
|
391
|
+
f")"
|
|
392
|
+
)
|