lib/Net/Async/Spotify/API/Generated/Playlists.pm

filter: Statementstmt 27.3% 29 / 106 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 31.2% 5 / 16 Podpod 100% 11 / 11 totaltotal 33.8% 45 / 133 SCAR 3.2
CC
1
Cov
27%
add_tracks_to_playlist
2.0
change_playlist_details
2.0
create_playlist
2.0
CRAP 1.4
« lib/Net/Async/Spotify/API/Generated/Player.pm ↑ Summary lib/Net/Async/Spotify/API/Generated/Browse.pm »
1 package Net::Async::Spotify::API::Generated::Playlists;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.001'; # VERSION
7 2 our $AUTHORITY = 'cpan:VNEALV'; # AUTHORITY
8  
9 2 ▶use mro;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use parent qw(Net::Async::Spotify::API::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =encoding utf8
15  
16 =head1 NAME
17  
18 Net::Async::Spotify::API::Generated::Playlists - Package representing Spotify Playlists API
19  
20 =head1 DESCRIPTION
21  
22 Autogenerated module.
23 Based on https://developer.spotify.com/documentation/web-api/reference/#reference-index
24 Check C<crawl-api-doc.pl> for more information.
25  
26 =head1 METHODS
27  
28 =cut
29  
30 =head2 add_tracks_to_playlist
31  
32 add_tracks_to_playlist - Add Items to a Playlist
33  
34 Add one or more items to a user’s playlist.
35  
36 with Request details being:
37  
38 =head3 header
39  
40 =over 4
41  
42 =item Authorization
43  
44 Type: string | Required: required
45 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.Adding items to the current user’s public playlists requires authorization of the playlist-modify-public scope; adding items to the current user’s private playlist (including collaborative playlists) requires the playlist-modify-private scope. See Using Scopes.
46  
47 =item Content-Type
48  
49 Type: string | Required: required
50 Required if URIs are passed in the request body, otherwise ignored. The content type of the request body: application/json
51  
52 =back
53  
54 =head3 json_body_parameter
55  
56 =over 4
57  
58 =item position
59  
60 Type: integer | Required: optional
61 The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0 ; to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist. Items are added in the order they appear in the uris array. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M"], "position": 3}
62  
63 =item uris
64  
65 Type: array[string] | Required: optional
66 A JSON array of the Spotify URIs to add. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}A maximum of 100 items can be added in one request. Note: if the uris parameter is present in the query string, any URIs listed here in the body will be ignored.
67  
68 =back
69  
70 =head3 path_parameter
71  
72 =over 4
73  
74 =item playlist_id
75  
76 Type: string | Required: required
77 The Spotify ID
78 for the playlist.
79  
80 =back
81  
82 =head3 query_parameter
83  
84 =over 4
85  
86 =item position
87  
88 Type: integer | Required: optional
89 The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0; to insert the items in the third position: position=2 . If omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
90  
91 =item uris
92  
93 Type: string | Required: optional
94 A comma-separated list of Spotify URIs to add, can be track or episode URIs. For example:uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh, spotify:track:1301WleyT98MSxVHPZCA6M, spotify:episode:512ojhOuo1ktJprKbVcKyQA maximum of 100 items can be added in one request. Note: it is likely that passing a large number of item URIs as a query parameter will exceed the maximum length of the request URI. When adding a large number of items, it is recommended to pass them in the request body, see below.
95  
96 =back
97  
98 and Response Objects being:
99  
100 - error object
101  
102  
103 On success, the HTTP status code in the response header is 201 Created. The response body contains a snapshot_id in JSON format. The snapshot_id can be used to identify your playlist version in future requests. On error, the header status code is an error code and the response body contains an error object. Trying to add an item when you do not have the user’s authorization, or when there are more than 10.000 items in the playlist, returns error 403 Forbidden.Try in our Web Console
104  
105 =cut
106  
107 0 ▶async sub add_tracks_to_playlist {
Subroutine add_tracks_to_playlist: not called CC=1 SCAR=6.9
Pod documented
108 0 my ($self, %args) = @_;
109  
110 0 my $request->{method} = 'POST';
111 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks';
112 $request->{param} = {
113 0 header => {
114 'Authorization' => {
115 type => 'string',
116 required => 'required',
117 },
118 'Content-Type' => {
119 type => 'string',
120 required => 'required',
121 },
122 },
123 json_body_parameter => {
124 'position' => {
125 type => 'integer',
126 required => 'optional',
127 },
128 'uris' => {
129 type => 'array[string]',
130 required => 'optional',
131 },
132 },
133 path_parameter => {
134 'playlist_id' => {
135 type => 'string',
136 required => 'required',
137 },
138 },
139 query_parameter => {
140 'position' => {
141 type => 'integer',
142 required => 'optional',
143 },
144 'uris' => {
145 type => 'string',
146 required => 'optional',
147 },
148 },
149 };
150 0 my $response_objs = [
151 'error object',
152  
153 ];
154  
155 0 await $self->call_api($request, $response_objs, %args);
156 2 }
157  
158 =head2 change_playlist_details
159  
160 change_playlist_details - Change a Playlist's Details
161  
162 Change a playlist’s name and public/private state. (The user must, of
163 course, own the playlist.)
164  
165 with Request details being:
166  
167 =head3 header
168  
169 =over 4
170  
171 =item Authorization
172  
173 Type: string | Required: required
174 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.Changing a public playlist for a user requires authorization of the playlist-modify-public scope; changing a private playlist requires the playlist-modify-private scope. See Using Scopes.
175  
176 =item Content-Type
177  
178 Type: string | Required: required
179 The content type of the request body: application/json
180  
181 =back
182  
183 =head3 json_body_parameter
184  
185 =over 4
186  
187 =item collaborative
188  
189 Type: boolean | Required: optional
190 If true , the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. Note: You can only set collaborative to true on non-public playlists.
191  
192 =item description
193  
194 Type: string | Required: optional
195 Value for playlist description as displayed in Spotify Clients and in the Web API.
196  
197 =item name
198  
199 Type: string | Required: optional
200 The new name for the playlist, for example "My New Playlist Title"
201  
202 =item public
203  
204 Type: boolean | Required: optional
205 If true the playlist will be public, if false it will be private.
206  
207 =back
208  
209 =head3 path_parameter
210  
211 =over 4
212  
213 =item playlist_id
214  
215 Type: string | Required: required
216 The Spotify ID
217 for the playlist.
218  
219 =back
220  
221 and Response Objects being:
222  
223 - error object
224  
225  
226 On success the HTTP status code in the response header is 200 OK.On error, the header status code is an error code and the response body contains an error object. Trying to change a playlist when you do not have the user’s authorization returns error 403 Forbidden.Try in our Web Console
227  
228 =cut
229  
230 0 ▶async sub change_playlist_details {
Subroutine change_playlist_details: not called CC=1 SCAR=6.9
Pod documented
231 0 my ($self, %args) = @_;
232  
233 0 my $request->{method} = 'PUT';
234 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}';
235 $request->{param} = {
236 0 header => {
237 'Authorization' => {
238 type => 'string',
239 required => 'required',
240 },
241 'Content-Type' => {
242 type => 'string',
243 required => 'required',
244 },
245 },
246 json_body_parameter => {
247 'collaborative' => {
248 type => 'boolean',
249 required => 'optional',
250 },
251 'description' => {
252 type => 'string',
253 required => 'optional',
254 },
255 'name' => {
256 type => 'string',
257 required => 'optional',
258 },
259 'public' => {
260 type => 'boolean',
261 required => 'optional',
262 },
263 },
264 path_parameter => {
265 'playlist_id' => {
266 type => 'string',
267 required => 'required',
268 },
269 },
270 };
271 0 my $response_objs = [
272 'error object',
273  
274 ];
275  
276 0 await $self->call_api($request, $response_objs, %args);
277 2 }
278  
279 =head2 create_playlist
280  
281 create_playlist - Create a Playlist
282  
283 Create a playlist for a Spotify user. (The playlist will be empty until
284 you add tracks.)
285  
286 with Request details being:
287  
288 =head3 header
289  
290 =over 4
291  
292 =item Authorization
293  
294 Type: string | Required: required
295 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user. Creating a public playlist for a user requires authorization of the playlist-modify-public scope; creating a private playlist requires the playlist-modify-private scope. See Using Scopes.
296  
297 =item Content-Type
298  
299 Type: string | Required: optional
300 The content type of the request body: application/json
301  
302 =back
303  
304 =head3 json_body_parameter
305  
306 =over 4
307  
308 =item collaborative
309  
310 Type: boolean | Required: optional
311 Defaults to false . If true the playlist will be collaborative. Note that to create a collaborative playlist you must also set public to false . To create collaborative playlists you must have granted playlist-modify-private and playlist-modify-public scopes .
312  
313 =item description
314  
315 Type: string | Required: optional
316 value for playlist description as displayed in Spotify Clients and in the Web API.
317  
318 =item name
319  
320 Type: string | Required: required
321 The name for the new playlist, for example "Your Coolest Playlist" . This name does not need to be unique; a user may have several playlists with the same name.
322  
323 =item public
324  
325 Type: boolean | Required: optional
326 Defaults to true . If true the playlist will be public, if false it will be private. To be able to create private playlists, the user must have granted the playlist-modify-private scope
327  
328 =back
329  
330 =head3 path_parameter
331  
332 =over 4
333  
334 =item user_id
335  
336 Type: string | Required: required
337 The user’s Spotify user ID.
338  
339 =back
340  
341 and Response Objects being:
342  
343 - playlist object
344 - error object
345  
346  
347 On success, the response body contains the created playlist object
348 in JSON format and the HTTP status code in the response header is 200 OK or
349 201 Created. There is also a Location response header giving the Web API
350 endpoint for the new playlist.On error, the header status code is an error code and the response body contains an error object. Trying to create a playlist when you do not have the user’s authorization returns error 403 Forbidden.Try in our Web Console
351  
352 =cut
353  
354 0 ▶async sub create_playlist {
Subroutine create_playlist: not called CC=1 SCAR=6.9
Pod documented
355 0 my ($self, %args) = @_;
356  
357 0 my $request->{method} = 'POST';
358 0 $request->{uri} = 'https://api.spotify.com/v1/users/{user_id}/playlists';
359 $request->{param} = {
360 0 header => {
361 'Authorization' => {
362 type => 'string',
363 required => 'required',
364 },
365 'Content-Type' => {
366 type => 'string',
367 required => 'optional',
368 },
369 },
370 json_body_parameter => {
371 'collaborative' => {
372 type => 'boolean',
373 required => 'optional',
374 },
375 'description' => {
376 type => 'string',
377 required => 'optional',
378 },
379 'name' => {
380 type => 'string',
381 required => 'required',
382 },
383 'public' => {
384 type => 'boolean',
385 required => 'optional',
386 },
387 },
388 path_parameter => {
389 'user_id' => {
390 type => 'string',
391 required => 'required',
392 },
393 },
394 };
395 0 my $response_objs = [
396 'playlist object',
397 'error object',
398  
399 ];
400  
401 0 await $self->call_api($request, $response_objs, %args);
402 2 }
403  
404 =head2 get_a_list_of_current_users_playlists
405  
406 get_a_list_of_current_users_playlists - Get a List of Current User's Playlists
407  
408 Get a list of the playlists owned or followed by the current Spotify
409 user.
410  
411 with Request details being:
412  
413 =head3 header
414  
415 =over 4
416  
417 =item Authorization
418  
419 Type: string | Required: required
420 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details.Private playlists are only retrievable for the current user and requires the playlist-read-private scope to have been authorized by the user. Note that this scope alone will not return collaborative playlists, even though they are always private.Collaborative playlists are only retrievable for the current user and requires the playlist-read-collaborative scope to have been authorized by the user.
421  
422 =back
423  
424 =head3 query_parameter
425  
426 =over 4
427  
428 =item limit
429  
430 Type: integer | Required: optional
431 ‘The maximum number of playlists to return. Default:
432 20. Minimum: 1. Maximum: 50.’
433  
434 =item offset
435  
436 Type: integer | Required: optional
437 ‘The index of the first playlist to return. Default:
438 0 (the first object). Maximum offset: 100.000. Use with limit to get the
439 next set of playlists.’
440  
441 =back
442  
443 and Response Objects being:
444  
445 - playlist object
446  
447  
448 On success, the HTTP status code in the response header is 200 OK and the response body contains an array of simplified playlist objects (wrapped in a paging object) in JSON format. On error, the header status code is an error code and the response body contains an error object. Please note that the access token has to be tied to a user.Try in our Web Console
449  
450 =cut
451  
452 0 ▶async sub get_a_list_of_current_users_playlists {
Subroutine get_a_list_of_current_users_playlists: not called CC=1 SCAR=6.9
Pod documented
453 0 my ($self, %args) = @_;
454  
455 0 my $request->{method} = 'GET';
456 0 $request->{uri} = 'https://api.spotify.com/v1/me/playlists';
457 $request->{param} = {
458 0 header => {
459 'Authorization' => {
460 type => 'string',
461 required => 'required',
462 },
463 },
464 query_parameter => {
465 'limit' => {
466 type => 'integer',
467 required => 'optional',
468 },
469 'offset' => {
470 type => 'integer',
471 required => 'optional',
472 },
473 },
474 };
475 0 my $response_objs = [
476 'playlist object',
477  
478 ];
479  
480 0 await $self->call_api($request, $response_objs, %args);
481 2 }
482  
483 =head2 get_list_users_playlists
484  
485 get_list_users_playlists - Get a List of a User's Playlists
486  
487 Get a list of the playlists owned or followed by a Spotify user.
488  
489 with Request details being:
490  
491 =head3 header
492  
493 =over 4
494  
495 =item Authorization
496  
497 Type: string | Required: required
498 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details.Private playlists are only retrievable for the current user and requires the playlist-read-private scope to have been authorized by the user. Note that this scope alone will not return collaborative playlists, even though they are always private.Collaborative playlists are only retrievable for the current user and requires the playlist-read-collaborative scope to have been authorized by the user.
499  
500 =back
501  
502 =head3 path_parameter
503  
504 =over 4
505  
506 =item user_id
507  
508 Type: string | Required: required
509 The user’s Spotify user ID.
510  
511 =back
512  
513 =head3 query_parameter
514  
515 =over 4
516  
517 =item limit
518  
519 Type: integer | Required: optional
520 The maximum number of playlists to return. Default:
521 20. Minimum: 1. Maximum: 50.
522  
523 =item offset
524  
525 Type: integer | Required: optional
526 The index of the first playlist to return. Default:
527 0 (the first object). Maximum offset: 100.000. Use with limit to get the
528 next set of playlists.
529  
530 =back
531  
532 and Response Objects being:
533  
534 - playlist object
535  
536  
537 On success, the HTTP status code in the response header is 200 OK and the response body contains an array of simplified playlist objects (wrapped in a paging object) in JSON format. On error, the header status code is an error code and the response body contains an error object.Try in our Web Console
538  
539 =cut
540  
541 0 ▶async sub get_list_users_playlists {
Subroutine get_list_users_playlists: not called CC=1 SCAR=6.9
Pod documented
542 0 my ($self, %args) = @_;
543  
544 0 my $request->{method} = 'GET';
545 0 $request->{uri} = 'https://api.spotify.com/v1/users/{user_id}/playlists';
546 $request->{param} = {
547 0 header => {
548 'Authorization' => {
549 type => 'string',
550 required => 'required',
551 },
552 },
553 path_parameter => {
554 'user_id' => {
555 type => 'string',
556 required => 'required',
557 },
558 },
559 query_parameter => {
560 'limit' => {
561 type => 'integer',
562 required => 'optional',
563 },
564 'offset' => {
565 type => 'integer',
566 required => 'optional',
567 },
568 },
569 };
570 0 my $response_objs = [
571 'playlist object',
572  
573 ];
574  
575 0 await $self->call_api($request, $response_objs, %args);
576 2 }
577  
578 =head2 get_playlist
579  
580 get_playlist - Get a Playlist
581  
582 Get a playlist owned by a Spotify user.
583  
584 with Request details being:
585  
586 =head3 header
587  
588 =over 4
589  
590 =item Authorization
591  
592 Type: string | Required: required
593 A valid access token from the Spotify Accounts service:
594 see the Web API Authorization Guide
595 for details. Both Public and Private playlists belonging to any user are retrievable
596 on provision of a valid access token.
597  
598 =back
599  
600 =head3 path_parameter
601  
602 =over 4
603  
604 =item playlist_id
605  
606 Type: string | Required: required
607 The Spotify ID
608 for the playlist.
609  
610 =back
611  
612 =head3 query_parameter
613  
614 =over 4
615  
616 =item additional_types
617  
618 Type: string | Required: optional
619 A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode.
620 Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.
621 In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the type field of each object.
622  
623 =item fields
624  
625 Type: string | Required: optional
626 Filters for the query: a comma-separated list of the
627 fields to return. If omitted, all fields are returned. For example, to get
628 just the playlist’’s description and URI: fields=description,uri. A dot
629 separator can be used to specify non-reoccurring fields, while parentheses
630 can be used to specify reoccurring fields within objects. For example, to
631 get just the added date and user ID of the adder: fields=tracks.items(added_at,added_by.id).
632 Use multiple parentheses to drill down into nested objects, for example: fields=tracks.items(track(name,href,album(name,href))).
633 Fields can be excluded by prefixing them with an exclamation mark, for example:
634 fields=tracks.items(track(name,href,album(!name,href)))
635  
636 =item market
637  
638 Type: string | Required: optional
639 An ISO 3166-1 alpha-2 country code
640 or the string from_token. Provide this parameter if you want to apply Track
641 Relinking.
642 For episodes, if a valid user access token is specified in the request header, the country associated with
643 the user account will take priority over this parameter.
644 Note: If neither market or user country are provided, the episode is considered unavailable for the client.
645  
646 =back
647  
648 and Response Objects being:
649  
650 - playlist object
651  
652  
653 On success, the response body contains a playlist object in JSON format and the HTTP status code in the response header is 200 OK. If an episode is unavailable in the given market, its information will not be included in the response. On error, the header status code is an error code and the response body contains an error object. Requesting playlists that you do not have the user’s authorization to access returns error 403 Forbidden.Try in our Web Console
654  
655 =cut
656  
657 0 ▶async sub get_playlist {
Subroutine get_playlist: not called CC=1 SCAR=6.9
Pod documented
658 0 my ($self, %args) = @_;
659  
660 0 my $request->{method} = 'GET';
661 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}';
662 $request->{param} = {
663 0 header => {
664 'Authorization' => {
665 type => 'string',
666 required => 'required',
667 },
668 },
669 path_parameter => {
670 'playlist_id' => {
671 type => 'string',
672 required => 'required',
673 },
674 },
675 query_parameter => {
676 'additional_types' => {
677 type => 'string',
678 required => 'optional',
679 },
680 'fields' => {
681 type => 'string',
682 required => 'optional',
683 },
684 'market' => {
685 type => 'string',
686 required => 'optional',
687 },
688 },
689 };
690 0 my $response_objs = [
691 'playlist object',
692  
693 ];
694  
695 0 await $self->call_api($request, $response_objs, %args);
696 2 }
697  
698 =head2 get_playlist_cover
699  
700 get_playlist_cover - Get a Playlist Cover Image
701  
702 Get the current image associated with a specific playlist.
703  
704 with Request details being:
705  
706 =head3 header
707  
708 =over 4
709  
710 =item Authorization
711  
712 Type: string | Required: required
713 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.This access token must be issued on behalf of the user. Current playlist image for both Public and Private playlists of any user are retrievable on provision of a valid access token.
714  
715 =back
716  
717 =head3 path_parameter
718  
719 =over 4
720  
721 =item playlist_id
722  
723 Type: string | Required: required
724 The Spotify ID
725 for the playlist.
726  
727 =back
728  
729 and Response Objects being:
730  
731 - image object
732  
733  
734 On success, the response body contains a list of image objects in JSON format and the HTTP status code in the response header is 200 OK On error, the header status code is an error code and the response body contains an error object.Try in our Web Console
735  
736 =cut
737  
738 0 ▶async sub get_playlist_cover {
Subroutine get_playlist_cover: not called CC=1 SCAR=6.9
Pod documented
739 0 my ($self, %args) = @_;
740  
741 0 my $request->{method} = 'GET';
742 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/images';
743 $request->{param} = {
744 0 header => {
745 'Authorization' => {
746 type => 'string',
747 required => 'required',
748 },
749 },
750 path_parameter => {
751 'playlist_id' => {
752 type => 'string',
753 required => 'required',
754 },
755 },
756 };
757 0 my $response_objs = [
758 'image object',
759  
760 ];
761  
762 0 await $self->call_api($request, $response_objs, %args);
763 2 }
764  
765 =head2 get_playlists_tracks
766  
767 get_playlists_tracks - Get a Playlist's Items
768  
769 Get full details of the items of a playlist owned by a Spotify user.
770  
771 with Request details being:
772  
773 =head3 header
774  
775 =over 4
776  
777 =item Authorization
778  
779 Type: string | Required: required
780 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. Both Public and Private playlists belonging to any user are retrievable on provision of a valid access token.
781  
782 =back
783  
784 =head3 path_parameter
785  
786 =over 4
787  
788 =item playlist_id
789  
790 Type: string | Required: required
791 The Spotify ID
792 for the playlist.
793  
794 =back
795  
796 =head3 query_parameter
797  
798 =over 4
799  
800 =item additional_types
801  
802 Type: string | Required: optional
803 A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode.
804 Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future.
805 In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the type field of each object.
806  
807 =item fields
808  
809 Type: string | Required: optional
810 Filters for the query: a comma-separated list of the
811 fields to return. If omitted, all fields are returned. For example, to get
812 just the total number of items and the request limit:fields=total,limitA
813 dot separator can be used to specify non-reoccurring fields, while parentheses
814 can be used to specify reoccurring fields within objects. For example, to
815 get just the added date and user ID of the adder:fields=items(added_at,added_by.id)Use
816 multiple parentheses to drill down into nested objects, for example:fields=items(track(name,href,album(name,href)))Fields
817 can be excluded by prefixing them with an exclamation mark, for example:fields=items.track.album(!external_urls,images)
818  
819 =item limit
820  
821 Type: integer | Required: optional
822 The maximum number of items to return. Default: 100.
823 Minimum: 1. Maximum: 100.
824  
825 =item market
826  
827 Type: string | Required: required
828 An ISO 3166-1 alpha-2 country code
829 or the string from_token. Provide this parameter if you want to apply Track
830 Relinking.
831 For episodes, if a valid user access token is specified in the request header, the country associated with
832 the user account will take priority over this parameter.
833 Note: If neither market or user country are provided, the episode is considered unavailable for the client.
834  
835 =item offset
836  
837 Type: integer | Required: optional
838 The index of the first item to return. Default: 0
839 (the first object).
840  
841 =back
842  
843 and Response Objects being:
844  
845 - track object
846  
847  
848 On success, the response body contains an array of track objects and episode objects (depends on the additional_types parameter), wrapped in a paging object in JSON format and the HTTP status code in the response header is 200 OK. If an episode is unavailable in the given market, its information will not be included in the response. On error, the header status code is an error code and the response body contains an error object. Requesting playlists that you do not have the user’s authorization to access returns error 403 Forbidden.Try in our Web Console
849  
850 =cut
851  
852 0 ▶async sub get_playlists_tracks {
Subroutine get_playlists_tracks: not called CC=1 SCAR=6.9
Pod documented
853 0 my ($self, %args) = @_;
854  
855 0 my $request->{method} = 'GET';
856 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks';
857 $request->{param} = {
858 0 header => {
859 'Authorization' => {
860 type => 'string',
861 required => 'required',
862 },
863 },
864 path_parameter => {
865 'playlist_id' => {
866 type => 'string',
867 required => 'required',
868 },
869 },
870 query_parameter => {
871 'additional_types' => {
872 type => 'string',
873 required => 'optional',
874 },
875 'fields' => {
876 type => 'string',
877 required => 'optional',
878 },
879 'limit' => {
880 type => 'integer',
881 required => 'optional',
882 },
883 'market' => {
884 type => 'string',
885 required => 'required',
886 },
887 'offset' => {
888 type => 'integer',
889 required => 'optional',
890 },
891 },
892 };
893 0 my $response_objs = [
894 'track object',
895  
896 ];
897  
898 0 await $self->call_api($request, $response_objs, %args);
899 2 }
900  
901 =head2 remove_tracks_playlist
902  
903 remove_tracks_playlist - Remove Items from a Playlist
904  
905 Remove one or more items from a user’s playlist.
906  
907 with Request details being:
908  
909 =head3 header
910  
911 =over 4
912  
913 =item Authorization
914  
915 Type: string | Required: required
916 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide
917 for details. The access token must have been issued on behalf of the user. Removing items from a user’s public playlist requires authorization of the playlist-modify-public scope; removing items from a private playlist requires the playlist-modify-private scope. See Using Scopes.
918  
919 =item Content-Type
920  
921 Type: string | Required: required
922 The content type of the request body: application/json
923  
924 =back
925  
926 =head3 json_body_parameter
927  
928 =over 4
929  
930 =item snapshot_id
931  
932 Type: string | Required: optional
933 The playlist’s snapshot ID against which you want to make the changes.
934 The API will validate that the specified items exist and in the specified positions and make the changes,
935 even if more recent changes have been made to the playlist.
936  
937 =item tracks
938  
939 Type: array[string] | Required: required
940 An array of objects containing Spotify URIs of the tracks or episodes to remove.
941 For example: { "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }. A maximum of 100 objects can be sent at once.
942  
943 =back
944  
945 =head3 path_parameter
946  
947 =over 4
948  
949 =item playlist_id
950  
951 Type: string | Required: required
952 The Spotify ID
953  
954 =back
955  
956 and Response Objects being:
957  
958 - error object
959  
960  
961 On success, the response body contains a snapshot_id in JSON format
962 and the HTTP status code in the response header is 200 OK. The snapshot_id
963 can be used to identify your playlist version in future requests.On error, the header status code is an error code and the response body contains an error object.
964 Trying to remove an item when you do not have the user’s authorization returns error 403 Forbidden.
965 Attempting to use several different ways to remove items returns 400 Bad Request.
966 Other client errors returning 400 Bad Request include specifying invalid positions.Notes### Frequently Asked Questions:
967 Is it possible to delete a playlist?
968 No, it isn’t. The reason there is no endpoint for this is explained in our Working With Playlists Guide in the section Following and Unfollowing a Playlist.
969  
970  
971 Can I use X-HTTP-Method-Override or similar to send a DELETE request overriding the HTTP verb?
972 Not at the moment, the delete operation needs to be specified through a DELETE request.Try in our Web Console
973  
974 =cut
975  
976 0 ▶async sub remove_tracks_playlist {
Subroutine remove_tracks_playlist: not called CC=1 SCAR=6.9
Pod documented
977 0 my ($self, %args) = @_;
978  
979 0 my $request->{method} = 'DELETE';
980 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks';
981 $request->{param} = {
982 0 header => {
983 'Authorization' => {
984 type => 'string',
985 required => 'required',
986 },
987 'Content-Type' => {
988 type => 'string',
989 required => 'required',
990 },
991 },
992 json_body_parameter => {
993 'snapshot_id' => {
994 type => 'string',
995 required => 'optional',
996 },
997 'tracks' => {
998 type => 'array[string]',
999 required => 'required',
1000 },
1001 },
1002 path_parameter => {
1003 'playlist_id' => {
1004 type => 'string',
1005 required => 'required',
1006 },
1007 },
1008 };
1009 0 my $response_objs = [
1010 'error object',
1011  
1012 ];
1013  
1014 0 await $self->call_api($request, $response_objs, %args);
1015 2 }
1016  
1017 =head2 reorder_or_replace_playlists_tracks
1018  
1019 reorder_or_replace_playlists_tracks - Reorder or Replace a Playlist's Items
1020  
1021 Either reorder or replace items in a playlist depending on the request’s parameters.
1022 To reorder items, include range_start, insert_before, range_length and snapshot_id in the request’s body.
1023 To replace items, include uris as either a query parameter or in the request’s body.
1024 Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.
1025  
1026 Note: Replace and reorder are mutually exclusive operations which share the same endpoint, but have different parameters.
1027 These operations can’t be applied together in a single request.
1028  
1029 with Request details being:
1030  
1031 =head3 header
1032  
1033 =over 4
1034  
1035 =item Authorization
1036  
1037 Type: string | Required: required
1038 A valid access token from the Spotify Accounts service:
1039 see the Web API Authorization Guide for details.
1040 The access token must have been issued on behalf of the user.
1041 Reordering or replacing items in the current user’s public playlists requires authorization of the playlist-modify-public scope;
1042 reordering or replacing items in the current user’s private playlist (including collaborative playlists) requires the playlist-modify-private scope.
1043 See Using Scopes.
1044  
1045 =item Content-Type
1046  
1047 Type: string | Required: optional
1048 Required if URIs are passed in the request body, otherwise ignored. The content type of the request body: application/json
1049  
1050 =back
1051  
1052 =head3 json_body_parameter
1053  
1054 =over 4
1055  
1056 =item insert_before
1057  
1058 Type: integer | Required: optional
1059 The position where the items should be inserted.To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.Examples:To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.
1060  
1061 =item range_length
1062  
1063 Type: integer | Required: optional
1064 The amount of items to be reordered. Defaults to 1 if not set.The range of items to be reordered begins from the range_start position, and includes the range_length subsequent items.Example:To move the items at index 9-10 to the start of the playlist, range_start is set to 9, and range_length is set to 2.
1065  
1066 =item range_start
1067  
1068 Type: integer | Required: optional
1069 The position of the first item to be reordered.
1070  
1071 =item snapshot_id
1072  
1073 Type: string | Required: optional
1074 The playlist’s snapshot ID against which you want to make the changes.
1075  
1076 =item uris
1077  
1078 Type: array[string] | Required: optional
1079  
1080  
1081 =back
1082  
1083 =head3 path_parameter
1084  
1085 =over 4
1086  
1087 =item playlist_id
1088  
1089 Type: string | Required: required
1090 The Spotify ID
1091 for the playlist.
1092  
1093 =back
1094  
1095 =head3 query_parameter
1096  
1097 =over 4
1098  
1099 =item uris
1100  
1101 Type: string | Required: optional
1102 A comma-separated list of Spotify URIs to set, can be track or episode URIs. For example: uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQA maximum of 100 items can be set in one request.
1103  
1104 =back
1105  
1106 and Response Objects being:
1107  
1108 - error object
1109  
1110  
1111 On a successful reorder operation, the response body contains a snapshot_id in JSON format
1112 and the HTTP status code in the response header is 200 OK. The snapshot_id
1113 can be used to identify your playlist version in future requests.On a successful replace operation, the HTTP status code in the response header is 201
1114 Created.On error, the header status code is an error code,
1115 the response body contains an error object,
1116 and the existing playlist is unmodified.
1117 Trying to set an item when you do not have the user’s authorization returns error 403 Forbidden.Try in our Web Console
1118  
1119 =cut
1120  
1121 0 ▶async sub reorder_or_replace_playlists_tracks {
Subroutine reorder_or_replace_playlists_tracks: not called CC=1 SCAR=6.9
Pod documented
1122 0 my ($self, %args) = @_;
1123  
1124 0 my $request->{method} = 'PUT';
1125 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks';
1126 $request->{param} = {
1127 0 header => {
1128 'Authorization' => {
1129 type => 'string',
1130 required => 'required',
1131 },
1132 'Content-Type' => {
1133 type => 'string',
1134 required => 'optional',
1135 },
1136 },
1137 json_body_parameter => {
1138 'insert_before' => {
1139 type => 'integer',
1140 required => 'optional',
1141 },
1142 'range_length' => {
1143 type => 'integer',
1144 required => 'optional',
1145 },
1146 'range_start' => {
1147 type => 'integer',
1148 required => 'optional',
1149 },
1150 'snapshot_id' => {
1151 type => 'string',
1152 required => 'optional',
1153 },
1154 'uris' => {
1155 type => 'array[string]',
1156 required => 'optional',
1157 },
1158 },
1159 path_parameter => {
1160 'playlist_id' => {
1161 type => 'string',
1162 required => 'required',
1163 },
1164 },
1165 query_parameter => {
1166 'uris' => {
1167 type => 'string',
1168 required => 'optional',
1169 },
1170 },
1171 };
1172 0 my $response_objs = [
1173 'error object',
1174  
1175 ];
1176  
1177 0 await $self->call_api($request, $response_objs, %args);
1178 2 }
1179  
1180 =head2 upload_custom_playlist_cover
1181  
1182 upload_custom_playlist_cover - Upload a Custom Playlist Cover Image
1183  
1184 Replace the image used to represent a specific playlist.
1185  
1186 with Request details being:
1187  
1188 =head3 header
1189  
1190 =over 4
1191  
1192 =item Authorization
1193  
1194 Type: string | Required: required
1195 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details. The access token must have been issued on behalf of the user.This access token must be tied to the user who owns the playlist, and must have the scope ugc-image-upload granted. In addition, the token must also contain playlist-modify-public and/or playlist-modify-private, depending the public status of the playlist you want to update . See Using Scopes.
1196  
1197 =item Content-Type
1198  
1199 Type: string | Required: required
1200 The content type of the request body: image/jpeg
1201  
1202 =back
1203  
1204 =head3 path_parameter
1205  
1206 =over 4
1207  
1208 =item playlist_id
1209  
1210 Type: string | Required: required
1211 The Spotify ID
1212 for the playlist.
1213  
1214 =back
1215  
1216 and Response Objects being:
1217  
1218  
1219  
1220 If you get status code 429, it means that you have sent too many requests.
1221 If this happens, have a look in the Retry-After header, where you will see a number displayed.
1222 This is the amount of seconds that you need to wait, before you can retry sending your requests.NotesThe request should contain a Base64 encoded JPEG image data, maximum payload size is 256 KB.Rate Limiting: If you get status code 429, it means that you have sent too many requests.
1223 If this happens, have a look in the Retry-After header, where you will see a number displayed. This is the amount of seconds that you need to wait, before you can retry sending your requests.Try in our Web Console
1224  
1225 =cut
1226  
1227 0 ▶async sub upload_custom_playlist_cover {
Subroutine upload_custom_playlist_cover: not called CC=1 SCAR=6.9
Pod documented
1228 0 my ($self, %args) = @_;
1229  
1230 0 my $request->{method} = 'PUT';
1231 0 $request->{uri} = 'https://api.spotify.com/v1/playlists/{playlist_id}/images';
1232 $request->{param} = {
1233 0 header => {
1234 'Authorization' => {
1235 type => 'string',
1236 required => 'required',
1237 },
1238 'Content-Type' => {
1239 type => 'string',
1240 required => 'required',
1241 },
1242 },
1243 path_parameter => {
1244 'playlist_id' => {
1245 type => 'string',
1246 required => 'required',
1247 },
1248 },
1249 };
1250 0 my $response_objs = [
1251  
1252 ];
1253  
1254 0 await $self->call_api($request, $response_objs, %args);
1255 2 }
1256  
1257 2 1;
« lib/Net/Async/Spotify/API/Generated/Player.pm ↑ Summary lib/Net/Async/Spotify/API/Generated/Browse.pm »