spotify-api-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +30 -0
- data/README.md +107 -0
- data/lib/spotify_web_api/api_helper.rb +10 -0
- data/lib/spotify_web_api/client.rb +154 -0
- data/lib/spotify_web_api/configuration.rb +180 -0
- data/lib/spotify_web_api/controllers/albums_controller.rb +295 -0
- data/lib/spotify_web_api/controllers/artists_controller.rb +187 -0
- data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
- data/lib/spotify_web_api/controllers/base_controller.rb +66 -0
- data/lib/spotify_web_api/controllers/categories_controller.rb +83 -0
- data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/episodes_controller.rb +239 -0
- data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
- data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
- data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
- data/lib/spotify_web_api/controllers/player_controller.rb +509 -0
- data/lib/spotify_web_api/controllers/playlists_controller.rb +521 -0
- data/lib/spotify_web_api/controllers/search_controller.rb +60 -0
- data/lib/spotify_web_api/controllers/shows_controller.rb +261 -0
- data/lib/spotify_web_api/controllers/tracks_controller.rb +491 -0
- data/lib/spotify_web_api/controllers/users_controller.rb +396 -0
- data/lib/spotify_web_api/exceptions/api_exception.rb +10 -0
- data/lib/spotify_web_api/exceptions/bad_request_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/forbidden_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/not_found_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +32 -0
- data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +32 -0
- data/lib/spotify_web_api/http/api_response.rb +21 -0
- data/lib/spotify_web_api/http/auth/o_auth2.rb +146 -0
- data/lib/spotify_web_api/http/http_call_back.rb +10 -0
- data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
- data/lib/spotify_web_api/http/http_request.rb +10 -0
- data/lib/spotify_web_api/http/http_response.rb +10 -0
- data/lib/spotify_web_api/models/album_base.rb +168 -0
- data/lib/spotify_web_api/models/album_group_enum.rb +29 -0
- data/lib/spotify_web_api/models/album_object.rb +247 -0
- data/lib/spotify_web_api/models/album_restriction_object.rb +53 -0
- data/lib/spotify_web_api/models/album_type_enum.rb +26 -0
- data/lib/spotify_web_api/models/artist_discography_album_object.rb +194 -0
- data/lib/spotify_web_api/models/artist_object.rb +147 -0
- data/lib/spotify_web_api/models/audio_analysis_object.rb +156 -0
- data/lib/spotify_web_api/models/audio_features_object.rb +249 -0
- data/lib/spotify_web_api/models/audiobook_base.rb +245 -0
- data/lib/spotify_web_api/models/audiobook_object.rb +253 -0
- data/lib/spotify_web_api/models/author_object.rb +50 -0
- data/lib/spotify_web_api/models/base_model.rb +62 -0
- data/lib/spotify_web_api/models/categories.rb +110 -0
- data/lib/spotify_web_api/models/category_object.rb +82 -0
- data/lib/spotify_web_api/models/chapter_base.rb +237 -0
- data/lib/spotify_web_api/models/chapter_object.rb +245 -0
- data/lib/spotify_web_api/models/chapter_restriction_object.rb +59 -0
- data/lib/spotify_web_api/models/context_object.rb +78 -0
- data/lib/spotify_web_api/models/copyright_object.rb +60 -0
- data/lib/spotify_web_api/models/currently_playing_context_object.rb +137 -0
- data/lib/spotify_web_api/models/currently_playing_object.rb +109 -0
- data/lib/spotify_web_api/models/cursor_object.rb +59 -0
- data/lib/spotify_web_api/models/cursor_paged_artists.rb +48 -0
- data/lib/spotify_web_api/models/cursor_paging_object.rb +88 -0
- data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +106 -0
- data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +106 -0
- data/lib/spotify_web_api/models/device_object.rb +126 -0
- data/lib/spotify_web_api/models/disallows_object.rb +140 -0
- data/lib/spotify_web_api/models/episode_base.rb +237 -0
- data/lib/spotify_web_api/models/episode_object.rb +246 -0
- data/lib/spotify_web_api/models/episode_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/error_object.rb +59 -0
- data/lib/spotify_web_api/models/explicit_content_settings_object.rb +61 -0
- data/lib/spotify_web_api/models/external_id_object.rb +72 -0
- data/lib/spotify_web_api/models/external_url_object.rb +51 -0
- data/lib/spotify_web_api/models/followers_object.rb +62 -0
- data/lib/spotify_web_api/models/image_object.rb +67 -0
- data/lib/spotify_web_api/models/include_external_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type1_enum.rb +20 -0
- data/lib/spotify_web_api/models/item_type2_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type3_enum.rb +23 -0
- data/lib/spotify_web_api/models/item_type_enum.rb +38 -0
- data/lib/spotify_web_api/models/linked_track_object.rb +89 -0
- data/lib/spotify_web_api/models/many_albums.rb +57 -0
- data/lib/spotify_web_api/models/many_artists.rb +57 -0
- data/lib/spotify_web_api/models/many_audio_features.rb +57 -0
- data/lib/spotify_web_api/models/many_audiobooks.rb +57 -0
- data/lib/spotify_web_api/models/many_chapters.rb +57 -0
- data/lib/spotify_web_api/models/many_devices.rb +57 -0
- data/lib/spotify_web_api/models/many_episodes.rb +57 -0
- data/lib/spotify_web_api/models/many_genres.rb +48 -0
- data/lib/spotify_web_api/models/many_simplified_shows.rb +57 -0
- data/lib/spotify_web_api/models/many_tracks.rb +57 -0
- data/lib/spotify_web_api/models/markets.rb +50 -0
- data/lib/spotify_web_api/models/me_albums_request.rb +55 -0
- data/lib/spotify_web_api/models/me_episodes_request.rb +52 -0
- data/lib/spotify_web_api/models/me_episodes_request1.rb +54 -0
- data/lib/spotify_web_api/models/me_following_request.rb +53 -0
- data/lib/spotify_web_api/models/me_following_request1.rb +55 -0
- data/lib/spotify_web_api/models/me_player_play_request.rb +89 -0
- data/lib/spotify_web_api/models/me_player_request.rb +63 -0
- data/lib/spotify_web_api/models/me_shows_request.rb +55 -0
- data/lib/spotify_web_api/models/me_tracks_request.rb +53 -0
- data/lib/spotify_web_api/models/me_tracks_request1.rb +55 -0
- data/lib/spotify_web_api/models/meta.rb +110 -0
- data/lib/spotify_web_api/models/mode_enum.rb +30 -0
- data/lib/spotify_web_api/models/narrator_object.rb +50 -0
- data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +45 -0
- data/lib/spotify_web_api/models/o_auth_scope_enum.rb +94 -0
- data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
- data/lib/spotify_web_api/models/paged_albums.rb +48 -0
- data/lib/spotify_web_api/models/paged_categories.rb +48 -0
- data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_artist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +59 -0
- data/lib/spotify_web_api/models/paging_object.rb +93 -0
- data/lib/spotify_web_api/models/paging_playlist_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_playlist_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_saved_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_album_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_show_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_simplified_track_object.rb +110 -0
- data/lib/spotify_web_api/models/paging_track_object.rb +110 -0
- data/lib/spotify_web_api/models/play_history_object.rb +77 -0
- data/lib/spotify_web_api/models/playlist_object.rb +193 -0
- data/lib/spotify_web_api/models/playlist_owner_object.rb +109 -0
- data/lib/spotify_web_api/models/playlist_snapshot_id.rb +50 -0
- data/lib/spotify_web_api/models/playlist_track_object.rb +90 -0
- data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +60 -0
- data/lib/spotify_web_api/models/playlist_user_object.rb +98 -0
- data/lib/spotify_web_api/models/playlists_followers_request.rb +51 -0
- data/lib/spotify_web_api/models/playlists_request.rb +82 -0
- data/lib/spotify_web_api/models/playlists_tracks_request.rb +72 -0
- data/lib/spotify_web_api/models/playlists_tracks_request1.rb +97 -0
- data/lib/spotify_web_api/models/playlists_tracks_request2.rb +75 -0
- data/lib/spotify_web_api/models/private_user_object.rb +181 -0
- data/lib/spotify_web_api/models/public_user_object.rb +128 -0
- data/lib/spotify_web_api/models/queue_object.rb +60 -0
- data/lib/spotify_web_api/models/reason_enum.rb +29 -0
- data/lib/spotify_web_api/models/recommendation_seed_object.rb +104 -0
- data/lib/spotify_web_api/models/recommendations_object.rb +74 -0
- data/lib/spotify_web_api/models/release_date_precision_enum.rb +26 -0
- data/lib/spotify_web_api/models/resume_point_object.rb +60 -0
- data/lib/spotify_web_api/models/saved_album_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_audiobook_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_episode_object.rb +70 -0
- data/lib/spotify_web_api/models/saved_show_object.rb +73 -0
- data/lib/spotify_web_api/models/saved_track_object.rb +73 -0
- data/lib/spotify_web_api/models/search_items.rb +107 -0
- data/lib/spotify_web_api/models/section_object.rb +180 -0
- data/lib/spotify_web_api/models/segment_object.rb +166 -0
- data/lib/spotify_web_api/models/show_base.rb +211 -0
- data/lib/spotify_web_api/models/show_object.rb +219 -0
- data/lib/spotify_web_api/models/simplified_album_object.rb +186 -0
- data/lib/spotify_web_api/models/simplified_artist_object.rb +98 -0
- data/lib/spotify_web_api/models/simplified_playlist_object.rb +184 -0
- data/lib/spotify_web_api/models/simplified_track_object.rb +227 -0
- data/lib/spotify_web_api/models/time_interval_object.rb +68 -0
- data/lib/spotify_web_api/models/track.rb +331 -0
- data/lib/spotify_web_api/models/track1.rb +50 -0
- data/lib/spotify_web_api/models/track_object.rb +265 -0
- data/lib/spotify_web_api/models/track_restriction_object.rb +58 -0
- data/lib/spotify_web_api/models/type2_enum.rb +20 -0
- data/lib/spotify_web_api/models/type3_enum.rb +20 -0
- data/lib/spotify_web_api/models/type4_enum.rb +20 -0
- data/lib/spotify_web_api/models/type6_enum.rb +20 -0
- data/lib/spotify_web_api/models/type7_enum.rb +20 -0
- data/lib/spotify_web_api/models/type8_enum.rb +20 -0
- data/lib/spotify_web_api/models/type9_enum.rb +20 -0
- data/lib/spotify_web_api/models/type_enum.rb +20 -0
- data/lib/spotify_web_api/models/users_playlists_request.rb +87 -0
- data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
- data/lib/spotify_web_api/utilities/file_wrapper.rb +16 -0
- data/lib/spotify_web_api.rb +198 -0
- metadata +264 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# UsersController
|
|
8
|
+
class UsersController < BaseController
|
|
9
|
+
# Get detailed profile information about the current user (including the
|
|
10
|
+
# current user's username).
|
|
11
|
+
# @return [PrivateUserObject] response from the API call
|
|
12
|
+
def get_current_users_profile
|
|
13
|
+
new_api_call_builder
|
|
14
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
15
|
+
'/me',
|
|
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(PrivateUserObject.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
|
+
|
|
39
|
+
# Get public profile information about a Spotify user.
|
|
40
|
+
# @param [String] user_id Required parameter: Example:
|
|
41
|
+
# @return [PublicUserObject] response from the API call
|
|
42
|
+
def get_users_profile(user_id)
|
|
43
|
+
new_api_call_builder
|
|
44
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
45
|
+
'/users/{user_id}',
|
|
46
|
+
Server::DEFAULT)
|
|
47
|
+
.template_param(new_parameter(user_id, key: 'user_id')
|
|
48
|
+
.should_encode(true))
|
|
49
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
50
|
+
.auth(Single.new('oauth_2_0')))
|
|
51
|
+
.response(new_response_handler
|
|
52
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
53
|
+
.deserialize_into(PublicUserObject.method(:from_hash))
|
|
54
|
+
.is_api_response(true)
|
|
55
|
+
.local_error('401',
|
|
56
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
57
|
+
' token or\nthe access token has expired. You should'\
|
|
58
|
+
' re-authenticate the user.\n",
|
|
59
|
+
UnauthorizedException)
|
|
60
|
+
.local_error('403',
|
|
61
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
62
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
63
|
+
' won't help here.\n",
|
|
64
|
+
ForbiddenException)
|
|
65
|
+
.local_error('429',
|
|
66
|
+
"The app has exceeded its rate limits.\n",
|
|
67
|
+
TooManyRequestsException))
|
|
68
|
+
.execute
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Add the current user as a follower of a playlist.
|
|
72
|
+
# @param [String] playlist_id Required parameter: Example:
|
|
73
|
+
# @param [PlaylistsFollowersRequest] body Optional parameter: Example:
|
|
74
|
+
# @return [void] response from the API call
|
|
75
|
+
def follow_playlist(playlist_id,
|
|
76
|
+
body: nil)
|
|
77
|
+
new_api_call_builder
|
|
78
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
79
|
+
'/playlists/{playlist_id}/followers',
|
|
80
|
+
Server::DEFAULT)
|
|
81
|
+
.template_param(new_parameter(playlist_id, key: 'playlist_id')
|
|
82
|
+
.should_encode(true))
|
|
83
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
84
|
+
.body_param(new_parameter(body))
|
|
85
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
86
|
+
.auth(Single.new('oauth_2_0')))
|
|
87
|
+
.response(new_response_handler
|
|
88
|
+
.is_response_void(true)
|
|
89
|
+
.is_api_response(true)
|
|
90
|
+
.local_error('401',
|
|
91
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
92
|
+
' token or\nthe access token has expired. You should'\
|
|
93
|
+
' re-authenticate the user.\n",
|
|
94
|
+
UnauthorizedException)
|
|
95
|
+
.local_error('403',
|
|
96
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
97
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
98
|
+
' won't help here.\n",
|
|
99
|
+
ForbiddenException)
|
|
100
|
+
.local_error('429',
|
|
101
|
+
"The app has exceeded its rate limits.\n",
|
|
102
|
+
TooManyRequestsException))
|
|
103
|
+
.execute
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Remove the current user as a follower of a playlist.
|
|
107
|
+
# @param [String] playlist_id Required parameter: Example:
|
|
108
|
+
# @return [void] response from the API call
|
|
109
|
+
def unfollow_playlist(playlist_id)
|
|
110
|
+
new_api_call_builder
|
|
111
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
112
|
+
'/playlists/{playlist_id}/followers',
|
|
113
|
+
Server::DEFAULT)
|
|
114
|
+
.template_param(new_parameter(playlist_id, key: 'playlist_id')
|
|
115
|
+
.should_encode(true))
|
|
116
|
+
.auth(Single.new('oauth_2_0')))
|
|
117
|
+
.response(new_response_handler
|
|
118
|
+
.is_response_void(true)
|
|
119
|
+
.is_api_response(true)
|
|
120
|
+
.local_error('401',
|
|
121
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
122
|
+
' token or\nthe access token has expired. You should'\
|
|
123
|
+
' re-authenticate the user.\n",
|
|
124
|
+
UnauthorizedException)
|
|
125
|
+
.local_error('403',
|
|
126
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
127
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
128
|
+
' won't help here.\n",
|
|
129
|
+
ForbiddenException)
|
|
130
|
+
.local_error('429',
|
|
131
|
+
"The app has exceeded its rate limits.\n",
|
|
132
|
+
TooManyRequestsException))
|
|
133
|
+
.execute
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Get the current user's followed artists.
|
|
137
|
+
# @param [ItemType1Enum] type Required parameter: Example:
|
|
138
|
+
# @param [String] after Optional parameter: Example:
|
|
139
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
140
|
+
# @return [CursorPagedArtists] response from the API call
|
|
141
|
+
def get_followed(type,
|
|
142
|
+
after: nil,
|
|
143
|
+
limit: 20)
|
|
144
|
+
new_api_call_builder
|
|
145
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
146
|
+
'/me/following',
|
|
147
|
+
Server::DEFAULT)
|
|
148
|
+
.query_param(new_parameter(type, key: 'type'))
|
|
149
|
+
.query_param(new_parameter(after, key: 'after'))
|
|
150
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
151
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
152
|
+
.auth(Single.new('oauth_2_0')))
|
|
153
|
+
.response(new_response_handler
|
|
154
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
155
|
+
.deserialize_into(CursorPagedArtists.method(:from_hash))
|
|
156
|
+
.is_api_response(true)
|
|
157
|
+
.local_error('401',
|
|
158
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
159
|
+
' token or\nthe access token has expired. You should'\
|
|
160
|
+
' re-authenticate the user.\n",
|
|
161
|
+
UnauthorizedException)
|
|
162
|
+
.local_error('403',
|
|
163
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
164
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
165
|
+
' won't help here.\n",
|
|
166
|
+
ForbiddenException)
|
|
167
|
+
.local_error('429',
|
|
168
|
+
"The app has exceeded its rate limits.\n",
|
|
169
|
+
TooManyRequestsException))
|
|
170
|
+
.execute
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Add the current user as a follower of one or more artists or other Spotify
|
|
174
|
+
# users.
|
|
175
|
+
# @param [ItemType2Enum] type Required parameter: Example:
|
|
176
|
+
# @param [String] ids Required parameter: Example:
|
|
177
|
+
# @param [MeFollowingRequest] body Optional parameter: Example:
|
|
178
|
+
# @return [void] response from the API call
|
|
179
|
+
def follow_artists_users(type,
|
|
180
|
+
ids,
|
|
181
|
+
body: nil)
|
|
182
|
+
new_api_call_builder
|
|
183
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
184
|
+
'/me/following',
|
|
185
|
+
Server::DEFAULT)
|
|
186
|
+
.query_param(new_parameter(type, key: 'type'))
|
|
187
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
188
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
189
|
+
.body_param(new_parameter(body))
|
|
190
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
191
|
+
.auth(Single.new('oauth_2_0')))
|
|
192
|
+
.response(new_response_handler
|
|
193
|
+
.is_response_void(true)
|
|
194
|
+
.is_api_response(true)
|
|
195
|
+
.local_error('401',
|
|
196
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
197
|
+
' token or\nthe access token has expired. You should'\
|
|
198
|
+
' re-authenticate the user.\n",
|
|
199
|
+
UnauthorizedException)
|
|
200
|
+
.local_error('403',
|
|
201
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
202
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
203
|
+
' won't help here.\n",
|
|
204
|
+
ForbiddenException)
|
|
205
|
+
.local_error('429',
|
|
206
|
+
"The app has exceeded its rate limits.\n",
|
|
207
|
+
TooManyRequestsException))
|
|
208
|
+
.execute
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Remove the current user as a follower of one or more artists or other
|
|
212
|
+
# Spotify users.
|
|
213
|
+
# @param [ItemType3Enum] type Required parameter: Example:
|
|
214
|
+
# @param [String] ids Required parameter: Example:
|
|
215
|
+
# @param [MeFollowingRequest1] body Optional parameter: Example:
|
|
216
|
+
# @return [void] response from the API call
|
|
217
|
+
def unfollow_artists_users(type,
|
|
218
|
+
ids,
|
|
219
|
+
body: nil)
|
|
220
|
+
new_api_call_builder
|
|
221
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
222
|
+
'/me/following',
|
|
223
|
+
Server::DEFAULT)
|
|
224
|
+
.query_param(new_parameter(type, key: 'type'))
|
|
225
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
226
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
227
|
+
.body_param(new_parameter(body))
|
|
228
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
229
|
+
.auth(Single.new('oauth_2_0')))
|
|
230
|
+
.response(new_response_handler
|
|
231
|
+
.is_response_void(true)
|
|
232
|
+
.is_api_response(true)
|
|
233
|
+
.local_error('401',
|
|
234
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
235
|
+
' token or\nthe access token has expired. You should'\
|
|
236
|
+
' re-authenticate the user.\n",
|
|
237
|
+
UnauthorizedException)
|
|
238
|
+
.local_error('403',
|
|
239
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
240
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
241
|
+
' won't help here.\n",
|
|
242
|
+
ForbiddenException)
|
|
243
|
+
.local_error('429',
|
|
244
|
+
"The app has exceeded its rate limits.\n",
|
|
245
|
+
TooManyRequestsException))
|
|
246
|
+
.execute
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Check to see if the current user is following one or more artists or other
|
|
250
|
+
# Spotify users.
|
|
251
|
+
# @param [ItemType3Enum] type Required parameter: Example:
|
|
252
|
+
# @param [String] ids Required parameter: Example:
|
|
253
|
+
# @return [Array[TrueClass | FalseClass]] response from the API call
|
|
254
|
+
def check_current_user_follows(type,
|
|
255
|
+
ids)
|
|
256
|
+
new_api_call_builder
|
|
257
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
258
|
+
'/me/following/contains',
|
|
259
|
+
Server::DEFAULT)
|
|
260
|
+
.query_param(new_parameter(type, key: 'type'))
|
|
261
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
262
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
263
|
+
.auth(Single.new('oauth_2_0')))
|
|
264
|
+
.response(new_response_handler
|
|
265
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
266
|
+
.is_api_response(true)
|
|
267
|
+
.is_response_array(true)
|
|
268
|
+
.is_primitive_response(true)
|
|
269
|
+
.local_error('401',
|
|
270
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
271
|
+
' token or\nthe access token has expired. You should'\
|
|
272
|
+
' re-authenticate the user.\n",
|
|
273
|
+
UnauthorizedException)
|
|
274
|
+
.local_error('403',
|
|
275
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
276
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
277
|
+
' won't help here.\n",
|
|
278
|
+
ForbiddenException)
|
|
279
|
+
.local_error('429',
|
|
280
|
+
"The app has exceeded its rate limits.\n",
|
|
281
|
+
TooManyRequestsException))
|
|
282
|
+
.execute
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Check to see if one or more Spotify users are following a specified
|
|
286
|
+
# playlist.
|
|
287
|
+
# @param [String] playlist_id Required parameter: Example:
|
|
288
|
+
# @param [String] ids Required parameter: Example:
|
|
289
|
+
# @return [Array[TrueClass | FalseClass]] response from the API call
|
|
290
|
+
def check_if_user_follows_playlist(playlist_id,
|
|
291
|
+
ids)
|
|
292
|
+
new_api_call_builder
|
|
293
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
294
|
+
'/playlists/{playlist_id}/followers/contains',
|
|
295
|
+
Server::DEFAULT)
|
|
296
|
+
.template_param(new_parameter(playlist_id, key: 'playlist_id')
|
|
297
|
+
.should_encode(true))
|
|
298
|
+
.query_param(new_parameter(ids, key: 'ids'))
|
|
299
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
300
|
+
.auth(Single.new('oauth_2_0')))
|
|
301
|
+
.response(new_response_handler
|
|
302
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
303
|
+
.is_api_response(true)
|
|
304
|
+
.is_response_array(true)
|
|
305
|
+
.is_primitive_response(true)
|
|
306
|
+
.local_error('401',
|
|
307
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
308
|
+
' token or\nthe access token has expired. You should'\
|
|
309
|
+
' re-authenticate the user.\n",
|
|
310
|
+
UnauthorizedException)
|
|
311
|
+
.local_error('403',
|
|
312
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
313
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
314
|
+
' won't help here.\n",
|
|
315
|
+
ForbiddenException)
|
|
316
|
+
.local_error('429',
|
|
317
|
+
"The app has exceeded its rate limits.\n",
|
|
318
|
+
TooManyRequestsException))
|
|
319
|
+
.execute
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Get the current user's top artists based on calculated affinity.
|
|
323
|
+
# @param [String] time_range Optional parameter: Example:medium_term
|
|
324
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
325
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
326
|
+
# @return [PagingArtistObject] response from the API call
|
|
327
|
+
def get_users_top_artists(time_range: 'medium_term',
|
|
328
|
+
limit: 20,
|
|
329
|
+
offset: 0)
|
|
330
|
+
new_api_call_builder
|
|
331
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
332
|
+
'/me/top/artists',
|
|
333
|
+
Server::DEFAULT)
|
|
334
|
+
.query_param(new_parameter(time_range, key: 'time_range'))
|
|
335
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
336
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
337
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
338
|
+
.auth(Single.new('oauth_2_0')))
|
|
339
|
+
.response(new_response_handler
|
|
340
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
341
|
+
.deserialize_into(PagingArtistObject.method(:from_hash))
|
|
342
|
+
.is_api_response(true)
|
|
343
|
+
.local_error('401',
|
|
344
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
345
|
+
' token or\nthe access token has expired. You should'\
|
|
346
|
+
' re-authenticate the user.\n",
|
|
347
|
+
UnauthorizedException)
|
|
348
|
+
.local_error('403',
|
|
349
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
350
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
351
|
+
' won't help here.\n",
|
|
352
|
+
ForbiddenException)
|
|
353
|
+
.local_error('429',
|
|
354
|
+
"The app has exceeded its rate limits.\n",
|
|
355
|
+
TooManyRequestsException))
|
|
356
|
+
.execute
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# Get the current user's top tracks based on calculated affinity.
|
|
360
|
+
# @param [String] time_range Optional parameter: Example:medium_term
|
|
361
|
+
# @param [Integer] limit Optional parameter: Example:20
|
|
362
|
+
# @param [Integer] offset Optional parameter: Example:0
|
|
363
|
+
# @return [PagingTrackObject] response from the API call
|
|
364
|
+
def get_users_top_tracks(time_range: 'medium_term',
|
|
365
|
+
limit: 20,
|
|
366
|
+
offset: 0)
|
|
367
|
+
new_api_call_builder
|
|
368
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
369
|
+
'/me/top/tracks',
|
|
370
|
+
Server::DEFAULT)
|
|
371
|
+
.query_param(new_parameter(time_range, key: 'time_range'))
|
|
372
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
373
|
+
.query_param(new_parameter(offset, key: 'offset'))
|
|
374
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
375
|
+
.auth(Single.new('oauth_2_0')))
|
|
376
|
+
.response(new_response_handler
|
|
377
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
378
|
+
.deserialize_into(PagingTrackObject.method(:from_hash))
|
|
379
|
+
.is_api_response(true)
|
|
380
|
+
.local_error('401',
|
|
381
|
+
"Bad or expired token. This can happen if the user revoked a'\
|
|
382
|
+
' token or\nthe access token has expired. You should'\
|
|
383
|
+
' re-authenticate the user.\n",
|
|
384
|
+
UnauthorizedException)
|
|
385
|
+
.local_error('403',
|
|
386
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired'\
|
|
387
|
+
'\ntimestamp...). Unfortunately, re-authenticating the user'\
|
|
388
|
+
' won't help here.\n",
|
|
389
|
+
ForbiddenException)
|
|
390
|
+
.local_error('429',
|
|
391
|
+
"The app has exceeded its rate limits.\n",
|
|
392
|
+
TooManyRequestsException))
|
|
393
|
+
.execute
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
|
8
|
+
class APIException < CoreLibrary::ApiException
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# BadRequest class.
|
|
8
|
+
class BadRequestException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ErrorObject]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# Forbidden class.
|
|
8
|
+
class ForbiddenException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ErrorObject]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# NotFound class.
|
|
8
|
+
class NotFoundException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ErrorObject]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# OAuth 2 Authorization endpoint exception.
|
|
8
|
+
class OAuthProviderException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Gets or sets error code.
|
|
13
|
+
# @return [OAuthProviderErrorEnum]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# Gets or sets human-readable text providing additional information on
|
|
17
|
+
# error.
|
|
18
|
+
# Used to assist the client developer in understanding the error that
|
|
19
|
+
# occurred.
|
|
20
|
+
# @return [String]
|
|
21
|
+
attr_accessor :error_description
|
|
22
|
+
|
|
23
|
+
# Gets or sets a URI identifying a human-readable web page with information
|
|
24
|
+
# about the error, used to provide the client developer with additional
|
|
25
|
+
# information about the error.
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :error_uri
|
|
28
|
+
|
|
29
|
+
# The constructor.
|
|
30
|
+
# @param [String] The reason for raising an exception.
|
|
31
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
32
|
+
def initialize(reason, response)
|
|
33
|
+
super(reason, response)
|
|
34
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
35
|
+
unbox(hash)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Populates this object by extracting properties from a hash.
|
|
39
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
40
|
+
# response body.
|
|
41
|
+
def unbox(hash)
|
|
42
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
43
|
+
@error_description =
|
|
44
|
+
hash.key?('error_description') ? hash['error_description'] : SKIP
|
|
45
|
+
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# TooManyRequests class.
|
|
8
|
+
class TooManyRequestsException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ErrorObject]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# Unauthorized class.
|
|
8
|
+
class UnauthorizedException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [ErrorObject]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# spotify_web_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SpotifyWebApi
|
|
7
|
+
# Http response received.
|
|
8
|
+
class ApiResponse < CoreLibrary::ApiResponse
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# The constructor
|
|
12
|
+
# @param [HttpResponse] http_response The original, raw response from the api.
|
|
13
|
+
# @param [Object] data The data field specified for the response.
|
|
14
|
+
# @param [Array<String>] errors Any errors returned by the server.
|
|
15
|
+
def initialize(http_response,
|
|
16
|
+
data: nil,
|
|
17
|
+
errors: nil)
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|