spotted 0.11.0 → 0.12.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/spotted/client.rb +60 -1
  5. data/lib/spotted/models/album_bulk_retrieve_response.rb +13 -25
  6. data/lib/spotted/models/album_retrieve_response.rb +13 -25
  7. data/lib/spotted/models/artist_list_albums_response.rb +5 -17
  8. data/lib/spotted/models/audio_analysis_retrieve_response.rb +3 -8
  9. data/lib/spotted/models/audiobook_base.rb +4 -16
  10. data/lib/spotted/models/audiobook_bulk_retrieve_response.rb +8 -8
  11. data/lib/spotted/models/audiobook_retrieve_response.rb +8 -8
  12. data/lib/spotted/models/browse/category_list_response.rb +9 -9
  13. data/lib/spotted/models/browse_get_new_releases_response.rb +14 -26
  14. data/lib/spotted/models/chapter_bulk_retrieve_response.rb +5 -17
  15. data/lib/spotted/models/chapter_retrieve_response.rb +5 -17
  16. data/lib/spotted/models/episode_object.rb +5 -17
  17. data/lib/spotted/models/me/album_list_response.rb +13 -25
  18. data/lib/spotted/models/me/audiobook_list_response.rb +8 -8
  19. data/lib/spotted/models/me/following_bulk_retrieve_params.rb +5 -15
  20. data/lib/spotted/models/paging_playlist_object.rb +8 -8
  21. data/lib/spotted/models/playlist_retrieve_response.rb +8 -8
  22. data/lib/spotted/models/search_query_response.rb +54 -66
  23. data/lib/spotted/models/show_base.rb +4 -16
  24. data/lib/spotted/models/show_retrieve_response.rb +8 -8
  25. data/lib/spotted/models/simplified_chapter_object.rb +5 -17
  26. data/lib/spotted/models/simplified_episode_object.rb +5 -17
  27. data/lib/spotted/models/track_object.rb +5 -17
  28. data/lib/spotted/models/users/playlist_create_response.rb +8 -8
  29. data/lib/spotted/resources/me/following.rb +3 -3
  30. data/lib/spotted/resources/playlists/images.rb +3 -3
  31. data/lib/spotted/version.rb +1 -1
  32. data/rbi/spotted/models/album_bulk_retrieve_response.rbi +21 -52
  33. data/rbi/spotted/models/album_retrieve_response.rbi +21 -43
  34. data/rbi/spotted/models/artist_list_albums_response.rbi +7 -36
  35. data/rbi/spotted/models/audio_analysis_retrieve_response.rbi +3 -8
  36. data/rbi/spotted/models/audiobook_base.rbi +7 -25
  37. data/rbi/spotted/models/audiobook_bulk_retrieve_response.rbi +16 -9
  38. data/rbi/spotted/models/audiobook_retrieve_response.rbi +14 -9
  39. data/rbi/spotted/models/browse/category_list_response.rbi +31 -19
  40. data/rbi/spotted/models/browse_get_new_releases_response.rbi +38 -62
  41. data/rbi/spotted/models/chapter_bulk_retrieve_response.rbi +7 -43
  42. data/rbi/spotted/models/chapter_retrieve_response.rbi +7 -36
  43. data/rbi/spotted/models/episode_object.rbi +7 -24
  44. data/rbi/spotted/models/me/album_list_response.rbi +23 -52
  45. data/rbi/spotted/models/me/audiobook_list_response.rbi +18 -9
  46. data/rbi/spotted/models/me/following_bulk_retrieve_params.rbi +5 -34
  47. data/rbi/spotted/models/paging_playlist_object.rbi +14 -9
  48. data/rbi/spotted/models/playlist_retrieve_response.rbi +14 -9
  49. data/rbi/spotted/models/search_query_response.rbi +96 -101
  50. data/rbi/spotted/models/show_base.rbi +7 -23
  51. data/rbi/spotted/models/show_retrieve_response.rbi +14 -9
  52. data/rbi/spotted/models/simplified_chapter_object.rbi +7 -27
  53. data/rbi/spotted/models/simplified_episode_object.rbi +7 -27
  54. data/rbi/spotted/models/track_object.rbi +7 -26
  55. data/rbi/spotted/models/users/playlist_create_response.rbi +14 -9
  56. data/rbi/spotted/resources/me/following.rbi +3 -3
  57. data/rbi/spotted/resources/playlists/images.rbi +1 -1
  58. data/sig/spotted/models/album_bulk_retrieve_response.rbs +17 -23
  59. data/sig/spotted/models/album_retrieve_response.rbs +17 -23
  60. data/sig/spotted/models/artist_list_albums_response.rbs +5 -15
  61. data/sig/spotted/models/audio_analysis_retrieve_response.rbs +3 -8
  62. data/sig/spotted/models/audiobook_base.rbs +5 -15
  63. data/sig/spotted/models/audiobook_bulk_retrieve_response.rbs +12 -8
  64. data/sig/spotted/models/audiobook_retrieve_response.rbs +12 -8
  65. data/sig/spotted/models/browse/category_list_response.rbs +12 -8
  66. data/sig/spotted/models/browse_get_new_releases_response.rbs +17 -23
  67. data/sig/spotted/models/chapter_bulk_retrieve_response.rbs +5 -15
  68. data/sig/spotted/models/chapter_retrieve_response.rbs +5 -15
  69. data/sig/spotted/models/episode_object.rbs +5 -15
  70. data/sig/spotted/models/me/album_list_response.rbs +17 -23
  71. data/sig/spotted/models/me/audiobook_list_response.rbs +12 -8
  72. data/sig/spotted/models/me/following_bulk_retrieve_params.rbs +4 -18
  73. data/sig/spotted/models/paging_playlist_object.rbs +12 -8
  74. data/sig/spotted/models/playlist_retrieve_response.rbs +12 -8
  75. data/sig/spotted/models/search_query_response.rbs +75 -63
  76. data/sig/spotted/models/show_base.rbs +5 -15
  77. data/sig/spotted/models/show_retrieve_response.rbs +12 -8
  78. data/sig/spotted/models/simplified_chapter_object.rbs +5 -15
  79. data/sig/spotted/models/simplified_episode_object.rbs +5 -15
  80. data/sig/spotted/models/track_object.rbs +5 -15
  81. data/sig/spotted/models/users/playlist_create_response.rbs +12 -8
  82. data/sig/spotted/resources/me/following.rbs +1 -1
  83. data/sig/spotted/resources/playlists/images.rbs +1 -1
  84. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53171d2924e8b65667348df43a8315b13834283411bcc57260a3dee25ed1b5bb
