Package be.ceau.itunesapi
Class Search
- java.lang.Object
-
- be.ceau.itunesapi.Search
-
- All Implemented Interfaces:
Serializable
public class Search extends Object implements Serializable
Request object for the iTunes Search API.- See Also:
- Search API, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbuild()Create the request URL for thisSearchResponseexecute()Execute this iTunes Search API request.Responseexecute(Connector connector)Execute this iTunes Search API request using the providedConnectorimplementation.AttributegetAttribute()CountrygetCountry()EntitygetEntity()LanggetLang()IntegergetLimit()MediagetMedia()StringgetTerm()IntegergetVersion()BooleanisExplicit()SearchsetAttribute(Attribute attribute)SearchsetCountry(Country country)SearchsetEntity(Entity entity)SearchsetExplicit(boolean explicit)SearchsetLang(Lang lang)SearchsetLimit(int limit)The number of search results you want the iTunes Store to return.SearchsetMedia(Media media)SearchsetTerm(String term)SearchsetVersion(int version)The search result key version you want to receive back from your search.
-
-
-
Method Detail
-
execute
public Response execute()
Execute this iTunes Search API request.- Returns:
- parsed
Responsefrom iTunes - Throws:
IllegalStateException- as thrown bybuild()RuntimeException- wrapping anyIOExceptionthrown performing the request or parsing the response
-
execute
public Response execute(Connector connector)
Execute this iTunes Search API request using the providedConnectorimplementation.- Parameters:
connector-Connectorimplementation, notnull- Returns:
- parsed
Responsefrom iTunes - Throws:
IllegalArgumentException- if argumentnullIllegalStateException- as thrown bybuild()RuntimeException- wrapping anyIOExceptionthrown performing the request or parsing the response
-
setTerm
public Search setTerm(String term)
- Parameters:
term- word or phrase to search for,String, can benull- Returns:
thisinstance for method chaining
-
setCountry
public Search setCountry(Country country)
- Parameters:
country-Country, can benull- Returns:
thisinstance for method chaining
-
setMedia
public Search setMedia(Media media)
- Parameters:
media-Media, can benull- Returns:
thisinstance for method chaining
-
setEntity
public Search setEntity(Entity entity)
- Parameters:
entity-Entity, can benull- Returns:
thisinstance for method chaining
-
setAttribute
public Search setAttribute(Attribute attribute)
- Parameters:
attribute-Attribute, can benull- Returns:
thisinstance for method chaining
-
setLimit
public Search setLimit(int limit)
The number of search results you want the iTunes Store to return. For example: 25. The default is 50. Valid between 1 and 200.- Parameters:
limit-intbetween 1 (inclusive) and 200 (inclusive)- Returns:
thisinstance for method chaining- Throws:
IllegalArgumentException- if limit not valid
-
setLang
public Search setLang(Lang lang)
- Parameters:
lang-Lang, can benull- Returns:
thisinstance for method chaining
-
setVersion
public Search setVersion(int version)
The search result key version you want to receive back from your search. The default is 2. Valid are 1 or 2- Parameters:
version-int1 or 2- Returns:
thisinstance for method chaining- Throws:
IllegalArgumentException- if version not valid
-
setExplicit
public Search setExplicit(boolean explicit)
- Parameters:
explicit-booleanindicating whether or not to include explicit results- Returns:
thisinstance for method chaining
-
build
public String build()
Create the request URL for thisSearch- Returns:
- full request URL matching this
Search - Throws:
IllegalStateException- if no term is set in thisSearch
-
-