public class MediaSearch extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowExplicit
allow/exclude explicit content in search results.
|
protected int |
apiVersion
The version of the iTunes api to use (1/2).
|
protected com.neovisionaries.i18n.CountryCode |
countryCode
ISO 3166-1 alpha-2 country code for the
iTunes store to search.
|
protected int |
limit
The maximum number of item's to return.
|
protected ItunesMedia |
media
The media type to search for.
|
protected ReturnLanguage |
returnLanguage
The language to return the result in (only english/japanese).
|
protected String |
searchTerm
The term to search for.
|
protected URL |
searchUrl
URL used to search the iTunes store, generated using all the variables of the instance
|
| Constructor and Description |
|---|
MediaSearch() |
| Modifier and Type | Method and Description |
|---|---|
T |
allowExplicit(boolean allowExplicit)
allow/remove explicit content in search results.
|
MediaSearch |
andReturn(MediaSearchReturnType returnType)
Sets the return type of the results
|
protected String |
constructUrlString() |
org.json.JSONObject |
execute()
execute the search
|
boolean |
explicitAllowed() |
int |
getApiVersion() |
MediaAttribute |
getAttribute() |
com.neovisionaries.i18n.CountryCode |
getCountryCode() |
int |
getLimit() |
ItunesMedia |
getMedia() |
ReturnLanguage |
getReturnLanguage() |
MediaSearchReturnType |
getReturnType() |
String |
getSearchTerm() |
URL |
getSearchUrl() |
MediaSearch |
inAttribute(MediaAttribute attribute)
Sets the media attribute the search term is compared with.
|
T |
inCountry(com.neovisionaries.i18n.CountryCode countryCode)
Sets the iTunes store to search.
|
protected void |
runPreExecutionChecks()
check the validity of all required data before executing the search
|
T |
with(String searchTerm)
Sets the term to search for.
|
T |
withApiVersion(ItunesApiVersion apiVersion)
Set the version of the iTunes api to use (1/2).
|
T |
withLimit(int limit)
Sets the maximum number of item's to return.
|
T |
withReturnLanguage(ReturnLanguage returnLanguage)
Sets the language results are return in.
|
protected String searchTerm
protected final ItunesMedia media
protected int limit
protected int apiVersion
protected boolean allowExplicit
protected com.neovisionaries.i18n.CountryCode countryCode
protected ReturnLanguage returnLanguage
protected URL searchUrl
public MediaSearch inAttribute(MediaAttribute attribute)
attribute - the music attribute the searchTerm is compared with.MediaSearchpublic MediaSearch andReturn(MediaSearchReturnType returnType)
returnType - the type of results you want returnedMediaSearchprotected String constructUrlString()
public MediaAttribute getAttribute()
public MediaSearchReturnType getReturnType()
public T with(String searchTerm)
searchTerm - the term to search forpublic T withLimit(int limit)
limit - the maximum number of item's to return.public T withApiVersion(ItunesApiVersion apiVersion)
apiVersion - the version of the iTunes api to use.public T allowExplicit(boolean allowExplicit)
allowExplicit - allow explicit content or not.public T withReturnLanguage(ReturnLanguage returnLanguage)
returnLanguage - The language result should be return in.public T inCountry(com.neovisionaries.i18n.CountryCode countryCode)
countryCode - ISO 3166-1 alpha-2 country code
for the iTunes store to search. Default is US.MediaSearchprotected void runPreExecutionChecks()
MissingRequiredParameterException - if the search term is not set.InvalidParameterException - if any of the set parameters are invalid.public org.json.JSONObject execute()
JSONObject object containing the results.MissingRequiredParameterException - if the search term is not set.InvalidParameterException - if any of the set parameters are invalid.SearchURLConstructionFailure - if there is an error during url construction.NetworkCommunicationException - if any issues occur while communicating with the iTunes api.public String getSearchTerm()
public ItunesMedia getMedia()
public int getLimit()
public int getApiVersion()
public boolean explicitAllowed()
public com.neovisionaries.i18n.CountryCode getCountryCode()
public ReturnLanguage getReturnLanguage()
public URL getSearchUrl()
Copyright © 2018. All rights reserved.