spotify-api-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +30 -0
  3. data/README.md +107 -0
  4. data/lib/spotify_web_api/api_helper.rb +10 -0
  5. data/lib/spotify_web_api/client.rb +154 -0
  6. data/lib/spotify_web_api/configuration.rb +180 -0
  7. data/lib/spotify_web_api/controllers/albums_controller.rb +295 -0
  8. data/lib/spotify_web_api/controllers/artists_controller.rb +187 -0
  9. data/lib/spotify_web_api/controllers/audiobooks_controller.rb +258 -0
  10. data/lib/spotify_web_api/controllers/base_controller.rb +66 -0
  11. data/lib/spotify_web_api/controllers/categories_controller.rb +83 -0
  12. data/lib/spotify_web_api/controllers/chapters_controller.rb +82 -0
  13. data/lib/spotify_web_api/controllers/episodes_controller.rb +239 -0
  14. data/lib/spotify_web_api/controllers/genres_controller.rb +39 -0
  15. data/lib/spotify_web_api/controllers/markets_controller.rb +38 -0
  16. data/lib/spotify_web_api/controllers/o_auth_authorization_controller.rb +82 -0
  17. data/lib/spotify_web_api/controllers/player_controller.rb +509 -0
  18. data/lib/spotify_web_api/controllers/playlists_controller.rb +521 -0
  19. data/lib/spotify_web_api/controllers/search_controller.rb +60 -0
  20. data/lib/spotify_web_api/controllers/shows_controller.rb +261 -0
  21. data/lib/spotify_web_api/controllers/tracks_controller.rb +491 -0
  22. data/lib/spotify_web_api/controllers/users_controller.rb +396 -0
  23. data/lib/spotify_web_api/exceptions/api_exception.rb +10 -0
  24. data/lib/spotify_web_api/exceptions/bad_request_exception.rb +32 -0
  25. data/lib/spotify_web_api/exceptions/forbidden_exception.rb +32 -0
  26. data/lib/spotify_web_api/exceptions/not_found_exception.rb +32 -0
  27. data/lib/spotify_web_api/exceptions/o_auth_provider_exception.rb +48 -0
  28. data/lib/spotify_web_api/exceptions/too_many_requests_exception.rb +32 -0
  29. data/lib/spotify_web_api/exceptions/unauthorized_exception.rb +32 -0
  30. data/lib/spotify_web_api/http/api_response.rb +21 -0
  31. data/lib/spotify_web_api/http/auth/o_auth2.rb +146 -0
  32. data/lib/spotify_web_api/http/http_call_back.rb +10 -0
  33. data/lib/spotify_web_api/http/http_method_enum.rb +10 -0
  34. data/lib/spotify_web_api/http/http_request.rb +10 -0
  35. data/lib/spotify_web_api/http/http_response.rb +10 -0
  36. data/lib/spotify_web_api/models/album_base.rb +168 -0
  37. data/lib/spotify_web_api/models/album_group_enum.rb +29 -0
  38. data/lib/spotify_web_api/models/album_object.rb +247 -0
  39. data/lib/spotify_web_api/models/album_restriction_object.rb +53 -0
  40. data/lib/spotify_web_api/models/album_type_enum.rb +26 -0
  41. data/lib/spotify_web_api/models/artist_discography_album_object.rb +194 -0
  42. data/lib/spotify_web_api/models/artist_object.rb +147 -0
  43. data/lib/spotify_web_api/models/audio_analysis_object.rb +156 -0
  44. data/lib/spotify_web_api/models/audio_features_object.rb +249 -0
  45. data/lib/spotify_web_api/models/audiobook_base.rb +245 -0
  46. data/lib/spotify_web_api/models/audiobook_object.rb +253 -0
  47. data/lib/spotify_web_api/models/author_object.rb +50 -0
  48. data/lib/spotify_web_api/models/base_model.rb +62 -0
  49. data/lib/spotify_web_api/models/categories.rb +110 -0
  50. data/lib/spotify_web_api/models/category_object.rb +82 -0
  51. data/lib/spotify_web_api/models/chapter_base.rb +237 -0
  52. data/lib/spotify_web_api/models/chapter_object.rb +245 -0
  53. data/lib/spotify_web_api/models/chapter_restriction_object.rb +59 -0
  54. data/lib/spotify_web_api/models/context_object.rb +78 -0
  55. data/lib/spotify_web_api/models/copyright_object.rb +60 -0
  56. data/lib/spotify_web_api/models/currently_playing_context_object.rb +137 -0
  57. data/lib/spotify_web_api/models/currently_playing_object.rb +109 -0
  58. data/lib/spotify_web_api/models/cursor_object.rb +59 -0
  59. data/lib/spotify_web_api/models/cursor_paged_artists.rb +48 -0
  60. data/lib/spotify_web_api/models/cursor_paging_object.rb +88 -0
  61. data/lib/spotify_web_api/models/cursor_paging_play_history_object.rb +106 -0
  62. data/lib/spotify_web_api/models/cursor_paging_simplified_artist_object.rb +106 -0
  63. data/lib/spotify_web_api/models/device_object.rb +126 -0
  64. data/lib/spotify_web_api/models/disallows_object.rb +140 -0
  65. data/lib/spotify_web_api/models/episode_base.rb +237 -0
  66. data/lib/spotify_web_api/models/episode_object.rb +246 -0
  67. data/lib/spotify_web_api/models/episode_restriction_object.rb +58 -0
  68. data/lib/spotify_web_api/models/error_object.rb +59 -0
  69. data/lib/spotify_web_api/models/explicit_content_settings_object.rb +61 -0
  70. data/lib/spotify_web_api/models/external_id_object.rb +72 -0
  71. data/lib/spotify_web_api/models/external_url_object.rb +51 -0
  72. data/lib/spotify_web_api/models/followers_object.rb +62 -0
  73. data/lib/spotify_web_api/models/image_object.rb +67 -0
  74. data/lib/spotify_web_api/models/include_external_enum.rb +23 -0
  75. data/lib/spotify_web_api/models/item_type1_enum.rb +20 -0
  76. data/lib/spotify_web_api/models/item_type2_enum.rb +23 -0
  77. data/lib/spotify_web_api/models/item_type3_enum.rb +23 -0
  78. data/lib/spotify_web_api/models/item_type_enum.rb +38 -0
  79. data/lib/spotify_web_api/models/linked_track_object.rb +89 -0
  80. data/lib/spotify_web_api/models/many_albums.rb +57 -0
  81. data/lib/spotify_web_api/models/many_artists.rb +57 -0
  82. data/lib/spotify_web_api/models/many_audio_features.rb +57 -0
  83. data/lib/spotify_web_api/models/many_audiobooks.rb +57 -0
  84. data/lib/spotify_web_api/models/many_chapters.rb +57 -0
  85. data/lib/spotify_web_api/models/many_devices.rb +57 -0
  86. data/lib/spotify_web_api/models/many_episodes.rb +57 -0
  87. data/lib/spotify_web_api/models/many_genres.rb +48 -0
  88. data/lib/spotify_web_api/models/many_simplified_shows.rb +57 -0
  89. data/lib/spotify_web_api/models/many_tracks.rb +57 -0
  90. data/lib/spotify_web_api/models/markets.rb +50 -0
  91. data/lib/spotify_web_api/models/me_albums_request.rb +55 -0
  92. data/lib/spotify_web_api/models/me_episodes_request.rb +52 -0
  93. data/lib/spotify_web_api/models/me_episodes_request1.rb +54 -0
  94. data/lib/spotify_web_api/models/me_following_request.rb +53 -0
  95. data/lib/spotify_web_api/models/me_following_request1.rb +55 -0
  96. data/lib/spotify_web_api/models/me_player_play_request.rb +89 -0
  97. data/lib/spotify_web_api/models/me_player_request.rb +63 -0
  98. data/lib/spotify_web_api/models/me_shows_request.rb +55 -0
  99. data/lib/spotify_web_api/models/me_tracks_request.rb +53 -0
  100. data/lib/spotify_web_api/models/me_tracks_request1.rb +55 -0
  101. data/lib/spotify_web_api/models/meta.rb +110 -0
  102. data/lib/spotify_web_api/models/mode_enum.rb +30 -0
  103. data/lib/spotify_web_api/models/narrator_object.rb +50 -0
  104. data/lib/spotify_web_api/models/o_auth_provider_error_enum.rb +45 -0
  105. data/lib/spotify_web_api/models/o_auth_scope_enum.rb +94 -0
  106. data/lib/spotify_web_api/models/o_auth_token.rb +96 -0
  107. data/lib/spotify_web_api/models/paged_albums.rb +48 -0
  108. data/lib/spotify_web_api/models/paged_categories.rb +48 -0
  109. data/lib/spotify_web_api/models/paging_artist_discography_album_object.rb +110 -0
  110. data/lib/spotify_web_api/models/paging_artist_object.rb +110 -0
  111. data/lib/spotify_web_api/models/paging_featured_playlist_object.rb +59 -0
  112. data/lib/spotify_web_api/models/paging_object.rb +93 -0
  113. data/lib/spotify_web_api/models/paging_playlist_object.rb +110 -0
  114. data/lib/spotify_web_api/models/paging_playlist_track_object.rb +110 -0
  115. data/lib/spotify_web_api/models/paging_saved_album_object.rb +110 -0
  116. data/lib/spotify_web_api/models/paging_saved_audiobook_object.rb +110 -0
  117. data/lib/spotify_web_api/models/paging_saved_episode_object.rb +110 -0
  118. data/lib/spotify_web_api/models/paging_saved_show_object.rb +110 -0
  119. data/lib/spotify_web_api/models/paging_saved_track_object.rb +110 -0
  120. data/lib/spotify_web_api/models/paging_simplified_album_object.rb +110 -0
  121. data/lib/spotify_web_api/models/paging_simplified_audiobook_object.rb +110 -0
  122. data/lib/spotify_web_api/models/paging_simplified_chapter_object.rb +110 -0
  123. data/lib/spotify_web_api/models/paging_simplified_episode_object.rb +110 -0
  124. data/lib/spotify_web_api/models/paging_simplified_show_object.rb +110 -0
  125. data/lib/spotify_web_api/models/paging_simplified_track_object.rb +110 -0
  126. data/lib/spotify_web_api/models/paging_track_object.rb +110 -0
  127. data/lib/spotify_web_api/models/play_history_object.rb +77 -0
  128. data/lib/spotify_web_api/models/playlist_object.rb +193 -0
  129. data/lib/spotify_web_api/models/playlist_owner_object.rb +109 -0
  130. data/lib/spotify_web_api/models/playlist_snapshot_id.rb +50 -0
  131. data/lib/spotify_web_api/models/playlist_track_object.rb +90 -0
  132. data/lib/spotify_web_api/models/playlist_tracks_ref_object.rb +60 -0
  133. data/lib/spotify_web_api/models/playlist_user_object.rb +98 -0
  134. data/lib/spotify_web_api/models/playlists_followers_request.rb +51 -0
  135. data/lib/spotify_web_api/models/playlists_request.rb +82 -0
  136. data/lib/spotify_web_api/models/playlists_tracks_request.rb +72 -0
  137. data/lib/spotify_web_api/models/playlists_tracks_request1.rb +97 -0
  138. data/lib/spotify_web_api/models/playlists_tracks_request2.rb +75 -0
  139. data/lib/spotify_web_api/models/private_user_object.rb +181 -0
  140. data/lib/spotify_web_api/models/public_user_object.rb +128 -0
  141. data/lib/spotify_web_api/models/queue_object.rb +60 -0
  142. data/lib/spotify_web_api/models/reason_enum.rb +29 -0
  143. data/lib/spotify_web_api/models/recommendation_seed_object.rb +104 -0
  144. data/lib/spotify_web_api/models/recommendations_object.rb +74 -0
  145. data/lib/spotify_web_api/models/release_date_precision_enum.rb +26 -0
  146. data/lib/spotify_web_api/models/resume_point_object.rb +60 -0
  147. data/lib/spotify_web_api/models/saved_album_object.rb +73 -0
  148. data/lib/spotify_web_api/models/saved_audiobook_object.rb +73 -0
  149. data/lib/spotify_web_api/models/saved_episode_object.rb +70 -0
  150. data/lib/spotify_web_api/models/saved_show_object.rb +73 -0
  151. data/lib/spotify_web_api/models/saved_track_object.rb +73 -0
  152. data/lib/spotify_web_api/models/search_items.rb +107 -0
  153. data/lib/spotify_web_api/models/section_object.rb +180 -0
  154. data/lib/spotify_web_api/models/segment_object.rb +166 -0
  155. data/lib/spotify_web_api/models/show_base.rb +211 -0
  156. data/lib/spotify_web_api/models/show_object.rb +219 -0
  157. data/lib/spotify_web_api/models/simplified_album_object.rb +186 -0
  158. data/lib/spotify_web_api/models/simplified_artist_object.rb +98 -0
  159. data/lib/spotify_web_api/models/simplified_playlist_object.rb +184 -0
  160. data/lib/spotify_web_api/models/simplified_track_object.rb +227 -0
  161. data/lib/spotify_web_api/models/time_interval_object.rb +68 -0
  162. data/lib/spotify_web_api/models/track.rb +331 -0
  163. data/lib/spotify_web_api/models/track1.rb +50 -0
  164. data/lib/spotify_web_api/models/track_object.rb +265 -0
  165. data/lib/spotify_web_api/models/track_restriction_object.rb +58 -0
  166. data/lib/spotify_web_api/models/type2_enum.rb +20 -0
  167. data/lib/spotify_web_api/models/type3_enum.rb +20 -0
  168. data/lib/spotify_web_api/models/type4_enum.rb +20 -0
  169. data/lib/spotify_web_api/models/type6_enum.rb +20 -0
  170. data/lib/spotify_web_api/models/type7_enum.rb +20 -0
  171. data/lib/spotify_web_api/models/type8_enum.rb +20 -0
  172. data/lib/spotify_web_api/models/type9_enum.rb +20 -0
  173. data/lib/spotify_web_api/models/type_enum.rb +20 -0
  174. data/lib/spotify_web_api/models/users_playlists_request.rb +87 -0
  175. data/lib/spotify_web_api/utilities/date_time_helper.rb +11 -0
  176. data/lib/spotify_web_api/utilities/file_wrapper.rb +16 -0
  177. data/lib/spotify_web_api.rb +198 -0
  178. metadata +264 -0
