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

filter: Statementstmt 67.8% 19 / 28 Branchbran n/a Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 71.4% 5 / 7 Podpod 50.0% 1 / 2 totaltotal 51.0% 25 / 49 CC 5 SCAR 26.6
CC
5
Cov
53%
search
30.0
mapping
2.0
BEGIN
1.0
CRAP 14.3
« lib/Net/Async/Spotify/API/Generated/Personalization.pm ↑ Summary lib/Net/Async/Spotify/Object.pm »
1 package Net::Async::Spotify::API::Generated::Search;
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.002'; # 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::Search - Package representing Spotify Search 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 0 ▶sub mapping { shift->{mapping} }
Subroutine mapping: not called CC=1 SCAR=6.9
Pod undocumented
31  
32 =head2 search
33  
34 search - Search for an Item
35  
36 Get Spotify Catalog information about albums, artists, playlists, tracks, shows or episodes
37 that match a keyword string.
38  
39 with Request details being:
40  
41 =head3 header
42  
43 =over 4
44  
45 =item Authorization
46  
47 Type: string | Required: required
48 A valid access token from the Spotify Accounts service: see the Web API Authorization Guide for details.
49  
50 =back
51  
52 =head3 query_parameter
53  
54 =over 4
55  
56 =item include_external
57  
58 Type: string | Required: optional
59 Possible values: audio If include_external=audio
60 is specified the response will include any relevant audio content that is
61 hosted externally. By default external content is filtered out from responses.
62  
63 =item limit
64  
65 Type: integer | Required: optional
66 Maximum number of results to return. Default:
67 20 Minimum: 1 Maximum: 50 Note: The limit is applied within
68 each type, not on the total response. For example, if the limit value
69 is 3 and the type is artist,album, the response contains 3 artists and 3
70 albums.
71  
72 =item market
73  
74 Type: string | Required: optional
75 An ISO 3166-1 alpha-2 country code
76 or the string from_token. If a country code is specified, only content that is playable in that market is returned.
77 Note: - Playlist results are not affected by the market parameter.
78 - If market is set to from_token, and a valid access token is specified
79 in the request header, only content playable in the country associated with
80 the user account, is returned. - Users can view the country that is associated
81 with their account in the account settings.
82 A user must grant access to the user-read-private scope prior to when the
83 access token is issued.
84  
85 =item offset
86  
87 Type: integer | Required: optional
88 The index of the first result to return. Default:
89 0 (the first result). Maximum offset (including limit): 1,000. Use
90 with limit to get the next page of search results.
91  
92 =item q
93  
94 Type: string | Required: required
95 Search query
96 keywords and optional field filters and operators. For example: q=roadhouse%20blues.
97  
98 =item type
99  
100 Type: string | Required: required
101 A comma-separated list of item types to search
102 across. Valid types are: album , artist, playlist, track, show and episode.
103 Search results include hits from all the specified item types. For
104 example: q=name:abacab&type=album,track returns both albums and tracks
105 with “abacab” included in their name.
106  
107 =back
108  
109 and Response Objects being:
110  
111 - artist object
112 - error object
113 - target object
114 - on object
115  
116  
117 On success: In the response header the HTTP status code is 200 OK.
118 For each type provided in the type parameter, the response body contains an array of
119 artist objects /
120 simplified album objects /
121 track objects /
122 simplified show objects /
123 simplified episode objects
124 wrapped in a paging object in JSON.On error: The header status code is an error code.
125 The response body contains an error object.NotesWriting a Query - GuidelinesEncode spaces with the hex code %20 or +.Keyword matching: Matching of search keywords is not case-sensitive. Operators, however, should be specified in uppercase.
126 Unless surrounded by double quotation marks, keywords are matched in any order. For example:
127 q=roadhouse&20blues matches both “Blues Roadhouse” and “Roadhouse of the Blues”.
128 q="roadhouse&20blues" matches “My Roadhouse Blues” but not “Roadhouse of the Blues”.Searching for playlists returns results where the query keyword(s) match any part of the playlist’s name or description. Only popular public playlists are returned.Operator: The operator NOT can be used to exclude results.For example: q=roadhouse%20NOT%20blues returns items that match “roadhouse” but excludes those that also contain the keyword “blues”.Note: The operator must be specified in uppercase. Otherwise, they are handled as normal keywords to be matched.Field filters: By default, results are returned when a match is found in any field of the target object type. Searches can be made more specific by specifying an album, artist or track field filter.For example: The query q=album:gold%20artist:abba&type=album returns only albums with the text “gold” in the album name and the text “abba” in the artist name.To limit the results to a particular year, use the field filter year with album, artist, and track searches.For example: q=bob%20year:2014Or with a date range. For example: q=bob%20year:1980-2020To retrieve only albums released in the last two weeks, use the field filter tag:new in album searches.To retrieve only albums with the lowest 10% popularity, use the field filter tag:hipster in album searches.
129 Note: This field filter only works with album searches.Depending on object types being searched for, other field filters, include genre (applicable to tracks and artists), upc, and isrc.
130 For example: q=lil%20genre:%22southern%20hip%20hop%22&type=artist.
131 Use double quotation marks around the genre keyword string if it contains spaces.Notes Currently, you cannot fetch sorted results.
132 You cannot search for playlists that contain a certain track.
133 You can search only one genre at a time.
134 You cannot search for playlists within a user’s library.
135 In an effort to keep the response small, but include as much information as possible, Spotify has expanded the response and intends to continue and improve the Search endpoint.
136  
137 To query based on a release date query at a year level using the year scope. For example: The query https://api.spotify.com/v1/search?q=bob%20year:2014&type=album Returns albums released in 2014 with their names or artist names containing “bob”. You can also use the tag:new field filter to get just these albums, as well as compilations and singles, released in the last 2 weeks.Try in our Web Console
138  
139 =cut
140  
141 0 ▶async sub search {
Subroutine search: not called CC=5 SCAR=34.0
Pod documented
142 0 my ($self, %args) = @_;
143  
144 0 my $mapping = $self->mapping;
145 0 ▶ my $request->{method} = $mapping->{search}{method} // 'GET';
Condition0%0/2
$mapping->{"search"}{"method"} // "GET"
l!l
00
MC/DC0%0/1
$mapping->{"search"}{"method"} // "GET"
$mapping->{"search"}{"method"}
Truth table0%0/2
A
A= $mapping->{"search"}{"method"}
Aresult
11
00
146 0 ▶ $request->{uri} = $mapping->{search}{uri} // 'https://api.spotify.com/v1/search';
Condition0%0/2
$mapping->{"search"}{"uri"} // "https://api.spotify.com/v1/search"
l!l
00
MC/DC0%0/1
$mapping->{"search"}{"uri"} // "https://api.spotify.com/v1/search"
$mapping->{"search"}{"uri"}
Truth table0%0/2
A
A= $mapping->{"search"}{"uri"}
Aresult
11
00
147 $request->{param} = $mapping->{search}{param} // {
148 0 ▶ header => {
Condition0%0/2
$mapping->{"search"}{"param"} // {"header", {"Authorization", {"type", "string", "required", "required"}}, "query_parameter", {"include_external", {"type", "string", "required", "optional"}, "limit", {"type", "integer", "required", "optional"}, "market", {"type", "string", "required", "optional"}, "offset", {"type", "integer", "required", "optional"}, "q", {"type", "string", "required", "required"}, "type", {"type", "string", "required", "required"}}}
l!l
00
MC/DC0%0/1
$mapping->{"search"}{"param"} // {"header", {"Authorization", {"type", "string", "required", "required"}}, "query_parameter", {"include_external", {"type", "string", "required", "optional"}, "limit", {"type", "integer", "required", "optional"}, "market", {"type", "string", "required", "optional"}, "offset", {"type", "integer", "required", "optional"}, "q", {"type", "string", "required", "required"}, "type", {"type", "string", "required", "required"}}}
$mapping->{"search"}{"param"}
Truth table0%0/2
A
A= $mapping->{"search"}{"param"}
Aresult
11
00
149 'Authorization' => {
150 type => 'string',
151 required => 'required',
152 },
153 },
154 query_parameter => {
155 'include_external' => {
156 type => 'string',
157 required => 'optional',
158 },
159 'limit' => {
160 type => 'integer',
161 required => 'optional',
162 },
163 'market' => {
164 type => 'string',
165 required => 'optional',
166 },
167 'offset' => {
168 type => 'integer',
169 required => 'optional',
170 },
171 'q' => {
172 type => 'string',
173 required => 'required',
174 },
175 'type' => {
176 type => 'string',
177 required => 'required',
178 },
179 },
180 };
181 my $response_objs = $mapping->{search}{response} // [
182 0 ▶ 'artist object',
Condition0%0/2
$mapping->{"search"}{"response"} // ["artist object", "error object", "target object", "on object"]
l!l
00
MC/DC0%0/1
$mapping->{"search"}{"response"} // ["artist object", "error object", "target object", "on object"]
$mapping->{"search"}{"response"}
Truth table0%0/2
A
A= $mapping->{"search"}{"response"}
Aresult
11
00
183 'error object',
184 'target object',
185 'on object',
186  
187 ];
188  
189 0 await $self->call_api($request, $response_objs, %args);
190 2 }
191  
192 2 1;
« lib/Net/Async/Spotify/API/Generated/Personalization.pm ↑ Summary lib/Net/Async/Spotify/Object.pm »