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.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +30 -0
  3. data/README.md +170 -0
  4. data/bin/console +15 -0
  5. data/lib/spotify_web_api/api_helper.rb +10 -0
  6. data/lib/spotify_web_api/client.rb +165 -0
  7. data/lib/spotify_web_api/configuration.rb +244 -0
  8. data/lib/spotify_web_api/controllers/albums_controller.rb +297 -0
  9. data/lib/spotify_web_api/controllers/artists_controller.rb +188 -0
  10. data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
  11. data/lib/spotify_web_api/controllers/base_controller.rb +60 -0
  12. data/lib/spotify_web_api/controllers/categories_controller.rb +84 -0
  13. data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
  14. data/lib/spotify_web_api/controllers/episodes_controller.rb +241 -0
  15. data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
  16. data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
  17. data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
  18. data/lib/spotify_web_api/controllers/player_controller.rb +525 -0
  19. data/lib/spotify_web_api/controllers/playlists_controller.rb +538 -0
  20. data/lib/spotify_web_api/controllers/search_controller.rb +61 -0
  21. data/lib/spotify_web_api/controllers/shows_controller.rb +263 -0
  22. data/lib/spotify_web_api/controllers/tracks_controller.rb +534 -0
  23. data/lib/spotify_web_api/controllers/users_controller.rb +402 -0
  24. data/lib/spotify_web_api/exceptions/api_exception.rb +21 -0
  25. data/lib/spotify_web_api/exceptions/bad_request_exception.rb +46 -0
  26. data/lib/spotify_web_api/exceptions/forbidden_exception.rb +46 -0
  27. data/lib/spotify_web_api/exceptions/not_found_exception.rb +46 -0
  28. data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +64 -0
  29. data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +46 -0
  30. data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +46 -0
  31. data/lib/spotify_web_api/http/api_response.rb +19 -0
  32. data/lib/spotify_web_api/http/auth/o_auth2.rb +164 -0
  33. data/lib/spotify_web_api/http/http_call_back.rb +10 -0
  34. data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
  35. data/lib/spotify_web_api/http/http_request.rb +10 -0
  36. data/lib/spotify_web_api/http/http_response.rb +10 -0
  37. data/lib/spotify_web_api/http/proxy_settings.rb +22 -0
  38. data/lib/spotify_web_api/models/album_base.rb +189 -0
  39. data/lib/spotify_web_api/models/album_group_enum.rb +44 -0
  40. data/lib/spotify_web_api/models/album_object.rb +273 -0
  41. data/lib/spotify_web_api/models/album_restriction_object.rb +75 -0
  42. data/lib/spotify_web_api/models/album_type_enum.rb +40 -0
  43. data/lib/spotify_web_api/models/artist_discography_album_object.rb +216 -0
  44. data/lib/spotify_web_api/models/artist_object.rb +174 -0
  45. data/lib/spotify_web_api/models/audio_analysis_object.rb +171 -0
  46. data/lib/spotify_web_api/models/audio_features_object.rb +273 -0
  47. data/lib/spotify_web_api/models/audiobook_base.rb +270 -0
  48. data/lib/spotify_web_api/models/audiobook_object.rb +278 -0
  49. data/lib/spotify_web_api/models/author_object.rb +62 -0
  50. data/lib/spotify_web_api/models/base_model.rb +110 -0
  51. data/lib/spotify_web_api/models/categories.rb +125 -0
  52. data/lib/spotify_web_api/models/category_object.rb +95 -0
  53. data/lib/spotify_web_api/models/chapter_base.rb +265 -0
  54. data/lib/spotify_web_api/models/chapter_object.rb +273 -0
  55. data/lib/spotify_web_api/models/chapter_restriction_object.rb +71 -0
  56. data/lib/spotify_web_api/models/context_object.rb +102 -0
  57. data/lib/spotify_web_api/models/copyright_object.rb +82 -0
  58. data/lib/spotify_web_api/models/currently_playing_context_object.rb +168 -0
  59. data/lib/spotify_web_api/models/currently_playing_object.rb +138 -0
  60. data/lib/spotify_web_api/models/cursor_object.rb +71 -0
  61. data/lib/spotify_web_api/models/cursor_paged_artists.rb +60 -0
  62. data/lib/spotify_web_api/models/cursor_paging_object.rb +102 -0
  63. data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +120 -0
  64. data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +120 -0
  65. data/lib/spotify_web_api/models/device_object.rb +153 -0
  66. data/lib/spotify_web_api/models/disallows_object.rb +171 -0
  67. data/lib/spotify_web_api/models/episode_base.rb +263 -0
  68. data/lib/spotify_web_api/models/episode_object.rb +368 -0
  69. data/lib/spotify_web_api/models/episode_restriction_object.rb +80 -0
  70. data/lib/spotify_web_api/models/error_object.rb +71 -0
  71. data/lib/spotify_web_api/models/explicit_content_settings_object.rb +74 -0
  72. data/lib/spotify_web_api/models/external_id_object.rb +94 -0
  73. data/lib/spotify_web_api/models/external_url_object.rb +73 -0
  74. data/lib/spotify_web_api/models/followers_object.rb +84 -0
  75. data/lib/spotify_web_api/models/image_object.rb +106 -0
  76. data/lib/spotify_web_api/models/include_external_enum.rb +29 -0
  77. data/lib/spotify_web_api/models/item_type1_enum.rb +26 -0
  78. data/lib/spotify_web_api/models/item_type2_enum.rb +36 -0
  79. data/lib/spotify_web_api/models/item_type3_enum.rb +36 -0
  80. data/lib/spotify_web_api/models/item_type_enum.rb +56 -0
  81. data/lib/spotify_web_api/models/linked_track_object.rb +113 -0
  82. data/lib/spotify_web_api/models/many_albums.rb +69 -0
  83. data/lib/spotify_web_api/models/many_artists.rb +69 -0
  84. data/lib/spotify_web_api/models/many_audio_features.rb +69 -0
  85. data/lib/spotify_web_api/models/many_audiobooks.rb +69 -0
  86. data/lib/spotify_web_api/models/many_chapters.rb +69 -0
  87. data/lib/spotify_web_api/models/many_devices.rb +69 -0
  88. data/lib/spotify_web_api/models/many_episodes.rb +69 -0
  89. data/lib/spotify_web_api/models/many_genres.rb +60 -0
  90. data/lib/spotify_web_api/models/many_simplified_shows.rb +69 -0
  91. data/lib/spotify_web_api/models/many_tracks.rb +69 -0
  92. data/lib/spotify_web_api/models/markets.rb +62 -0
  93. data/lib/spotify_web_api/models/me_albums_request.rb +67 -0
  94. data/lib/spotify_web_api/models/me_episodes_request.rb +64 -0
  95. data/lib/spotify_web_api/models/me_episodes_request1.rb +66 -0
  96. data/lib/spotify_web_api/models/me_following_request.rb +65 -0
  97. data/lib/spotify_web_api/models/me_following_request1.rb +67 -0
  98. data/lib/spotify_web_api/models/me_player_play_request.rb +103 -0
  99. data/lib/spotify_web_api/models/me_player_request.rb +75 -0
  100. data/lib/spotify_web_api/models/me_shows_request.rb +67 -0
  101. data/lib/spotify_web_api/models/me_tracks_request.rb +65 -0
  102. data/lib/spotify_web_api/models/me_tracks_request1.rb +67 -0
  103. data/lib/spotify_web_api/models/meta.rb +127 -0
  104. data/lib/spotify_web_api/models/mode_enum.rb +50 -0
  105. data/lib/spotify_web_api/models/narrator_object.rb +62 -0
  106. data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +62 -0
  107. data/lib/spotify_web_api/models/o_auth_scope_enum.rb +124 -0
  108. data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
  109. data/lib/spotify_web_api/models/paged_albums.rb +60 -0
  110. data/lib/spotify_web_api/models/paged_categories.rb +60 -0
  111. data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +125 -0
  112. data/lib/spotify_web_api/models/paging_artist_object.rb +125 -0
  113. data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +71 -0
  114. data/lib/spotify_web_api/models/paging_object.rb +107 -0
  115. data/lib/spotify_web_api/models/paging_playlist_object.rb +125 -0
  116. data/lib/spotify_web_api/models/paging_playlist_track_object.rb +125 -0
  117. data/lib/spotify_web_api/models/paging_saved_album_object.rb +125 -0
  118. data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +125 -0
  119. data/lib/spotify_web_api/models/paging_saved_episode_object.rb +125 -0
  120. data/lib/spotify_web_api/models/paging_saved_show_object.rb +125 -0
  121. data/lib/spotify_web_api/models/paging_saved_track_object.rb +125 -0
  122. data/lib/spotify_web_api/models/paging_simplified_album_object.rb +125 -0
  123. data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +125 -0
  124. data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +125 -0
  125. data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +125 -0
  126. data/lib/spotify_web_api/models/paging_simplified_show_object.rb +125 -0
  127. data/lib/spotify_web_api/models/paging_simplified_track_object.rb +125 -0
  128. data/lib/spotify_web_api/models/paging_track_object.rb +125 -0
  129. data/lib/spotify_web_api/models/play_history_object.rb +90 -0
  130. data/lib/spotify_web_api/models/playlist_object.rb +213 -0
  131. data/lib/spotify_web_api/models/playlist_owner_object.rb +124 -0
  132. data/lib/spotify_web_api/models/playlist_snapshot_id.rb +62 -0
  133. data/lib/spotify_web_api/models/playlist_track_object.rb +116 -0
  134. data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +72 -0
  135. data/lib/spotify_web_api/models/playlist_user_object.rb +122 -0
  136. data/lib/spotify_web_api/models/playlists_followers_request.rb +63 -0
  137. data/lib/spotify_web_api/models/playlists_request.rb +96 -0
  138. data/lib/spotify_web_api/models/playlists_tracks_request.rb +84 -0
  139. data/lib/spotify_web_api/models/playlists_tracks_request1.rb +112 -0
  140. data/lib/spotify_web_api/models/playlists_tracks_request2.rb +87 -0
  141. data/lib/spotify_web_api/models/private_user_object.rb +200 -0
  142. data/lib/spotify_web_api/models/public_user_object.rb +144 -0
  143. data/lib/spotify_web_api/models/queue_object.rb +86 -0
  144. data/lib/spotify_web_api/models/reason_enum.rb +43 -0
  145. data/lib/spotify_web_api/models/recommendation_seed_object.rb +120 -0
  146. data/lib/spotify_web_api/models/recommendations_object.rb +86 -0
  147. data/lib/spotify_web_api/models/release_date_precision_enum.rb +40 -0
  148. data/lib/spotify_web_api/models/resume_point_object.rb +84 -0
  149. data/lib/spotify_web_api/models/saved_album_object.rb +85 -0
  150. data/lib/spotify_web_api/models/saved_audiobook_object.rb +85 -0
  151. data/lib/spotify_web_api/models/saved_episode_object.rb +82 -0
  152. data/lib/spotify_web_api/models/saved_show_object.rb +85 -0
  153. data/lib/spotify_web_api/models/saved_track_object.rb +85 -0
  154. data/lib/spotify_web_api/models/search_items.rb +122 -0
  155. data/lib/spotify_web_api/models/section_object.rb +201 -0
  156. data/lib/spotify_web_api/models/segment_object.rb +184 -0
  157. data/lib/spotify_web_api/models/show_base.rb +327 -0
  158. data/lib/spotify_web_api/models/show_object.rb +243 -0
  159. data/lib/spotify_web_api/models/simplified_album_object.rb +284 -0
  160. data/lib/spotify_web_api/models/simplified_artist_object.rb +122 -0
  161. data/lib/spotify_web_api/models/simplified_playlist_object.rb +203 -0
  162. data/lib/spotify_web_api/models/simplified_track_object.rb +251 -0
  163. data/lib/spotify_web_api/models/time_interval_object.rb +81 -0
  164. data/lib/spotify_web_api/models/track.rb +367 -0
  165. data/lib/spotify_web_api/models/track1.rb +62 -0
  166. data/lib/spotify_web_api/models/track_object.rb +301 -0
  167. data/lib/spotify_web_api/models/track_restriction_object.rb +80 -0
  168. data/lib/spotify_web_api/models/type2_enum.rb +26 -0
  169. data/lib/spotify_web_api/models/type3_enum.rb +26 -0
  170. data/lib/spotify_web_api/models/type4_enum.rb +26 -0
  171. data/lib/spotify_web_api/models/type5_enum.rb +26 -0
  172. data/lib/spotify_web_api/models/type6_enum.rb +26 -0
  173. data/lib/spotify_web_api/models/type8_enum.rb +26 -0
  174. data/lib/spotify_web_api/models/type9_enum.rb +26 -0
  175. data/lib/spotify_web_api/models/type_enum.rb +26 -0
  176. data/lib/spotify_web_api/models/users_playlists_request.rb +101 -0
  177. data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
  178. data/lib/spotify_web_api/utilities/file_wrapper.rb +28 -0
  179. data/lib/spotify_web_api/utilities/union_type_lookup.rb +73 -0
  180. data/lib/spotify_web_api.rb +200 -0
  181. metadata +264 -0