4
- data.tar.gz: 4a987cf805446e513e6d977a00aa999f48d64ca881e7adc6f7a3ae9352169348
3
+ metadata.gz: 696d1201dbd3bfb90b486db93bc6b1b671ed6a977f4aac62a1c7f01049ceb63a
4
+ data.tar.gz: 14b673555eb41b979bc507f86e417d311fe5b31953fb875146e96b992ae05fb6
5
5
  SHA512:
6
- metadata.gz: 13b3fab4d5ead1e934399769d8556ba0521e2bebcbe5a0da61fc4cefba97ebd92801afc3d4136bc70f7efea09b7a3ac0689e41e8633968d4f983d11a7f4bc1b2
7
- data.tar.gz: 0ce09546710593e818c08530438f4ab6918fd9e103ad54d3376af6362da5bb197298bdec2a931cc6868259aa49eacd08a827108d4375a5075922a1295594667e
6
+ metadata.gz: ed1cb5ae938ded271bafef35692200963c900a77ce410e4c8c71611a6d45be523f319be8eba55bd926a41fcda4f933786f4adcf768efff0701895e7f26aa4cc0
7
+ data.tar.gz: f36d877b11ca3b92f0c4ed6658886c242c72a772e7ae23ad242be69e95fa8b5af0e350269b4bf69378dd53630b8f8ed512248b0722d5cb01b2fc07faf028ab96
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 (2025-11-18)
4
+
5
+ Full Changelog: [v0.11.0...v0.12.0](https://github.com/cjavdev/spotted/compare/v0.11.0...v0.12.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([2d46753](https://github.com/cjavdev/spotted/commit/2d467536b14036b59bd83f1ad36a793f283c0ba7))
10
+ * **api:** manual updates ([d50ef2c](https://github.com/cjavdev/spotted/commit/d50ef2cfac3d7ad78c0cdddb6b63e265eee41ce5))
11
+ * **api:** manual updates ([88e978f](https://github.com/cjavdev/spotted/commit/88e978fe47e83e5c3ec1b6e11f61c3e7b0da364a))
12
+ * **api:** manual updates ([1282962](https://github.com/cjavdev/spotted/commit/1282962d4ed287f19e6f85542cd8f1ab2d3dd262))
13
+ * **api:** manual updates ([d5a6316](https://github.com/cjavdev/spotted/commit/d5a6316595fc63e413751042e043d32f02f727e9))
14
+ * **api:** manual updates ([c7e3fcc](https://github.com/cjavdev/spotted/commit/c7e3fcc445d8a027ac3afceeba51b59c6f6882af))
15
+
3
16
  ## 0.11.0 (2025-11-10)
4
17
 
5
18
  Full Changelog: [v0.10.0...v0.11.0](https://github.com/cjavdev/spotted/compare/v0.10.0...v0.11.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "spotted", "~> 0.11.0"
20
+ gem "spotted", "~> 0.12.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -76,7 +76,15 @@ module Spotted
76
76
  #
77
77
  # @return [Hash{String=>String}]
78
78
  private def auth_headers
79
- {**bearer_auth, **oauth_2_0}
79
+ unless @access_token.nil?
80
+ return {**bearer_auth}
81
+ end
82
+
83
+ if @client_id && @client_secret
84
+ return {**oauth_2_0}
85
+ end
86
+
87
+ {}
80
88
  end
81
89
 
82
90
  # @api private
@@ -212,5 +220,56 @@ module Spotted
212
220
  query_string = URI.encode_www_form(params)
213
221
  "https://accounts.spotify.com/authorize?#{query_string}"
214
222
  end
223
+
224
+ # Exchanges an authorization code for an access token.
225
+ #
226
+ # @param code [String] The authorization code to exchange
227
+ # @param redirect_uri [String] The redirect URI used to obtain the authorization code
228
+ #
229
+ # @return [Object] The access token and refresh token
230
+ def exchange_authorization_code(code:, redirect_uri:)
231
+ if @client_id.nil? || @client_secret.nil?
232
+ raise ArgumentError, "Both client_id and client_secret must be set to exchange an authorization code."
233
+ end
234
+ body = URI.encode_www_form(
235
+ grant_type: "authorization_code",
236
+ code: code,
237
+ redirect_uri: redirect_uri
238
+ )
239
+ client = Spotted::Client.new(
240
+ client_id: @client_id,
241
+ client_secret: @client_secret,
242
+ base_url: "https://accounts.spotify.com"
243
+ )
244
+ client.request(
245
+ method: :post,
246
+ headers: {
247
+ "Content-Type" => "application/x-www-form-urlencoded",
248
+ "Authorization" => "Basic #{Base64.strict_encode64("#{@client_id}:#{@client_secret}")}"
249
+ },
250
+ path: "/api/token",
251
+ body: body
252
+ )
253
+ end
254
+
255
+ def refresh_access_token(refresh_token:)
256
+ if @client_id.nil? || @client_secret.nil?
257
+ raise ArgumentError, "Both client_id and client_secret must be set to refresh an access token."
258
+ end
259
+ body = URI.encode_www_form(
260
+ grant_type: "refresh_token",
261
+ refresh_token: refresh_token
262
+ )
263
+ client = Spotted::Client.new(client_id: @client_id, client_secret: @client_secret, base_url: "https://accounts.spotify.com")
264
+ client.request(
265
+ method: :post,
266
+ headers: {
267
+ "Content-Type" => "application/x-www-form-urlencoded",
268
+ "Authorization" => "Basic #{Base64.strict_encode64("#{@client_id}:#{@client_secret}")}"
269
+ },
270
+ path: "/api/token",
271
+ body: body
272
+ )
273
+ end
215
274
  end
216
275
  end
@@ -83,8 +83,8 @@ module Spotted
83
83
  # @!attribute type
84
84
  # The object type.
85
85
  #
86
- # @return [Symbol, Spotted::Models::AlbumBulkRetrieveResponse::Album::Type]
87
- required :type, enum: -> { Spotted::Models::AlbumBulkRetrieveResponse::Album::Type }
86
+ # @return [Symbol, :album]
87
+ required :type, const: :album
88
88
 
89
89
  # @!attribute uri
90
90
  # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the
@@ -145,7 +145,7 @@ module Spotted
145
145
  # @return [Spotted::Models::AlbumBulkRetrieveResponse::Album::Tracks, nil]
146
146
  optional :tracks, -> { Spotted::Models::AlbumBulkRetrieveResponse::Album::Tracks }
147
147
 
148
- # @!method initialize(id:, album_type:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, type:, uri:, artists: nil, copyrights: nil, external_ids: nil, genres: nil, label: nil, popularity: nil, restrictions: nil, tracks: nil)
148
+ # @!method initialize(id:, album_type:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, uri:, artists: nil, copyrights: nil, external_ids: nil, genres: nil, label: nil, popularity: nil, restrictions: nil, tracks: nil, type: :album)
149
149
  # Some parameter documentations has been truncated, see
150
150
  # {Spotted::Models::AlbumBulkRetrieveResponse::Album} for more details.
151
151
  #
@@ -169,8 +169,6 @@ module Spotted
169
169
  #
170
170
  # @param total_tracks [Integer] The number of tracks in the album.
171
171
  #
172
- # @param type [Symbol, Spotted::Models::AlbumBulkRetrieveResponse::Album::Type] The object type.
173
- #
174
172
  # @param uri [String] The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the albu
175
173
  #
176
174
  # @param artists [Array<Spotted::Models::SimplifiedArtistObject>] The artists of the album. Each artist object includes a link in `href` to more d
@@ -188,6 +186,8 @@ module Spotted
188
186
  # @param restrictions [Spotted::Models::AlbumRestrictionObject] Included in the response when a content restriction is applied.
189
187
  #
190
188
  # @param tracks [Spotted::Models::AlbumBulkRetrieveResponse::Album::Tracks] The tracks of the album.
189
+ #
190
+ # @param type [Symbol, :album] The object type.
191
191
 
192
192
  # The type of the album.
193
193
  #
@@ -217,18 +217,6 @@ module Spotted
217
217
  # @return [Array<Symbol>]
218
218
  end
219
219
 
220
- # The object type.
221
- #
222
- # @see Spotted::Models::AlbumBulkRetrieveResponse::Album#type
223
- module Type
224
- extend Spotted::Internal::Type::Enum
225
-
226
- ALBUM = :album
227
-
228
- # @!method self.values
229
- # @return [Array<Symbol>]
230
- end
231
-
232
220
  # @see Spotted::Models::AlbumBulkRetrieveResponse::Album#tracks
233
221
  class Tracks < Spotted::Internal::Type::BaseModel
234
222
  # @!attribute href
@@ -237,11 +225,6 @@ module Spotted
237
225
  # @return [String]
238
226
  required :href, String
239
227
 
240
- # @!attribute items
241
- #
242
- # @return [Array<Spotted::Models::SimplifiedTrackObject>]
243
- required :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedTrackObject] }
244
-
245
228
  # @!attribute limit
246
229
  # The maximum number of items in the response (as set in the query or by default).
247
230
  #
@@ -272,7 +255,12 @@ module Spotted
272
255
  # @return [Integer]
273
256
  required :total, Integer
274
257
 
275
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
258
+ # @!attribute items
259
+ #
260
+ # @return [Array<Spotted::Models::SimplifiedTrackObject>, nil]
261
+ optional :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedTrackObject] }
262
+
263
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
276
264
  # Some parameter documentations has been truncated, see
277
265
  # {Spotted::Models::AlbumBulkRetrieveResponse::Album::Tracks} for more details.
278
266
  #
@@ -280,8 +268,6 @@ module Spotted
280
268
  #
281
269
  # @param href [String] A link to the Web API endpoint returning the full result of the request
282
270
  #
283
- # @param items [Array<Spotted::Models::SimplifiedTrackObject>]
284
- #
285
271
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
286
272
  #
287
273
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -291,6 +277,8 @@ module Spotted
291
277
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
292
278
  #
293
279
  # @param total [Integer] The total number of items available to return.
280
+ #
281
+ # @param items [Array<Spotted::Models::SimplifiedTrackObject>]
294
282
  end
295
283
  end
296
284
  end
@@ -73,8 +73,8 @@ module Spotted
73
73
  # @!attribute type
74
74
  # The object type.
75
75
  #
76
- # @return [Symbol, Spotted::Models::AlbumRetrieveResponse::Type]
77
- required :type, enum: -> { Spotted::Models::AlbumRetrieveResponse::Type }
76
+ # @return [Symbol, :album]
77
+ required :type, const: :album
78
78
 
79
79
  # @!attribute uri
80
80
  # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the
@@ -135,7 +135,7 @@ module Spotted
135
135
  # @return [Spotted::Models::AlbumRetrieveResponse::Tracks, nil]
136
136
  optional :tracks, -> { Spotted::Models::AlbumRetrieveResponse::Tracks }
137
137
 
138
- # @!method initialize(id:, album_type:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, type:, uri:, artists: nil, copyrights: nil, external_ids: nil, genres: nil, label: nil, popularity: nil, restrictions: nil, tracks: nil)
138
+ # @!method initialize(id:, album_type:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, uri:, artists: nil, copyrights: nil, external_ids: nil, genres: nil, label: nil, popularity: nil, restrictions: nil, tracks: nil, type: :album)
139
139
  # Some parameter documentations has been truncated, see
140
140
  # {Spotted::Models::AlbumRetrieveResponse} for more details.
141
141
  #
@@ -159,8 +159,6 @@ module Spotted
159
159
  #
160
160
  # @param total_tracks [Integer] The number of tracks in the album.
161
161
  #
162
- # @param type [Symbol, Spotted::Models::AlbumRetrieveResponse::Type] The object type.
163
- #
164
162
  # @param uri [String] The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the albu
165
163
  #
166
164
  # @param artists [Array<Spotted::Models::SimplifiedArtistObject>] The artists of the album. Each artist object includes a link in `href` to more d
@@ -178,6 +176,8 @@ module Spotted
178
176
  # @param restrictions [Spotted::Models::AlbumRestrictionObject] Included in the response when a content restriction is applied.
179
177
  #
180
178
  # @param tracks [Spotted::Models::AlbumRetrieveResponse::Tracks] The tracks of the album.
179
+ #
180
+ # @param type [Symbol, :album] The object type.
181
181
 
182
182
  # The type of the album.
183
183
  #
@@ -207,18 +207,6 @@ module Spotted
207
207
  # @return [Array<Symbol>]
208
208
  end
209
209
 
210
- # The object type.
211
- #
212
- # @see Spotted::Models::AlbumRetrieveResponse#type
213
- module Type
214
- extend Spotted::Internal::Type::Enum
215
-
216
- ALBUM = :album
217
-
218
- # @!method self.values
219
- # @return [Array<Symbol>]
220
- end
221
-
222
210
  # @see Spotted::Models::AlbumRetrieveResponse#tracks
223
211
  class Tracks < Spotted::Internal::Type::BaseModel
224
212
  # @!attribute href
@@ -227,11 +215,6 @@ module Spotted
227
215
  # @return [String]
228
216
  required :href, String
229
217
 
230
- # @!attribute items
231
- #
232
- # @return [Array<Spotted::Models::SimplifiedTrackObject>]
233
- required :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedTrackObject] }
234
-
235
218
  # @!attribute limit
236
219
  # The maximum number of items in the response (as set in the query or by default).
237
220
  #
@@ -262,7 +245,12 @@ module Spotted
262
245
  # @return [Integer]
263
246
  required :total, Integer
264
247
 
265
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
248
+ # @!attribute items
249
+ #
250
+ # @return [Array<Spotted::Models::SimplifiedTrackObject>, nil]
251
+ optional :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedTrackObject] }
252
+
253
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
266
254
  # Some parameter documentations has been truncated, see
267
255
  # {Spotted::Models::AlbumRetrieveResponse::Tracks} for more details.
268
256
  #
@@ -270,8 +258,6 @@ module Spotted
270
258
  #
271
259
  # @param href [String] A link to the Web API endpoint returning the full result of the request
272
260
  #
273
- # @param items [Array<Spotted::Models::SimplifiedTrackObject>]
274
- #
275
261
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
276
262
  #
277
263
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -281,6 +267,8 @@ module Spotted
281
267
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
282
268
  #
283
269
  # @param total [Integer] The total number of items available to return.
270
+ #
271
+ # @param items [Array<Spotted::Models::SimplifiedTrackObject>]
284
272
  end
285
273
  end
286
274
  end
@@ -86,8 +86,8 @@ module Spotted
86
86
  # @!attribute type
87
87
  # The object type.
88
88
  #
89
- # @return [Symbol, Spotted::Models::ArtistListAlbumsResponse::Type]
90
- required :type, enum: -> { Spotted::Models::ArtistListAlbumsResponse::Type }
89
+ # @return [Symbol, :album]
90
+ required :type, const: :album
91
91
 
92
92
  # @!attribute uri
93
93
  # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the
@@ -102,7 +102,7 @@ module Spotted
102
102
  # @return [Spotted::Models::AlbumRestrictionObject, nil]
103
103
  optional :restrictions, -> { Spotted::AlbumRestrictionObject }
104
104
 
105
- # @!method initialize(id:, album_group:, album_type:, artists:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, type:, uri:, restrictions: nil)
105
+ # @!method initialize(id:, album_group:, album_type:, artists:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, uri:, restrictions: nil, type: :album)
106
106
  # Some parameter documentations has been truncated, see
107
107
  # {Spotted::Models::ArtistListAlbumsResponse} for more details.
108
108
  #
@@ -130,11 +130,11 @@ module Spotted
130
130
  #
131
131
  # @param total_tracks [Integer] The number of tracks in the album.
132
132
  #
133
- # @param type [Symbol, Spotted::Models::ArtistListAlbumsResponse::Type] The object type.
134
- #
135
133
  # @param uri [String] The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the albu
136
134
  #
137
135
  # @param restrictions [Spotted::Models::AlbumRestrictionObject] Included in the response when a content restriction is applied.
136
+ #
137
+ # @param type [Symbol, :album] The object type.
138
138
 
139
139
  # This field describes the relationship between the artist and the album.
140
140
  #
@@ -178,18 +178,6 @@ module Spotted
178
178
  # @!method self.values
179
179
  # @return [Array<Symbol>]
180
180
  end
181
-
182
- # The object type.
183
- #
184
- # @see Spotted::Models::ArtistListAlbumsResponse#type
185
- module Type
186
- extend Spotted::Internal::Type::Enum
187
-
188
- ALBUM = :album
189
-
190
- # @!method self.values
191
- # @return [Array<Symbol>]
192
- end
193
181
  end
194
182
  end
195
183
  end
@@ -262,14 +262,9 @@ module Spotted
262
262
  module Mode
263
263
  extend Spotted::Internal::Type::Enum
264
264
 
265
- # No result
266
- MINUS_1 = -1
267
-
268
- # Minor
269
- MODE_0 = 0
270
-
271
- # Major
272
- MODE_1 = 1
265
+ MODE_NO_RESULT = -1
266
+ MODE_MINOR = 0
267
+ MODE_MAJOR = 1
273
268
 
274
269
  # @!method self.values
275
270
  # @return [Array<Float>]
@@ -108,8 +108,8 @@ module Spotted
108
108
  # @!attribute type
109
109
  # The object type.
110
110
  #
111
- # @return [Symbol, Spotted::Models::AudiobookBase::Type]
112
- required :type, enum: -> { Spotted::AudiobookBase::Type }
111
+ # @return [Symbol, :audiobook]
112
+ required :type, const: :audiobook
113
113
 
114
114
  # @!attribute uri
115
115
  # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the
@@ -124,7 +124,7 @@ module Spotted
124
124
  # @return [String, nil]
125
125
  optional :edition, String
126
126
 
127
- # @!method initialize(id:, authors:, available_markets:, copyrights:, description:, explicit:, external_urls:, href:, html_description:, images:, languages:, media_type:, name:, narrators:, publisher:, total_chapters:, type:, uri:, edition: nil)
127
+ # @!method initialize(id:, authors:, available_markets:, copyrights:, description:, explicit:, external_urls:, href:, html_description:, images:, languages:, media_type:, name:, narrators:, publisher:, total_chapters:, uri:, edition: nil, type: :audiobook)
128
128
  # Some parameter documentations has been truncated, see
129
129
  # {Spotted::Models::AudiobookBase} for more details.
130
130
  #
@@ -160,23 +160,11 @@ module Spotted
160
160
  #
161
161
  # @param total_chapters [Integer] The number of chapters in this audiobook.
162
162
  #
163
- # @param type [Symbol, Spotted::Models::AudiobookBase::Type] The object type.
164
- #
165
163
  # @param uri [String] The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the audi
166
164
  #
167
165
  # @param edition [String] The edition of the audiobook.
168
-
169
- # The object type.
170
166
  #
171
- # @see Spotted::Models::AudiobookBase#type
172
- module Type
173
- extend Spotted::Internal::Type::Enum
174
-
175
- AUDIOBOOK = :audiobook
176
-
177
- # @!method self.values
178
- # @return [Array<Symbol>]
179
- end
167
+ # @param type [Symbol, :audiobook] The object type.
180
168
  end
181
169
  end
182
170
  end
@@ -33,11 +33,6 @@ module Spotted
33
33
  # @return [String]
34
34
  required :href, String
35
35
 
36
- # @!attribute items
37
- #
38
- # @return [Array<Spotted::Models::SimplifiedChapterObject>]
39
- required :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedChapterObject] }
40
-
41
36
  # @!attribute limit
42
37
  # The maximum number of items in the response (as set in the query or by default).
43
38
  #
@@ -68,7 +63,12 @@ module Spotted
68
63
  # @return [Integer]
69
64
  required :total, Integer
70
65
 
71
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
66
+ # @!attribute items
67
+ #
68
+ # @return [Array<Spotted::Models::SimplifiedChapterObject>, nil]
69
+ optional :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedChapterObject] }
70
+
71
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
72
72
  # Some parameter documentations has been truncated, see
