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,198 @@
|
|
|
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 apimatic_core.configurations.global_configuration import (
|
|
8
|
+
GlobalConfiguration,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.decorators.lazy_property import (
|
|
11
|
+
LazyProperty,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from spotifywebapi.configuration import (
|
|
15
|
+
Configuration,
|
|
16
|
+
Environment,
|
|
17
|
+
)
|
|
18
|
+
from spotifywebapi.controllers.albums_controller import (
|
|
19
|
+
AlbumsController,
|
|
20
|
+
)
|
|
21
|
+
from spotifywebapi.controllers.artists_controller import (
|
|
22
|
+
ArtistsController,
|
|
23
|
+
)
|
|
24
|
+
from spotifywebapi.controllers.audiobooks_controller import (
|
|
25
|
+
AudiobooksController,
|
|
26
|
+
)
|
|
27
|
+
from spotifywebapi.controllers.base_controller import (
|
|
28
|
+
BaseController,
|
|
29
|
+
)
|
|
30
|
+
from spotifywebapi.controllers.categories_controller import (
|
|
31
|
+
CategoriesController,
|
|
32
|
+
)
|
|
33
|
+
from spotifywebapi.controllers.chapters_controller import (
|
|
34
|
+
ChaptersController,
|
|
35
|
+
)
|
|
36
|
+
from spotifywebapi.controllers.episodes_controller import (
|
|
37
|
+
EpisodesController,
|
|
38
|
+
)
|
|
39
|
+
from spotifywebapi.controllers.genres_controller import (
|
|
40
|
+
GenresController,
|
|
41
|
+
)
|
|
42
|
+
from spotifywebapi.controllers.markets_controller import (
|
|
43
|
+
MarketsController,
|
|
44
|
+
)
|
|
45
|
+
from spotifywebapi.controllers.o_auth_authorization_controller import (
|
|
46
|
+
OAuthAuthorizationController,
|
|
47
|
+
)
|
|
48
|
+
from spotifywebapi.controllers.player_controller import (
|
|
49
|
+
PlayerController,
|
|
50
|
+
)
|
|
51
|
+
from spotifywebapi.controllers.playlists_controller import (
|
|
52
|
+
PlaylistsController,
|
|
53
|
+
)
|
|
54
|
+
from spotifywebapi.controllers.search_controller import (
|
|
55
|
+
SearchController,
|
|
56
|
+
)
|
|
57
|
+
from spotifywebapi.controllers.shows_controller import (
|
|
58
|
+
ShowsController,
|
|
59
|
+
)
|
|
60
|
+
from spotifywebapi.controllers.tracks_controller import (
|
|
61
|
+
TracksController,
|
|
62
|
+
)
|
|
63
|
+
from spotifywebapi.controllers.users_controller import (
|
|
64
|
+
UsersController,
|
|
65
|
+
)
|
|
66
|
+
from spotifywebapi.http.auth.o_auth_2 import (
|
|
67
|
+
OAuth2,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class SpotifywebapiClient(object):
|
|
72
|
+
"""Client that provide access to the SpotifywebapiClient APIs."""
|
|
73
|
+
|
|
74
|
+
@LazyProperty
|
|
75
|
+
def albums(self):
|
|
76
|
+
"""Provide access to the AlbumsController endpoints."""
|
|
77
|
+
return AlbumsController(self.global_configuration)
|
|
78
|
+
|
|
79
|
+
@LazyProperty
|
|
80
|
+
def artists(self):
|
|
81
|
+
"""Provide access to the ArtistsController endpoints."""
|
|
82
|
+
return ArtistsController(self.global_configuration)
|
|
83
|
+
|
|
84
|
+
@LazyProperty
|
|
85
|
+
def audiobooks(self):
|
|
86
|
+
"""Provide access to the AudiobooksController endpoints."""
|
|
87
|
+
return AudiobooksController(self.global_configuration)
|
|
88
|
+
|
|
89
|
+
@LazyProperty
|
|
90
|
+
def categories(self):
|
|
91
|
+
"""Provide access to the CategoriesController endpoints."""
|
|
92
|
+
return CategoriesController(self.global_configuration)
|
|
93
|
+
|
|
94
|
+
@LazyProperty
|
|
95
|
+
def chapters(self):
|
|
96
|
+
"""Provide access to the ChaptersController endpoints."""
|
|
97
|
+
return ChaptersController(self.global_configuration)
|
|
98
|
+
|
|
99
|
+
@LazyProperty
|
|
100
|
+
def episodes(self):
|
|
101
|
+
"""Provide access to the EpisodesController endpoints."""
|
|
102
|
+
return EpisodesController(self.global_configuration)
|
|
103
|
+
|
|
104
|
+
@LazyProperty
|
|
105
|
+
def genres(self):
|
|
106
|
+
"""Provide access to the GenresController endpoints."""
|
|
107
|
+
return GenresController(self.global_configuration)
|
|
108
|
+
|
|
109
|
+
@LazyProperty
|
|
110
|
+
def markets(self):
|
|
111
|
+
"""Provide access to the MarketsController endpoints."""
|
|
112
|
+
return MarketsController(self.global_configuration)
|
|
113
|
+
|
|
114
|
+
@LazyProperty
|
|
115
|
+
def player(self):
|
|
116
|
+
"""Provide access to the PlayerController endpoints."""
|
|
117
|
+
return PlayerController(self.global_configuration)
|
|
118
|
+
|
|
119
|
+
@LazyProperty
|
|
120
|
+
def playlists(self):
|
|
121
|
+
"""Provide access to the PlaylistsController endpoints."""
|
|
122
|
+
return PlaylistsController(self.global_configuration)
|
|
123
|
+
|
|
124
|
+
@LazyProperty
|
|
125
|
+
def search(self):
|
|
126
|
+
"""Provide access to the SearchController endpoints."""
|
|
127
|
+
return SearchController(self.global_configuration)
|
|
128
|
+
|
|
129
|
+
@LazyProperty
|
|
130
|
+
def shows(self):
|
|
131
|
+
"""Provide access to the ShowsController endpoints."""
|
|
132
|
+
return ShowsController(self.global_configuration)
|
|
133
|
+
|
|
134
|
+
@LazyProperty
|
|
135
|
+
def tracks(self):
|
|
136
|
+
"""Provide access to the TracksController endpoints."""
|
|
137
|
+
return TracksController(self.global_configuration)
|
|
138
|
+
|
|
139
|
+
@LazyProperty
|
|
140
|
+
def users(self):
|
|
141
|
+
"""Provide access to the UsersController endpoints."""
|
|
142
|
+
return UsersController(self.global_configuration)
|
|
143
|
+
|
|
144
|
+
@LazyProperty
|
|
145
|
+
def o_auth_authorization(self):
|
|
146
|
+
"""Provide access to the OAuthAuthorizationController endpoints."""
|
|
147
|
+
return OAuthAuthorizationController(self.global_configuration)
|
|
148
|
+
|
|
149
|
+
@property
|
|
150
|
+
def oauth_2_0(self):
|
|
151
|
+
"""Provide access to the Oauth20 auth manager."""
|
|
152
|
+
return self.auth_managers["oauth_2_0"]
|
|
153
|
+
|
|
154
|
+
def __init__(self, http_client_instance=None,
|
|
155
|
+
override_http_client_configuration=False, http_call_back=None,
|
|
156
|
+
timeout=60, max_retries=0, backoff_factor=2,
|
|
157
|
+
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
158
|
+
environment=Environment.PRODUCTION, o_auth_client_id=None,
|
|
159
|
+
o_auth_client_secret=None, o_auth_redirect_uri=None,
|
|
160
|
+
o_auth_token=None, o_auth_scopes=None,
|
|
161
|
+
authorization_code_auth_credentials=None, config=None):
|
|
162
|
+
"""Initialize a new instance of SpotifywebapiClient."""
|
|
163
|
+
self.config = config or Configuration(
|
|
164
|
+
http_client_instance=http_client_instance,
|
|
165
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
166
|
+
http_call_back=http_call_back, timeout=timeout,
|
|
167
|
+
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
168
|
+
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
169
|
+
proxy_settings=proxy_settings, environment=environment,
|
|
170
|
+
o_auth_client_id=o_auth_client_id,
|
|
171
|
+
o_auth_client_secret=o_auth_client_secret,
|
|
172
|
+
o_auth_redirect_uri=o_auth_redirect_uri, o_auth_token=o_auth_token,
|
|
173
|
+
o_auth_scopes=o_auth_scopes,
|
|
174
|
+
authorization_code_auth_credentials=authorization_code_auth_credentials)
|
|
175
|
+
|
|
176
|
+
self.global_configuration = GlobalConfiguration(self.config)\
|
|
177
|
+
.global_errors(BaseController.global_errors())\
|
|
178
|
+
.base_uri_executor(self.config.get_base_uri)\
|
|
179
|
+
.user_agent(BaseController.user_agent(),
|
|
180
|
+
BaseController.user_agent_parameters())
|
|
181
|
+
|
|
182
|
+
self.auth_managers = {
|
|
183
|
+
"oauth_2_0": OAuth2(self.config.authorization_code_auth_credentials,
|
|
184
|
+
self.global_configuration),
|
|
185
|
+
}
|
|
186
|
+
self.global_configuration =\
|
|
187
|
+
self.global_configuration.auth_managers(self.auth_managers)
|
|
188
|
+
|
|
189
|
+
@classmethod
|
|
190
|
+
def from_environment(cls, dotenv_path=None, **overrides):
|
|
191
|
+
"""Create a client instance using environment variables.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
SpotifywebapiClient instance.
|
|
195
|
+
|
|
196
|
+
"""
|
|
197
|
+
return cls(config=Configuration
|
|
198
|
+
.from_environment(dotenv_path=dotenv_path, **overrides))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
spotifywebapi
|
|
3
|
+
|
|
4
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
5
|
+
https://www.apimatic.io ).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from apimatic_core.types.file_wrapper import FileWrapper as CoreFileWrapper
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileWrapper(CoreFileWrapper):
|
|
12
|
+
"""A wrapper to allow passing in content type for file uploads."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, file, content_type: str="application/octet-stream") -> None:
|
|
15
|
+
"""Initialize a new `FileWrapper` instance.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
file: A readable file-like object or byte stream to wrap.
|
|
19
|
+
content_type (str, optional): The MIME type to associate with the
|
|
20
|
+
file. Defaults to `"application/octet-stream"`.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(file, content_type)
|
|
24
|
+
|
|
25
|
+
def __repr__(self) -> str:
|
|
26
|
+
"""Return a detailed string representation of the instance.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
str: A detailed, unambiguous representation of the wrapper.
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
return (f"{self.__class__.__name__}("
|
|
33
|
+
f"file={self._file_stream!r}, "
|
|
34
|
+
f"content_type={self.content_type!r})")
|
|
35
|
+
|
|
36
|
+
def __str__(self) -> str:
|
|
37
|
+
"""Return a user-friendly string representation of the instance.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
str: A concise, readable representation of the wrapper.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
return (f"{self.__class__.__name__}("
|
|
44
|
+
f"file={self._file_stream!s}, "
|
|
45
|
+
f"content_type={self.content_type!s})")
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
spotifywebapi
|
|
4
|
+
|
|
5
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
6
|
+
https://www.apimatic.io ).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# ruff: noqa: E501
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import (
|
|
13
|
+
Callable,
|
|
14
|
+
ClassVar,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from apimatic_core.types.union_types.leaf_type import (
|
|
18
|
+
LeafType,
|
|
19
|
+
)
|
|
20
|
+
from apimatic_core.types.union_types.one_of import (
|
|
21
|
+
OneOf,
|
|
22
|
+
)
|
|
23
|
+
from apimatic_core.types.union_types.union_type_context import (
|
|
24
|
+
UnionTypeContext as Context,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from spotifywebapi.models.episode_object import (
|
|
28
|
+
EpisodeObject,
|
|
29
|
+
)
|
|
30
|
+
from spotifywebapi.models.track_object import (
|
|
31
|
+
TrackObject,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class UnionTypeLookUp:
|
|
36
|
+
"""
|
|
37
|
+
Provides lookup and factory methods for predefined union type templates.
|
|
38
|
+
This class stores a mapping of template names to callables that construct
|
|
39
|
+
union type instances. These templates are used to describe compatible
|
|
40
|
+
data shapes by combining primitive or model-based types into a single
|
|
41
|
+
resolved representation at runtime.
|
|
42
|
+
|
|
43
|
+
Attributes:
|
|
44
|
+
_templates (dict): A mapping of template names to factory callables
|
|
45
|
+
that create configured union types.
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
_templates: ClassVar[dict[str, Callable]] = {
|
|
50
|
+
"PlaylistTrackObjectTrack": lambda: OneOf(
|
|
51
|
+
[
|
|
52
|
+
LeafType(TrackObject),
|
|
53
|
+
LeafType(EpisodeObject),
|
|
54
|
+
],
|
|
55
|
+
Context.create(
|
|
56
|
+
is_optional=True,
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
"QueueObjectCurrentlyPlaying": lambda: OneOf(
|
|
60
|
+
[
|
|
61
|
+
LeafType(TrackObject),
|
|
62
|
+
LeafType(EpisodeObject),
|
|
63
|
+
],
|
|
64
|
+
Context.create(
|
|
65
|
+
is_optional=True,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
"QueueObjectQueue": lambda: OneOf(
|
|
69
|
+
[
|
|
70
|
+
LeafType(TrackObject),
|
|
71
|
+
LeafType(EpisodeObject),
|
|
72
|
+
],
|
|
73
|
+
Context.create(
|
|
74
|
+
is_array=True,
|
|
75
|
+
is_optional=True,
|
|
76
|
+
),
|
|
77
|
+
),
|
|
78
|
+
"CurrentlyPlayingContextObjectItem": lambda: OneOf(
|
|
79
|
+
[
|
|
80
|
+
LeafType(TrackObject),
|
|
81
|
+
LeafType(EpisodeObject),
|
|
82
|
+
],
|
|
83
|
+
Context.create(
|
|
84
|
+
is_optional=True,
|
|
85
|
+
),
|
|
86
|
+
),
|
|
87
|
+
"CurrentlyPlayingObjectItem": lambda: OneOf(
|
|
88
|
+
[
|
|
89
|
+
LeafType(TrackObject),
|
|
90
|
+
LeafType(EpisodeObject),
|
|
91
|
+
],
|
|
92
|
+
Context.create(
|
|
93
|
+
is_optional=True,
|
|
94
|
+
),
|
|
95
|
+
),
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@staticmethod
|
|
99
|
+
def get(name):
|
|
100
|
+
"""
|
|
101
|
+
Retrieve and construct a union type template by name.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
name (str): The key identifying the template to resolve.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Any: A new instance of the union type defined for the given name.
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
KeyError: If no template exists for the specified name.
|
|
111
|
+
|
|
112
|
+
"""
|
|
113
|
+
return UnionTypeLookUp._templates[name]()
|