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,258 @@
|
|
|
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
|
+
# AudiobooksController
|
|
8
|
+
class AudiobooksController < BaseController
|
|
9
|
+
# Get Spotify catalog information for a single audiobook. Audiobooks are
|
|
10
|
+
# only available within the US, UK, Canada, Ireland, New Zealand and
|
|
11
|
+
# Australia markets.
|
|
12
|
+
# @param [String] id Required parameter: TODO: type description here
|
|
13
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
14
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
15
|
+
def get_an_audiobook(id,
|
|
16
|
+
market: nil)
|
|
17
|
+
@api_call
|
|
18
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
19
|
+
'/audiobooks/{id}',
|
|
20
|
+
Server::DEFAULT)
|
|
21
|
+
.template_param(new_parameter(id, key: 'id')
|
|
22
|
+
.should_encode(true))
|
|
23
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
24
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
25
|
+
.auth(Single.new('oauth_2_0')))
|
|
26
|
+
.response(new_response_handler
|
|
27
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
28
|
+
.deserialize_into(AudiobookObject.method(:from_hash))
|
|
29
|
+
.is_api_response(true)
|
|
30
|
+
.local_error('400',
|
|
31
|
+
"The request contains malformed data in path, query parameters,'\
|
|
32
|
+
' or body.\n",
|
|
33
|
+
BadRequestException)
|
|
34
|
+
.local_error('401',
|
|
35
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
36
|
+
' token or\nthe access token has expired. You should'\
|
|
37
|
+
' re-authenticate the user.\n",
|
|
38
|
+
UnauthorizedException)
|
|
39
|
+
.local_error('403',
|
|
40
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
41
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
42
|
+
' won't help here.\n",
|
|
43
|
+
ForbiddenException)
|
|
44
|
+
.local_error('404',
|
|
45
|
+
"The requested resource cannot be found.\n",
|
|
46
|
+
NotFoundException)
|
|
47
|
+
.local_error('429',
|
|
48
|
+
"The app has exceeded its rate limits.\n",
|
|
49
|
+
TooManyRequestsException))
|
|
50
|
+
.execute
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Get Spotify catalog information for several audiobooks identified by their
|
|
54
|
+
# Spotify IDs. Audiobooks are only available within the US, UK, Canada,
|
|
55
|
+
# Ireland, New Zealand and Australia markets.
|
|
56
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
57
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
58
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
59
|
+
def get_multiple_audiobooks(ids,
|
|
60
|
+
market: nil)
|
|
61
|
+
@api_call
|
|
62
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
63
|
+
'/audiobooks',
|
|
64
|
+
Server::DEFAULT)
|
|
65
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
66
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
67
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
68
|
+
.auth(Single.new('oauth_2_0')))
|
|
69
|
+
.response(new_response_handler
|
|
70
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
71
|
+
.deserialize_into(ManyAudiobooks.method(:from_hash))
|
|
72
|
+
.is_api_response(true)
|
|
73
|
+
.local_error('401',
|
|
74
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
75
|
+
' token or\nthe access token has expired. You should'\
|
|
76
|
+
' re-authenticate the user.\n",
|
|
77
|
+
UnauthorizedException)
|
|
78
|
+
.local_error('403',
|
|
79
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
80
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
81
|
+
' won't help here.\n",
|
|
82
|
+
ForbiddenException)
|
|
83
|
+
.local_error('429',
|
|
84
|
+
"The app has exceeded its rate limits.\n",
|
|
85
|
+
TooManyRequestsException))
|
|
86
|
+
.execute
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Get Spotify catalog information about an audiobook's chapters. Audiobooks
|
|
90
|
+
# are only available within the US, UK, Canada, Ireland, New Zealand and
|
|
91
|
+
# Australia markets.
|
|
92
|
+
# @param [String] id Required parameter: TODO: type description here
|
|
93
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
94
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
95
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
96
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
97
|
+
def get_audiobook_chapters(id,
|
|
98
|
+
market: nil,
|
|
99
|
+
limit: 20,
|
|
100
|
+
offset: 0)
|
|
101
|
+
@api_call
|
|
102
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
103
|
+
'/audiobooks/{id}/chapters',
|
|
104
|
+
Server::DEFAULT)
|
|
105
|
+
.template_param(new_parameter(id, key: 'id')
|
|
106
|
+
.should_encode(true))
|
|
107
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
108
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
109
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
110
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
111
|
+
.auth(Single.new('oauth_2_0')))
|
|
112
|
+
.response(new_response_handler
|
|
113
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
114
|
+
.deserialize_into(PagingSimplifiedChapterObject.method(:from_hash))
|
|
115
|
+
.is_api_response(true)
|
|
116
|
+
.local_error('401',
|
|
117
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
118
|
+
' token or\nthe access token has expired. You should'\
|
|
119
|
+
' re-authenticate the user.\n",
|
|
120
|
+
UnauthorizedException)
|
|
121
|
+
.local_error('403',
|
|
122
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
123
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
124
|
+
' won't help here.\n",
|
|
125
|
+
ForbiddenException)
|
|
126
|
+
.local_error('429',
|
|
127
|
+
"The app has exceeded its rate limits.\n",
|
|
128
|
+
TooManyRequestsException))
|
|
129
|
+
.execute
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Get a list of the audiobooks saved in the current Spotify user's 'Your
|
|
133
|
+
# Music' library.
|
|
134
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
135
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
136
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
137
|
+
def get_users_saved_audiobooks(limit: 20,
|
|
138
|
+
offset: 0)
|
|
139
|
+
@api_call
|
|
140
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
141
|
+
'/me/audiobooks',
|
|
142
|
+
Server::DEFAULT)
|
|
143
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
144
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
145
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
146
|
+
.auth(Single.new('oauth_2_0')))
|
|
147
|
+
.response(new_response_handler
|
|
148
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
149
|
+
.deserialize_into(PagingSavedAudiobookObject.method(:from_hash))
|
|
150
|
+
.is_api_response(true)
|
|
151
|
+
.local_error('401',
|
|
152
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
153
|
+
' token or\nthe access token has expired. You should'\
|
|
154
|
+
' re-authenticate the user.\n",
|
|
155
|
+
UnauthorizedException)
|
|
156
|
+
.local_error('403',
|
|
157
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
158
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
159
|
+
' won't help here.\n",
|
|
160
|
+
ForbiddenException)
|
|
161
|
+
.local_error('429',
|
|
162
|
+
"The app has exceeded its rate limits.\n",
|
|
163
|
+
TooManyRequestsException))
|
|
164
|
+
.execute
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Save one or more audiobooks to the current Spotify user's library.
|
|
168
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
169
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
170
|
+
def save_audiobooks_user(ids)
|
|
171
|
+
@api_call
|
|
172
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
173
|
+
'/me/audiobooks',
|
|
174
|
+
Server::DEFAULT)
|
|
175
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
176
|
+
.auth(Single.new('oauth_2_0')))
|
|
177
|
+
.response(new_response_handler
|
|
178
|
+
.is_response_void(true)
|
|
179
|
+
.is_api_response(true)
|
|
180
|
+
.local_error('401',
|
|
181
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
182
|
+
' token or\nthe access token has expired. You should'\
|
|
183
|
+
' re-authenticate the user.\n",
|
|
184
|
+
UnauthorizedException)
|
|
185
|
+
.local_error('403',
|
|
186
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
187
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
188
|
+
' won't help here.\n",
|
|
189
|
+
ForbiddenException)
|
|
190
|
+
.local_error('429',
|
|
191
|
+
"The app has exceeded its rate limits.\n",
|
|
192
|
+
TooManyRequestsException))
|
|
193
|
+
.execute
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Remove one or more audiobooks from the Spotify user's library.
|
|
197
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
198
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
199
|
+
def remove_audiobooks_user(ids)
|
|
200
|
+
@api_call
|
|
201
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
202
|
+
'/me/audiobooks',
|
|
203
|
+
Server::DEFAULT)
|
|
204
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
205
|
+
.auth(Single.new('oauth_2_0')))
|
|
206
|
+
.response(new_response_handler
|
|
207
|
+
.is_response_void(true)
|
|
208
|
+
.is_api_response(true)
|
|
209
|
+
.local_error('401',
|
|
210
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
211
|
+
' token or\nthe access token has expired. You should'\
|
|
212
|
+
' re-authenticate the user.\n",
|
|
213
|
+
UnauthorizedException)
|
|
214
|
+
.local_error('403',
|
|
215
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
216
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
217
|
+
' won't help here.\n",
|
|
218
|
+
ForbiddenException)
|
|
219
|
+
.local_error('429',
|
|
220
|
+
"The app has exceeded its rate limits.\n",
|
|
221
|
+
TooManyRequestsException))
|
|
222
|
+
.execute
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Check if one or more audiobooks are already saved in the current Spotify
|
|
226
|
+
# user's library.
|
|
227
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
228
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
229
|
+
def check_users_saved_audiobooks(ids)
|
|
230
|
+
@api_call
|
|
231
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
232
|
+
'/me/audiobooks/contains',
|
|
233
|
+
Server::DEFAULT)
|
|
234
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
235
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
236
|
+
.auth(Single.new('oauth_2_0')))
|
|
237
|
+
.response(new_response_handler
|
|
238
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
239
|
+
.is_api_response(true)
|
|
240
|
+
.is_response_array(true)
|
|
241
|
+
.is_primitive_response(true)
|
|
242
|
+
.local_error('401',
|
|
243
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
244
|
+
' token or\nthe access token has expired. You should'\
|
|
245
|
+
' re-authenticate the user.\n",
|
|
246
|
+
UnauthorizedException)
|
|
247
|
+
.local_error('403',
|
|
248
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
249
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
250
|
+
' won't help here.\n",
|
|
251
|
+
ForbiddenException)
|
|
252
|
+
.local_error('429',
|
|
253
|
+
"The app has exceeded its rate limits.\n",
|
|
254
|
+
TooManyRequestsException))
|
|
255
|
+
.execute
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
# BaseController.
|
|
8
|
+
class BaseController
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_accessor :config, :http_call_back
|
|
11
|
+
|
|
12
|
+
def self.user_agent
|
|
13
|
+
'APIMATIC 3.0'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
GLOBAL_ERRORS = {
|
|
18
|
+
'default' => ErrorCase.new
|
|
19
|
+
.error_message('HTTP response not OK.')
|
|
20
|
+
.exception_type(APIException)
|
|
21
|
+
}.freeze
|
|
22
|
+
|
|
23
|
+
# Initialization constructor.
|
|
24
|
+
# @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
|
|
25
|
+
def initialize(global_configuration)
|
|
26
|
+
@global_configuration = global_configuration
|
|
27
|
+
@config = @global_configuration.client_configuration
|
|
28
|
+
@http_call_back = @config.http_callback
|
|
29
|
+
@api_call = ApiCall.new(@global_configuration)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Creates a new instance of the request builder.
|
|
33
|
+
# @param [String] http_method The HTTP method to use in the request.
|
|
34
|
+
# @param [String] path The endpoint path to use in the request.
|
|
35
|
+
# @param [String] server The server to extract the base uri for the request.
|
|
36
|
+
# @return [RequestBuilder] The instance of RequestBuilder.
|
|
37
|
+
def new_request_builder(http_method, path, server)
|
|
38
|
+
RequestBuilder.new
|
|
39
|
+
.http_method(http_method)
|
|
40
|
+
.path(path)
|
|
41
|
+
.server(server)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Creates a new instance of the response handler.
|
|
45
|
+
# @return [ResponseHandler] The instance of ResponseHandler.
|
|
46
|
+
def new_response_handler
|
|
47
|
+
ResponseHandler.new
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Creates a new instance of the parameter.
|
|
51
|
+
# @param [String|optional] key The key of the parameter.
|
|
52
|
+
# @param [Object] value The value of the parameter.
|
|
53
|
+
# @return [Parameter] The instance of Parameter.
|
|
54
|
+
def new_parameter(value, key: nil)
|
|
55
|
+
Parameter.new
|
|
56
|
+
.key(key)
|
|
57
|
+
.value(value)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
# CategoriesController
|
|
8
|
+
class CategoriesController < BaseController
|
|
9
|
+
# Get a list of categories used to tag items in Spotify (on, for example,
|
|
10
|
+
# the Spotify player’s “Browse” tab).
|
|
11
|
+
# @param [String] locale Optional parameter: TODO: type description here
|
|
12
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
13
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
14
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
15
|
+
def get_categories(locale: nil,
|
|
16
|
+
limit: 20,
|
|
17
|
+
offset: 0)
|
|
18
|
+
@api_call
|
|
19
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
20
|
+
'/browse/categories',
|
|
21
|
+
Server::DEFAULT)
|
|
22
|
+
.query_param(new_parameter(locale, key: 'locale'))
|
|
23
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
24
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
25
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
26
|
+
.auth(Single.new('oauth_2_0')))
|
|
27
|
+
.response(new_response_handler
|
|
28
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
29
|
+
.deserialize_into(PagedCategories.method(:from_hash))
|
|
30
|
+
.is_api_response(true)
|
|
31
|
+
.local_error('401',
|
|
32
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
33
|
+
' token or\nthe access token has expired. You should'\
|
|
34
|
+
' re-authenticate the user.\n",
|
|
35
|
+
UnauthorizedException)
|
|
36
|
+
.local_error('403',
|
|
37
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
38
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
39
|
+
' won't help here.\n",
|
|
40
|
+
ForbiddenException)
|
|
41
|
+
.local_error('429',
|
|
42
|
+
"The app has exceeded its rate limits.\n",
|
|
43
|
+
TooManyRequestsException))
|
|
44
|
+
.execute
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get a single category used to tag items in Spotify (on, for example, the
|
|
48
|
+
# Spotify player’s “Browse” tab).
|
|
49
|
+
# @param [String] category_id Required parameter: TODO: type description
|
|
50
|
+
# here
|
|
51
|
+
# @param [String] locale Optional parameter: TODO: type description here
|
|
52
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
53
|
+
def get_a_category(category_id,
|
|
54
|
+
locale: nil)
|
|
55
|
+
@api_call
|
|
56
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
57
|
+
'/browse/categories/{category_id}',
|
|
58
|
+
Server::DEFAULT)
|
|
59
|
+
.template_param(new_parameter(category_id, key: 'category_id')
|
|
60
|
+
.should_encode(true))
|
|
61
|
+
.query_param(new_parameter(locale, key: 'locale'))
|
|
62
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
63
|
+
.auth(Single.new('oauth_2_0')))
|
|
64
|
+
.response(new_response_handler
|
|
65
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
66
|
+
.deserialize_into(CategoryObject.method(:from_hash))
|
|
67
|
+
.is_api_response(true)
|
|
68
|
+
.local_error('401',
|
|
69
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
70
|
+
' token or\nthe access token has expired. You should'\
|
|
71
|
+
' re-authenticate the user.\n",
|
|
72
|
+
UnauthorizedException)
|
|
73
|
+
.local_error('403',
|
|
74
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
75
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
76
|
+
' won't help here.\n",
|
|
77
|
+
ForbiddenException)
|
|
78
|
+
.local_error('429',
|
|
79
|
+
"The app has exceeded its rate limits.\n",
|
|
80
|
+
TooManyRequestsException))
|
|
81
|
+
.execute
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
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
|
+
# ChaptersController
|
|
8
|
+
class ChaptersController < BaseController
|
|
9
|
+
# Get Spotify catalog information for a single audiobook chapter. Chapters
|
|
10
|
+
# are only available within the US, UK, Canada, Ireland, New Zealand and
|
|
11
|
+
# Australia markets.
|
|
12
|
+
# @param [String] id Required parameter: TODO: type description here
|
|
13
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
14
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
15
|
+
def get_a_chapter(id,
|
|
16
|
+
market: nil)
|
|
17
|
+
@api_call
|
|
18
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
19
|
+
'/chapters/{id}',
|
|
20
|
+
Server::DEFAULT)
|
|
21
|
+
.template_param(new_parameter(id, key: 'id')
|
|
22
|
+
.should_encode(true))
|
|
23
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
24
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
25
|
+
.auth(Single.new('oauth_2_0')))
|
|
26
|
+
.response(new_response_handler
|
|
27
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
28
|
+
.deserialize_into(ChapterObject.method(:from_hash))
|
|
29
|
+
.is_api_response(true)
|
|
30
|
+
.local_error('401',
|
|
31
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
32
|
+
' token or\nthe access token has expired. You should'\
|
|
33
|
+
' re-authenticate the user.\n",
|
|
34
|
+
UnauthorizedException)
|
|
35
|
+
.local_error('403',
|
|
36
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
37
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
38
|
+
' won't help here.\n",
|
|
39
|
+
ForbiddenException)
|
|
40
|
+
.local_error('429',
|
|
41
|
+
"The app has exceeded its rate limits.\n",
|
|
42
|
+
TooManyRequestsException))
|
|
43
|
+
.execute
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Get Spotify catalog information for several audiobook chapters identified
|
|
47
|
+
# by their Spotify IDs. Chapters are only available within the US, UK,
|
|
48
|
+
# Canada, Ireland, New Zealand and Australia markets.
|
|
49
|
+
# @param [String] ids Required parameter: TODO: type description here
|
|
50
|
+
# @param [String] market Optional parameter: TODO: type description here
|
|
51
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
52
|
+
def get_several_chapters(ids,
|
|
53
|
+
market: nil)
|
|
54
|
+
@api_call
|
|
55
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
56
|
+
'/chapters',
|
|
57
|
+
Server::DEFAULT)
|
|
58
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
59
|
+
.query_param(new_parameter(market, key: 'market'))
|
|
60
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
61
|
+
.auth(Single.new('oauth_2_0')))
|
|
62
|
+
.response(new_response_handler
|
|
63
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
64
|
+
.deserialize_into(ManyChapters.method(:from_hash))
|
|
65
|
+
.is_api_response(true)
|
|
66
|
+
.local_error('401',
|
|
67
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
68
|
+
' token or\nthe access token has expired. You should'\
|
|
69
|
+
' re-authenticate the user.\n",
|
|
70
|
+
UnauthorizedException)
|
|
71
|
+
.local_error('403',
|
|
72
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
73
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
74
|
+
' won't help here.\n",
|
|
75
|
+
ForbiddenException)
|
|
76
|
+
.local_error('429',
|
|
77
|
+
"The app has exceeded its rate limits.\n",
|
|
78
|
+
TooManyRequestsException))
|
|
79
|
+
.execute
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|