@@ -0,0 +1,109 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistOwnerObject Model.
8
+ class PlaylistOwnerObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Known public external URLs for this user.
13
+ # @return [ExternalUrlObject]
14
+ attr_accessor :external_urls
15
+
16
+ # Information about the followers of this user.
17
+ # @return [FollowersObject]
18
+ attr_accessor :followers
19
+
20
+ # A link to the Web API endpoint for this user.
21
+ # @return [String]
22
+ attr_accessor :href
23
+
24
+ # The [Spotify user ID](/documentation/web-api/concepts/spotify-uris-ids)
25
+ # for this user.
26
+ # @return [String]
27
+ attr_accessor :id
28
+
29
+ # The object type.
30
+ # @return [Type4Enum]
31
+ attr_accessor :type
32
+
33
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
34
+ # this user.
35
+ # @return [String]
36
+ attr_accessor :uri
37
+
38
+ # The name displayed on the user's profile. `null` if not available.
39
+ # @return [String]
40
+ attr_accessor :display_name
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['external_urls'] = 'external_urls'
46
+ @_hash['followers'] = 'followers'
47
+ @_hash['href'] = 'href'
48
+ @_hash['id'] = 'id'
49
+ @_hash['type'] = 'type'
50
+ @_hash['uri'] = 'uri'
51
+ @_hash['display_name'] = 'display_name'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ external_urls
59
+ followers
60
+ href
61
+ id
62
+ type
63
+ uri
64
+ display_name
65
+ ]
66
+ end
67
+
68
+ # An array for nullable fields
69
+ def self.nullables
70
+ %w[
71
+ display_name
72
+ ]
73
+ end
74
+
75
+ def initialize(external_urls = SKIP, followers = SKIP, href = SKIP,
76
+ id = SKIP, type = SKIP, uri = SKIP, display_name = SKIP)
77
+ @external_urls = external_urls unless external_urls == SKIP
78
+ @followers = followers unless followers == SKIP
79
+ @href = href unless href == SKIP
80
+ @id = id unless id == SKIP
81
+ @type = type unless type == SKIP
82
+ @uri = uri unless uri == SKIP
83
+ @display_name = display_name unless display_name == SKIP
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
92
+ followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
93
+ href = hash.key?('href') ? hash['href'] : SKIP
94
+ id = hash.key?('id') ? hash['id'] : SKIP
95
+ type = hash.key?('type') ? hash['type'] : SKIP
96
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
97
+ display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
98
+
99
+ # Create object from extracted values.
100
+ PlaylistOwnerObject.new(external_urls,
101
+ followers,
102
+ href,
103
+ id,
104
+ type,
105
+ uri,
106
+ display_name)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,50 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistSnapshotId Model.
8
+ class PlaylistSnapshotId < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :snapshot_id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['snapshot_id'] = 'snapshot_id'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ snapshot_id
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(snapshot_id = SKIP)
36
+ @snapshot_id = snapshot_id unless snapshot_id == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ snapshot_id = hash.key?('snapshot_id') ? hash['snapshot_id'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ PlaylistSnapshotId.new(snapshot_id)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,90 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module SpotifyWebApi
8
+ # PlaylistTrackObject Model.
9
+ class PlaylistTrackObject < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The date and time the track or episode was added. _**Note**: some very old
14
+ # playlists may return `null` in this field._
15
+ # @return [DateTime]
16
+ attr_accessor :added_at
17
+
18
+ # The Spotify user who added the track or episode. _**Note**: some very old
19
+ # playlists may return `null` in this field._
20
+ # @return [PlaylistUserObject]
21
+ attr_accessor :added_by
22
+
23
+ # Whether this track or episode is a [local
24
+ # file](/documentation/web-api/concepts/playlists/#local-files) or not.
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :is_local
27
+
28
+ # Information about the track or episode.
29
+ # @return [Object]
30
+ attr_accessor :track
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['added_at'] = 'added_at'
36
+ @_hash['added_by'] = 'added_by'
37
+ @_hash['is_local'] = 'is_local'
38
+ @_hash['track'] = 'track'
39
+ @_hash
40
+ end
41
+
42
+ # An array for optional fields
43
+ def self.optionals
44
+ %w[
45
+ added_at
46
+ added_by
47
+ is_local
48
+ track
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(added_at = SKIP, added_by = SKIP, is_local = SKIP,
58
+ track = SKIP)
59
+ @added_at = added_at unless added_at == SKIP
60
+ @added_by = added_by unless added_by == SKIP
61
+ @is_local = is_local unless is_local == SKIP
62
+ @track = track unless track == SKIP
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ added_at = if hash.key?('added_at')
71
+ (DateTimeHelper.from_rfc3339(hash['added_at']) if hash['added_at'])
72
+ else
73
+ SKIP
74
+ end
75
+ added_by = PlaylistUserObject.from_hash(hash['added_by']) if hash['added_by']
76
+ is_local = hash.key?('is_local') ? hash['is_local'] : SKIP
77
+ track = hash.key?('track') ? hash['track'] : SKIP
78
+
79
+ # Create object from extracted values.
80
+ PlaylistTrackObject.new(added_at,
81
+ added_by,
82
+ is_local,
83
+ track)
84
+ end
85
+
86
+ def to_custom_added_at
87
+ DateTimeHelper.to_rfc3339(added_at)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,60 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistTracksRefObject Model.
8
+ class PlaylistTracksRefObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A link to the Web API endpoint where full details of the playlist's tracks
13
+ # can be retrieved.
14
+ # @return [String]
15
+ attr_accessor :href
16
+
17
+ # Number of tracks in the playlist.
18
+ # @return [Integer]
19
+ attr_accessor :total
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['href'] = 'href'
25
+ @_hash['total'] = 'total'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ href
33
+ total
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(href = SKIP, total = SKIP)
43
+ @href = href unless href == SKIP
44
+ @total = total unless total == SKIP
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ href = hash.key?('href') ? hash['href'] : SKIP
53
+ total = hash.key?('total') ? hash['total'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ PlaylistTracksRefObject.new(href,
57
+ total)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,98 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistUserObject Model.
8
+ class PlaylistUserObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Known public external URLs for this user.
13
+ # @return [ExternalUrlObject]
14
+ attr_accessor :external_urls
15
+
16
+ # Information about the followers of this user.
17
+ # @return [FollowersObject]
18
+ attr_accessor :followers
19
+
20
+ # A link to the Web API endpoint for this user.
21
+ # @return [String]
22
+ attr_accessor :href
23
+
24
+ # The [Spotify user ID](/documentation/web-api/concepts/spotify-uris-ids)
25
+ # for this user.
26
+ # @return [String]
27
+ attr_accessor :id
28
+
29
+ # The object type.
30
+ # @return [Type4Enum]
31
+ attr_accessor :type
32
+
33
+ # The [Spotify URI](/documentation/web-api/concepts/spotify-uris-ids) for
34
+ # this user.
35
+ # @return [String]
36
+ attr_accessor :uri
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['external_urls'] = 'external_urls'
42
+ @_hash['followers'] = 'followers'
43
+ @_hash['href'] = 'href'
44
+ @_hash['id'] = 'id'
45
+ @_hash['type'] = 'type'
46
+ @_hash['uri'] = 'uri'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ external_urls
54
+ followers
55
+ href
56
+ id
57
+ type
58
+ uri
59
+ ]
60
+ end
61
+
62
+ # An array for nullable fields
63
+ def self.nullables
64
+ []
65
+ end
66
+
67
+ def initialize(external_urls = SKIP, followers = SKIP, href = SKIP,
68
+ id = SKIP, type = SKIP, uri = SKIP)
69
+ @external_urls = external_urls unless external_urls == SKIP
70
+ @followers = followers unless followers == SKIP
71
+ @href = href unless href == SKIP
72
+ @id = id unless id == SKIP
73
+ @type = type unless type == SKIP
74
+ @uri = uri unless uri == SKIP
75
+ end
76
+
77
+ # Creates an instance of the object from a hash.
78
+ def self.from_hash(hash)
79
+ return nil unless hash
80
+
81
+ # Extract variables from the hash.
82
+ external_urls = ExternalUrlObject.from_hash(hash['external_urls']) if hash['external_urls']
83
+ followers = FollowersObject.from_hash(hash['followers']) if hash['followers']
84
+ href = hash.key?('href') ? hash['href'] : SKIP
85
+ id = hash.key?('id') ? hash['id'] : SKIP
86
+ type = hash.key?('type') ? hash['type'] : SKIP
87
+ uri = hash.key?('uri') ? hash['uri'] : SKIP
88
+
89
+ # Create object from extracted values.
90
+ PlaylistUserObject.new(external_urls,
91
+ followers,
92
+ href,
93
+ id,
94
+ type,
95
+ uri)
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,51 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistsFollowersRequest Model.
8
+ class PlaylistsFollowersRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Defaults to `true`. If `true` the playlist will be included in user's
13
+ # public playlists, if `false` it will remain private.
14
+ # @return [TrueClass | FalseClass]
15
+ attr_accessor :public
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['public'] = 'public'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ %w[
27
+ public
28
+ ]
29
+ end
30
+
31
+ # An array for nullable fields
32
+ def self.nullables
33
+ []
34
+ end
35
+
36
+ def initialize(public = SKIP)
37
+ @public = public unless public == SKIP
38
+ end
39
+
40
+ # Creates an instance of the object from a hash.
41
+ def self.from_hash(hash)
42
+ return nil unless hash
43
+
44
+ # Extract variables from the hash.
45
+ public = hash.key?('public') ? hash['public'] : SKIP
46
+
47
+ # Create object from extracted values.
48
+ PlaylistsFollowersRequest.new(public)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,82 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistsRequest Model.
8
+ class PlaylistsRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The new name for the playlist, for example `"My New Playlist Title"`
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # If `true` the playlist will be public, if `false` it will be private.
17
+ # @return [TrueClass | FalseClass]
18
+ attr_accessor :public
19
+
20
+ # If `true`, the playlist will become collaborative and other users will be
21
+ # able to modify the playlist in their Spotify client. <br/>
22
+ # _**Note**: You can only set `collaborative` to `true` on non-public
23
+ # playlists._
24
+ # @return [TrueClass | FalseClass]
25
+ attr_accessor :collaborative
26
+
27
+ # Value for playlist description as displayed in Spotify Clients and in the
28
+ # Web API.
29
+ # @return [String]
30
+ attr_accessor :description
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['name'] = 'name'
36
+ @_hash['public'] = 'public'
37
+ @_hash['collaborative'] = 'collaborative'
38
+ @_hash['description'] = 'description'
39
+ @_hash
40
+ end
41
+
42
+ # An array for optional fields
43
+ def self.optionals
44
+ %w[
45
+ name
46
+ public
47
+ collaborative
48
+ description
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(name = SKIP, public = SKIP, collaborative = SKIP,
58
+ description = SKIP)
59
+ @name = name unless name == SKIP
60
+ @public = public unless public == SKIP
61
+ @collaborative = collaborative unless collaborative == SKIP
62
+ @description = description unless description == SKIP
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ name = hash.key?('name') ? hash['name'] : SKIP
71
+ public = hash.key?('public') ? hash['public'] : SKIP
72
+ collaborative = hash.key?('collaborative') ? hash['collaborative'] : SKIP
73
+ description = hash.key?('description') ? hash['description'] : SKIP
74
+
75
+ # Create object from extracted values.
76
+ PlaylistsRequest.new(name,
77
+ public,
78
+ collaborative,
79
+ description)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,72 @@
1
+ # spotify_web_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module SpotifyWebApi
7
+ # PlaylistsTracksRequest Model.
8
+ class PlaylistsTracksRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A JSON array of the [Spotify
13
+ # URIs](/documentation/web-api/concepts/spotify-uris-ids) to add. For
14
+ # example: `{"uris":
15
+ # ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZC
16
+ # A6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}`<br/>A maximum of 100
17
+ # items can be added in one request. _**Note**: if the `uris` parameter is
18
+ # present in the query string, any URIs listed here in the body will be
19
+ # ignored._
20
+ # @return [Array[String]]
21
+ attr_accessor :uris
22
+
23
+ # The position to insert the items, a zero-based index. For example, to
24
+ # insert the items in the first position: `position=0` ; to insert the items
25
+ # in the third position: `position=2`. If omitted, the items will be
26
+ # appended to the playlist. Items are added in the order they appear in the
27
+ # uris array. For example: `{"uris":
28
+ # ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZC
29
+ # A6M"], "position": 3}`
30
+ # @return [Integer]
31
+ attr_accessor :position
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['uris'] = 'uris'
37
+ @_hash['position'] = 'position'
38
+ @_hash
39
+ end
40
+
41
+ # An array for optional fields
42
+ def self.optionals
43
+ %w[
44
+ uris
45
+ position
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(uris = SKIP, position = SKIP)
55
+ @uris = uris unless uris == SKIP
56
+ @position = position unless position == SKIP
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ uris = hash.key?('uris') ? hash['uris'] : SKIP
65
+ position = hash.key?('position') ? hash['position'] : SKIP
66
+
67
+ # Create object from extracted values.
68
+ PlaylistsTracksRequest.new(uris,
69
+ position)
70
+ end
71
+ end
72
+ end