73
73
  # {Spotted::Models::AudiobookBulkRetrieveResponse::Audiobook::Chapters} for more
74
74
  # details.
@@ -77,8 +77,6 @@ module Spotted
77
77
  #
78
78
  # @param href [String] A link to the Web API endpoint returning the full result of the request
79
79
  #
80
- # @param items [Array<Spotted::Models::SimplifiedChapterObject>]
81
- #
82
80
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
83
81
  #
84
82
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -88,6 +86,8 @@ module Spotted
88
86
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
89
87
  #
90
88
  # @param total [Integer] The total number of items available to return.
89
+ #
90
+ # @param items [Array<Spotted::Models::SimplifiedChapterObject>]
91
91
  end
92
92
  end
93
93
  end
@@ -23,11 +23,6 @@ module Spotted
23
23
  # @return [String]
24
24
  required :href, String
25
25
 
26
- # @!attribute items
27
- #
28
- # @return [Array<Spotted::Models::SimplifiedChapterObject>]
29
- required :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedChapterObject] }
30
-
31
26
  # @!attribute limit
32
27
  # The maximum number of items in the response (as set in the query or by default).
33
28
  #
@@ -58,7 +53,12 @@ module Spotted
58
53
  # @return [Integer]
59
54
  required :total, Integer
60
55
 
