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,130 @@
|
|
|
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 CopyrightObject(object):
|
|
11
|
+
"""Implementation of the 'CopyrightObject' model.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
text (str): The copyright text for this content.
|
|
15
|
+
mtype (str): The type of copyright: `C` = the copyright, `P` = the sound
|
|
16
|
+
recording (performance) copyright.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
# Create a mapping from Model property names to API property names
|
|
21
|
+
_names = {
|
|
22
|
+
"text": "text",
|
|
23
|
+
"mtype": "type",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_optionals = [
|
|
27
|
+
"text",
|
|
28
|
+
"mtype",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
text=APIHelper.SKIP,
|
|
34
|
+
mtype=APIHelper.SKIP):
|
|
35
|
+
"""Initialize a CopyrightObject instance."""
|
|
36
|
+
# Initialize members of the class
|
|
37
|
+
if text is not APIHelper.SKIP:
|
|
38
|
+
self.text = text
|
|
39
|
+
if mtype is not APIHelper.SKIP:
|
|
40
|
+
self.mtype = mtype
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def from_dictionary(cls,
|
|
44
|
+
dictionary):
|
|
45
|
+
"""Create an instance of this model from a dictionary
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
49
|
+
as obtained from the deserialization of the server's response. The
|
|
50
|
+
keys MUST match property names in the API description.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
object: An instance of this structure class.
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
# Extract variables from the dictionary
|
|
60
|
+
text =\
|
|
61
|
+
dictionary.get("text")\
|
|
62
|
+
if dictionary.get("text")\
|
|
63
|
+
else APIHelper.SKIP
|
|
64
|
+
mtype =\
|
|
65
|
+
dictionary.get("type")\
|
|
66
|
+
if dictionary.get("type")\
|
|
67
|
+
else APIHelper.SKIP
|
|
68
|
+
|
|
69
|
+
# Return an object of this model
|
|
70
|
+
return cls(text,
|
|
71
|
+
mtype)
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def validate(cls, dictionary):
|
|
75
|
+
"""Validate dictionary against class required properties
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
79
|
+
as obtained from the deserialization of the server's response. The
|
|
80
|
+
keys MUST match property names in the API description.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
boolean : if dictionary is valid contains required properties.
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
if isinstance(dictionary, cls):
|
|
87
|
+
return True
|
|
88
|
+
|
|
89
|
+
if not isinstance(dictionary, dict):
|
|
90
|
+
return False
|
|
91
|
+
|
|
92
|
+
return True
|
|
93
|
+
|
|
94
|
+
def __repr__(self):
|
|
95
|
+
"""Return a unambiguous string representation."""
|
|
96
|
+
_text=(
|
|
97
|
+
self.text
|
|
98
|
+
if hasattr(self, "text")
|
|
99
|
+
else None
|
|
100
|
+
)
|
|
101
|
+
_mtype=(
|
|
102
|
+
self.mtype
|
|
103
|
+
if hasattr(self, "mtype")
|
|
104
|
+
else None
|
|
105
|
+
)
|
|
106
|
+
return (
|
|
107
|
+
f"{self.__class__.__name__}("
|
|
108
|
+
f"text={_text!r}, "
|
|
109
|
+
f"mtype={_mtype!r}, "
|
|
110
|
+
f")"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def __str__(self):
|
|
114
|
+
"""Return a human-readable string representation."""
|
|
115
|
+
_text=(
|
|
116
|
+
self.text
|
|
117
|
+
if hasattr(self, "text")
|
|
118
|
+
else None
|
|
119
|
+
)
|
|
120
|
+
_mtype=(
|
|
121
|
+
self.mtype
|
|
122
|
+
if hasattr(self, "mtype")
|
|
123
|
+
else None
|
|
124
|
+
)
|
|
125
|
+
return (
|
|
126
|
+
f"{self.__class__.__name__}("
|
|
127
|
+
f"text={_text!s}, "
|
|
128
|
+
f"mtype={_mtype!s}, "
|
|
129
|
+
f")"
|
|
130
|
+
)
|
|
@@ -0,0 +1,314 @@
|
|
|
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.context_object import (
|
|
9
|
+
ContextObject,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.device_object import (
|
|
12
|
+
DeviceObject,
|
|
13
|
+
)
|
|
14
|
+
from spotifywebapi.models.disallows_object import (
|
|
15
|
+
DisallowsObject,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CurrentlyPlayingContextObject(object):
|
|
20
|
+
"""Implementation of the 'CurrentlyPlayingContextObject' model.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
device (DeviceObject): The device that is currently active.
|
|
24
|
+
repeat_state (str): off, track, context
|
|
25
|
+
shuffle_state (bool): If shuffle is on or off.
|
|
26
|
+
context (ContextObject): A Context Object. Can be `null`.
|
|
27
|
+
timestamp (int): Unix Millisecond Timestamp when data was fetched.
|
|
28
|
+
progress_ms (int): Progress into the currently playing track or episode. Can
|
|
29
|
+
be `null`.
|
|
30
|
+
is_playing (bool): If something is currently playing, return `true`.
|
|
31
|
+
item (TrackObject | EpisodeObject | None): The currently playing track or
|
|
32
|
+
episode. Can be `null`.
|
|
33
|
+
currently_playing_type (str): The object type of the currently playing item.
|
|
34
|
+
Can be one of `track`, `episode`, `ad` or `unknown`.
|
|
35
|
+
actions (DisallowsObject): Allows to update the user interface based on which
|
|
36
|
+
playback actions are available within the current context.
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
# Create a mapping from Model property names to API property names
|
|
41
|
+
_names = {
|
|
42
|
+
"device": "device",
|
|
43
|
+
"repeat_state": "repeat_state",
|
|
44
|
+
"shuffle_state": "shuffle_state",
|
|
45
|
+
"context": "context",
|
|
46
|
+
"timestamp": "timestamp",
|
|
47
|
+
"progress_ms": "progress_ms",
|
|
48
|
+
"is_playing": "is_playing",
|
|
49
|
+
"item": "item",
|
|
50
|
+
"currently_playing_type": "currently_playing_type",
|
|
51
|
+
"actions": "actions",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_optionals = [
|
|
55
|
+
"device",
|
|
56
|
+
"repeat_state",
|
|
57
|
+
"shuffle_state",
|
|
58
|
+
"context",
|
|
59
|
+
"timestamp",
|
|
60
|
+
"progress_ms",
|
|
61
|
+
"is_playing",
|
|
62
|
+
"item",
|
|
63
|
+
"currently_playing_type",
|
|
64
|
+
"actions",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
def __init__(
|
|
68
|
+
self,
|
|
69
|
+
device=APIHelper.SKIP,
|
|
70
|
+
repeat_state=APIHelper.SKIP,
|
|
71
|
+
shuffle_state=APIHelper.SKIP,
|
|
72
|
+
context=APIHelper.SKIP,
|
|
73
|
+
timestamp=APIHelper.SKIP,
|
|
74
|
+
progress_ms=APIHelper.SKIP,
|
|
75
|
+
is_playing=APIHelper.SKIP,
|
|
76
|
+
item=APIHelper.SKIP,
|
|
77
|
+
currently_playing_type=APIHelper.SKIP,
|
|
78
|
+
actions=APIHelper.SKIP):
|
|
79
|
+
"""Initialize a CurrentlyPlayingContextObject instance."""
|
|
80
|
+
# Initialize members of the class
|
|
81
|
+
if device is not APIHelper.SKIP:
|
|
82
|
+
self.device = device
|
|
83
|
+
if repeat_state is not APIHelper.SKIP:
|
|
84
|
+
self.repeat_state = repeat_state
|
|
85
|
+
if shuffle_state is not APIHelper.SKIP:
|
|
86
|
+
self.shuffle_state = shuffle_state
|
|
87
|
+
if context is not APIHelper.SKIP:
|
|
88
|
+
self.context = context
|
|
89
|
+
if timestamp is not APIHelper.SKIP:
|
|
90
|
+
self.timestamp = timestamp
|
|
91
|
+
if progress_ms is not APIHelper.SKIP:
|
|
92
|
+
self.progress_ms = progress_ms
|
|
93
|
+
if is_playing is not APIHelper.SKIP:
|
|
94
|
+
self.is_playing = is_playing
|
|
95
|
+
if item is not APIHelper.SKIP:
|
|
96
|
+
self.item = item
|
|
97
|
+
if currently_playing_type is not APIHelper.SKIP:
|
|
98
|
+
self.currently_playing_type = currently_playing_type
|
|
99
|
+
if actions is not APIHelper.SKIP:
|
|
100
|
+
self.actions = actions
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dictionary(cls,
|
|
104
|
+
dictionary):
|
|
105
|
+
"""Create an instance of this model from a dictionary
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
109
|
+
as obtained from the deserialization of the server's response. The
|
|
110
|
+
keys MUST match property names in the API description.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
object: An instance of this structure class.
|
|
114
|
+
|
|
115
|
+
"""
|
|
116
|
+
from spotifywebapi.utilities.union_type_lookup import (
|
|
117
|
+
UnionTypeLookUp,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
# Extract variables from the dictionary
|
|
124
|
+
device =\
|
|
125
|
+
DeviceObject.from_dictionary(
|
|
126
|
+
dictionary.get("device"))\
|
|
127
|
+
if "device" in dictionary.keys()\
|
|
128
|
+
else APIHelper.SKIP
|
|
129
|
+
repeat_state =\
|
|
130
|
+
dictionary.get("repeat_state")\
|
|
131
|
+
if dictionary.get("repeat_state")\
|
|
132
|
+
else APIHelper.SKIP
|
|
133
|
+
shuffle_state =\
|
|
134
|
+
dictionary.get("shuffle_state")\
|
|
135
|
+
if "shuffle_state" in dictionary.keys()\
|
|
136
|
+
else APIHelper.SKIP
|
|
137
|
+
context =\
|
|
138
|
+
ContextObject.from_dictionary(
|
|
139
|
+
dictionary.get("context"))\
|
|
140
|
+
if "context" in dictionary.keys()\
|
|
141
|
+
else APIHelper.SKIP
|
|
142
|
+
timestamp =\
|
|
143
|
+
dictionary.get("timestamp")\
|
|
144
|
+
if dictionary.get("timestamp")\
|
|
145
|
+
else APIHelper.SKIP
|
|
146
|
+
progress_ms =\
|
|
147
|
+
dictionary.get("progress_ms")\
|
|
148
|
+
if dictionary.get("progress_ms")\
|
|
149
|
+
else APIHelper.SKIP
|
|
150
|
+
is_playing =\
|
|
151
|
+
dictionary.get("is_playing")\
|
|
152
|
+
if "is_playing" in dictionary.keys()\
|
|
153
|
+
else APIHelper.SKIP
|
|
154
|
+
item = APIHelper.deserialize_union_type(
|
|
155
|
+
UnionTypeLookUp.get("CurrentlyPlayingContextObjectItem"),
|
|
156
|
+
dictionary.get("item"),
|
|
157
|
+
False)\
|
|
158
|
+
if dictionary.get("item") is not None\
|
|
159
|
+
else APIHelper.SKIP
|
|
160
|
+
currently_playing_type =\
|
|
161
|
+
dictionary.get("currently_playing_type")\
|
|
162
|
+
if dictionary.get("currently_playing_type")\
|
|
163
|
+
else APIHelper.SKIP
|
|
164
|
+
actions =\
|
|
165
|
+
DisallowsObject.from_dictionary(
|
|
166
|
+
dictionary.get("actions"))\
|
|
167
|
+
if "actions" in dictionary.keys()\
|
|
168
|
+
else APIHelper.SKIP
|
|
169
|
+
|
|
170
|
+
# Return an object of this model
|
|
171
|
+
return cls(device,
|
|
172
|
+
repeat_state,
|
|
173
|
+
shuffle_state,
|
|
174
|
+
context,
|
|
175
|
+
timestamp,
|
|
176
|
+
progress_ms,
|
|
177
|
+
is_playing,
|
|
178
|
+
item,
|
|
179
|
+
currently_playing_type,
|
|
180
|
+
actions)
|
|
181
|
+
|
|
182
|
+
def __repr__(self):
|
|
183
|
+
"""Return a unambiguous string representation."""
|
|
184
|
+
_device=(
|
|
185
|
+
self.device
|
|
186
|
+
if hasattr(self, "device")
|
|
187
|
+
else None
|
|
188
|
+
)
|
|
189
|
+
_repeat_state=(
|
|
190
|
+
self.repeat_state
|
|
191
|
+
if hasattr(self, "repeat_state")
|
|
192
|
+
else None
|
|
193
|
+
)
|
|
194
|
+
_shuffle_state=(
|
|
195
|
+
self.shuffle_state
|
|
196
|
+
if hasattr(self, "shuffle_state")
|
|
197
|
+
else None
|
|
198
|
+
)
|
|
199
|
+
_context=(
|
|
200
|
+
self.context
|
|
201
|
+
if hasattr(self, "context")
|
|
202
|
+
else None
|
|
203
|
+
)
|
|
204
|
+
_timestamp=(
|
|
205
|
+
self.timestamp
|
|
206
|
+
if hasattr(self, "timestamp")
|
|
207
|
+
else None
|
|
208
|
+
)
|
|
209
|
+
_progress_ms=(
|
|
210
|
+
self.progress_ms
|
|
211
|
+
if hasattr(self, "progress_ms")
|
|
212
|
+
else None
|
|
213
|
+
)
|
|
214
|
+
_is_playing=(
|
|
215
|
+
self.is_playing
|
|
216
|
+
if hasattr(self, "is_playing")
|
|
217
|
+
else None
|
|
218
|
+
)
|
|
219
|
+
_item=(
|
|
220
|
+
self.item
|
|
221
|
+
if hasattr(self, "item")
|
|
222
|
+
else None
|
|
223
|
+
)
|
|
224
|
+
_currently_playing_type=(
|
|
225
|
+
self.currently_playing_type
|
|
226
|
+
if hasattr(self, "currently_playing_type")
|
|
227
|
+
else None
|
|
228
|
+
)
|
|
229
|
+
_actions=(
|
|
230
|
+
self.actions
|
|
231
|
+
if hasattr(self, "actions")
|
|
232
|
+
else None
|
|
233
|
+
)
|
|
234
|
+
return (
|
|
235
|
+
f"{self.__class__.__name__}("
|
|
236
|
+
f"device={_device!r}, "
|
|
237
|
+
f"repeat_state={_repeat_state!r}, "
|
|
238
|
+
f"shuffle_state={_shuffle_state!r}, "
|
|
239
|
+
f"context={_context!r}, "
|
|
240
|
+
f"timestamp={_timestamp!r}, "
|
|
241
|
+
f"progress_ms={_progress_ms!r}, "
|
|
242
|
+
f"is_playing={_is_playing!r}, "
|
|
243
|
+
f"item={_item!r}, "
|
|
244
|
+
f"currently_playing_type={_currently_playing_type!r}, "
|
|
245
|
+
f"actions={_actions!r}, "
|
|
246
|
+
f")"
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def __str__(self):
|
|
250
|
+
"""Return a human-readable string representation."""
|
|
251
|
+
_device=(
|
|
252
|
+
self.device
|
|
253
|
+
if hasattr(self, "device")
|
|
254
|
+
else None
|
|
255
|
+
)
|
|
256
|
+
_repeat_state=(
|
|
257
|
+
self.repeat_state
|
|
258
|
+
if hasattr(self, "repeat_state")
|
|
259
|
+
else None
|
|
260
|
+
)
|
|
261
|
+
_shuffle_state=(
|
|
262
|
+
self.shuffle_state
|
|
263
|
+
if hasattr(self, "shuffle_state")
|
|
264
|
+
else None
|
|
265
|
+
)
|
|
266
|
+
_context=(
|
|
267
|
+
self.context
|
|
268
|
+
if hasattr(self, "context")
|
|
269
|
+
else None
|
|
270
|
+
)
|
|
271
|
+
_timestamp=(
|
|
272
|
+
self.timestamp
|
|
273
|
+
if hasattr(self, "timestamp")
|
|
274
|
+
else None
|
|
275
|
+
)
|
|
276
|
+
_progress_ms=(
|
|
277
|
+
self.progress_ms
|
|
278
|
+
if hasattr(self, "progress_ms")
|
|
279
|
+
else None
|
|
280
|
+
)
|
|
281
|
+
_is_playing=(
|
|
282
|
+
self.is_playing
|
|
283
|
+
if hasattr(self, "is_playing")
|
|
284
|
+
else None
|
|
285
|
+
)
|
|
286
|
+
_item=(
|
|
287
|
+
self.item
|
|
288
|
+
if hasattr(self, "item")
|
|
289
|
+
else None
|
|
290
|
+
)
|
|
291
|
+
_currently_playing_type=(
|
|
292
|
+
self.currently_playing_type
|
|
293
|
+
if hasattr(self, "currently_playing_type")
|
|
294
|
+
else None
|
|
295
|
+
)
|
|
296
|
+
_actions=(
|
|
297
|
+
self.actions
|
|
298
|
+
if hasattr(self, "actions")
|
|
299
|
+
else None
|
|
300
|
+
)
|
|
301
|
+
return (
|
|
302
|
+
f"{self.__class__.__name__}("
|
|
303
|
+
f"device={_device!s}, "
|
|
304
|
+
f"repeat_state={_repeat_state!s}, "
|
|
305
|
+
f"shuffle_state={_shuffle_state!s}, "
|
|
306
|
+
f"context={_context!s}, "
|
|
307
|
+
f"timestamp={_timestamp!s}, "
|
|
308
|
+
f"progress_ms={_progress_ms!s}, "
|
|
309
|
+
f"is_playing={_is_playing!s}, "
|
|
310
|
+
f"item={_item!s}, "
|
|
311
|
+
f"currently_playing_type={_currently_playing_type!s}, "
|
|
312
|
+
f"actions={_actions!s}, "
|
|
313
|
+
f")"
|
|
314
|
+
)
|
|
@@ -0,0 +1,241 @@
|
|
|
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.context_object import (
|
|
9
|
+
ContextObject,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.disallows_object import (
|
|
12
|
+
DisallowsObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CurrentlyPlayingObject(object):
|
|
17
|
+
"""Implementation of the 'CurrentlyPlayingObject' model.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
context (ContextObject): A Context Object. Can be `null`.
|
|
21
|
+
timestamp (int): Unix Millisecond Timestamp when data was fetched
|
|
22
|
+
progress_ms (int): Progress into the currently playing track or episode. Can
|
|
23
|
+
be `null`.
|
|
24
|
+
is_playing (bool): If something is currently playing, return `true`.
|
|
25
|
+
item (TrackObject | EpisodeObject | None): The currently playing track or
|
|
26
|
+
episode. Can be `null`.
|
|
27
|
+
currently_playing_type (str): The object type of the currently playing item.
|
|
28
|
+
Can be one of `track`, `episode`, `ad` or `unknown`.
|
|
29
|
+
actions (DisallowsObject): Allows to update the user interface based on which
|
|
30
|
+
playback actions are available within the current context.
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# Create a mapping from Model property names to API property names
|
|
35
|
+
_names = {
|
|
36
|
+
"context": "context",
|
|
37
|
+
"timestamp": "timestamp",
|
|
38
|
+
"progress_ms": "progress_ms",
|
|
39
|
+
"is_playing": "is_playing",
|
|
40
|
+
"item": "item",
|
|
41
|
+
"currently_playing_type": "currently_playing_type",
|
|
42
|
+
"actions": "actions",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_optionals = [
|
|
46
|
+
"context",
|
|
47
|
+
"timestamp",
|
|
48
|
+
"progress_ms",
|
|
49
|
+
"is_playing",
|
|
50
|
+
"item",
|
|
51
|
+
"currently_playing_type",
|
|
52
|
+
"actions",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
def __init__(
|
|
56
|
+
self,
|
|
57
|
+
context=APIHelper.SKIP,
|
|
58
|
+
timestamp=APIHelper.SKIP,
|
|
59
|
+
progress_ms=APIHelper.SKIP,
|
|
60
|
+
is_playing=APIHelper.SKIP,
|
|
61
|
+
item=APIHelper.SKIP,
|
|
62
|
+
currently_playing_type=APIHelper.SKIP,
|
|
63
|
+
actions=APIHelper.SKIP):
|
|
64
|
+
"""Initialize a CurrentlyPlayingObject instance."""
|
|
65
|
+
# Initialize members of the class
|
|
66
|
+
if context is not APIHelper.SKIP:
|
|
67
|
+
self.context = context
|
|
68
|
+
if timestamp is not APIHelper.SKIP:
|
|
69
|
+
self.timestamp = timestamp
|
|
70
|
+
if progress_ms is not APIHelper.SKIP:
|
|
71
|
+
self.progress_ms = progress_ms
|
|
72
|
+
if is_playing is not APIHelper.SKIP:
|
|
73
|
+
self.is_playing = is_playing
|
|
74
|
+
if item is not APIHelper.SKIP:
|
|
75
|
+
self.item = item
|
|
76
|
+
if currently_playing_type is not APIHelper.SKIP:
|
|
77
|
+
self.currently_playing_type = currently_playing_type
|
|
78
|
+
if actions is not APIHelper.SKIP:
|
|
79
|
+
self.actions = actions
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dictionary(cls,
|
|
83
|
+
dictionary):
|
|
84
|
+
"""Create an instance of this model from a dictionary
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
88
|
+
as obtained from the deserialization of the server's response. The
|
|
89
|
+
keys MUST match property names in the API description.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
object: An instance of this structure class.
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
from spotifywebapi.utilities.union_type_lookup import (
|
|
96
|
+
UnionTypeLookUp,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
# Extract variables from the dictionary
|
|
103
|
+
context =\
|
|
104
|
+
ContextObject.from_dictionary(
|
|
105
|
+
dictionary.get("context"))\
|
|
106
|
+
if "context" in dictionary.keys()\
|
|
107
|
+
else APIHelper.SKIP
|
|
108
|
+
timestamp =\
|
|
109
|
+
dictionary.get("timestamp")\
|
|
110
|
+
if dictionary.get("timestamp")\
|
|
111
|
+
else APIHelper.SKIP
|
|
112
|
+
progress_ms =\
|
|
113
|
+
dictionary.get("progress_ms")\
|
|
114
|
+
if dictionary.get("progress_ms")\
|
|
115
|
+
else APIHelper.SKIP
|
|
116
|
+
is_playing =\
|
|
117
|
+
dictionary.get("is_playing")\
|
|
118
|
+
if "is_playing" in dictionary.keys()\
|
|
119
|
+
else APIHelper.SKIP
|
|
120
|
+
item = APIHelper.deserialize_union_type(
|
|
121
|
+
UnionTypeLookUp.get("CurrentlyPlayingObjectItem"),
|
|
122
|
+
dictionary.get("item"),
|
|
123
|
+
False)\
|
|
124
|
+
if dictionary.get("item") is not None\
|
|
125
|
+
else APIHelper.SKIP
|
|
126
|
+
currently_playing_type =\
|
|
127
|
+
dictionary.get("currently_playing_type")\
|
|
128
|
+
if dictionary.get("currently_playing_type")\
|
|
129
|
+
else APIHelper.SKIP
|
|
130
|
+
actions =\
|
|
131
|
+
DisallowsObject.from_dictionary(
|
|
132
|
+
dictionary.get("actions"))\
|
|
133
|
+
if "actions" in dictionary.keys()\
|
|
134
|
+
else APIHelper.SKIP
|
|
135
|
+
|
|
136
|
+
# Return an object of this model
|
|
137
|
+
return cls(context,
|
|
138
|
+
timestamp,
|
|
139
|
+
progress_ms,
|
|
140
|
+
is_playing,
|
|
141
|
+
item,
|
|
142
|
+
currently_playing_type,
|
|
143
|
+
actions)
|
|
144
|
+
|
|
145
|
+
def __repr__(self):
|
|
146
|
+
"""Return a unambiguous string representation."""
|
|
147
|
+
_context=(
|
|
148
|
+
self.context
|
|
149
|
+
if hasattr(self, "context")
|
|
150
|
+
else None
|
|
151
|
+
)
|
|
152
|
+
_timestamp=(
|
|
153
|
+
self.timestamp
|
|
154
|
+
if hasattr(self, "timestamp")
|
|
155
|
+
else None
|
|
156
|
+
)
|
|
157
|
+
_progress_ms=(
|
|
158
|
+
self.progress_ms
|
|
159
|
+
if hasattr(self, "progress_ms")
|
|
160
|
+
else None
|
|
161
|
+
)
|
|
162
|
+
_is_playing=(
|
|
163
|
+
self.is_playing
|
|
164
|
+
if hasattr(self, "is_playing")
|
|
165
|
+
else None
|
|
166
|
+
)
|
|
167
|
+
_item=(
|
|
168
|
+
self.item
|
|
169
|
+
if hasattr(self, "item")
|
|
170
|
+
else None
|
|
171
|
+
)
|
|
172
|
+
_currently_playing_type=(
|
|
173
|
+
self.currently_playing_type
|
|
174
|
+
if hasattr(self, "currently_playing_type")
|
|
175
|
+
else None
|
|
176
|
+
)
|
|
177
|
+
_actions=(
|
|
178
|
+
self.actions
|
|
179
|
+
if hasattr(self, "actions")
|
|
180
|
+
else None
|
|
181
|
+
)
|
|
182
|
+
return (
|
|
183
|
+
f"{self.__class__.__name__}("
|
|
184
|
+
f"context={_context!r}, "
|
|
185
|
+
f"timestamp={_timestamp!r}, "
|
|
186
|
+
f"progress_ms={_progress_ms!r}, "
|
|
187
|
+
f"is_playing={_is_playing!r}, "
|
|
188
|
+
f"item={_item!r}, "
|
|
189
|
+
f"currently_playing_type={_currently_playing_type!r}, "
|
|
190
|
+
f"actions={_actions!r}, "
|
|
191
|
+
f")"
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def __str__(self):
|
|
195
|
+
"""Return a human-readable string representation."""
|
|
196
|
+
_context=(
|
|
197
|
+
self.context
|
|
198
|
+
if hasattr(self, "context")
|
|
199
|
+
else None
|
|
200
|
+
)
|
|
201
|
+
_timestamp=(
|
|
202
|
+
self.timestamp
|
|
203
|
+
if hasattr(self, "timestamp")
|
|
204
|
+
else None
|
|
205
|
+
)
|
|
206
|
+
_progress_ms=(
|
|
207
|
+
self.progress_ms
|
|
208
|
+
if hasattr(self, "progress_ms")
|
|
209
|
+
else None
|
|
210
|
+
)
|
|
211
|
+
_is_playing=(
|
|
212
|
+
self.is_playing
|
|
213
|
+
if hasattr(self, "is_playing")
|
|
214
|
+
else None
|
|
215
|
+
)
|
|
216
|
+
_item=(
|
|
217
|
+
self.item
|
|
218
|
+
if hasattr(self, "item")
|
|
219
|
+
else None
|
|
220
|
+
)
|
|
221
|
+
_currently_playing_type=(
|
|
222
|
+
self.currently_playing_type
|
|
223
|
+
if hasattr(self, "currently_playing_type")
|
|
224
|
+
else None
|
|
225
|
+
)
|
|
226
|
+
_actions=(
|
|
227
|
+
self.actions
|
|
228
|
+
if hasattr(self, "actions")
|
|
229
|
+
else None
|
|
230
|
+
)
|
|
231
|
+
return (
|
|
232
|
+
f"{self.__class__.__name__}("
|
|
233
|
+
f"context={_context!s}, "
|
|
234
|
+
f"timestamp={_timestamp!s}, "
|
|
235
|
+
f"progress_ms={_progress_ms!s}, "
|
|
236
|
+
f"is_playing={_is_playing!s}, "
|
|
237
|
+
f"item={_item!s}, "
|
|
238
|
+
f"currently_playing_type={_currently_playing_type!s}, "
|
|
239
|
+
f"actions={_actions!s}, "
|
|
240
|
+
f")"
|
|
241
|
+
)
|