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,109 @@
|
|
|
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
|
+
|
|
9
|
+
|
|
10
|
+
class AlbumRestrictionObject(object):
|
|
11
|
+
"""Implementation of the 'AlbumRestrictionObject' model.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
reason (ReasonEnum): The reason for the restriction. Albums may be restricted
|
|
15
|
+
if the content is not available in a given market, to the user's
|
|
16
|
+
subscription type, or when the user's account is set to not play explicit
|
|
17
|
+
content. Additional reasons may be added in the future.
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
# Create a mapping from Model property names to API property names
|
|
22
|
+
_names = {
|
|
23
|
+
"reason": "reason",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_optionals = [
|
|
27
|
+
"reason",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
reason=APIHelper.SKIP):
|
|
33
|
+
"""Initialize a AlbumRestrictionObject instance."""
|
|
34
|
+
# Initialize members of the class
|
|
35
|
+
if reason is not APIHelper.SKIP:
|
|
36
|
+
self.reason = reason
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def from_dictionary(cls,
|
|
40
|
+
dictionary):
|
|
41
|
+
"""Create an instance of this model from a dictionary
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
45
|
+
as obtained from the deserialization of the server's response. The
|
|
46
|
+
keys MUST match property names in the API description.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
object: An instance of this structure class.
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
# Extract variables from the dictionary
|
|
56
|
+
reason =\
|
|
57
|
+
dictionary.get("reason")\
|
|
58
|
+
if dictionary.get("reason")\
|
|
59
|
+
else APIHelper.SKIP
|
|
60
|
+
|
|
61
|
+
# Return an object of this model
|
|
62
|
+
return cls(reason)
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def validate(cls, dictionary):
|
|
66
|
+
"""Validate dictionary against class required properties
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
70
|
+
as obtained from the deserialization of the server's response. The
|
|
71
|
+
keys MUST match property names in the API description.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
boolean : if dictionary is valid contains required properties.
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
if isinstance(dictionary, cls):
|
|
78
|
+
return True
|
|
79
|
+
|
|
80
|
+
if not isinstance(dictionary, dict):
|
|
81
|
+
return False
|
|
82
|
+
|
|
83
|
+
return True
|
|
84
|
+
|
|
85
|
+
def __repr__(self):
|
|
86
|
+
"""Return a unambiguous string representation."""
|
|
87
|
+
_reason=(
|
|
88
|
+
self.reason
|
|
89
|
+
if hasattr(self, "reason")
|
|
90
|
+
else None
|
|
91
|
+
)
|
|
92
|
+
return (
|
|
93
|
+
f"{self.__class__.__name__}("
|
|
94
|
+
f"reason={_reason!r}, "
|
|
95
|
+
f")"
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def __str__(self):
|
|
99
|
+
"""Return a human-readable string representation."""
|
|
100
|
+
_reason=(
|
|
101
|
+
self.reason
|
|
102
|
+
if hasattr(self, "reason")
|
|
103
|
+
else None
|
|
104
|
+
)
|
|
105
|
+
return (
|
|
106
|
+
f"{self.__class__.__name__}("
|
|
107
|
+
f"reason={_reason!s}, "
|
|
108
|
+
f")"
|
|
109
|
+
)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
|
|
8
|
+
class AlbumTypeEnum(object):
|
|
9
|
+
"""Implementation of the 'AlbumType' enum.
|
|
10
|
+
|
|
11
|
+
The type of the album.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
ALBUM: The enum member of type str.
|
|
15
|
+
SINGLE: The enum member of type str.
|
|
16
|
+
COMPILATION: The enum member of type str.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
_all_values = ["album", "single", "compilation"]
|
|
21
|
+
ALBUM = "album"
|
|
22
|
+
|
|
23
|
+
SINGLE = "single"
|
|
24
|
+
|
|
25
|
+
COMPILATION = "compilation"
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def validate(cls, value):
|
|
29
|
+
"""Validate value contains in enum
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
value: the value to be validated
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
boolean : if value is valid enum values.
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
return value in cls._all_values
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def from_value(cls, value, default=None):
|
|
42
|
+
"""Return the matching enum value for the given input."""
|
|
43
|
+
if value is None:
|
|
44
|
+
return default
|
|
45
|
+
|
|
46
|
+
# If numeric and matches directly
|
|
47
|
+
if isinstance(value, int):
|
|
48
|
+
for name, val in cls.__dict__.items():
|
|
49
|
+
if not name.startswith("_") and val == value:
|
|
50
|
+
return val
|
|
51
|
+
|
|
52
|
+
# If string, perform case-insensitive match
|
|
53
|
+
if isinstance(value, str):
|
|
54
|
+
value_lower = value.lower()
|
|
55
|
+
for name, val in cls.__dict__.items():
|
|
56
|
+
if not name.startswith("_") and (
|
|
57
|
+
name.lower() == value_lower or str(val).lower() == value_lower
|
|
58
|
+
):
|
|
59
|
+
return val
|
|
60
|
+
|
|
61
|
+
# Fallback to default
|
|
62
|
+
return default
|
|
@@ -0,0 +1,298 @@
|
|
|
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.album_restriction_object import (
|
|
9
|
+
AlbumRestrictionObject,
|
|
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.simplified_artist_object import (
|
|
18
|
+
SimplifiedArtistObject,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ArtistDiscographyAlbumObject(object):
|
|
23
|
+
"""Implementation of the 'ArtistDiscographyAlbumObject' model.
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
album_type (AlbumTypeEnum): The type of the album.
|
|
27
|
+
total_tracks (int): The number of tracks in the album.
|
|
28
|
+
available_markets (List[str]): The markets in which the album is available:
|
|
29
|
+
[ISO 3166-1 alpha-2 country
|
|
30
|
+
codes](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). _**NOTE**: an
|
|
31
|
+
album is considered available in a market when at least 1 of its tracks
|
|
32
|
+
is available in that market._
|
|
33
|
+
external_urls (ExternalUrlObject): Known external URLs for this album.
|
|
34
|
+
href (str): A link to the Web API endpoint providing full details of the
|
|
35
|
+
album.
|
|
36
|
+
id (str): The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids)
|
|
37
|
+
for the album.
|
|
38
|
+
images (List[ImageObject]): The cover art for the album in various sizes,
|
|
39
|
+
widest first.
|
|
40
|
+
name (str): The name of the album. In case of an album takedown, the value
|
|
41
|
+
may be an empty string.
|
|
42
|
+
release_date (str): The date the album was first released.
|
|
43
|
+
release_date_precision (ReleaseDatePrecisionEnum): The precision with which
|
|
44
|
+
`release_date` value is known.
|
|
45
|
+
restrictions (AlbumRestrictionObject): Included in the response when a
|
|
46
|
+
content restriction is applied.
|
|
47
|
+
mtype (Type2Enum): The object type.
|
|
48
|
+
uri (str): The [Spotify
|
|
49
|
+
URI](/documentation/web-api/concepts/spotify-uris-ids) for the album.
|
|
50
|
+
artists (List[SimplifiedArtistObject]): The artists of the album. Each artist
|
|
51
|
+
object includes a link in `href` to more detailed information about the
|
|
52
|
+
artist.
|
|
53
|
+
album_group (AlbumGroupEnum): This field describes the relationship between
|
|
54
|
+
the artist and the album.
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
# Create a mapping from Model property names to API property names
|
|
59
|
+
_names = {
|
|
60
|
+
"album_type": "album_type",
|
|
61
|
+
"total_tracks": "total_tracks",
|
|
62
|
+
"available_markets": "available_markets",
|
|
63
|
+
"external_urls": "external_urls",
|
|
64
|
+
"href": "href",
|
|
65
|
+
"id": "id",
|
|
66
|
+
"images": "images",
|
|
67
|
+
"name": "name",
|
|
68
|
+
"release_date": "release_date",
|
|
69
|
+
"release_date_precision": "release_date_precision",
|
|
70
|
+
"mtype": "type",
|
|
71
|
+
"uri": "uri",
|
|
72
|
+
"artists": "artists",
|
|
73
|
+
"album_group": "album_group",
|
|
74
|
+
"restrictions": "restrictions",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_optionals = [
|
|
78
|
+
"restrictions",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
album_type=None,
|
|
84
|
+
total_tracks=None,
|
|
85
|
+
available_markets=None,
|
|
86
|
+
external_urls=None,
|
|
87
|
+
href=None,
|
|
88
|
+
id=None,
|
|
89
|
+
images=None,
|
|
90
|
+
name=None,
|
|
91
|
+
release_date=None,
|
|
92
|
+
release_date_precision=None,
|
|
93
|
+
mtype=None,
|
|
94
|
+
uri=None,
|
|
95
|
+
artists=None,
|
|
96
|
+
album_group=None,
|
|
97
|
+
restrictions=APIHelper.SKIP):
|
|
98
|
+
"""Initialize a ArtistDiscographyAlbumObject instance."""
|
|
99
|
+
# Initialize members of the class
|
|
100
|
+
self.album_type = album_type
|
|
101
|
+
self.total_tracks = total_tracks
|
|
102
|
+
self.available_markets = available_markets
|
|
103
|
+
self.external_urls = external_urls
|
|
104
|
+
self.href = href
|
|
105
|
+
self.id = id
|
|
106
|
+
self.images = images
|
|
107
|
+
self.name = name
|
|
108
|
+
self.release_date = release_date
|
|
109
|
+
self.release_date_precision = release_date_precision
|
|
110
|
+
if restrictions is not APIHelper.SKIP:
|
|
111
|
+
self.restrictions = restrictions
|
|
112
|
+
self.mtype = mtype
|
|
113
|
+
self.uri = uri
|
|
114
|
+
self.artists = artists
|
|
115
|
+
self.album_group = album_group
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_dictionary(cls,
|
|
119
|
+
dictionary):
|
|
120
|
+
"""Create an instance of this model from a dictionary
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
124
|
+
as obtained from the deserialization of the server's response. The
|
|
125
|
+
keys MUST match property names in the API description.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
object: An instance of this structure class.
|
|
129
|
+
|
|
130
|
+
"""
|
|
131
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
# Extract variables from the dictionary
|
|
135
|
+
album_type =\
|
|
136
|
+
dictionary.get("album_type")\
|
|
137
|
+
if dictionary.get("album_type")\
|
|
138
|
+
else None
|
|
139
|
+
total_tracks =\
|
|
140
|
+
dictionary.get("total_tracks")\
|
|
141
|
+
if dictionary.get("total_tracks")\
|
|
142
|
+
else None
|
|
143
|
+
available_markets =\
|
|
144
|
+
dictionary.get("available_markets")\
|
|
145
|
+
if dictionary.get("available_markets")\
|
|
146
|
+
else None
|
|
147
|
+
external_urls =\
|
|
148
|
+
ExternalUrlObject.from_dictionary(
|
|
149
|
+
dictionary.get("external_urls"))\
|
|
150
|
+
if dictionary.get("external_urls") else None
|
|
151
|
+
href =\
|
|
152
|
+
dictionary.get("href")\
|
|
153
|
+
if dictionary.get("href")\
|
|
154
|
+
else None
|
|
155
|
+
id =\
|
|
156
|
+
dictionary.get("id")\
|
|
157
|
+
if dictionary.get("id")\
|
|
158
|
+
else None
|
|
159
|
+
images = None
|
|
160
|
+
if dictionary.get("images") is not None:
|
|
161
|
+
images = [
|
|
162
|
+
ImageObject.from_dictionary(x)
|
|
163
|
+
for x in dictionary.get("images")
|
|
164
|
+
]
|
|
165
|
+
name =\
|
|
166
|
+
dictionary.get("name")\
|
|
167
|
+
if dictionary.get("name")\
|
|
168
|
+
else None
|
|
169
|
+
release_date =\
|
|
170
|
+
dictionary.get("release_date")\
|
|
171
|
+
if dictionary.get("release_date")\
|
|
172
|
+
else None
|
|
173
|
+
release_date_precision =\
|
|
174
|
+
dictionary.get("release_date_precision")\
|
|
175
|
+
if dictionary.get("release_date_precision")\
|
|
176
|
+
else None
|
|
177
|
+
mtype =\
|
|
178
|
+
dictionary.get("type")\
|
|
179
|
+
if dictionary.get("type")\
|
|
180
|
+
else None
|
|
181
|
+
uri =\
|
|
182
|
+
dictionary.get("uri")\
|
|
183
|
+
if dictionary.get("uri")\
|
|
184
|
+
else None
|
|
185
|
+
artists = None
|
|
186
|
+
if dictionary.get("artists") is not None:
|
|
187
|
+
artists = [
|
|
188
|
+
SimplifiedArtistObject.from_dictionary(x)
|
|
189
|
+
for x in dictionary.get("artists")
|
|
190
|
+
]
|
|
191
|
+
album_group =\
|
|
192
|
+
dictionary.get("album_group")\
|
|
193
|
+
if dictionary.get("album_group")\
|
|
194
|
+
else None
|
|
195
|
+
restrictions =\
|
|
196
|
+
AlbumRestrictionObject.from_dictionary(
|
|
197
|
+
dictionary.get("restrictions"))\
|
|
198
|
+
if "restrictions" in dictionary.keys()\
|
|
199
|
+
else APIHelper.SKIP
|
|
200
|
+
|
|
201
|
+
# Return an object of this model
|
|
202
|
+
return cls(album_type,
|
|
203
|
+
total_tracks,
|
|
204
|
+
available_markets,
|
|
205
|
+
external_urls,
|
|
206
|
+
href,
|
|
207
|
+
id,
|
|
208
|
+
images,
|
|
209
|
+
name,
|
|
210
|
+
release_date,
|
|
211
|
+
release_date_precision,
|
|
212
|
+
mtype,
|
|
213
|
+
uri,
|
|
214
|
+
artists,
|
|
215
|
+
album_group,
|
|
216
|
+
restrictions)
|
|
217
|
+
|
|
218
|
+
def __repr__(self):
|
|
219
|
+
"""Return a unambiguous string representation."""
|
|
220
|
+
_album_type=self.album_type
|
|
221
|
+
_total_tracks=self.total_tracks
|
|
222
|
+
_available_markets=self.available_markets
|
|
223
|
+
_external_urls=self.external_urls
|
|
224
|
+
_href=self.href
|
|
225
|
+
_id=self.id
|
|
226
|
+
_images=self.images
|
|
227
|
+
_name=self.name
|
|
228
|
+
_release_date=self.release_date
|
|
229
|
+
_release_date_precision=self.release_date_precision
|
|
230
|
+
_restrictions=(
|
|
231
|
+
self.restrictions
|
|
232
|
+
if hasattr(self, "restrictions")
|
|
233
|
+
else None
|
|
234
|
+
)
|
|
235
|
+
_mtype=self.mtype
|
|
236
|
+
_uri=self.uri
|
|
237
|
+
_artists=self.artists
|
|
238
|
+
_album_group=self.album_group
|
|
239
|
+
return (
|
|
240
|
+
f"{self.__class__.__name__}("
|
|
241
|
+
f"album_type={_album_type!r}, "
|
|
242
|
+
f"total_tracks={_total_tracks!r}, "
|
|
243
|
+
f"available_markets={_available_markets!r}, "
|
|
244
|
+
f"external_urls={_external_urls!r}, "
|
|
245
|
+
f"href={_href!r}, "
|
|
246
|
+
f"id={_id!r}, "
|
|
247
|
+
f"images={_images!r}, "
|
|
248
|
+
f"name={_name!r}, "
|
|
249
|
+
f"release_date={_release_date!r}, "
|
|
250
|
+
f"release_date_precision={_release_date_precision!r}, "
|
|
251
|
+
f"restrictions={_restrictions!r}, "
|
|
252
|
+
f"mtype={_mtype!r}, "
|
|
253
|
+
f"uri={_uri!r}, "
|
|
254
|
+
f"artists={_artists!r}, "
|
|
255
|
+
f"album_group={_album_group!r}, "
|
|
256
|
+
f")"
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
def __str__(self):
|
|
260
|
+
"""Return a human-readable string representation."""
|
|
261
|
+
_album_type=self.album_type
|
|
262
|
+
_total_tracks=self.total_tracks
|
|
263
|
+
_available_markets=self.available_markets
|
|
264
|
+
_external_urls=self.external_urls
|
|
265
|
+
_href=self.href
|
|
266
|
+
_id=self.id
|
|
267
|
+
_images=self.images
|
|
268
|
+
_name=self.name
|
|
269
|
+
_release_date=self.release_date
|
|
270
|
+
_release_date_precision=self.release_date_precision
|
|
271
|
+
_restrictions=(
|
|
272
|
+
self.restrictions
|
|
273
|
+
if hasattr(self, "restrictions")
|
|
274
|
+
else None
|
|
275
|
+
)
|
|
276
|
+
_mtype=self.mtype
|
|
277
|
+
_uri=self.uri
|
|
278
|
+
_artists=self.artists
|
|
279
|
+
_album_group=self.album_group
|
|
280
|
+
return (
|
|
281
|
+
f"{self.__class__.__name__}("
|
|
282
|
+
f"album_type={_album_type!s}, "
|
|
283
|
+
f"total_tracks={_total_tracks!s}, "
|
|
284
|
+
f"available_markets={_available_markets!s}, "
|
|
285
|
+
f"external_urls={_external_urls!s}, "
|
|
286
|
+
f"href={_href!s}, "
|
|
287
|
+
f"id={_id!s}, "
|
|
288
|
+
f"images={_images!s}, "
|
|
289
|
+
f"name={_name!s}, "
|
|
290
|
+
f"release_date={_release_date!s}, "
|
|
291
|
+
f"release_date_precision={_release_date_precision!s}, "
|
|
292
|
+
f"restrictions={_restrictions!s}, "
|
|
293
|
+
f"mtype={_mtype!s}, "
|
|
294
|
+
f"uri={_uri!s}, "
|
|
295
|
+
f"artists={_artists!s}, "
|
|
296
|
+
f"album_group={_album_group!s}, "
|
|
297
|
+
f")"
|
|
298
|
+
)
|