SPTSearch Class Reference
Inherits from | NSObject |
Declared in | SPTSearch.h |
Overview
This class provides helpers for using the search features in the Spotify API, See: https://developer.spotify.com/web-api/console/search/
Tasks
Search
-
+ performSearchWithQuery:queryType:offset:accessToken:market:callback:
-
+ createRequestForSearchWithQuery:queryType:offset:accessToken:market:error:
-
+ performSearchWithQuery:queryType:accessToken:market:callback:
-
+ createRequestForSearchWithQuery:queryType:accessToken:market:error:
-
+ performSearchWithQuery:queryType:offset:accessToken:callback:
-
+ createRequestForSearchWithQuery:queryType:offset:accessToken:error:
-
+ performSearchWithQuery:queryType:accessToken:callback:
-
+ createRequestForSearchWithQuery:queryType:accessToken:error:
Parsers / Deserializers
Class Methods
createRequestForSearchWithQuery:queryType:accessToken:error:
Create a request for searching with a given query.
+ (NSURLRequest *)createRequestForSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType accessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- accessToken
A valid access token.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTSearch.h
createRequestForSearchWithQuery:queryType:accessToken:market:error:
Createa a query for searching with a given query and market filtering
+ (NSURLRequest *)createRequestForSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType accessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)error
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- accessToken
A valid access token.
- market
Either a ISO 3166-1 country code to filter the results to, or
from_token
to pick the market from the session (requires theuser-read-private
scope), ornil
for no market filtering.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTSearch.h
createRequestForSearchWithQuery:queryType:offset:accessToken:error:
Create a request for searching with a given query and offset
+ (NSURLRequest *)createRequestForSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType offset:(NSInteger)offset accessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- offset
The index at which to start returning results.
- accessToken
A valid access token.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTSearch.h
createRequestForSearchWithQuery:queryType:offset:accessToken:market:error:
Create a request for searching with a given query, offset and market filtering
+ (NSURLRequest *)createRequestForSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType offset:(NSInteger)offset accessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)error
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- offset
The index at which to start returning results.
- accessToken
A valid access token.
- market
Either a ISO 3166-1 country code to filter the results to, or “from_token” (
SPTMarketFromToken
) to pick the market from the session (requires theuser-read-private
scope), ornil
for no market filtering.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTSearch.h
performSearchWithQuery:queryType:accessToken:callback:
Performs a search with a given query.
+ (void)performSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType accessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- accessToken
A valid access token.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPage
containing results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.h
performSearchWithQuery:queryType:accessToken:market:callback:
Performs a search with a given query and market filtering
+ (void)performSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType accessToken:(NSString *)accessToken market:(NSString *)market callback:(SPTRequestCallback)block
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- accessToken
A valid access token.
- market
Either a ISO 3166-1 country code to filter the results to, or
from_token
to pick the market from the session (requires theuser-read-private
scope), ornil
for no market filtering.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPage
containing results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.h
performSearchWithQuery:queryType:offset:accessToken:callback:
Performs a search with a given query and offset
+ (void)performSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType offset:(NSInteger)offset accessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- offset
The index at which to start returning results.
- accessToken
A valid access token.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPage
containing results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.h
performSearchWithQuery:queryType:offset:accessToken:market:callback:
Performs a search with a given query, offset and market filtering
+ (void)performSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType offset:(NSInteger)offset accessToken:(NSString *)accessToken market:(NSString *)market callback:(SPTRequestCallback)block
Parameters
- searchQuery
The query to pass to the search.
- searchQueryType
The type of search to do.
- offset
The index at which to start returning results.
- accessToken
A valid access token.
- market
Either a ISO 3166-1 country code to filter the results to, or “from_token” (
SPTMarketFromToken
) to pick the market from the session (requires theuser-read-private
scope), ornil
for no market filtering.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPage
containing results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.h
searchResultsFromData:withResponse:queryType:error:
Parse the response from createRequestForSearch into a list of search results
+ (SPTListPage *)searchResultsFromData:(NSData *)data withResponse:(NSURLResponse *)response queryType:(SPTSearchQueryType)searchQueryType error:(NSError **)error
Parameters
- data
The API response data
- response
The API response object
- searchQueryType
The type of search to do.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Return Value
The list of search results as an SPTListPage
object
Declared In
SPTSearch.h
searchResultsFromDecodedJSON:queryType:error:
Parse the response from createRequestForSearch into a list of search results
+ (SPTListPage *)searchResultsFromDecodedJSON:(id)decodedObject queryType:(SPTSearchQueryType)searchQueryType error:(NSError **)error
Parameters
- decodedObject
The decoded JSON object structure
- searchQueryType
The type of search to do.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Return Value
The list of search results as an SPTListPage
object
Declared In
SPTSearch.h