61
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
56
+ # @!attribute items
57
+ #
58
+ # @return [Array<Spotted::Models::SimplifiedChapterObject>, nil]
59
+ optional :items, -> { Spotted::Internal::Type::ArrayOf[Spotted::SimplifiedChapterObject] }
60
+
61
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
62
62
  # Some parameter documentations has been truncated, see
63
63
  # {Spotted::Models::AudiobookRetrieveResponse::Chapters} for more details.
64
64
  #
@@ -66,8 +66,6 @@ module Spotted
66
66
  #
67
67
  # @param href [String] A link to the Web API endpoint returning the full result of the request
68
68
  #
69
- # @param items [Array<Spotted::Models::SimplifiedChapterObject>]
70
- #
71
69
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
72
70
  #
73
71
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -77,6 +75,8 @@ module Spotted
77
75
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
78
76
  #
79
77
  # @param total [Integer] The total number of items available to return.
78
+ #
79
+ # @param items [Array<Spotted::Models::SimplifiedChapterObject>]
80
80
  end
81
81
  end
82
82
  end
@@ -21,12 +21,6 @@ module Spotted
21
21
  # @return [String]
22
22
  required :href, String
23
23
 
24
- # @!attribute items
25
- #
26
- # @return [Array<Spotted::Models::Browse::CategoryListResponse::Categories::Item>]
27
- required :items,
28
- -> { Spotted::Internal::Type::ArrayOf[Spotted::Models::Browse::CategoryListResponse::Categories::Item] }
29
-
30
24
  # @!attribute limit
