spotify-apimatic-sdk 1.0.0__py3-none-any.whl

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 (186) hide show
  1. spotify_apimatic_sdk-1.0.0.dist-info/METADATA +150 -0
  2. spotify_apimatic_sdk-1.0.0.dist-info/RECORD +186 -0
  3. spotify_apimatic_sdk-1.0.0.dist-info/WHEEL +5 -0
  4. spotify_apimatic_sdk-1.0.0.dist-info/licenses/LICENSE +30 -0
  5. spotify_apimatic_sdk-1.0.0.dist-info/top_level.txt +1 -0
  6. spotifywebapi/__init__.py +12 -0
  7. spotifywebapi/api_helper.py +19 -0
  8. spotifywebapi/configuration.py +318 -0
  9. spotifywebapi/controllers/__init__.py +20 -0
  10. spotifywebapi/controllers/albums_controller.py +498 -0
  11. spotifywebapi/controllers/artists_controller.py +327 -0
  12. spotifywebapi/controllers/audiobooks_controller.py +441 -0
  13. spotifywebapi/controllers/base_controller.py +67 -0
  14. spotifywebapi/controllers/categories_controller.py +161 -0
  15. spotifywebapi/controllers/chapters_controller.py +157 -0
  16. spotifywebapi/controllers/episodes_controller.py +390 -0
  17. spotifywebapi/controllers/genres_controller.py +84 -0
  18. spotifywebapi/controllers/markets_controller.py +82 -0
  19. spotifywebapi/controllers/o_auth_authorization_controller.py +156 -0
  20. spotifywebapi/controllers/player_controller.py +807 -0
  21. spotifywebapi/controllers/playlists_controller.py +851 -0
  22. spotifywebapi/controllers/search_controller.py +123 -0
  23. spotifywebapi/controllers/shows_controller.py +439 -0
  24. spotifywebapi/controllers/tracks_controller.py +821 -0
  25. spotifywebapi/controllers/users_controller.py +649 -0
  26. spotifywebapi/exceptions/__init__.py +11 -0
  27. spotifywebapi/exceptions/api_exception.py +36 -0
  28. spotifywebapi/exceptions/bad_request_exception.py +56 -0
  29. spotifywebapi/exceptions/forbidden_exception.py +56 -0
  30. spotifywebapi/exceptions/not_found_exception.py +56 -0
  31. spotifywebapi/exceptions/o_auth_provider_exception.py +73 -0
  32. spotifywebapi/exceptions/too_many_requests_exception.py +56 -0
  33. spotifywebapi/exceptions/unauthorized_exception.py +56 -0
  34. spotifywebapi/http/__init__.py +11 -0
  35. spotifywebapi/http/api_response.py +67 -0
  36. spotifywebapi/http/auth/__init__.py +5 -0
  37. spotifywebapi/http/auth/o_auth_2.py +336 -0
  38. spotifywebapi/http/http_call_back.py +20 -0
  39. spotifywebapi/http/http_client_provider.py +23 -0
  40. spotifywebapi/http/http_method_enum.py +25 -0
  41. spotifywebapi/http/http_request.py +55 -0
  42. spotifywebapi/http/http_response.py +45 -0
  43. spotifywebapi/http/proxy_settings.py +50 -0
  44. spotifywebapi/models/__init__.py +142 -0
  45. spotifywebapi/models/album_base.py +264 -0
  46. spotifywebapi/models/album_group_enum.py +51 -0
  47. spotifywebapi/models/album_object.py +375 -0
  48. spotifywebapi/models/album_restriction_object.py +109 -0
  49. spotifywebapi/models/album_type_enum.py +62 -0
  50. spotifywebapi/models/artist_discography_album_object.py +298 -0
  51. spotifywebapi/models/artist_object.py +335 -0
  52. spotifywebapi/models/audio_analysis_object.py +266 -0
  53. spotifywebapi/models/audio_features_object.py +518 -0
  54. spotifywebapi/models/audiobook_base.py +353 -0
  55. spotifywebapi/models/audiobook_object.py +369 -0
  56. spotifywebapi/models/author_object.py +85 -0
  57. spotifywebapi/models/categories.py +162 -0
  58. spotifywebapi/models/category_object.py +117 -0
  59. spotifywebapi/models/chapter_base.py +392 -0
  60. spotifywebapi/models/chapter_object.py +408 -0
  61. spotifywebapi/models/chapter_restriction_object.py +113 -0
  62. spotifywebapi/models/context_object.py +181 -0
  63. spotifywebapi/models/copyright_object.py +130 -0
  64. spotifywebapi/models/currently_playing_context_object.py +314 -0
  65. spotifywebapi/models/currently_playing_object.py +241 -0
  66. spotifywebapi/models/cursor_object.py +108 -0
  67. spotifywebapi/models/cursor_paged_artists.py +75 -0
  68. spotifywebapi/models/cursor_paging_object.py +183 -0
  69. spotifywebapi/models/cursor_paging_play_history_object.py +214 -0
  70. spotifywebapi/models/cursor_paging_simplified_artist_object.py +213 -0
  71. spotifywebapi/models/device_object.py +278 -0
  72. spotifywebapi/models/disallows_object.py +314 -0
  73. spotifywebapi/models/episode_base.py +394 -0
  74. spotifywebapi/models/episode_object.py +665 -0
  75. spotifywebapi/models/episode_restriction_object.py +112 -0
  76. spotifywebapi/models/error_object.py +85 -0
  77. spotifywebapi/models/explicit_content_settings_object.py +110 -0
  78. spotifywebapi/models/external_id_object.py +156 -0
  79. spotifywebapi/models/external_url_object.py +107 -0
  80. spotifywebapi/models/followers_object.py +134 -0
  81. spotifywebapi/models/image_object.py +168 -0
  82. spotifywebapi/models/include_external_enum.py +45 -0
  83. spotifywebapi/models/item_type_1_enum.py +56 -0
  84. spotifywebapi/models/item_type_2_enum.py +45 -0
  85. spotifywebapi/models/item_type_3_enum.py +45 -0
  86. spotifywebapi/models/item_type_enum.py +58 -0
  87. spotifywebapi/models/linked_track_object.py +205 -0
  88. spotifywebapi/models/many_albums.py +76 -0
  89. spotifywebapi/models/many_artists.py +76 -0
  90. spotifywebapi/models/many_audio_features.py +77 -0
  91. spotifywebapi/models/many_audiobooks.py +77 -0
  92. spotifywebapi/models/many_chapters.py +77 -0
  93. spotifywebapi/models/many_devices.py +76 -0
  94. spotifywebapi/models/many_episodes.py +77 -0
  95. spotifywebapi/models/many_genres.py +69 -0
  96. spotifywebapi/models/many_simplified_shows.py +74 -0
  97. spotifywebapi/models/many_tracks.py +76 -0
  98. spotifywebapi/models/markets.py +85 -0
  99. spotifywebapi/models/me_albums_request.py +90 -0
  100. spotifywebapi/models/me_episodes_request.py +73 -0
  101. spotifywebapi/models/me_episodes_request_1.py +89 -0
  102. spotifywebapi/models/me_following_request.py +74 -0
  103. spotifywebapi/models/me_following_request_1.py +90 -0
  104. spotifywebapi/models/me_player_play_request.py +165 -0
  105. spotifywebapi/models/me_player_request.py +103 -0
  106. spotifywebapi/models/me_shows_request.py +89 -0
  107. spotifywebapi/models/me_tracks_request.py +74 -0
  108. spotifywebapi/models/me_tracks_request_1.py +90 -0
  109. spotifywebapi/models/meta.py +227 -0
  110. spotifywebapi/models/mode_enum.py +52 -0
  111. spotifywebapi/models/narrator_object.py +85 -0
  112. spotifywebapi/models/o_auth_provider_error_enum.py +67 -0
  113. spotifywebapi/models/o_auth_scope_enum.py +98 -0
  114. spotifywebapi/models/o_auth_token.py +113 -0
  115. spotifywebapi/models/paged_albums.py +75 -0
  116. spotifywebapi/models/paged_categories.py +74 -0
  117. spotifywebapi/models/paging_artist_discography_album_object.py +163 -0
  118. spotifywebapi/models/paging_artist_object.py +162 -0
  119. spotifywebapi/models/paging_featured_playlist_object.py +113 -0
  120. spotifywebapi/models/paging_object.py +142 -0
  121. spotifywebapi/models/paging_playlist_object.py +163 -0
  122. spotifywebapi/models/paging_playlist_track_object.py +163 -0
  123. spotifywebapi/models/paging_saved_album_object.py +163 -0
  124. spotifywebapi/models/paging_saved_audiobook_object.py +163 -0
  125. spotifywebapi/models/paging_saved_episode_object.py +163 -0
  126. spotifywebapi/models/paging_saved_show_object.py +163 -0
  127. spotifywebapi/models/paging_saved_track_object.py +163 -0
  128. spotifywebapi/models/paging_simplified_album_object.py +163 -0
  129. spotifywebapi/models/paging_simplified_audiobook_object.py +162 -0
  130. spotifywebapi/models/paging_simplified_chapter_object.py +162 -0
  131. spotifywebapi/models/paging_simplified_episode_object.py +162 -0
  132. spotifywebapi/models/paging_simplified_show_object.py +160 -0
  133. spotifywebapi/models/paging_simplified_track_object.py +163 -0
  134. spotifywebapi/models/paging_track_object.py +162 -0
  135. spotifywebapi/models/play_history_object.py +141 -0
  136. spotifywebapi/models/playlist_object.py +425 -0
  137. spotifywebapi/models/playlist_owner_object.py +238 -0
  138. spotifywebapi/models/playlist_snapshot_id.py +85 -0
  139. spotifywebapi/models/playlist_track_object.py +171 -0
  140. spotifywebapi/models/playlist_tracks_ref_object.py +109 -0
  141. spotifywebapi/models/playlist_user_object.py +231 -0
  142. spotifywebapi/models/playlists_followers_request.py +86 -0
  143. spotifywebapi/models/playlists_request.py +160 -0
  144. spotifywebapi/models/playlists_tracks_request.py +121 -0
  145. spotifywebapi/models/playlists_tracks_request_1.py +188 -0
  146. spotifywebapi/models/playlists_tracks_request_2.py +109 -0
  147. spotifywebapi/models/private_user_object.py +379 -0
  148. spotifywebapi/models/public_user_object.py +268 -0
  149. spotifywebapi/models/queue_object.py +118 -0
  150. spotifywebapi/models/reason_enum.py +65 -0
  151. spotifywebapi/models/recommendation_seed_object.py +208 -0
  152. spotifywebapi/models/recommendations_object.py +96 -0
  153. spotifywebapi/models/release_date_precision_enum.py +62 -0
  154. spotifywebapi/models/resume_point_object.py +131 -0
  155. spotifywebapi/models/saved_album_object.py +118 -0
  156. spotifywebapi/models/saved_audiobook_object.py +118 -0
  157. spotifywebapi/models/saved_episode_object.py +116 -0
  158. spotifywebapi/models/saved_show_object.py +116 -0
  159. spotifywebapi/models/saved_track_object.py +118 -0
  160. spotifywebapi/models/search_items.py +256 -0
  161. spotifywebapi/models/section_object.py +362 -0
  162. spotifywebapi/models/segment_object.py +307 -0
  163. spotifywebapi/models/show_base.py +550 -0
  164. spotifywebapi/models/show_object.py +319 -0
  165. spotifywebapi/models/simplified_album_object.py +468 -0
  166. spotifywebapi/models/simplified_artist_object.py +228 -0
  167. spotifywebapi/models/simplified_playlist_object.py +398 -0
  168. spotifywebapi/models/simplified_track_object.py +494 -0
  169. spotifywebapi/models/time_interval_object.py +132 -0
  170. spotifywebapi/models/track.py +697 -0
  171. spotifywebapi/models/track_1.py +85 -0
  172. spotifywebapi/models/track_object.py +605 -0
  173. spotifywebapi/models/track_restriction_object.py +112 -0
  174. spotifywebapi/models/type_2_enum.py +56 -0
  175. spotifywebapi/models/type_3_enum.py +56 -0
  176. spotifywebapi/models/type_4_enum.py +56 -0
  177. spotifywebapi/models/type_5_enum.py +56 -0
  178. spotifywebapi/models/type_6_enum.py +56 -0
  179. spotifywebapi/models/type_8_enum.py +42 -0
  180. spotifywebapi/models/type_9_enum.py +42 -0
  181. spotifywebapi/models/type_enum.py +56 -0
  182. spotifywebapi/models/users_playlists_request.py +154 -0
  183. spotifywebapi/spotifywebapi_client.py +198 -0
  184. spotifywebapi/utilities/__init__.py +6 -0
  185. spotifywebapi/utilities/file_wrapper.py +45 -0
  186. spotifywebapi/utilities/union_type_lookup.py +113 -0
