Package be.ceau.itunesapi
Class FeedGenerator
- java.lang.Object
-
- be.ceau.itunesapi.FeedGenerator
-
- All Implemented Interfaces:
Serializable
public class FeedGenerator extends Object implements Serializable
Request object for the iTunes Feed Generator API.- See Also:
- rss.itunes.apple.com, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FeedGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Feedexecute()Queries iTunes using the current state of thisFeedGeneratorFeedexecute(Connector connector)Execute this Feed Generator API request using the providedConnectorimplementation.CountrygetCountry()FeedTypegetFeedType()FeedFormatgetFormat()MediaTypegetMediaType()intgetResultsLimit()StringgetUrl()Construct a valid feed URL based on the current state of thisFeedGeneratorbooleanisAllowExplicit()FeedGeneratorsetAllowExplicit(boolean allowExplicit)Default value istrueFeedGeneratorsetCountry(Country country)Default value isCountry.UNITED_STATESFeedGeneratorsetFeedType(FeedType feedType)Default value isFeedType.NEW_MUSIC
The givenFeedTypemust be compatible with the currentMediaType.FeedGeneratorsetFormat(FeedFormat format)Default value isFeedFormat.JSONFeedGeneratorsetMediaType(MediaType mediaType)Default value isMediaType.APPLE_MUSIC
SettingMediaTypealso changes theFeedTypeto be compatible with the givenMediaTypeFeedGeneratorsetResultsLimit(int resultsLimit)Default value is10
Note that Apple limits results to 200, even when more are requested
-
-
-
Method Detail
-
getUrl
public String getUrl()
Construct a valid feed URL based on the current state of thisFeedGenerator- Returns:
- url as
String, nevernull
-
execute
public Feed execute()
Queries iTunes using the current state of thisFeedGenerator- Returns:
- parsed
Feed
-
execute
public Feed execute(Connector connector)
Execute this Feed Generator API request using the providedConnectorimplementation.- Parameters:
connector-Connectorimplementation, notnull- Returns:
- parsed
Feedresponse from iTunes - Throws:
IllegalArgumentException- if argumentnullRuntimeException- wrapping anyIOExceptionthrown performing the request or parsing the response
-
getCountry
public Country getCountry()
-
setCountry
public FeedGenerator setCountry(Country country)
Default value isCountry.UNITED_STATES- Parameters:
country- aCountry, notnull- Returns:
thisinstance for method chaining
-
getMediaType
public MediaType getMediaType()
-
setMediaType
public FeedGenerator setMediaType(MediaType mediaType)
Default value isMediaType.APPLE_MUSIC
SettingMediaTypealso changes theFeedTypeto be compatible with the givenMediaType- Parameters:
mediaType- aMediaType, notnull- Returns:
thisinstance for method chaining
-
getFeedType
public FeedType getFeedType()
-
setFeedType
public FeedGenerator setFeedType(FeedType feedType)
Default value isFeedType.NEW_MUSIC
The givenFeedTypemust be compatible with the currentMediaType. Refer toMediaType.getCompatibleFeedTypes()to determine whichFeedTypeinstances are compatible with the currentMediaType.- Parameters:
feedType- aFeedType, notnull- Returns:
thisinstance for method chaining- See Also:
MediaType.getCompatibleFeedTypes()
-
getResultsLimit
public int getResultsLimit()
-
setResultsLimit
public FeedGenerator setResultsLimit(int resultsLimit)
Default value is10
Note that Apple limits results to 200, even when more are requested- Parameters:
resultsLimit- a positive integer- Returns:
thisinstance for method chaining
-
isAllowExplicit
public boolean isAllowExplicit()
-
setAllowExplicit
public FeedGenerator setAllowExplicit(boolean allowExplicit)
Default value istrue- Parameters:
allowExplicit- true if explicit results may be included- Returns:
thisinstance for method chaining
-
getFormat
public FeedFormat getFormat()
-
setFormat
public FeedGenerator setFormat(FeedFormat format)
Default value isFeedFormat.JSON- Parameters:
format- aFeedFormat, notnull- Returns:
thisinstance for method chaining
-
-