31
25
  # The maximum number of items in the response (as set in the query or by default).
32
26
  #
@@ -57,14 +51,18 @@ module Spotted
57
51
  # @return [Integer]
58
52
  required :total, Integer
59
53
 
60
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
54
+ # @!attribute items
55
+ #
56
+ # @return [Array<Spotted::Models::Browse::CategoryListResponse::Categories::Item>, nil]
57
+ optional :items,
58
+ -> { Spotted::Internal::Type::ArrayOf[Spotted::Models::Browse::CategoryListResponse::Categories::Item] }
59
+
60
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
61
61
  # Some parameter documentations has been truncated, see
62
62
  # {Spotted::Models::Browse::CategoryListResponse::Categories} for more details.
63
63
  #
64
64
  # @param href [String] A link to the Web API endpoint returning the full result of the request
65
65
  #
66
- # @param items [Array<Spotted::Models::Browse::CategoryListResponse::Categories::Item>]
67
- #
68
66
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
69
67
  #
70
68
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -74,6 +72,8 @@ module Spotted
74
72
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
75
73
  #
76
74
  # @param total [Integer] The total number of items available to return.
75
+ #
76
+ # @param items [Array<Spotted::Models::Browse::CategoryListResponse::Categories::Item>]
77
77
 
78
78
  class Item < Spotted::Internal::Type::BaseModel