@@ -0,0 +1,525 @@
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
+ # PlayerController
8
+ class PlayerController < BaseController
9
+ # Get information about the user’s current playback state, including track
10
+ # or episode, progress, and active device.
11
+ # @param [String] market Optional parameter: TODO: type description here
12
+ # @param [String] additional_types Optional parameter: TODO: type
13
+ # description here
14
+ # @return [ApiResponse] Complete http response with raw body and status code.
15
+ def get_information_about_the_users_current_playback(market: nil,
16
+ additional_types: nil)
17
+ @api_call
18
+ .request(new_request_builder(HttpMethodEnum::GET,
19
+ '/me/player',
20
+ Server::DEFAULT)
21
+ .query_param(new_parameter(market, key: 'market'))
22
+ .query_param(new_parameter(additional_types, key: 'additional_types'))
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(CurrentlyPlayingContextObject.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
+ # Transfer playback to a new device and optionally begin playback. This API
46
+ # only works for users who have Spotify Premium. The order of execution is
47
+ # not guaranteed when you use this API with other Player API endpoints.
48
+ # @param [MePlayerRequest] body Optional parameter: TODO: type description
49
+ # here
50
+ # @return [ApiResponse] Complete http response with raw body and status code.
51
+ def transfer_a_users_playback(body: nil)
52
+ @api_call
53
+ .request(new_request_builder(HttpMethodEnum::PUT,
54
+ '/me/player',
55
+ Server::DEFAULT)
56
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
57
+ .body_param(new_parameter(body))
58
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
59
+ .auth(Single.new('oauth_2_0')))
60
+ .response(new_response_handler
61
+ .is_response_void(true)
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 information about a user’s available Spotify Connect devices. Some
80
+ # device models are not supported and will not be listed in the API
81
+ # response.
82
+ # @return [ApiResponse] Complete http response with raw body and status code.
83
+ def get_a_users_available_devices
84
+ @api_call
85
+ .request(new_request_builder(HttpMethodEnum::GET,
86
+ '/me/player/devices',
87
+ Server::DEFAULT)
88
+ .header_param(new_parameter('application/json', key: 'accept'))
89
+ .auth(Single.new('oauth_2_0')))
90
+ .response(new_response_handler
91
+ .deserializer(APIHelper.method(:custom_type_deserializer))
92
+ .deserialize_into(ManyDevices.method(:from_hash))
93
+ .is_api_response(true)
94
+ .local_error('401',
95
+ "Bad or expired token. This can happen if the user revoked a'\
96
+ ' token or\nthe access token has expired. You should'\
97
+ ' re-authenticate the user.\n",
98
+ UnauthorizedException)
99
+ .local_error('403',
100
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
101
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
102
+ ' won't help here.\n",
103
+ ForbiddenException)
104
+ .local_error('429',
105
+ "The app has exceeded its rate limits.\n",
106
+ TooManyRequestsException))
107
+ .execute
108
+ end
109
+
110
+ # Get the object currently being played on the user's Spotify account.
111
+ # @param [String] market Optional parameter: TODO: type description here
112
+ # @param [String] additional_types Optional parameter: TODO: type
113
+ # description here
114
+ # @return [ApiResponse] Complete http response with raw body and status code.
115
+ def get_the_users_currently_playing_track(market: nil,
116
+ additional_types: nil)
117
+ @api_call
118
+ .request(new_request_builder(HttpMethodEnum::GET,
119
+ '/me/player/currently-playing',
120
+ Server::DEFAULT)
121
+ .query_param(new_parameter(market, key: 'market'))
122
+ .query_param(new_parameter(additional_types, key: 'additional_types'))
123
+ .header_param(new_parameter('application/json', key: 'accept'))
124
+ .auth(Single.new('oauth_2_0')))
125
+ .response(new_response_handler
126
+ .deserializer(APIHelper.method(:custom_type_deserializer))
127
+ .deserialize_into(CurrentlyPlayingObject.method(:from_hash))
128
+ .is_api_response(true)
129
+ .local_error('401',
130
+ "Bad or expired token. This can happen if the user revoked a'\
131
+ ' token or\nthe access token has expired. You should'\
132
+ ' re-authenticate the user.\n",
133
+ UnauthorizedException)
134
+ .local_error('403',
135
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
136
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
137
+ ' won't help here.\n",
138
+ ForbiddenException)
139
+ .local_error('429',
140
+ "The app has exceeded its rate limits.\n",
141
+ TooManyRequestsException))
142
+ .execute
143
+ end
144
+
145
+ # Start a new context or resume current playback on the user's active
146
+ # device. This API only works for users who have Spotify Premium. The order
147
+ # of execution is not guaranteed when you use this API with other Player API
148
+ # endpoints.
149
+ # @param [String] device_id Optional parameter: TODO: type description
150
+ # here
151
+ # @param [MePlayerPlayRequest] body Optional parameter: TODO: type
152
+ # description here
153
+ # @return [ApiResponse] Complete http response with raw body and status code.
154
+ def start_a_users_playback(device_id: nil,
155
+ body: nil)
156
+ @api_call
157
+ .request(new_request_builder(HttpMethodEnum::PUT,
158
+ '/me/player/play',
159
+ Server::DEFAULT)
160
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
161
+ .query_param(new_parameter(device_id, key: 'device_id'))
162
+ .body_param(new_parameter(body))
163
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
164
+ .auth(Single.new('oauth_2_0')))
165
+ .response(new_response_handler
166
+ .is_response_void(true)
167
+ .is_api_response(true)
168
+ .local_error('401',
169
+ "Bad or expired token. This can happen if the user revoked a'\
170
+ ' token or\nthe access token has expired. You should'\
171
+ ' re-authenticate the user.\n",
172
+ UnauthorizedException)
173
+ .local_error('403',
174
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
175
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
176
+ ' won't help here.\n",
177
+ ForbiddenException)
178
+ .local_error('429',
179
+ "The app has exceeded its rate limits.\n",
180
+ TooManyRequestsException))
181
+ .execute
182
+ end
183
+
184
+ # Pause playback on the user's account. This API only works for users who
185
+ # have Spotify Premium. The order of execution is not guaranteed when you
186
+ # use this API with other Player API endpoints.
187
+ # @param [String] device_id Optional parameter: TODO: type description
188
+ # here
189
+ # @return [ApiResponse] Complete http response with raw body and status code.
190
+ def pause_a_users_playback(device_id: nil)
191
+ @api_call
192
+ .request(new_request_builder(HttpMethodEnum::PUT,
193
+ '/me/player/pause',
194
+ Server::DEFAULT)
195
+ .query_param(new_parameter(device_id, key: 'device_id'))
196
+ .auth(Single.new('oauth_2_0')))
197
+ .response(new_response_handler
198
+ .is_response_void(true)
199
+ .is_api_response(true)
200
+ .local_error('401',
201
+ "Bad or expired token. This can happen if the user revoked a'\
202
+ ' token or\nthe access token has expired. You should'\
203
+ ' re-authenticate the user.\n",
204
+ UnauthorizedException)
205
+ .local_error('403',
206
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
207
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
208
+ ' won't help here.\n",
209
+ ForbiddenException)
210
+ .local_error('429',
211
+ "The app has exceeded its rate limits.\n",
212
+ TooManyRequestsException))
213
+ .execute
214
+ end
215
+
216
+ # Skips to next track in the user’s queue. This API only works for users who
217
+ # have Spotify Premium. The order of execution is not guaranteed when you
218
+ # use this API with other Player API endpoints.
219
+ # @param [String] device_id Optional parameter: TODO: type description
220
+ # here
221
+ # @return [ApiResponse] Complete http response with raw body and status code.
222
+ def skip_users_playback_to_next_track(device_id: nil)
223
+ @api_call
224
+ .request(new_request_builder(HttpMethodEnum::POST,
225
+ '/me/player/next',
226
+ Server::DEFAULT)
227
+ .query_param(new_parameter(device_id, key: 'device_id'))
228
+ .auth(Single.new('oauth_2_0')))
229
+ .response(new_response_handler
230
+ .is_response_void(true)
231
+ .is_api_response(true)
232
+ .local_error('401',
233
+ "Bad or expired token. This can happen if the user revoked a'\
234
+ ' token or\nthe access token has expired. You should'\
235
+ ' re-authenticate the user.\n",
236
+ UnauthorizedException)
237
+ .local_error('403',
238
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
239
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
240
+ ' won't help here.\n",
241
+ ForbiddenException)
242
+ .local_error('429',
243
+ "The app has exceeded its rate limits.\n",
244
+ TooManyRequestsException))
245
+ .execute
246
+ end
247
+
248
+ # Skips to previous track in the user’s queue. This API only works for users
249
+ # who have Spotify Premium. The order of execution is not guaranteed when
250
+ # you use this API with other Player API endpoints.
251
+ # @param [String] device_id Optional parameter: TODO: type description
252
+ # here
253
+ # @return [ApiResponse] Complete http response with raw body and status code.
254
+ def skip_users_playback_to_previous_track(device_id: nil)
255
+ @api_call
256
+ .request(new_request_builder(HttpMethodEnum::POST,
257
+ '/me/player/previous',
258
+ Server::DEFAULT)
259
+ .query_param(new_parameter(device_id, key: 'device_id'))
260
+ .auth(Single.new('oauth_2_0')))
261
+ .response(new_response_handler
262
+ .is_response_void(true)
263
+ .is_api_response(true)
264
+ .local_error('401',
265
+ "Bad or expired token. This can happen if the user revoked a'\
266
+ ' token or\nthe access token has expired. You should'\
267
+ ' re-authenticate the user.\n",
268
+ UnauthorizedException)
269
+ .local_error('403',
270
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
271
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
272
+ ' won't help here.\n",
273
+ ForbiddenException)
274
+ .local_error('429',
275
+ "The app has exceeded its rate limits.\n",
276
+ TooManyRequestsException))
277
+ .execute
278
+ end
279
+
280
+ # Seeks to the given position in the user’s currently playing track. This
281
+ # API only works for users who have Spotify Premium. The order of execution
282
+ # is not guaranteed when you use this API with other Player API endpoints.
283
+ # @param [Integer] position_ms Required parameter: TODO: type description
284
+ # here
285
+ # @param [String] device_id Optional parameter: TODO: type description
286
+ # here
287
+ # @return [ApiResponse] Complete http response with raw body and status code.
288
+ def seek_to_position_in_currently_playing_track(position_ms,
289
+ device_id: nil)
290
+ @api_call
291
+ .request(new_request_builder(HttpMethodEnum::PUT,
292
+ '/me/player/seek',
293
+ Server::DEFAULT)
294
+ .query_param(new_parameter(position_ms, key: 'position_ms'))
295
+ .query_param(new_parameter(device_id, key: 'device_id'))
296
+ .auth(Single.new('oauth_2_0')))
297
+ .response(new_response_handler
298
+ .is_response_void(true)
299
+ .is_api_response(true)
300
+ .local_error('401',
301
+ "Bad or expired token. This can happen if the user revoked a'\
302
+ ' token or\nthe access token has expired. You should'\
303
+ ' re-authenticate the user.\n",
304
+ UnauthorizedException)
305
+ .local_error('403',
306
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
307
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
308
+ ' won't help here.\n",
309
+ ForbiddenException)
310
+ .local_error('429',
311
+ "The app has exceeded its rate limits.\n",
312
+ TooManyRequestsException))
313
+ .execute
314
+ end
315
+
316
+ # Set the repeat mode for the user's playback. This API only works for users
317
+ # who have Spotify Premium. The order of execution is not guaranteed when
318
+ # you use this API with other Player API endpoints.
319
+ # @param [String] state Required parameter: TODO: type description here
320
+ # @param [String] device_id Optional parameter: TODO: type description
321
+ # here
322
+ # @return [ApiResponse] Complete http response with raw body and status code.
323
+ def set_repeat_mode_on_users_playback(state,
324
+ device_id: nil)
325
+ @api_call
326
+ .request(new_request_builder(HttpMethodEnum::PUT,
327
+ '/me/player/repeat',
328
+ Server::DEFAULT)
329
+ .query_param(new_parameter(state, key: 'state'))
330
+ .query_param(new_parameter(device_id, key: 'device_id'))
331
+ .auth(Single.new('oauth_2_0')))
332
+ .response(new_response_handler
333
+ .is_response_void(true)
334
+ .is_api_response(true)
335
+ .local_error('401',
336
+ "Bad or expired token. This can happen if the user revoked a'\
337
+ ' token or\nthe access token has expired. You should'\
338
+ ' re-authenticate the user.\n",
339
+ UnauthorizedException)
340
+ .local_error('403',
341
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
342
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
343
+ ' won't help here.\n",
344
+ ForbiddenException)
345
+ .local_error('429',
346
+ "The app has exceeded its rate limits.\n",
347
+ TooManyRequestsException))
348
+ .execute
349
+ end
350
+
351
+ # Set the volume for the user’s current playback device. This API only works
352
+ # for users who have Spotify Premium. The order of execution is not
353
+ # guaranteed when you use this API with other Player API endpoints.
354
+ # @param [Integer] volume_percent Required parameter: TODO: type description
355
+ # here
356
+ # @param [String] device_id Optional parameter: TODO: type description
357
+ # here
358
+ # @return [ApiResponse] Complete http response with raw body and status code.
359
+ def set_volume_for_users_playback(volume_percent,
360
+ device_id: nil)
361
+ @api_call
362
+ .request(new_request_builder(HttpMethodEnum::PUT,
363
+ '/me/player/volume',
364
+ Server::DEFAULT)
365
+ .query_param(new_parameter(volume_percent, key: 'volume_percent'))
366
+ .query_param(new_parameter(device_id, key: 'device_id'))
367
+ .auth(Single.new('oauth_2_0')))
368
+ .response(new_response_handler
369
+ .is_response_void(true)
370
+ .is_api_response(true)
371
+ .local_error('401',
372
+ "Bad or expired token. This can happen if the user revoked a'\
373
+ ' token or\nthe access token has expired. You should'\
374
+ ' re-authenticate the user.\n",
375
+ UnauthorizedException)
376
+ .local_error('403',
377
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
378
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
379
+ ' won't help here.\n",
380
+ ForbiddenException)
381
+ .local_error('429',
382
+ "The app has exceeded its rate limits.\n",
383
+ TooManyRequestsException))
384
+ .execute
385
+ end
386
+
387
+ # Toggle shuffle on or off for user’s playback. This API only works for
388
+ # users who have Spotify Premium. The order of execution is not guaranteed
389
+ # when you use this API with other Player API endpoints.
390
+ # @param [TrueClass | FalseClass] state Required parameter: TODO: type
391
+ # description here
392
+ # @param [String] device_id Optional parameter: TODO: type description
393
+ # here
394
+ # @return [ApiResponse] Complete http response with raw body and status code.
395
+ def toggle_shuffle_for_users_playback(state,
396
+ device_id: nil)
397
+ @api_call
398
+ .request(new_request_builder(HttpMethodEnum::PUT,
399
+ '/me/player/shuffle',
400
+ Server::DEFAULT)
401
+ .query_param(new_parameter(state, key: 'state'))
402
+ .query_param(new_parameter(device_id, key: 'device_id'))
403
+ .auth(Single.new('oauth_2_0')))
404
+ .response(new_response_handler
405
+ .is_response_void(true)
406
+ .is_api_response(true)
407
+ .local_error('401',
408
+ "Bad or expired token. This can happen if the user revoked a'\
409
+ ' token or\nthe access token has expired. You should'\
410
+ ' re-authenticate the user.\n",
411
+ UnauthorizedException)
412
+ .local_error('403',
413
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
414
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
415
+ ' won't help here.\n",
416
+ ForbiddenException)
417
+ .local_error('429',
418
+ "The app has exceeded its rate limits.\n",
419
+ TooManyRequestsException))
420
+ .execute
421
+ end
422
+
423
+ # Get tracks from the current user's recently played tracks.
424
+ # _**Note**: Currently doesn't support podcast episodes._
425
+ # @param [Integer] limit Optional parameter: Example:20
426
+ # @param [Integer] after Optional parameter: TODO: type description here
427
+ # @param [Integer] before Optional parameter: TODO: type description here
428
+ # @return [ApiResponse] Complete http response with raw body and status code.
429
+ def get_recently_played(limit: 20,
430
+ after: nil,
431
+ before: nil)
432
+ @api_call
433
+ .request(new_request_builder(HttpMethodEnum::GET,
434
+ '/me/player/recently-played',
435
+ Server::DEFAULT)
436
+ .query_param(new_parameter(limit, key: 'limit'))
437
+ .query_param(new_parameter(after, key: 'after'))
438
+ .query_param(new_parameter(before, key: 'before'))
439
+ .header_param(new_parameter('application/json', key: 'accept'))
440
+ .auth(Single.new('oauth_2_0')))
441
+ .response(new_response_handler
442
+ .deserializer(APIHelper.method(:custom_type_deserializer))
443
+ .deserialize_into(CursorPagingPlayHistoryObject.method(:from_hash))
444
+ .is_api_response(true)
445
+ .local_error('401',
446
+ "Bad or expired token. This can happen if the user revoked a'\
447
+ ' token or\nthe access token has expired. You should'\
448
+ ' re-authenticate the user.\n",
449
+ UnauthorizedException)
450
+ .local_error('403',
451
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
452
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
453
+ ' won't help here.\n",
454
+ ForbiddenException)
455
+ .local_error('429',
456
+ "The app has exceeded its rate limits.\n",
457
+ TooManyRequestsException))
458
+ .execute
459
+ end
460
+
461
+ # Get the list of objects that make up the user's queue.
462
+ # @return [ApiResponse] Complete http response with raw body and status code.
463
+ def get_queue
464
+ @api_call
465
+ .request(new_request_builder(HttpMethodEnum::GET,
466
+ '/me/player/queue',
467
+ Server::DEFAULT)
468
+ .header_param(new_parameter('application/json', key: 'accept'))
469
+ .auth(Single.new('oauth_2_0')))
470
+ .response(new_response_handler
471
+ .deserializer(APIHelper.method(:custom_type_deserializer))
472
+ .deserialize_into(QueueObject.method(:from_hash))
473
+ .is_api_response(true)
474
+ .local_error('401',
475
+ "Bad or expired token. This can happen if the user revoked a'\
476
+ ' token or\nthe access token has expired. You should'\
477
+ ' re-authenticate the user.\n",
478
+ UnauthorizedException)
479
+ .local_error('403',
480
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
481
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
482
+ ' won't help here.\n",
483
+ ForbiddenException)
484
+ .local_error('429',
485
+ "The app has exceeded its rate limits.\n",
486
+ TooManyRequestsException))
487
+ .execute
488
+ end
489
+
490
+ # Add an item to the end of the user's current playback queue. This API only
491
+ # works for users who have Spotify Premium. The order of execution is not
492
+ # guaranteed when you use this API with other Player API endpoints.
493
+ # @param [String] uri Required parameter: TODO: type description here
494
+ # @param [String] device_id Optional parameter: TODO: type description
495
+ # here
496
+ # @return [ApiResponse] Complete http response with raw body and status code.
497
+ def add_to_queue(uri,
498
+ device_id: nil)
499
+ @api_call
500
+ .request(new_request_builder(HttpMethodEnum::POST,
501
+ '/me/player/queue',
502
+ Server::DEFAULT)
503
+ .query_param(new_parameter(uri, key: 'uri'))
504
+ .query_param(new_parameter(device_id, key: 'device_id'))
505
+ .auth(Single.new('oauth_2_0')))
506
+ .response(new_response_handler
507
+ .is_response_void(true)
508
+ .is_api_response(true)
509
+ .local_error('401',
510
+ "Bad or expired token. This can happen if the user revoked a'\
511
+ ' token or\nthe access token has expired. You should'\
512
+ ' re-authenticate the user.\n",
513
+ UnauthorizedException)
514
+ .local_error('403',
515
+ "Bad OAuth request (wrong consumer key, bad nonce, expired'\
516
+ '\ntimestamp...). Unfortunately, re-authenticating the user'\
517
+ ' won't help here.\n",
518
+ ForbiddenException)
519
+ .local_error('429',
520
+ "The app has exceeded its rate limits.\n",
521
+ TooManyRequestsException))
522
+ .execute
523
+ end
524
+ end
525
+ end