public abstract class

EspnConnector

extends Object
java.lang.Object
   ↳ org.mule.module.EspnConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Mule ESPN API Connector - Connect Mule applications to the ESPN developer API (see http://developer.espn.com/)

Summary

Constants
String BASE_URI
Fields
private String apiKey apiKey provided by ESPN during api registration process
private HttpClient httpClient
Public Constructors
EspnConnector()
Public Methods
String getApiKey()
abstract String getAthletes(String resource, String athleteId, String dates, String group, String enable, String seasonType, String language, String limit, String offset, String accept)
getAthletes
abstract String getAthletesNews(String resource, String athleteId, String dates, String insider, String language, String limit, String offset, String accept)
getAthletesNews
HttpClient getHttpClient()
abstract String getNews(String resource, String dates, String insider, String language, String limit, String offset, String accept)
getNews
abstract String getNewsById(String resource, String newsId, String dates, String insider, String language, String accept)
getNewsById
abstract String getNewsHeadlines(String resource, String insider, String language, String limit, String offset, String accept)
getNewsHeadlines
abstract String getNewsHeadlinesTop(String resource, String insider, String language, String region, String limit, String offset, String accept)
getNewsHeadlinesTop
abstract String getSports(String limit, String offset, String accept)
getAllSports
abstract String getSportsOrganizingBodies(String sport, String limit, String offset, String accept)
getSportsOrganizingBodies
abstract String getSportsOrganizingGroupsDivisions(String sport, String league, String limit, String offset, String accept)
getSportsOrganizingGroupsDivisions
abstract String getTeams(String resource, String teamId, String enable, String groups, String language, String limit, String offset, String accept)
getTeams
abstract String getTeamsNews(String resource, String teamId, String dates, String insider, String language, String limit, String offset, String accept)
getTeamsNews
void setApiKey(String apiKey)
Set property
void setHttpClient(HttpClient httpClient)
Set property
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String BASE_URI

Constant Value: "http://api.espn.com/v1"

Fields

private String apiKey

apiKey provided by ESPN during api registration process

private HttpClient httpClient

Public Constructors

public EspnConnector ()

Public Methods

public String getApiKey ()

public abstract String getAthletes (String resource, String athleteId, String dates, String group, String enable, String seasonType, String language, String limit, String offset, String accept)

getAthletes

Parameters
resource ESPN resource (i.e. /sports/baseball/mlb)
athleteId ESPN player id
dates ESPN dates values (year) for requested data (i.e. 2011, 2012, etc...)
group ESPN group (integer) allows filtering by "group" or division
enable ESPN optional flag to enable specific info (comma separated string) valid values: [stats|logos|notes|competitors]
seasonType ESPN season type accepts pre/reg/post for preseason, regular and postseason respectively
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String representing athlete data (can be JSON or XML depending on 'accept' parameter)
Throws
IOException Thrown in the event of a communications error

public abstract String getAthletesNews (String resource, String athleteId, String dates, String insider, String language, String limit, String offset, String accept)

getAthletesNews

Parameters
resource ESPN resource (i.e. /espnw)
athleteId ESPN identifier for a particular player/athlete.
dates Integer in the form of "yyyymmdd" to get news for a particular date.
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String Stories about a particular player/athlete (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public HttpClient getHttpClient ()

public abstract String getNews (String resource, String dates, String insider, String language, String limit, String offset, String accept)

getNews

Parameters
resource ESPN resource (i.e. /espnw)
dates Integer in the form of "yyyymmdd" to get news for a particular date.
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String Representing a stream of all news for current date (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error Thrown in the event of a communications error

public abstract String getNewsById (String resource, String newsId, String dates, String insider, String language, String accept)

getNewsById

Parameters
resource ESPN resource (i.e. /espnw)
newsId ESPN specific story identifier
dates Integer in the form of "yyyymmdd" to get news for a particular date.
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String represents news story identified by input parameter newsId (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error Thrown in the event of a communications error

public abstract String getNewsHeadlines (String resource, String insider, String language, String limit, String offset, String accept)

getNewsHeadlines

Parameters
resource ESPN resource (i.e. /espnw)
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String ESPN news headlines (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error Thrown in the event of a communications error

public abstract String getNewsHeadlinesTop (String resource, String insider, String language, String region, String limit, String offset, String accept)

getNewsHeadlinesTop

Parameters
resource ESPN resource (i.e. /espnw)
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
region Can be used in conjunction with the lang query string parameter to return focused headlines for a particular region, where available.
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String Top stories as shown on ESPN.com home page. Only applicable to /sports resource (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public abstract String getSports (String limit, String offset, String accept)

getAllSports

Parameters
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String List of all sports currently supported in the ESPN API (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public abstract String getSportsOrganizingBodies (String sport, String limit, String offset, String accept)

getSportsOrganizingBodies

Parameters
sport ESPN sport name
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String returns a reference to all organizing bodies, or leagues (e.g. MLB) that are supported within a sport (e.g. baseball) (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public abstract String getSportsOrganizingGroupsDivisions (String sport, String league, String limit, String offset, String accept)

getSportsOrganizingGroupsDivisions

Parameters
sport ESPN sport name
league ESPN league abbreviation (organizing body)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String returns information for all groups/divisions that make up an organizing body (i.e. MLB) (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public abstract String getTeams (String resource, String teamId, String enable, String groups, String language, String limit, String offset, String accept)

getTeams

Parameters
resource ESPN resource (i.e. /sports/baseball/mlb)
teamId ESPN team identifier
enable ESPN optional flag to enable specific info (comma separated string) valid values: [venues|stats|roster|leaders]
groups ESPN group (integer) allows filtering by "group" or division
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String representing team data (can be JSON or XML depending on 'accept' parameter)
Throws
IOException Thrown in the event of a communications error

public abstract String getTeamsNews (String resource, String teamId, String dates, String insider, String language, String limit, String offset, String accept)

getTeamsNews

Parameters
resource ESPN resource (i.e. /espnw)
teamId ESPN identifier for a particular team.
dates Integer in the form of "yyyymmdd" to get news for a particular date.
insider ESPN content to be included, valid values: yes, no, only
language ESPN lang - valid values include 'en' (English) and 'es' (Spanish)
limit Used to limit the number of results returned
offset Used for pagination (i.e. 11 will start with the 11th entry in the response)
accept Used when you can not set the Accepted header (i.e. application/json, text/xml)
Returns
  • String Stories about a particular team (can be JSON or XML depending on 'accept' parameter).
Throws
IOException Thrown in the event of a communications error

public void setApiKey (String apiKey)

Set property

Parameters
apiKey ESPN API key (see developer.espn.com for access to their APIs)

public void setHttpClient (HttpClient httpClient)

Set property

Parameters
httpClient