79
79
  # @!attribute id
@@ -20,12 +20,6 @@ module Spotted
20
20
  # @return [String]
21
21
  required :href, String
22
22
 
23
- # @!attribute items
24
- #
25
- # @return [Array<Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item>]
26
- required :items,
27
- -> { Spotted::Internal::Type::ArrayOf[Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item] }
28
-
29
23
  # @!attribute limit
30
24
  # The maximum number of items in the response (as set in the query or by default).
31
25
  #
@@ -56,14 +50,18 @@ module Spotted
56
50
  # @return [Integer]
57
51
  required :total, Integer
58
52
 
59
- # @!method initialize(href:, items:, limit:, next_:, offset:, previous:, total:)
53
+ # @!attribute items
54
+ #
55
+ # @return [Array<Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item>, nil]
56
+ optional :items,
57
+ -> { Spotted::Internal::Type::ArrayOf[Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item] }
58
+
59
+ # @!method initialize(href:, limit:, next_:, offset:, previous:, total:, items: nil)
60
60
  # Some parameter documentations has been truncated, see
61
61
  # {Spotted::Models::BrowseGetNewReleasesResponse::Albums} for more details.
62
62
  #
63
63
  # @param href [String] A link to the Web API endpoint returning the full result of the request
64
64
  #
65
- # @param items [Array<Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item>]
66
- #
67
65
  # @param limit [Integer] The maximum number of items in the response (as set in the query or by default).
