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,241 @@
|
|
|
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
|
+
# EpisodesController
|
|
8
|
+
class EpisodesController < BaseController
|
|
9
|
+
# Get Spotify catalog information for a single episode identified by its
|
|
10
|
+
# unique Spotify ID.
|
|
11
|
+
# @param [String] id Required parameter: TODO: type description here
|
|
12
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
13
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
14
|
+
def get_an_episode(id,
|
|
15
|
+
market: nil)
|
|
16
|
+
@api_call
|
|
17
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
18
|
+
'/episodes/{id}',
|
|
19
|
+
Server::DEFAULT)
|
|
20
|
+
.template_param(new_parameter(id, key: 'id')
|
|
21
|
+
.should_encode(true))
|
|
22
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
23
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
24
|
+
.auth(Single.new('oauth_2_0')))
|
|
25
|
+
.response(new_response_handler
|
|
26
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
27
|
+
.deserialize_into(EpisodeObject.method(:from_hash))
|
|
28
|
+
.is_api_response(true)
|
|
29
|
+
.local_error('401',
|
|
30
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
31
|
+
' token or\nthe access token has expired. You should'\
|
|
32
|
+
' re-authenticate the user.\n",
|
|
33
|
+
UnauthorizedException)
|
|
34
|
+
.local_error('403',
|
|
35
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
36
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
37
|
+
' won't help here.\n",
|
|
38
|
+
ForbiddenException)
|
|
39
|
+
.local_error('429',
|
|
40
|
+
"The app has exceeded its rate limits.\n",
|
|
41
|
+
TooManyRequestsException))
|
|
42
|
+
.execute
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get Spotify catalog information for several episodes based on their
|
|
46
|
+
# Spotify IDs.
|
|
47
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
48
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
49
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
50
|
+
def get_multiple_episodes(ids,
|
|
51
|
+
market: nil)
|
|
52
|
+
@api_call
|
|
53
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
54
|
+
'/episodes',
|
|
55
|
+
Server::DEFAULT)
|
|
56
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
57
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
58
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
59
|
+
.auth(Single.new('oauth_2_0')))
|
|
60
|
+
.response(new_response_handler
|
|
61
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
62
|
+
.deserialize_into(ManyEpisodes.method(:from_hash))
|
|
63
|
+
.is_api_response(true)
|
|
64
|
+
.local_error('401',
|
|
65
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
66
|
+
' token or\nthe access token has expired. You should'\
|
|
67
|
+
' re-authenticate the user.\n",
|
|
68
|
+
UnauthorizedException)
|
|
69
|
+
.local_error('403',
|
|
70
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
71
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
72
|
+
' won't help here.\n",
|
|
73
|
+
ForbiddenException)
|
|
74
|
+
.local_error('429',
|
|
75
|
+
"The app has exceeded its rate limits.\n",
|
|
76
|
+
TooManyRequestsException))
|
|
77
|
+
.execute
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Get a list of the episodes saved in the current Spotify user's
|
|
81
|
+
# library.<br/>
|
|
82
|
+
# This API endpoint is in __beta__ and could change without warning. Please
|
|
83
|
+
# share any feedback that you have, or issues that you discover, in our
|
|
84
|
+
# [developer community
|
|
85
|
+
# forum](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotif
|
|
86
|
+
# y_Developer).
|
|
87
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
88
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
89
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
90
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
91
|
+
def get_users_saved_episodes(market: nil,
|
|
92
|
+
limit: 20,
|
|
93
|
+
offset: 0)
|
|
94
|
+
@api_call
|
|
95
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
96
|
+
'/me/episodes',
|
|
97
|
+
Server::DEFAULT)
|
|
98
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
99
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
100
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
101
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
102
|
+
.auth(Single.new('oauth_2_0')))
|
|
103
|
+
.response(new_response_handler
|
|
104
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
105
|
+
.deserialize_into(PagingSavedEpisodeObject.method(:from_hash))
|
|
106
|
+
.is_api_response(true)
|
|
107
|
+
.local_error('401',
|
|
108
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
109
|
+
' token or\nthe access token has expired. You should'\
|
|
110
|
+
' re-authenticate the user.\n",
|
|
111
|
+
UnauthorizedException)
|
|
112
|
+
.local_error('403',
|
|
113
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
114
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
115
|
+
' won't help here.\n",
|
|
116
|
+
ForbiddenException)
|
|
117
|
+
.local_error('429',
|
|
118
|
+
"The app has exceeded its rate limits.\n",
|
|
119
|
+
TooManyRequestsException))
|
|
120
|
+
.execute
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Save one or more episodes to the current user's library.<br/>
|
|
124
|
+
# This API endpoint is in __beta__ and could change without warning. Please
|
|
125
|
+
# share any feedback that you have, or issues that you discover, in our
|
|
126
|
+
# [developer community
|
|
127
|
+
# forum](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotif
|
|
128
|
+
# y_Developer).
|
|
129
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
130
|
+
# @param [MeEpisodesRequest] body Optional parameter: TODO: type description
|
|
131
|
+
# here
|
|
132
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
133
|
+
def save_episodes_user(ids,
|
|
134
|
+
body: nil)
|
|
135
|
+
@api_call
|
|
136
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
137
|
+
'/me/episodes',
|
|
138
|
+
Server::DEFAULT)
|
|
139
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
140
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
141
|
+
.body_param(new_parameter(body))
|
|
142
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
143
|
+
.auth(Single.new('oauth_2_0')))
|
|
144
|
+
.response(new_response_handler
|
|
145
|
+
.is_response_void(true)
|
|
146
|
+
.is_api_response(true)
|
|
147
|
+
.local_error('401',
|
|
148
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
149
|
+
' token or\nthe access token has expired. You should'\
|
|
150
|
+
' re-authenticate the user.\n",
|
|
151
|
+
UnauthorizedException)
|
|
152
|
+
.local_error('403',
|
|
153
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
154
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
155
|
+
' 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
|
+
end
|
|
162
|
+
|
|
163
|
+
# Remove one or more episodes from the current user's library.<br/>
|
|
164
|
+
# This API endpoint is in __beta__ and could change without warning. Please
|
|
165
|
+
# share any feedback that you have, or issues that you discover, in our
|
|
166
|
+
# [developer community
|
|
167
|
+
# forum](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotif
|
|
168
|
+
# y_Developer).
|
|
169
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
170
|
+
# @param [MeEpisodesRequest1] body Optional parameter: TODO: type
|
|
171
|
+
# description here
|
|
172
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
173
|
+
def remove_episodes_user(ids,
|
|
174
|
+
body: nil)
|
|
175
|
+
@api_call
|
|
176
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
177
|
+
'/me/episodes',
|
|
178
|
+
Server::DEFAULT)
|
|
179
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
180
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
181
|
+
.body_param(new_parameter(body))
|
|
182
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
183
|
+
.auth(Single.new('oauth_2_0')))
|
|
184
|
+
.response(new_response_handler
|
|
185
|
+
.is_response_void(true)
|
|
186
|
+
.is_api_response(true)
|
|
187
|
+
.local_error('401',
|
|
188
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
189
|
+
' token or\nthe access token has expired. You should'\
|
|
190
|
+
' re-authenticate the user.\n",
|
|
191
|
+
UnauthorizedException)
|
|
192
|
+
.local_error('403',
|
|
193
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
194
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
195
|
+
' won't help here.\n",
|
|
196
|
+
ForbiddenException)
|
|
197
|
+
.local_error('429',
|
|
198
|
+
"The app has exceeded its rate limits.\n",
|
|
199
|
+
TooManyRequestsException))
|
|
200
|
+
.execute
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Check if one or more episodes is already saved in the current Spotify
|
|
204
|
+
# user's 'Your Episodes' library.<br/>
|
|
205
|
+
# This API endpoint is in __beta__ and could change without warning. Please
|
|
206
|
+
# share any feedback that you have, or issues that you discover, in our
|
|
207
|
+
# [developer community
|
|
208
|
+
# forum](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotif
|
|
209
|
+
# y_Developer)..
|
|
210
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
211
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
212
|
+
def check_users_saved_episodes(ids)
|
|
213
|
+
@api_call
|
|
214
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
215
|
+
'/me/episodes/contains',
|
|
216
|
+
Server::DEFAULT)
|
|
217
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
218
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
219
|
+
.auth(Single.new('oauth_2_0')))
|
|
220
|
+
.response(new_response_handler
|
|
221
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
222
|
+
.is_api_response(true)
|
|
223
|
+
.is_response_array(true)
|
|
224
|
+
.is_primitive_response(true)
|
|
225
|
+
.local_error('401',
|
|
226
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
227
|
+
' token or\nthe access token has expired. You should'\
|
|
228
|
+
' re-authenticate the user.\n",
|
|
229
|
+
UnauthorizedException)
|
|
230
|
+
.local_error('403',
|
|
231
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
232
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
233
|
+
' won't help here.\n",
|
|
234
|
+
ForbiddenException)
|
|
235
|
+
.local_error('429',
|
|
236
|
+
"The app has exceeded its rate limits.\n",
|
|
237
|
+
TooManyRequestsException))
|
|
238
|
+
.execute
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
# GenresController
|
|
8
|
+
class GenresController < BaseController
|
|
9
|
+
# Retrieve a list of available genres seed parameter values for
|
|
10
|
+
# [recommendations](/documentation/web-api/reference/get-recommendations).
|
|
11
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
12
|
+
def get_recommendation_genres
|
|
13
|
+
@api_call
|
|
14
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
15
|
+
'/recommendations/available-genre-seeds',
|
|
16
|
+
Server::DEFAULT)
|
|
17
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
18
|
+
.auth(Single.new('oauth_2_0')))
|
|
19
|
+
.response(new_response_handler
|
|
20
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
21
|
+
.deserialize_into(ManyGenres.method(:from_hash))
|
|
22
|
+
.is_api_response(true)
|
|
23
|
+
.local_error('401',
|
|
24
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
25
|
+
' token or\nthe access token has expired. You should'\
|
|
26
|
+
' re-authenticate the user.\n",
|
|
27
|
+
UnauthorizedException)
|
|
28
|
+
.local_error('403',
|
|
29
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
30
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
31
|
+
' won't help here.\n",
|
|
32
|
+
ForbiddenException)
|
|
33
|
+
.local_error('429',
|
|
34
|
+
"The app has exceeded its rate limits.\n",
|
|
35
|
+
TooManyRequestsException))
|
|
36
|
+
.execute
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
# MarketsController
|
|
8
|
+
class MarketsController < BaseController
|
|
9
|
+
# Get the list of markets where Spotify is available.
|
|
10
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
11
|
+
def get_available_markets
|
|
12
|
+
@api_call
|
|
13
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
14
|
+
'/markets',
|
|
15
|
+
Server::DEFAULT)
|
|
16
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
17
|
+
.auth(Single.new('oauth_2_0')))
|
|
18
|
+
.response(new_response_handler
|
|
19
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
20
|
+
.deserialize_into(Markets.method(:from_hash))
|
|
21
|
+
.is_api_response(true)
|
|
22
|
+
.local_error('401',
|
|
23
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
24
|
+
' token or\nthe access token has expired. You should'\
|
|
25
|
+
' re-authenticate the user.\n",
|
|
26
|
+
UnauthorizedException)
|
|
27
|
+
.local_error('403',
|
|
28
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
29
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
30
|
+
' won't help here.\n",
|
|
31
|
+
ForbiddenException)
|
|
32
|
+
.local_error('429',
|
|
33
|
+
"The app has exceeded its rate limits.\n",
|
|
34
|
+
TooManyRequestsException))
|
|
35
|
+
.execute
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
# OAuthAuthorizationController
|
|
8
|
+
class OAuthAuthorizationController < BaseController
|
|
9
|
+
# Create a new OAuth 2 token.
|
|
10
|
+
# @param [String] authorization Required parameter: Authorization header in
|
|
11
|
+
# Basic auth format
|
|
12
|
+
# @param [String] code Required parameter: Authorization Code
|
|
13
|
+
# @param [String] redirect_uri Required parameter: Redirect Uri
|
|
14
|
+
# @param [Hash] _field_parameters Additional optional form parameters are
|
|
15
|
+
# supported by this endpoint.
|
|
16
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
17
|
+
def request_token(authorization,
|
|
18
|
+
code,
|
|
19
|
+
redirect_uri,
|
|
20
|
+
_field_parameters: nil)
|
|
21
|
+
@api_call
|
|
22
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
23
|
+
'/api/token',
|
|
24
|
+
Server::AUTH_SERVER)
|
|
25
|
+
.form_param(new_parameter('authorization_code', key: 'grant_type'))
|
|
26
|
+
.header_param(new_parameter(authorization, key: 'Authorization'))
|
|
27
|
+
.form_param(new_parameter(code, key: 'code'))
|
|
28
|
+
.form_param(new_parameter(redirect_uri, key: 'redirect_uri'))
|
|
29
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
30
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
31
|
+
.additional_form_params(_field_parameters))
|
|
32
|
+
.response(new_response_handler
|
|
33
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
34
|
+
.deserialize_into(OAuthToken.method(:from_hash))
|
|
35
|
+
.is_api_response(true)
|
|
36
|
+
.local_error('400',
|
|
37
|
+
'OAuth 2 provider returned an error.',
|
|
38
|
+
OAuthProviderException)
|
|
39
|
+
.local_error('401',
|
|
40
|
+
'OAuth 2 provider says client authentication failed.',
|
|
41
|
+
OAuthProviderException))
|
|
42
|
+
.execute
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Obtain a new access token using a refresh token
|
|
46
|
+
# @param [String] authorization Required parameter: Authorization header in
|
|
47
|
+
# Basic auth format
|
|
48
|
+
# @param [String] refresh_token Required parameter: Refresh token
|
|
49
|
+
# @param [String] scope Optional parameter: Requested scopes as a
|
|
50
|
+
# space-delimited list.
|
|
51
|
+
# @param [Hash] _field_parameters Additional optional form parameters are
|
|
52
|
+
# supported by this endpoint.
|
|
53
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
54
|
+
def refresh_token(authorization,
|
|
55
|
+
refresh_token,
|
|
56
|
+
scope: nil,
|
|
57
|
+
_field_parameters: nil)
|
|
58
|
+
@api_call
|
|
59
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
60
|
+
'/api/token',
|
|
61
|
+
Server::AUTH_SERVER)
|
|
62
|
+
.form_param(new_parameter('refresh_token', key: 'grant_type'))
|
|
63
|
+
.header_param(new_parameter(authorization, key: 'Authorization'))
|
|
64
|
+
.form_param(new_parameter(refresh_token, key: 'refresh_token'))
|
|
65
|
+
.form_param(new_parameter(scope, key: 'scope'))
|
|
66
|
+
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
67
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
68
|
+
.additional_form_params(_field_parameters))
|
|
69
|
+
.response(new_response_handler
|
|
70
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
71
|
+
.deserialize_into(OAuthToken.method(:from_hash))
|
|
72
|
+
.is_api_response(true)
|
|
73
|
+
.local_error('400',
|
|
74
|
+
'OAuth 2 provider returned an error.',
|
|
75
|
+
OAuthProviderException)
|
|
76
|
+
.local_error('401',
|
|
77
|
+
'OAuth 2 provider says client authentication failed.',
|
|
78
|
+
OAuthProviderException))
|
|
79
|
+
.execute
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|