spotify-api-sdk 1.0.0
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.
- checksums.yaml +7 -0
- data/LICENSE +30 -0
- data/README.md +107 -0
- data/lib/spotify_web_api/api_helper.rb +10 -0
- data/lib/spotify_web_api/client.rb +154 -0
- data/lib/spotify_web_api/configuration.rb +180 -0
- data/lib/spotify_web_api/controllers/albums_controller.rb +295 -0
- data/lib/spotify_web_api/controllers/artists_controller.rb +187 -0
- data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
- data/lib/spotify_web_api/controllers/base_controller.rb +66 -0
- data/lib/spotify_web_api/controllers/categories_controller.rb +83 -0
- data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/episodes_controller.rb +239 -0
- data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
- data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
- data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/player_controller.rb +509 -0
- data/lib/spotify_web_api/controllers/playlists_controller.rb +521 -0
- data/lib/spotify_web_api/controllers/search_controller.rb +60 -0
- data/lib/spotify_web_api/controllers/shows_controller.rb +261 -0
- data/lib/spotify_web_api/controllers/tracks_controller.rb +491 -0
- data/lib/spotify_web_api/controllers/users_controller.rb +396 -0
- data/lib/spotify_web_api/exceptions/api_exception.rb +10 -0
- data/lib/spotify_web_api/exceptions/bad_request_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/forbidden_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/not_found_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +32 -0
- data/lib/spotify_web_api/http/api_response.rb +21 -0
- data/lib/spotify_web_api/http/auth/o_auth2.rb +146 -0
- data/lib/spotify_web_api/http/http_call_back.rb +10 -0
- data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
- data/lib/spotify_web_api/http/http_request.rb +10 -0
- data/lib/spotify_web_api/http/http_response.rb +10 -0
- data/lib/spotify_web_api/models/album_base.rb +168 -0
- data/lib/spotify_web_api/models/album_group_enum.rb +29 -0
- data/lib/spotify_web_api/models/album_object.rb +247 -0
- data/lib/spotify_web_api/models/album_restriction_object.rb +53 -0
- data/lib/spotify_web_api/models/album_type_enum.rb +26 -0
- data/lib/spotify_web_api/models/artist_discography_album_object.rb +194 -0
- data/lib/spotify_web_api/models/artist_object.rb +147 -0
- data/lib/spotify_web_api/models/audio_analysis_object.rb +156 -0
- data/lib/spotify_web_api/models/audio_features_object.rb +249 -0
- data/lib/spotify_web_api/models/audiobook_base.rb +245 -0
- data/lib/spotify_web_api/models/audiobook_object.rb +253 -0
- data/lib/spotify_web_api/models/author_object.rb +50 -0
- data/lib/spotify_web_api/models/base_model.rb +62 -0
- data/lib/spotify_web_api/models/categories.rb +110 -0
- data/lib/spotify_web_api/models/category_object.rb +82 -0
- data/lib/spotify_web_api/models/chapter_base.rb +237 -0
- data/lib/spotify_web_api/models/chapter_object.rb +245 -0
- data/lib/spotify_web_api/models/chapter_restriction_object.rb +59 -0
- data/lib/spotify_web_api/models/context_object.rb +78 -0
- data/lib/spotify_web_api/models/copyright_object.rb +60 -0
- data/lib/spotify_web_api/models/currently_playing_context_object.rb +137 -0
- data/lib/spotify_web_api/models/currently_playing_object.rb +109 -0
- data/lib/spotify_web_api/models/cursor_object.rb +59 -0
- data/lib/spotify_web_api/models/cursor_paged_artists.rb +48 -0
- data/lib/spotify_web_api/models/cursor_paging_object.rb +88 -0
- data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +106 -0
- data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +106 -0
- data/lib/spotify_web_api/models/device_object.rb +126 -0
- data/lib/spotify_web_api/models/disallows_object.rb +140 -0
- data/lib/spotify_web_api/models/episode_base.rb +237 -0
- data/lib/spotify_web_api/models/episode_object.rb +246 -0
- data/lib/spotify_web_api/models/episode_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/error_object.rb +59 -0
- data/lib/spotify_web_api/models/explicit_content_settings_object.rb +61 -0
- data/lib/spotify_web_api/models/external_id_object.rb +72 -0
- data/lib/spotify_web_api/models/external_url_object.rb +51 -0
- data/lib/spotify_web_api/models/followers_object.rb +62 -0
- data/lib/spotify_web_api/models/image_object.rb +67 -0
- data/lib/spotify_web_api/models/include_external_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type1_enum.rb +20 -0
- data/lib/spotify_web_api/models/item_type2_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type3_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type_enum.rb +38 -0
- data/lib/spotify_web_api/models/linked_track_object.rb +89 -0
- data/lib/spotify_web_api/models/many_albums.rb +57 -0
- data/lib/spotify_web_api/models/many_artists.rb +57 -0
- data/lib/spotify_web_api/models/many_audio_features.rb +57 -0
- data/lib/spotify_web_api/models/many_audiobooks.rb +57 -0
- data/lib/spotify_web_api/models/many_chapters.rb +57 -0
- data/lib/spotify_web_api/models/many_devices.rb +57 -0
- data/lib/spotify_web_api/models/many_episodes.rb +57 -0
- data/lib/spotify_web_api/models/many_genres.rb +48 -0
- data/lib/spotify_web_api/models/many_simplified_shows.rb +57 -0
- data/lib/spotify_web_api/models/many_tracks.rb +57 -0
- data/lib/spotify_web_api/models/markets.rb +50 -0
- data/lib/spotify_web_api/models/me_albums_request.rb +55 -0
- data/lib/spotify_web_api/models/me_episodes_request.rb +52 -0
- data/lib/spotify_web_api/models/me_episodes_request1.rb +54 -0
- data/lib/spotify_web_api/models/me_following_request.rb +53 -0
- data/lib/spotify_web_api/models/me_following_request1.rb +55 -0
- data/lib/spotify_web_api/models/me_player_play_request.rb +89 -0
- data/lib/spotify_web_api/models/me_player_request.rb +63 -0
- data/lib/spotify_web_api/models/me_shows_request.rb +55 -0
- data/lib/spotify_web_api/models/me_tracks_request.rb +53 -0
- data/lib/spotify_web_api/models/me_tracks_request1.rb +55 -0
- data/lib/spotify_web_api/models/meta.rb +110 -0
- data/lib/spotify_web_api/models/mode_enum.rb +30 -0
- data/lib/spotify_web_api/models/narrator_object.rb +50 -0
- data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +45 -0
- data/lib/spotify_web_api/models/o_auth_scope_enum.rb +94 -0
- data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
- data/lib/spotify_web_api/models/paged_albums.rb +48 -0
- data/lib/spotify_web_api/models/paged_categories.rb +48 -0
- data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_artist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +59 -0
- data/lib/spotify_web_api/models/paging_object.rb +93 -0
- data/lib/spotify_web_api/models/paging_playlist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_playlist_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_track_object.rb +110 -0
- data/lib/spotify_web_api/models/play_history_object.rb +77 -0
- data/lib/spotify_web_api/models/playlist_object.rb +193 -0
- data/lib/spotify_web_api/models/playlist_owner_object.rb +109 -0
- data/lib/spotify_web_api/models/playlist_snapshot_id.rb +50 -0
- data/lib/spotify_web_api/models/playlist_track_object.rb +90 -0
- data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +60 -0
- data/lib/spotify_web_api/models/playlist_user_object.rb +98 -0
- data/lib/spotify_web_api/models/playlists_followers_request.rb +51 -0
- data/lib/spotify_web_api/models/playlists_request.rb +82 -0
- data/lib/spotify_web_api/models/playlists_tracks_request.rb +72 -0
- data/lib/spotify_web_api/models/playlists_tracks_request1.rb +97 -0
- data/lib/spotify_web_api/models/playlists_tracks_request2.rb +75 -0
- data/lib/spotify_web_api/models/private_user_object.rb +181 -0
- data/lib/spotify_web_api/models/public_user_object.rb +128 -0
- data/lib/spotify_web_api/models/queue_object.rb +60 -0
- data/lib/spotify_web_api/models/reason_enum.rb +29 -0
- data/lib/spotify_web_api/models/recommendation_seed_object.rb +104 -0
- data/lib/spotify_web_api/models/recommendations_object.rb +74 -0
- data/lib/spotify_web_api/models/release_date_precision_enum.rb +26 -0
- data/lib/spotify_web_api/models/resume_point_object.rb +60 -0
- data/lib/spotify_web_api/models/saved_album_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_audiobook_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_episode_object.rb +70 -0
- data/lib/spotify_web_api/models/saved_show_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_track_object.rb +73 -0
- data/lib/spotify_web_api/models/search_items.rb +107 -0
- data/lib/spotify_web_api/models/section_object.rb +180 -0
- data/lib/spotify_web_api/models/segment_object.rb +166 -0
- data/lib/spotify_web_api/models/show_base.rb +211 -0
- data/lib/spotify_web_api/models/show_object.rb +219 -0
- data/lib/spotify_web_api/models/simplified_album_object.rb +186 -0
- data/lib/spotify_web_api/models/simplified_artist_object.rb +98 -0
- data/lib/spotify_web_api/models/simplified_playlist_object.rb +184 -0
- data/lib/spotify_web_api/models/simplified_track_object.rb +227 -0
- data/lib/spotify_web_api/models/time_interval_object.rb +68 -0
- data/lib/spotify_web_api/models/track.rb +331 -0
- data/lib/spotify_web_api/models/track1.rb +50 -0
- data/lib/spotify_web_api/models/track_object.rb +265 -0
- data/lib/spotify_web_api/models/track_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/type2_enum.rb +20 -0
- data/lib/spotify_web_api/models/type3_enum.rb +20 -0
- data/lib/spotify_web_api/models/type4_enum.rb +20 -0
- data/lib/spotify_web_api/models/type6_enum.rb +20 -0
- data/lib/spotify_web_api/models/type7_enum.rb +20 -0
- data/lib/spotify_web_api/models/type8_enum.rb +20 -0
- data/lib/spotify_web_api/models/type9_enum.rb +20 -0
- data/lib/spotify_web_api/models/type_enum.rb +20 -0
- data/lib/spotify_web_api/models/users_playlists_request.rb +87 -0
- data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
- data/lib/spotify_web_api/utilities/file_wrapper.rb +16 -0
- data/lib/spotify_web_api.rb +198 -0
- metadata +264 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# AlbumsController
|
|
8
|
+
class AlbumsController < BaseController
|
|
9
|
+
# Get Spotify catalog information for a single album.
|
|
10
|
+
# @param [String] id Required parameter: Example:
|
|
11
|
+
# @param [String] market Optional parameter: Example:
|
|
12
|
+
# @return [AlbumObject] response from the API call
|
|
13
|
+
def get_an_album(id,
|
|
14
|
+
market: nil)
|
|
15
|
+
new_api_call_builder
|
|
16
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
17
|
+
'/albums/{id}',
|
|
18
|
+
Server::DEFAULT)
|
|
19
|
+
.template_param(new_parameter(id, key: 'id')
|
|
20
|
+
.should_encode(true))
|
|
21
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
22
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
23
|
+
.auth(Single.new('oauth_2_0')))
|
|
24
|
+
.response(new_response_handler
|
|
25
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
26
|
+
.deserialize_into(AlbumObject.method(:from_hash))
|
|
27
|
+
.is_api_response(true)
|
|
28
|
+
.local_error('401',
|
|
29
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
30
|
+
' token or\nthe access token has expired. You should'\
|
|
31
|
+
' re-authenticate the user.\n",
|
|
32
|
+
UnauthorizedException)
|
|
33
|
+
.local_error('403',
|
|
34
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
35
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
36
|
+
' won't help here.\n",
|
|
37
|
+
ForbiddenException)
|
|
38
|
+
.local_error('429',
|
|
39
|
+
"The app has exceeded its rate limits.\n",
|
|
40
|
+
TooManyRequestsException))
|
|
41
|
+
.execute
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Get Spotify catalog information for multiple albums identified by their
|
|
45
|
+
# Spotify IDs.
|
|
46
|
+
# @param [String] ids Required parameter: Example:
|
|
47
|
+
# @param [String] market Optional parameter: Example:
|
|
48
|
+
# @return [ManyAlbums] response from the API call
|
|
49
|
+
def get_multiple_albums(ids,
|
|
50
|
+
market: nil)
|
|
51
|
+
new_api_call_builder
|
|
52
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
53
|
+
'/albums',
|
|
54
|
+
Server::DEFAULT)
|
|
55
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
56
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
57
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
58
|
+
.auth(Single.new('oauth_2_0')))
|
|
59
|
+
.response(new_response_handler
|
|
60
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
61
|
+
.deserialize_into(ManyAlbums.method(:from_hash))
|
|
62
|
+
.is_api_response(true)
|
|
63
|
+
.local_error('401',
|
|
64
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
65
|
+
' token or\nthe access token has expired. You should'\
|
|
66
|
+
' re-authenticate the user.\n",
|
|
67
|
+
UnauthorizedException)
|
|
68
|
+
.local_error('403',
|
|
69
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
70
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
71
|
+
' won't help here.\n",
|
|
72
|
+
ForbiddenException)
|
|
73
|
+
.local_error('429',
|
|
74
|
+
"The app has exceeded its rate limits.\n",
|
|
75
|
+
TooManyRequestsException))
|
|
76
|
+
.execute
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Get Spotify catalog information about an album’s tracks.
|
|
80
|
+
# Optional parameters can be used to limit the number of tracks returned.
|
|
81
|
+
# @param [String] id Required parameter: Example:
|
|
82
|
+
# @param [String] market Optional parameter: Example:
|
|
83
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
84
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
85
|
+
# @return [PagingSimplifiedTrackObject] response from the API call
|
|
86
|
+
def get_an_albums_tracks(id,
|
|
87
|
+
market: nil,
|
|
88
|
+
limit: 20,
|
|
89
|
+
offset: 0)
|
|
90
|
+
new_api_call_builder
|
|
91
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
92
|
+
'/albums/{id}/tracks',
|
|
93
|
+
Server::DEFAULT)
|
|
94
|
+
.template_param(new_parameter(id, key: 'id')
|
|
95
|
+
.should_encode(true))
|
|
96
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
97
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
98
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
99
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
100
|
+
.auth(Single.new('oauth_2_0')))
|
|
101
|
+
.response(new_response_handler
|
|
102
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
103
|
+
.deserialize_into(PagingSimplifiedTrackObject.method(:from_hash))
|
|
104
|
+
.is_api_response(true)
|
|
105
|
+
.local_error('401',
|
|
106
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
107
|
+
' token or\nthe access token has expired. You should'\
|
|
108
|
+
' re-authenticate the user.\n",
|
|
109
|
+
UnauthorizedException)
|
|
110
|
+
.local_error('403',
|
|
111
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
112
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
113
|
+
' won't help here.\n",
|
|
114
|
+
ForbiddenException)
|
|
115
|
+
.local_error('429',
|
|
116
|
+
"The app has exceeded its rate limits.\n",
|
|
117
|
+
TooManyRequestsException))
|
|
118
|
+
.execute
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Get a list of the albums saved in the current Spotify user's 'Your Music'
|
|
122
|
+
# library.
|
|
123
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
124
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
125
|
+
# @param [String] market Optional parameter: Example:
|
|
126
|
+
# @return [PagingSavedAlbumObject] response from the API call
|
|
127
|
+
def get_users_saved_albums(limit: 20,
|
|
128
|
+
offset: 0,
|
|
129
|
+
market: nil)
|
|
130
|
+
new_api_call_builder
|
|
131
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
132
|
+
'/me/albums',
|
|
133
|
+
Server::DEFAULT)
|
|
134
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
135
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
136
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
137
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
138
|
+
.auth(Single.new('oauth_2_0')))
|
|
139
|
+
.response(new_response_handler
|
|
140
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
141
|
+
.deserialize_into(PagingSavedAlbumObject.method(:from_hash))
|
|
142
|
+
.is_api_response(true)
|
|
143
|
+
.local_error('401',
|
|
144
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
145
|
+
' token or\nthe access token has expired. You should'\
|
|
146
|
+
' re-authenticate the user.\n",
|
|
147
|
+
UnauthorizedException)
|
|
148
|
+
.local_error('403',
|
|
149
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
150
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
151
|
+
' won't help here.\n",
|
|
152
|
+
ForbiddenException)
|
|
153
|
+
.local_error('429',
|
|
154
|
+
"The app has exceeded its rate limits.\n",
|
|
155
|
+
TooManyRequestsException))
|
|
156
|
+
.execute
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Save one or more albums to the current user's 'Your Music' library.
|
|
160
|
+
# @param [String] ids Required parameter: Example:
|
|
161
|
+
# @param [MeAlbumsRequest] body Optional parameter: Example:
|
|
162
|
+
# @return [void] response from the API call
|
|
163
|
+
def save_albums_user(ids,
|
|
164
|
+
body: nil)
|
|
165
|
+
new_api_call_builder
|
|
166
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
167
|
+
'/me/albums',
|
|
168
|
+
Server::DEFAULT)
|
|
169
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
170
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
171
|
+
.body_param(new_parameter(body))
|
|
172
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
173
|
+
.auth(Single.new('oauth_2_0')))
|
|
174
|
+
.response(new_response_handler
|
|
175
|
+
.is_response_void(true)
|
|
176
|
+
.is_api_response(true)
|
|
177
|
+
.local_error('401',
|
|
178
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
179
|
+
' token or\nthe access token has expired. You should'\
|
|
180
|
+
' re-authenticate the user.\n",
|
|
181
|
+
UnauthorizedException)
|
|
182
|
+
.local_error('403',
|
|
183
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
184
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
185
|
+
' won't help here.\n",
|
|
186
|
+
ForbiddenException)
|
|
187
|
+
.local_error('429',
|
|
188
|
+
"The app has exceeded its rate limits.\n",
|
|
189
|
+
TooManyRequestsException))
|
|
190
|
+
.execute
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Remove one or more albums from the current user's 'Your Music' library.
|
|
194
|
+
# @param [String] ids Required parameter: Example:
|
|
195
|
+
# @param [MeAlbumsRequest] body Optional parameter: Example:
|
|
196
|
+
# @return [void] response from the API call
|
|
197
|
+
def remove_albums_user(ids,
|
|
198
|
+
body: nil)
|
|
199
|
+
new_api_call_builder
|
|
200
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
201
|
+
'/me/albums',
|
|
202
|
+
Server::DEFAULT)
|
|
203
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
204
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
205
|
+
.body_param(new_parameter(body))
|
|
206
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
207
|
+
.auth(Single.new('oauth_2_0')))
|
|
208
|
+
.response(new_response_handler
|
|
209
|
+
.is_response_void(true)
|
|
210
|
+
.is_api_response(true)
|
|
211
|
+
.local_error('401',
|
|
212
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
213
|
+
' token or\nthe access token has expired. You should'\
|
|
214
|
+
' re-authenticate the user.\n",
|
|
215
|
+
UnauthorizedException)
|
|
216
|
+
.local_error('403',
|
|
217
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
218
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
219
|
+
' won't help here.\n",
|
|
220
|
+
ForbiddenException)
|
|
221
|
+
.local_error('429',
|
|
222
|
+
"The app has exceeded its rate limits.\n",
|
|
223
|
+
TooManyRequestsException))
|
|
224
|
+
.execute
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Check if one or more albums is already saved in the current Spotify user's
|
|
228
|
+
# 'Your Music' library.
|
|
229
|
+
# @param [String] ids Required parameter: Example:
|
|
230
|
+
# @return [Array[TrueClass | FalseClass]] response from the API call
|
|
231
|
+
def check_users_saved_albums(ids)
|
|
232
|
+
new_api_call_builder
|
|
233
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
234
|
+
'/me/albums/contains',
|
|
235
|
+
Server::DEFAULT)
|
|
236
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
237
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
238
|
+
.auth(Single.new('oauth_2_0')))
|
|
239
|
+
.response(new_response_handler
|
|
240
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
241
|
+
.is_api_response(true)
|
|
242
|
+
.is_response_array(true)
|
|
243
|
+
.is_primitive_response(true)
|
|
244
|
+
.local_error('401',
|
|
245
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
246
|
+
' token or\nthe access token has expired. You should'\
|
|
247
|
+
' re-authenticate the user.\n",
|
|
248
|
+
UnauthorizedException)
|
|
249
|
+
.local_error('403',
|
|
250
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
251
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
252
|
+
' won't help here.\n",
|
|
253
|
+
ForbiddenException)
|
|
254
|
+
.local_error('429',
|
|
255
|
+
"The app has exceeded its rate limits.\n",
|
|
256
|
+
TooManyRequestsException))
|
|
257
|
+
.execute
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Get a list of new album releases featured in Spotify (shown, for example,
|
|
261
|
+
# on a Spotify player’s “Browse” tab).
|
|
262
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
263
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
264
|
+
# @return [PagedAlbums] response from the API call
|
|
265
|
+
def get_new_releases(limit: 20,
|
|
266
|
+
offset: 0)
|
|
267
|
+
new_api_call_builder
|
|
268
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
269
|
+
'/browse/new-releases',
|
|
270
|
+
Server::DEFAULT)
|
|
271
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
272
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
273
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
274
|
+
.auth(Single.new('oauth_2_0')))
|
|
275
|
+
.response(new_response_handler
|
|
276
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
277
|
+
.deserialize_into(PagedAlbums.method(:from_hash))
|
|
278
|
+
.is_api_response(true)
|
|
279
|
+
.local_error('401',
|
|
280
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
281
|
+
' token or\nthe access token has expired. You should'\
|
|
282
|
+
' re-authenticate the user.\n",
|
|
283
|
+
UnauthorizedException)
|
|
284
|
+
.local_error('403',
|
|
285
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
286
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
287
|
+
' won't help here.\n",
|
|
288
|
+
ForbiddenException)
|
|
289
|
+
.local_error('429',
|
|
290
|
+
"The app has exceeded its rate limits.\n",
|
|
291
|
+
TooManyRequestsException))
|
|
292
|
+
.execute
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
end
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# ArtistsController
|
|
8
|
+
class ArtistsController < BaseController
|
|
9
|
+
# Get Spotify catalog information for a single artist identified by their
|
|
10
|
+
# unique Spotify ID.
|
|
11
|
+
# @param [String] id Required parameter: Example:
|
|
12
|
+
# @return [ArtistObject] response from the API call
|
|
13
|
+
def get_an_artist(id)
|
|
14
|
+
new_api_call_builder
|
|
15
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
16
|
+
'/artists/{id}',
|
|
17
|
+
Server::DEFAULT)
|
|
18
|
+
.template_param(new_parameter(id, key: 'id')
|
|
19
|
+
.should_encode(true))
|
|
20
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
21
|
+
.auth(Single.new('oauth_2_0')))
|
|
22
|
+
.response(new_response_handler
|
|
23
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
24
|
+
.deserialize_into(ArtistObject.method(:from_hash))
|
|
25
|
+
.is_api_response(true)
|
|
26
|
+
.local_error('401',
|
|
27
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
28
|
+
' token or\nthe access token has expired. You should'\
|
|
29
|
+
' re-authenticate the user.\n",
|
|
30
|
+
UnauthorizedException)
|
|
31
|
+
.local_error('403',
|
|
32
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
33
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
34
|
+
' won't help here.\n",
|
|
35
|
+
ForbiddenException)
|
|
36
|
+
.local_error('429',
|
|
37
|
+
"The app has exceeded its rate limits.\n",
|
|
38
|
+
TooManyRequestsException))
|
|
39
|
+
.execute
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Get Spotify catalog information for several artists based on their Spotify
|
|
43
|
+
# IDs.
|
|
44
|
+
# @param [String] ids Required parameter: Example:
|
|
45
|
+
# @return [ManyArtists] response from the API call
|
|
46
|
+
def get_multiple_artists(ids)
|
|
47
|
+
new_api_call_builder
|
|
48
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
49
|
+
'/artists',
|
|
50
|
+
Server::DEFAULT)
|
|
51
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
52
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
53
|
+
.auth(Single.new('oauth_2_0')))
|
|
54
|
+
.response(new_response_handler
|
|
55
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
56
|
+
.deserialize_into(ManyArtists.method(:from_hash))
|
|
57
|
+
.is_api_response(true)
|
|
58
|
+
.local_error('401',
|
|
59
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
60
|
+
' token or\nthe access token has expired. You should'\
|
|
61
|
+
' re-authenticate the user.\n",
|
|
62
|
+
UnauthorizedException)
|
|
63
|
+
.local_error('403',
|
|
64
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
65
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
66
|
+
' won't help here.\n",
|
|
67
|
+
ForbiddenException)
|
|
68
|
+
.local_error('429',
|
|
69
|
+
"The app has exceeded its rate limits.\n",
|
|
70
|
+
TooManyRequestsException))
|
|
71
|
+
.execute
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Get Spotify catalog information about an artist's albums.
|
|
75
|
+
# @param [String] id Required parameter: Example:
|
|
76
|
+
# @param [String] include_groups Optional parameter: Example:
|
|
77
|
+
# @param [String] market Optional parameter: Example:
|
|
78
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
79
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
80
|
+
# @return [PagingArtistDiscographyAlbumObject] response from the API call
|
|
81
|
+
def get_an_artists_albums(id,
|
|
82
|
+
include_groups: nil,
|
|
83
|
+
market: nil,
|
|
84
|
+
limit: 20,
|
|
85
|
+
offset: 0)
|
|
86
|
+
new_api_call_builder
|
|
87
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
88
|
+
'/artists/{id}/albums',
|
|
89
|
+
Server::DEFAULT)
|
|
90
|
+
.template_param(new_parameter(id, key: 'id')
|
|
91
|
+
.should_encode(true))
|
|
92
|
+
.query_param(new_parameter(include_groups, key: 'include_groups'))
|
|
93
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
94
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
95
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
96
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
97
|
+
.auth(Single.new('oauth_2_0')))
|
|
98
|
+
.response(new_response_handler
|
|
99
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
100
|
+
.deserialize_into(PagingArtistDiscographyAlbumObject.method(:from_hash))
|
|
101
|
+
.is_api_response(true)
|
|
102
|
+
.local_error('401',
|
|
103
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
104
|
+
' token or\nthe access token has expired. You should'\
|
|
105
|
+
' re-authenticate the user.\n",
|
|
106
|
+
UnauthorizedException)
|
|
107
|
+
.local_error('403',
|
|
108
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
109
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
110
|
+
' won't help here.\n",
|
|
111
|
+
ForbiddenException)
|
|
112
|
+
.local_error('429',
|
|
113
|
+
"The app has exceeded its rate limits.\n",
|
|
114
|
+
TooManyRequestsException))
|
|
115
|
+
.execute
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Get Spotify catalog information about an artist's top tracks by country.
|
|
119
|
+
# @param [String] id Required parameter: Example:
|
|
120
|
+
# @param [String] market Optional parameter: Example:
|
|
121
|
+
# @return [ManyTracks] response from the API call
|
|
122
|
+
def get_an_artists_top_tracks(id,
|
|
123
|
+
market: nil)
|
|
124
|
+
new_api_call_builder
|
|
125
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
126
|
+
'/artists/{id}/top-tracks',
|
|
127
|
+
Server::DEFAULT)
|
|
128
|
+
.template_param(new_parameter(id, key: 'id')
|
|
129
|
+
.should_encode(true))
|
|
130
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
131
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
132
|
+
.auth(Single.new('oauth_2_0')))
|
|
133
|
+
.response(new_response_handler
|
|
134
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
135
|
+
.deserialize_into(ManyTracks.method(:from_hash))
|
|
136
|
+
.is_api_response(true)
|
|
137
|
+
.local_error('401',
|
|
138
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
139
|
+
' token or\nthe access token has expired. You should'\
|
|
140
|
+
' re-authenticate the user.\n",
|
|
141
|
+
UnauthorizedException)
|
|
142
|
+
.local_error('403',
|
|
143
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
144
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
145
|
+
' won't help here.\n",
|
|
146
|
+
ForbiddenException)
|
|
147
|
+
.local_error('429',
|
|
148
|
+
"The app has exceeded its rate limits.\n",
|
|
149
|
+
TooManyRequestsException))
|
|
150
|
+
.execute
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Get Spotify catalog information about artists similar to a given artist.
|
|
154
|
+
# Similarity is based on analysis of the Spotify community's listening
|
|
155
|
+
# history.
|
|
156
|
+
# @param [String] id Required parameter: Example:
|
|
157
|
+
# @return [ManyArtists] response from the API call
|
|
158
|
+
def get_an_artists_related_artists(id)
|
|
159
|
+
new_api_call_builder
|
|
160
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
161
|
+
'/artists/{id}/related-artists',
|
|
162
|
+
Server::DEFAULT)
|
|
163
|
+
.template_param(new_parameter(id, key: 'id')
|
|
164
|
+
.should_encode(true))
|
|
165
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
166
|
+
.auth(Single.new('oauth_2_0')))
|
|
167
|
+
.response(new_response_handler
|
|
168
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
169
|
+
.deserialize_into(ManyArtists.method(:from_hash))
|
|
170
|
+
.is_api_response(true)
|
|
171
|
+
.local_error('401',
|
|
172
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
173
|
+
' token or\nthe access token has expired. You should'\
|
|
174
|
+
' re-authenticate the user.\n",
|
|
175
|
+
UnauthorizedException)
|
|
176
|
+
.local_error('403',
|
|
177
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
178
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
179
|
+
' won't help here.\n",
|
|
180
|
+
ForbiddenException)
|
|
181
|
+
.local_error('429',
|
|
182
|
+
"The app has exceeded its rate limits.\n",
|
|
183
|
+
TooManyRequestsException))
|
|
184
|
+
.execute
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|