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,123 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.array_serialization_format import (
|
|
13
|
+
SerializationFormats,
|
|
14
|
+
)
|
|
15
|
+
from apimatic_core.types.parameter import Parameter
|
|
16
|
+
|
|
17
|
+
from spotifywebapi.api_helper import APIHelper
|
|
18
|
+
from spotifywebapi.configuration import Server
|
|
19
|
+
from spotifywebapi.controllers.base_controller import (
|
|
20
|
+
BaseController,
|
|
21
|
+
)
|
|
22
|
+
from spotifywebapi.exceptions.forbidden_exception import (
|
|
23
|
+
ForbiddenException,
|
|
24
|
+
)
|
|
25
|
+
from spotifywebapi.exceptions.too_many_requests_exception import (
|
|
26
|
+
TooManyRequestsException,
|
|
27
|
+
)
|
|
28
|
+
from spotifywebapi.exceptions.unauthorized_exception import (
|
|
29
|
+
UnauthorizedException,
|
|
30
|
+
)
|
|
31
|
+
from spotifywebapi.http.http_method_enum import (
|
|
32
|
+
HttpMethodEnum,
|
|
33
|
+
)
|
|
34
|
+
from spotifywebapi.models.search_items import (
|
|
35
|
+
SearchItems,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SearchController(BaseController):
|
|
40
|
+
"""A Controller to access Endpoints in the spotifywebapi API."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, config):
|
|
43
|
+
"""Initialize SearchController object."""
|
|
44
|
+
super(SearchController, self).__init__(config)
|
|
45
|
+
|
|
46
|
+
def search(self,
|
|
47
|
+
q,
|
|
48
|
+
mtype,
|
|
49
|
+
market=None,
|
|
50
|
+
limit=20,
|
|
51
|
+
offset=0,
|
|
52
|
+
include_external=None):
|
|
53
|
+
"""Perform a GET request to /search.
|
|
54
|
+
|
|
55
|
+
Get Spotify catalog information about albums, artists, playlists, tracks,
|
|
56
|
+
shows, episodes or audiobooks
|
|
57
|
+
that match a keyword string. Audiobooks are only available within the US, UK,
|
|
58
|
+
Canada, Ireland, New Zealand and Australia markets.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
q (str): The request query parameter.
|
|
62
|
+
mtype (List[ItemTypeEnum]): The request query parameter.
|
|
63
|
+
market (str, optional): The request query parameter.
|
|
64
|
+
limit (int, optional): The request query parameter. Example: 20
|
|
65
|
+
offset (int, optional): The request query parameter. Example: 0
|
|
66
|
+
include_external (IncludeExternalEnum, optional): The request query
|
|
67
|
+
parameter.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
ApiResponse: An object with the response value as well as other useful
|
|
71
|
+
information such as status codes and headers. Search response
|
|
72
|
+
|
|
73
|
+
Raises:
|
|
74
|
+
APIException: When an error occurs while fetching the data from the
|
|
75
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
76
|
+
message, and the HTTP body that was received in the request.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
return super().new_api_call_builder.request(
|
|
80
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
81
|
+
.path("/search")
|
|
82
|
+
.http_method(HttpMethodEnum.GET)
|
|
83
|
+
.query_param(Parameter()
|
|
84
|
+
.key("q")
|
|
85
|
+
.value(q))
|
|
86
|
+
.query_param(Parameter()
|
|
87
|
+
.key("type")
|
|
88
|
+
.value(mtype))
|
|
89
|
+
.query_param(Parameter()
|
|
90
|
+
.key("market")
|
|
91
|
+
.value(market))
|
|
92
|
+
.query_param(Parameter()
|
|
93
|
+
.key("limit")
|
|
94
|
+
.value(limit))
|
|
95
|
+
.query_param(Parameter()
|
|
96
|
+
.key("offset")
|
|
97
|
+
.value(offset))
|
|
98
|
+
.query_param(Parameter()
|
|
99
|
+
.key("include_external")
|
|
100
|
+
.value(include_external))
|
|
101
|
+
.header_param(Parameter()
|
|
102
|
+
.key("accept")
|
|
103
|
+
.value("application/json"))
|
|
104
|
+
.array_serialization_format(SerializationFormats.CSV)
|
|
105
|
+
.auth(Single("oauth_2_0")),
|
|
106
|
+
).response(
|
|
107
|
+
ResponseHandler()
|
|
108
|
+
.deserializer(APIHelper.json_deserialize)
|
|
109
|
+
.deserialize_into(SearchItems.from_dictionary)
|
|
110
|
+
.is_api_response(True)
|
|
111
|
+
.local_error("401",
|
|
112
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
113
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
114
|
+
"\n",
|
|
115
|
+
UnauthorizedException)
|
|
116
|
+
.local_error("403",
|
|
117
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
118
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
119
|
+
ForbiddenException)
|
|
120
|
+
.local_error("429",
|
|
121
|
+
"The app has exceeded its rate limits.\n",
|
|
122
|
+
TooManyRequestsException),
|
|
123
|
+
).execute()
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.parameter import Parameter
|
|
13
|
+
|
|
14
|
+
from spotifywebapi.api_helper import APIHelper
|
|
15
|
+
from spotifywebapi.configuration import Server
|
|
16
|
+
from spotifywebapi.controllers.base_controller import (
|
|
17
|
+
BaseController,
|
|
18
|
+
)
|
|
19
|
+
from spotifywebapi.exceptions.forbidden_exception import (
|
|
20
|
+
ForbiddenException,
|
|
21
|
+
)
|
|
22
|
+
from spotifywebapi.exceptions.too_many_requests_exception import (
|
|
23
|
+
TooManyRequestsException,
|
|
24
|
+
)
|
|
25
|
+
from spotifywebapi.exceptions.unauthorized_exception import (
|
|
26
|
+
UnauthorizedException,
|
|
27
|
+
)
|
|
28
|
+
from spotifywebapi.http.http_method_enum import (
|
|
29
|
+
HttpMethodEnum,
|
|
30
|
+
)
|
|
31
|
+
from spotifywebapi.models.many_simplified_shows import (
|
|
32
|
+
ManySimplifiedShows,
|
|
33
|
+
)
|
|
34
|
+
from spotifywebapi.models.paging_saved_show_object import (
|
|
35
|
+
PagingSavedShowObject,
|
|
36
|
+
)
|
|
37
|
+
from spotifywebapi.models.paging_simplified_episode_object import (
|
|
38
|
+
PagingSimplifiedEpisodeObject,
|
|
39
|
+
)
|
|
40
|
+
from spotifywebapi.models.show_object import (
|
|
41
|
+
ShowObject,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ShowsController(BaseController):
|
|
46
|
+
"""A Controller to access Endpoints in the spotifywebapi API."""
|
|
47
|
+
|
|
48
|
+
def __init__(self, config):
|
|
49
|
+
"""Initialize ShowsController object."""
|
|
50
|
+
super(ShowsController, self).__init__(config)
|
|
51
|
+
|
|
52
|
+
def get_a_show(self,
|
|
53
|
+
id,
|
|
54
|
+
market=None):
|
|
55
|
+
"""Perform a GET request to /shows/{id}.
|
|
56
|
+
|
|
57
|
+
Get Spotify catalog information for a single show identified by its
|
|
58
|
+
unique Spotify ID.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
id (str): The request template parameter.
|
|
62
|
+
market (str, optional): The request query parameter.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
ApiResponse: An object with the response value as well as other useful
|
|
66
|
+
information such as status codes and headers. A show
|
|
67
|
+
|
|
68
|
+
Raises:
|
|
69
|
+
APIException: When an error occurs while fetching the data from the
|
|
70
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
71
|
+
message, and the HTTP body that was received in the request.
|
|
72
|
+
|
|
73
|
+
"""
|
|
74
|
+
return super().new_api_call_builder.request(
|
|
75
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
76
|
+
.path("/shows/{id}")
|
|
77
|
+
.http_method(HttpMethodEnum.GET)
|
|
78
|
+
.template_param(Parameter()
|
|
79
|
+
.key("id")
|
|
80
|
+
.value(id)
|
|
81
|
+
.should_encode(True))
|
|
82
|
+
.query_param(Parameter()
|
|
83
|
+
.key("market")
|
|
84
|
+
.value(market))
|
|
85
|
+
.header_param(Parameter()
|
|
86
|
+
.key("accept")
|
|
87
|
+
.value("application/json"))
|
|
88
|
+
.auth(Single("oauth_2_0")),
|
|
89
|
+
).response(
|
|
90
|
+
ResponseHandler()
|
|
91
|
+
.deserializer(APIHelper.json_deserialize)
|
|
92
|
+
.deserialize_into(ShowObject.from_dictionary)
|
|
93
|
+
.is_api_response(True)
|
|
94
|
+
.local_error("401",
|
|
95
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
96
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
97
|
+
"\n",
|
|
98
|
+
UnauthorizedException)
|
|
99
|
+
.local_error("403",
|
|
100
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
101
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
102
|
+
ForbiddenException)
|
|
103
|
+
.local_error("429",
|
|
104
|
+
"The app has exceeded its rate limits.\n",
|
|
105
|
+
TooManyRequestsException),
|
|
106
|
+
).execute()
|
|
107
|
+
|
|
108
|
+
def get_multiple_shows(self,
|
|
109
|
+
ids,
|
|
110
|
+
market=None):
|
|
111
|
+
"""Perform a GET request to /shows.
|
|
112
|
+
|
|
113
|
+
Get Spotify catalog information for several shows based on their Spotify IDs.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
ids (str): The request query parameter.
|
|
117
|
+
market (str, optional): The request query parameter.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
ApiResponse: An object with the response value as well as other useful
|
|
121
|
+
information such as status codes and headers. A set of shows
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
APIException: When an error occurs while fetching the data from the
|
|
125
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
126
|
+
message, and the HTTP body that was received in the request.
|
|
127
|
+
|
|
128
|
+
"""
|
|
129
|
+
return super().new_api_call_builder.request(
|
|
130
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
131
|
+
.path("/shows")
|
|
132
|
+
.http_method(HttpMethodEnum.GET)
|
|
133
|
+
.query_param(Parameter()
|
|
134
|
+
.key("ids")
|
|
135
|
+
.value(ids))
|
|
136
|
+
.query_param(Parameter()
|
|
137
|
+
.key("market")
|
|
138
|
+
.value(market))
|
|
139
|
+
.header_param(Parameter()
|
|
140
|
+
.key("accept")
|
|
141
|
+
.value("application/json"))
|
|
142
|
+
.auth(Single("oauth_2_0")),
|
|
143
|
+
).response(
|
|
144
|
+
ResponseHandler()
|
|
145
|
+
.deserializer(APIHelper.json_deserialize)
|
|
146
|
+
.deserialize_into(ManySimplifiedShows.from_dictionary)
|
|
147
|
+
.is_api_response(True)
|
|
148
|
+
.local_error("401",
|
|
149
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
150
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
151
|
+
"\n",
|
|
152
|
+
UnauthorizedException)
|
|
153
|
+
.local_error("403",
|
|
154
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
155
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
156
|
+
ForbiddenException)
|
|
157
|
+
.local_error("429",
|
|
158
|
+
"The app has exceeded its rate limits.\n",
|
|
159
|
+
TooManyRequestsException),
|
|
160
|
+
).execute()
|
|
161
|
+
|
|
162
|
+
def get_a_shows_episodes(self,
|
|
163
|
+
id,
|
|
164
|
+
market=None,
|
|
165
|
+
limit=20,
|
|
166
|
+
offset=0):
|
|
167
|
+
"""Perform a GET request to /shows/{id}/episodes.
|
|
168
|
+
|
|
169
|
+
Get Spotify catalog information about an show’s episodes. Optional parameters
|
|
170
|
+
can be used to limit the number of episodes returned.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
id (str): The request template parameter.
|
|
174
|
+
market (str, optional): The request query parameter.
|
|
175
|
+
limit (int, optional): The request query parameter. Example: 20
|
|
176
|
+
offset (int, optional): The request query parameter. Example: 0
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
ApiResponse: An object with the response value as well as other useful
|
|
180
|
+
information such as status codes and headers. Pages of episodes
|
|
181
|
+
|
|
182
|
+
Raises:
|
|
183
|
+
APIException: When an error occurs while fetching the data from the
|
|
184
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
185
|
+
message, and the HTTP body that was received in the request.
|
|
186
|
+
|
|
187
|
+
"""
|
|
188
|
+
return super().new_api_call_builder.request(
|
|
189
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
190
|
+
.path("/shows/{id}/episodes")
|
|
191
|
+
.http_method(HttpMethodEnum.GET)
|
|
192
|
+
.template_param(Parameter()
|
|
193
|
+
.key("id")
|
|
194
|
+
.value(id)
|
|
195
|
+
.should_encode(True))
|
|
196
|
+
.query_param(Parameter()
|
|
197
|
+
.key("market")
|
|
198
|
+
.value(market))
|
|
199
|
+
.query_param(Parameter()
|
|
200
|
+
.key("limit")
|
|
201
|
+
.value(limit))
|
|
202
|
+
.query_param(Parameter()
|
|
203
|
+
.key("offset")
|
|
204
|
+
.value(offset))
|
|
205
|
+
.header_param(Parameter()
|
|
206
|
+
.key("accept")
|
|
207
|
+
.value("application/json"))
|
|
208
|
+
.auth(Single("oauth_2_0")),
|
|
209
|
+
).response(
|
|
210
|
+
ResponseHandler()
|
|
211
|
+
.deserializer(APIHelper.json_deserialize)
|
|
212
|
+
.deserialize_into(PagingSimplifiedEpisodeObject.from_dictionary)
|
|
213
|
+
.is_api_response(True)
|
|
214
|
+
.local_error("401",
|
|
215
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
216
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
217
|
+
"\n",
|
|
218
|
+
UnauthorizedException)
|
|
219
|
+
.local_error("403",
|
|
220
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
221
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
222
|
+
ForbiddenException)
|
|
223
|
+
.local_error("429",
|
|
224
|
+
"The app has exceeded its rate limits.\n",
|
|
225
|
+
TooManyRequestsException),
|
|
226
|
+
).execute()
|
|
227
|
+
|
|
228
|
+
def get_users_saved_shows(self,
|
|
229
|
+
limit=20,
|
|
230
|
+
offset=0):
|
|
231
|
+
"""Perform a GET request to /me/shows.
|
|
232
|
+
|
|
233
|
+
Get a list of shows saved in the current Spotify user's library. Optional
|
|
234
|
+
parameters can be used to limit the number of shows returned.
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
limit (int, optional): The request query parameter. Example: 20
|
|
238
|
+
offset (int, optional): The request query parameter. Example: 0
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
ApiResponse: An object with the response value as well as other useful
|
|
242
|
+
information such as status codes and headers. Pages of shows
|
|
243
|
+
|
|
244
|
+
Raises:
|
|
245
|
+
APIException: When an error occurs while fetching the data from the
|
|
246
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
247
|
+
message, and the HTTP body that was received in the request.
|
|
248
|
+
|
|
249
|
+
"""
|
|
250
|
+
return super().new_api_call_builder.request(
|
|
251
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
252
|
+
.path("/me/shows")
|
|
253
|
+
.http_method(HttpMethodEnum.GET)
|
|
254
|
+
.query_param(Parameter()
|
|
255
|
+
.key("limit")
|
|
256
|
+
.value(limit))
|
|
257
|
+
.query_param(Parameter()
|
|
258
|
+
.key("offset")
|
|
259
|
+
.value(offset))
|
|
260
|
+
.header_param(Parameter()
|
|
261
|
+
.key("accept")
|
|
262
|
+
.value("application/json"))
|
|
263
|
+
.auth(Single("oauth_2_0")),
|
|
264
|
+
).response(
|
|
265
|
+
ResponseHandler()
|
|
266
|
+
.deserializer(APIHelper.json_deserialize)
|
|
267
|
+
.deserialize_into(PagingSavedShowObject.from_dictionary)
|
|
268
|
+
.is_api_response(True)
|
|
269
|
+
.local_error("401",
|
|
270
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
271
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
272
|
+
"\n",
|
|
273
|
+
UnauthorizedException)
|
|
274
|
+
.local_error("403",
|
|
275
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
276
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
277
|
+
ForbiddenException)
|
|
278
|
+
.local_error("429",
|
|
279
|
+
"The app has exceeded its rate limits.\n",
|
|
280
|
+
TooManyRequestsException),
|
|
281
|
+
).execute()
|
|
282
|
+
|
|
283
|
+
def save_shows_user(self,
|
|
284
|
+
ids,
|
|
285
|
+
body=None):
|
|
286
|
+
"""Perform a PUT request to /me/shows.
|
|
287
|
+
|
|
288
|
+
Save one or more shows to current Spotify user's library.
|
|
289
|
+
|
|
290
|
+
Args:
|
|
291
|
+
ids (str): The request query parameter.
|
|
292
|
+
body (MeShowsRequest, optional): The request body parameter.
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
ApiResponse: An object with the response value as well as other useful
|
|
296
|
+
information such as status codes and headers. Show saved
|
|
297
|
+
|
|
298
|
+
Raises:
|
|
299
|
+
APIException: When an error occurs while fetching the data from the
|
|
300
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
301
|
+
message, and the HTTP body that was received in the request.
|
|
302
|
+
|
|
303
|
+
"""
|
|
304
|
+
return super().new_api_call_builder.request(
|
|
305
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
306
|
+
.path("/me/shows")
|
|
307
|
+
.http_method(HttpMethodEnum.PUT)
|
|
308
|
+
.query_param(Parameter()
|
|
309
|
+
.key("ids")
|
|
310
|
+
.value(ids))
|
|
311
|
+
.header_param(Parameter()
|
|
312
|
+
.key("Content-Type")
|
|
313
|
+
.value("application/json"))
|
|
314
|
+
.body_param(Parameter()
|
|
315
|
+
.value(body))
|
|
316
|
+
.body_serializer(APIHelper.json_serialize)
|
|
317
|
+
.auth(Single("oauth_2_0")),
|
|
318
|
+
).response(
|
|
319
|
+
ResponseHandler()
|
|
320
|
+
.is_api_response(True)
|
|
321
|
+
.local_error("401",
|
|
322
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
323
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
324
|
+
"\n",
|
|
325
|
+
UnauthorizedException)
|
|
326
|
+
.local_error("403",
|
|
327
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
328
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
329
|
+
ForbiddenException)
|
|
330
|
+
.local_error("429",
|
|
331
|
+
"The app has exceeded its rate limits.\n",
|
|
332
|
+
TooManyRequestsException),
|
|
333
|
+
).execute()
|
|
334
|
+
|
|
335
|
+
def remove_shows_user(self,
|
|
336
|
+
ids,
|
|
337
|
+
market=None,
|
|
338
|
+
body=None):
|
|
339
|
+
"""Perform a DELETE request to /me/shows.
|
|
340
|
+
|
|
341
|
+
Delete one or more shows from current Spotify user's library.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
ids (str): The request query parameter.
|
|
345
|
+
market (str, optional): The request query parameter.
|
|
346
|
+
body (MeShowsRequest, optional): The request body parameter.
|
|
347
|
+
|
|
348
|
+
Returns:
|
|
349
|
+
ApiResponse: An object with the response value as well as other useful
|
|
350
|
+
information such as status codes and headers. Show removed
|
|
351
|
+
|
|
352
|
+
Raises:
|
|
353
|
+
APIException: When an error occurs while fetching the data from the
|
|
354
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
355
|
+
message, and the HTTP body that was received in the request.
|
|
356
|
+
|
|
357
|
+
"""
|
|
358
|
+
return super().new_api_call_builder.request(
|
|
359
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
360
|
+
.path("/me/shows")
|
|
361
|
+
.http_method(HttpMethodEnum.DELETE)
|
|
362
|
+
.query_param(Parameter()
|
|
363
|
+
.key("ids")
|
|
364
|
+
.value(ids))
|
|
365
|
+
.header_param(Parameter()
|
|
366
|
+
.key("Content-Type")
|
|
367
|
+
.value("application/json"))
|
|
368
|
+
.query_param(Parameter()
|
|
369
|
+
.key("market")
|
|
370
|
+
.value(market))
|
|
371
|
+
.body_param(Parameter()
|
|
372
|
+
.value(body))
|
|
373
|
+
.body_serializer(APIHelper.json_serialize)
|
|
374
|
+
.auth(Single("oauth_2_0")),
|
|
375
|
+
).response(
|
|
376
|
+
ResponseHandler()
|
|
377
|
+
.is_api_response(True)
|
|
378
|
+
.local_error("401",
|
|
379
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
380
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
381
|
+
"\n",
|
|
382
|
+
UnauthorizedException)
|
|
383
|
+
.local_error("403",
|
|
384
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
385
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
386
|
+
ForbiddenException)
|
|
387
|
+
.local_error("429",
|
|
388
|
+
"The app has exceeded its rate limits.\n",
|
|
389
|
+
TooManyRequestsException),
|
|
390
|
+
).execute()
|
|
391
|
+
|
|
392
|
+
def check_users_saved_shows(self,
|
|
393
|
+
ids):
|
|
394
|
+
"""Perform a GET request to /me/shows/contains.
|
|
395
|
+
|
|
396
|
+
Check if one or more shows is already saved in the current Spotify user's
|
|
397
|
+
library.
|
|
398
|
+
|
|
399
|
+
Args:
|
|
400
|
+
ids (str): The request query parameter.
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
ApiResponse: An object with the response value as well as other useful
|
|
404
|
+
information such as status codes and headers. Array of booleans
|
|
405
|
+
|
|
406
|
+
Raises:
|
|
407
|
+
APIException: When an error occurs while fetching the data from the
|
|
408
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
409
|
+
message, and the HTTP body that was received in the request.
|
|
410
|
+
|
|
411
|
+
"""
|
|
412
|
+
return super().new_api_call_builder.request(
|
|
413
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
414
|
+
.path("/me/shows/contains")
|
|
415
|
+
.http_method(HttpMethodEnum.GET)
|
|
416
|
+
.query_param(Parameter()
|
|
417
|
+
.key("ids")
|
|
418
|
+
.value(ids))
|
|
419
|
+
.header_param(Parameter()
|
|
420
|
+
.key("accept")
|
|
421
|
+
.value("application/json"))
|
|
422
|
+
.auth(Single("oauth_2_0")),
|
|
423
|
+
).response(
|
|
424
|
+
ResponseHandler()
|
|
425
|
+
.deserializer(APIHelper.json_deserialize)
|
|
426
|
+
.is_api_response(True)
|
|
427
|
+
.local_error("401",
|
|
428
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
429
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
430
|
+
"\n",
|
|
431
|
+
UnauthorizedException)
|
|
432
|
+
.local_error("403",
|
|
433
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
434
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
435
|
+
ForbiddenException)
|
|
436
|
+
.local_error("429",
|
|
437
|
+
"The app has exceeded its rate limits.\n",
|
|
438
|
+
TooManyRequestsException),
|
|
439
|
+
).execute()
|