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 **)errorParameters
- 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
NSErrorthat will receive the error code if operation failed.
Declared In
SPTSearch.hcreateRequestForSearchWithQuery: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 **)errorParameters
- 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_tokento pick the market from the session (requires theuser-read-privatescope), ornilfor no market filtering.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Declared In
SPTSearch.hcreateRequestForSearchWithQuery: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 **)errorParameters
- 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
NSErrorthat will receive the error code if operation failed.
Declared In
SPTSearch.hcreateRequestForSearchWithQuery: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 **)errorParameters
- 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-privatescope), ornilfor no market filtering.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Declared In
SPTSearch.hperformSearchWithQuery:queryType:accessToken:callback:
Performs a search with a given query.
+ (void)performSearchWithQuery:(NSString *)searchQuery queryType:(SPTSearchQueryType)searchQueryType accessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- 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
SPTListPagecontaining results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.hperformSearchWithQuery: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)blockParameters
- 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_tokento pick the market from the session (requires theuser-read-privatescope), ornilfor no market filtering.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPagecontaining results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.hperformSearchWithQuery: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)blockParameters
- 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
SPTListPagecontaining results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.hperformSearchWithQuery: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)blockParameters
- 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-privatescope), ornilfor no market filtering.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPagecontaining results on success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTSearch.hsearchResultsFromData: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 **)errorParameters
- data
The API response data
- response
The API response object
- searchQueryType
The type of search to do.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Return Value
The list of search results as an SPTListPage object
Declared In
SPTSearch.hsearchResultsFromDecodedJSON:queryType:error:
Parse the response from createRequestForSearch into a list of search results
+ (SPTListPage *)searchResultsFromDecodedJSON:(id)decodedObject queryType:(SPTSearchQueryType)searchQueryType error:(NSError **)errorParameters
- decodedObject
The decoded JSON object structure
- searchQueryType
The type of search to do.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Return Value
The list of search results as an SPTListPage object
Declared In
SPTSearch.h