68
66
  #
69
67
  # @param next_ [String, nil] URL to the next page of items. ( `null` if none)
@@ -73,6 +71,8 @@ module Spotted
73
71
  # @param previous [String, nil] URL to the previous page of items. ( `null` if none)
74
72
  #
75
73
  # @param total [Integer] The total number of items available to return.
74
+ #
75
+ # @param items [Array<Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item>]
76
76
 
77
77
  class Item < Spotted::Internal::Type::BaseModel
78
78
  # @!attribute id
@@ -151,8 +151,8 @@ module Spotted
151
151
  # @!attribute type
152
152
  # The object type.
153
153
  #
154
- # @return [Symbol, Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item::Type]
155
- required :type, enum: -> { Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item::Type }
154
+ # @return [Symbol, :album]
155
+ required :type, const: :album
156
156
 
157
157
  # @!attribute uri
158
158
  # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the
@@ -167,7 +167,7 @@ module Spotted
167
167
  # @return [Spotted::Models::AlbumRestrictionObject, nil]
168
168
  optional :restrictions, -> { Spotted::AlbumRestrictionObject }
169
169
 
170
- # @!method initialize(id:, album_type:, artists:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, type:, uri:, restrictions: nil)
170
+ # @!method initialize(id:, album_type:, artists:, available_markets:, external_urls:, href:, images:, name:, release_date:, release_date_precision:, total_tracks:, uri:, restrictions: nil, type: :album)
171
171
  # Some parameter documentations has been truncated, see
172
172
  # {Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item} for more details.
173
173
  #
@@ -193,11 +193,11 @@ module Spotted
193
193
  #
194
194
  # @param total_tracks [Integer] The number of tracks in the album.
195
195
  #
196
- # @param type [Symbol, Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item::Type] The object type.
197
- #
198
196
  # @param uri [String] The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for the albu
199
197
  #
200
198
  # @param restrictions [Spotted::Models::AlbumRestrictionObject] Included in the response when a content restriction is applied.
199
+ #
200
+ # @param type [Symbol, :album] The object type.
201
201
 
202
202
  # The type of the album.
203
203
  #
@@ -226,18 +226,6 @@ module Spotted
226
226
  # @!method self.values
227
227
  # @return [Array<Symbol>]
228
228
  end
229
-
230
- # The object type.
231
- #
232
- # @see Spotted::Models::BrowseGetNewReleasesResponse::Albums::Item#type
233
- module Type
234
- extend Spotted::Internal::Type::Enum
235
-
236
- ALBUM = :album
237
-
238
- # @!method self.values
239
- # @return [Array<Symbol>]
240
- end
241
229
  end
242
230
  end
243
231
  end