@@ -0,0 +1,335 @@
1
+ """spotifywebapi.
2
+
3
+ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
4
+ """
5
+
6
+ # ruff: noqa: E501
7
+ from spotifywebapi.api_helper import APIHelper
8
+ from spotifywebapi.models.external_url_object import (
9
+ ExternalUrlObject,
10
+ )
11
+ from spotifywebapi.models.followers_object import (
12
+ FollowersObject,
13
+ )
14
+ from spotifywebapi.models.image_object import (
15
+ ImageObject,
16
+ )
17
+
18
+
19
+ class ArtistObject(object):
20
+ """Implementation of the 'ArtistObject' model.
21
+
22
+ Attributes:
23
+ external_urls (ExternalUrlObject): Known external URLs for this artist.
24
+ followers (FollowersObject): Information about the followers of the artist.
25
+ genres (List[str]): A list of the genres the artist is associated with. If
26
+ not yet classified, the array is empty.
27
+ href (str): A link to the Web API endpoint providing full details of the
28
+ artist.
29
+ id (str): The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids)
30
+ for the artist.
31
+ images (List[ImageObject]): Images of the artist in various sizes, widest
32
+ first.
33
+ name (str): The name of the artist.
34
+ popularity (int): The popularity of the artist. The value will be between 0
35
+ and 100, with 100 being the most popular. The artist's popularity is
36
+ calculated from the popularity of all the artist's tracks.
37
+ mtype (TypeEnum): The object type.
38
+ uri (str): The [Spotify
39
+ URI](/documentation/web-api/concepts/spotify-uris-ids) for the artist.
40
+
41
+ """
42
+
43
+ # Create a mapping from Model property names to API property names
44
+ _names = {
45
+ "external_urls": "external_urls",
46
+ "followers": "followers",
47
+ "genres": "genres",
48
+ "href": "href",
49
+ "id": "id",
50
+ "images": "images",
51
+ "name": "name",
52
+ "popularity": "popularity",
53
+ "mtype": "type",
54
+ "uri": "uri",
55
+ }
56
+
57
+ _optionals = [
58
+ "external_urls",
59
+ "followers",
60
+ "genres",
61
+ "href",
62
+ "id",
63
+ "images",
64
+ "name",
65
+ "popularity",
66
+ "mtype",
67
+ "uri",
68
+ ]
69
+
70
+ def __init__(
71
+ self,
72
+ external_urls=APIHelper.SKIP,
73
+ followers=APIHelper.SKIP,
74
+ genres=APIHelper.SKIP,
75
+ href=APIHelper.SKIP,
76
+ id=APIHelper.SKIP,
77
+ images=APIHelper.SKIP,
78
+ name=APIHelper.SKIP,
79
+ popularity=APIHelper.SKIP,
80
+ mtype=APIHelper.SKIP,
81
+ uri=APIHelper.SKIP):
82
+ """Initialize a ArtistObject instance."""
83
+ # Initialize members of the class
84
+ if external_urls is not APIHelper.SKIP:
85
+ self.external_urls = external_urls
86
+ if followers is not APIHelper.SKIP:
87
+ self.followers = followers
88
+ if genres is not APIHelper.SKIP:
89
+ self.genres = genres
90
+ if href is not APIHelper.SKIP:
91
+ self.href = href
92
+ if id is not APIHelper.SKIP:
93
+ self.id = id
94
+ if images is not APIHelper.SKIP:
95
+ self.images = images
96
+ if name is not APIHelper.SKIP:
97
+ self.name = name
98
+ if popularity is not APIHelper.SKIP:
99
+ self.popularity = popularity
100
+ if mtype is not APIHelper.SKIP:
101
+ self.mtype = mtype
102
+ if uri is not APIHelper.SKIP:
103
+ self.uri = uri
104
+
105
+ @classmethod
106
+ def from_dictionary(cls,
107
+ dictionary):
108
+ """Create an instance of this model from a dictionary
109
+
110
+ Args:
111
+ dictionary (dictionary): A dictionary representation of the object
112
+ as obtained from the deserialization of the server's response. The
113
+ keys MUST match property names in the API description.
114
+
115
+ Returns:
116
+ object: An instance of this structure class.
117
+
118
+ """
119
+ if not isinstance(dictionary, dict) or dictionary is None:
120
+ return None
121
+
122
+ # Extract variables from the dictionary
123
+ external_urls =\
124
+ ExternalUrlObject.from_dictionary(
125
+ dictionary.get("external_urls"))\
126
+ if "external_urls" in dictionary.keys()\
127
+ else APIHelper.SKIP
128
+ followers =\
129
+ FollowersObject.from_dictionary(
130
+ dictionary.get("followers"))\
131
+ if "followers" in dictionary.keys()\
132
+ else APIHelper.SKIP
133
+ genres =\
134
+ dictionary.get("genres")\
135
+ if dictionary.get("genres")\
136
+ else APIHelper.SKIP
137
+ href =\
138
+ dictionary.get("href")\
139
+ if dictionary.get("href")\
140
+ else APIHelper.SKIP
141
+ id =\
142
+ dictionary.get("id")\
143
+ if dictionary.get("id")\
144
+ else APIHelper.SKIP
145
+ images = None
146
+ if dictionary.get("images") is not None:
147
+ images = [
148
+ ImageObject.from_dictionary(x)
149
+ for x in dictionary.get("images")
150
+ ]
151
+ else:
152
+ images = APIHelper.SKIP
153
+ name =\
154
+ dictionary.get("name")\
155
+ if dictionary.get("name")\
156
+ else APIHelper.SKIP
157
+ popularity =\
158
+ dictionary.get("popularity")\
159
+ if dictionary.get("popularity")\
160
+ else APIHelper.SKIP
161
+ mtype =\
162
+ dictionary.get("type")\
163
+ if dictionary.get("type")\
164
+ else APIHelper.SKIP
165
+ uri =\
166
+ dictionary.get("uri")\
167
+ if dictionary.get("uri")\
168
+ else APIHelper.SKIP
169
+
170
+ # Return an object of this model
171
+ return cls(external_urls,
172
+ followers,
173
+ genres,
174
+ href,
175
+ id,
176
+ images,
177
+ name,
178
+ popularity,
179
+ mtype,
180
+ uri)
181
+
182
+ @classmethod
183
+ def validate(cls, dictionary):
184
+ """Validate dictionary against class required properties
185
+
186
+ Args:
187
+ dictionary (dictionary): A dictionary representation of the object
188
+ as obtained from the deserialization of the server's response. The
189
+ keys MUST match property names in the API description.
190
+
191
+ Returns:
192
+ boolean : if dictionary is valid contains required properties.
193
+
194
+ """
195
+ if isinstance(dictionary, cls):
196
+ return True
197
+
198
+ if not isinstance(dictionary, dict):
199
+ return False
200
+
201
+ return True
202
+
203
+ def __repr__(self):
204
+ """Return a unambiguous string representation."""
205
+ _external_urls=(
206
+ self.external_urls
207
+ if hasattr(self, "external_urls")
208
+ else None
209
+ )
210
+ _followers=(
211
+ self.followers
212
+ if hasattr(self, "followers")
213
+ else None
214
+ )
215
+ _genres=(
216
+ self.genres
217
+ if hasattr(self, "genres")
218
+ else None
219
+ )
220
+ _href=(
221
+ self.href
222
+ if hasattr(self, "href")
223
+ else None
224
+ )
225
+ _id=(
226
+ self.id
227
+ if hasattr(self, "id")
228
+ else None
229
+ )
230
+ _images=(
231
+ self.images
232
+ if hasattr(self, "images")
233
+ else None
234
+ )
235
+ _name=(
236
+ self.name
237
+ if hasattr(self, "name")
238
+ else None
239
+ )
240
+ _popularity=(
241
+ self.popularity
242
+ if hasattr(self, "popularity")
243
+ else None
244
+ )
245
+ _mtype=(
246
+ self.mtype
247
+ if hasattr(self, "mtype")
248
+ else None
249
+ )
250
+ _uri=(
251
+ self.uri
252
+ if hasattr(self, "uri")
253
+ else None
254
+ )
255
+ return (
256
+ f"{self.__class__.__name__}("
257
+ f"external_urls={_external_urls!r}, "
258
+ f"followers={_followers!r}, "
259
+ f"genres={_genres!r}, "
260
+ f"href={_href!r}, "
261
+ f"id={_id!r}, "
262
+ f"images={_images!r}, "
263
+ f"name={_name!r}, "
264
+ f"popularity={_popularity!r}, "
265
+ f"mtype={_mtype!r}, "
266
+ f"uri={_uri!r}, "
267
+ f")"
268
+ )
269
+
270
+ def __str__(self):
271
+ """Return a human-readable string representation."""
272
+ _external_urls=(
273
+ self.external_urls
274
+ if hasattr(self, "external_urls")
275
+ else None
276
+ )
277
+ _followers=(
278
+ self.followers
279
+ if hasattr(self, "followers")
280
+ else None
281
+ )
282
+ _genres=(
283
+ self.genres
284
+ if hasattr(self, "genres")
285
+ else None
286
+ )
287
+ _href=(
288
+ self.href
289
+ if hasattr(self, "href")
290
+ else None
291
+ )
292
+ _id=(
293
+ self.id
294
+ if hasattr(self, "id")
295
+ else None
296
+ )
297
+ _images=(
298
+ self.images
299
+ if hasattr(self, "images")
300
+ else None
301
+ )
302
+ _name=(
303
+ self.name
304
+ if hasattr(self, "name")
305
+ else None
306
+ )
307
+ _popularity=(
308
+ self.popularity
309
+ if hasattr(self, "popularity")
310
+ else None
311
+ )
312
+ _mtype=(
313
+ self.mtype
314
+ if hasattr(self, "mtype")
315
+ else None
316
+ )
317
+ _uri=(
318
+ self.uri
319
+ if hasattr(self, "uri")
320
+ else None
321
+ )
322
+ return (
323
+ f"{self.__class__.__name__}("
324
+ f"external_urls={_external_urls!s}, "
325
+ f"followers={_followers!s}, "
326
+ f"genres={_genres!s}, "
327
+ f"href={_href!s}, "
328
+ f"id={_id!s}, "
329
+ f"images={_images!s}, "
330
+ f"name={_name!s}, "
331
+ f"popularity={_popularity!s}, "
332
+ f"mtype={_mtype!s}, "
333
+ f"uri={_uri!s}, "
334
+ f")"
335
+ )
@@ -0,0 +1,266 @@
1
+ """spotifywebapi.
2
+
3
+ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
4
+ """
5
+
6
+ # ruff: noqa: E501
7
+ from spotifywebapi.api_helper import APIHelper
8
+ from spotifywebapi.models.meta import Meta
9
+ from spotifywebapi.models.section_object import (
10
+ SectionObject,
11
+ )
12
+ from spotifywebapi.models.segment_object import (
13
+ SegmentObject,
14
+ )
15
+ from spotifywebapi.models.time_interval_object import (
16
+ TimeIntervalObject,
17
+ )
18
+ from spotifywebapi.models.track import Track
19
+
20
+
21
+ class AudioAnalysisObject(object):
22
+ """Implementation of the 'AudioAnalysisObject' model.
23
+
24
+ Attributes:
25
+ meta (Meta): The model property of type Meta.
26
+ track (Track): The model property of type Track.
27
+ bars (List[TimeIntervalObject]): The time intervals of the bars throughout
28
+ the track. A bar (or measure) is a segment of time defined as a given
29
+ number of beats.
30
+ beats (List[TimeIntervalObject]): The time intervals of beats throughout the
31
+ track. A beat is the basic time unit of a piece of music; for example,
32
+ each tick of a metronome. Beats are typically multiples of tatums.
33
+ sections (List[SectionObject]): Sections are defined by large variations in
34
+ rhythm or timbre, e.g. chorus, verse, bridge, guitar solo, etc. Each
35
+ section contains its own descriptions of tempo, key, mode,
36
+ time_signature, and loudness.
37
+ segments (List[SegmentObject]): Each segment contains a roughly conisistent
38
+ sound throughout its duration.
39
+ tatums (List[TimeIntervalObject]): A tatum represents the lowest regular
40
+ pulse train that a listener intuitively infers from the timing of
41
+ perceived musical events (segments).
42
+
43
+ """
44
+
45
+ # Create a mapping from Model property names to API property names
46
+ _names = {
47
+ "meta": "meta",
48
+ "track": "track",
49
+ "bars": "bars",
50
+ "beats": "beats",
51
+ "sections": "sections",
52
+ "segments": "segments",
53
+ "tatums": "tatums",
54
+ }
55
+
56
+ _optionals = [
57
+ "meta",
58
+ "track",
59
+ "bars",
60
+ "beats",
61
+ "sections",
62
+ "segments",
63
+ "tatums",
64
+ ]
65
+
66
+ def __init__(
67
+ self,
68
+ meta=APIHelper.SKIP,
69
+ track=APIHelper.SKIP,
70
+ bars=APIHelper.SKIP,
71
+ beats=APIHelper.SKIP,
72
+ sections=APIHelper.SKIP,
73
+ segments=APIHelper.SKIP,
74
+ tatums=APIHelper.SKIP):
75
+ """Initialize a AudioAnalysisObject instance."""
76
+ # Initialize members of the class
77
+ if meta is not APIHelper.SKIP:
78
+ self.meta = meta
79
+ if track is not APIHelper.SKIP:
80
+ self.track = track
81
+ if bars is not APIHelper.SKIP:
82
+ self.bars = bars
83
+ if beats is not APIHelper.SKIP:
84
+ self.beats = beats
85
+ if sections is not APIHelper.SKIP:
86
+ self.sections = sections
87
+ if segments is not APIHelper.SKIP:
88
+ self.segments = segments
89
+ if tatums is not APIHelper.SKIP:
90
+ self.tatums = tatums
91
+
92
+ @classmethod
93
+ def from_dictionary(cls,
94
+ dictionary):
95
+ """Create an instance of this model from a dictionary
96
+
97
+ Args:
98
+ dictionary (dictionary): A dictionary representation of the object
99
+ as obtained from the deserialization of the server's response. The
100
+ keys MUST match property names in the API description.
101
+
102
+ Returns:
103
+ object: An instance of this structure class.
104
+
105
+ """
106
+ if not isinstance(dictionary, dict) or dictionary is None:
107
+ return None
108
+
109
+ # Extract variables from the dictionary
110
+ meta =\
111
+ Meta.from_dictionary(
112
+ dictionary.get("meta"))\
113
+ if "meta" in dictionary.keys()\
114
+ else APIHelper.SKIP
115
+ track =\
116
+ Track.from_dictionary(
117
+ dictionary.get("track"))\
118
+ if "track" in dictionary.keys()\
119
+ else APIHelper.SKIP
120
+ bars = None
121
+ if dictionary.get("bars") is not None:
122
+ bars = [
123
+ TimeIntervalObject.from_dictionary(x)
124
+ for x in dictionary.get("bars")
125
+ ]
126
+ else:
127
+ bars = APIHelper.SKIP
128
+ beats = None
129
+ if dictionary.get("beats") is not None:
130
+ beats = [
131
+ TimeIntervalObject.from_dictionary(x)
132
+ for x in dictionary.get("beats")
133
+ ]
134
+ else:
135
+ beats = APIHelper.SKIP
136
+ sections = None
137
+ if dictionary.get("sections") is not None:
138
+ sections = [
139
+ SectionObject.from_dictionary(x)
140
+ for x in dictionary.get("sections")
141
+ ]
142
+ else:
143
+ sections = APIHelper.SKIP
144
+ segments = None
145
+ if dictionary.get("segments") is not None:
146
+ segments = [
147
+ SegmentObject.from_dictionary(x)
148
+ for x in dictionary.get("segments")
149
+ ]
150
+ else:
151
+ segments = APIHelper.SKIP
152
+ tatums = None
153
+ if dictionary.get("tatums") is not None:
154
+ tatums = [
155
+ TimeIntervalObject.from_dictionary(x)
156
+ for x in dictionary.get("tatums")
157
+ ]
158
+ else:
159
+ tatums = APIHelper.SKIP
160
+
161
+ # Return an object of this model
162
+ return cls(meta,
163
+ track,
164
+ bars,
165
+ beats,
166
+ sections,
167
+ segments,
168
+ tatums)
169
+
170
+ def __repr__(self):
171
+ """Return a unambiguous string representation."""
172
+ _meta=(
173
+ self.meta
174
+ if hasattr(self, "meta")
175
+ else None
176
+ )
177
+ _track=(
178
+ self.track
179
+ if hasattr(self, "track")
180
+ else None
181
+ )
182
+ _bars=(
183
+ self.bars
184
+ if hasattr(self, "bars")
185
+ else None
186
+ )
187
+ _beats=(
188
+ self.beats
189
+ if hasattr(self, "beats")
190
+ else None
191
+ )
192
+ _sections=(
193
+ self.sections
194
+ if hasattr(self, "sections")
195
+ else None
196
+ )
197
+ _segments=(
198
+ self.segments
199
+ if hasattr(self, "segments")
200
+ else None
201
+ )
202
+ _tatums=(
203
+ self.tatums
204
+ if hasattr(self, "tatums")
205
+ else None
206
+ )
207
+ return (
208
+ f"{self.__class__.__name__}("
209
+ f"meta={_meta!r}, "
210
+ f"track={_track!r}, "
211
+ f"bars={_bars!r}, "
212
+ f"beats={_beats!r}, "
213
+ f"sections={_sections!r}, "
214
+ f"segments={_segments!r}, "
215
+ f"tatums={_tatums!r}, "
216
+ f")"
217
+ )
218
+
219
+ def __str__(self):
220
+ """Return a human-readable string representation."""
221
+ _meta=(
222
+ self.meta
223
+ if hasattr(self, "meta")
224
+ else None
225
+ )
226
+ _track=(
227
+ self.track
228
+ if hasattr(self, "track")
229
+ else None
230
+ )
231
+ _bars=(
232
+ self.bars
233
+ if hasattr(self, "bars")
234
+ else None
235
+ )
236
+ _beats=(
237
+ self.beats
238
+ if hasattr(self, "beats")
239
+ else None
240
+ )
241
+ _sections=(
242
+ self.sections
243
+ if hasattr(self, "sections")
244
+ else None
245
+ )
246
+ _segments=(
247
+ self.segments
248
+ if hasattr(self, "segments")
249
+ else None
250
+ )
251
+ _tatums=(
252
+ self.tatums
253
+ if hasattr(self, "tatums")
254
+ else None
255
+ )
256
+ return (
257
+ f"{self.__class__.__name__}("
258
+ f"meta={_meta!s}, "
259
+ f"track={_track!s}, "
260
+ f"bars={_bars!s}, "
261
+ f"beats={_beats!s}, "
262
+ f"sections={_sections!s}, "
263
+ f"segments={_segments!s}, "
264
+ f"tatums={_tatums!s}, "
265
+ f")"
266
+ )