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