Interface TheTVDBApi
-
- All Known Implementing Classes:
TheTVDBApiImpl
public interface TheTVDBApi
Main interface of the TheTVDB API connector.
This interface provides access to all available routes of the remote TheTVDB.com REST API. Routes which accept additional optional and mandatory query parameters can either be invoked with a given set ofQueryParameters
or via some predefined shortcut-methods. These shortcut-methods will accept certain values as direct method parameters which will then be forwarded to the REST API as regular URL query parameters. Please note that shortcut-methods exist for most of the common query scenarios but maybe not for all. In case of more complex query setups the user has to take care of creating a properly configuredQueryParameters
object, which is slightly more effort than using the shortcut-methods but gives the user unlimited configuration options.
In order to create a new API instance theTheTVDBApiFactory
should be used. This factory also provides additional helper methods, for example to easily create newQueryParameters
.
To cover a wide range of possible applications, this API connector provides multiple layouts in order to allow an easy integration regardless of your actual project requirements. It gives you the option to use prefabbed DTO's which will be parsed from the actual JSON returned by the remote service. In case you need advanced exception handling or you prefer to parse the JSON into your own data models (or don't want to parse it at all), other API layouts will provide you with extended API response DTO's or even with the raw JSON. The following API layouts are currently available:TheTVDBApi
This is probably the most common layout. It provides various shortcut-methods and automatically maps the received JSON data content into simple Java DTO's (at least for more complex response data). The user does not have to worry about JSON parsing but can simply work with the returned DTO's like he works with every other Java object. However, these objects do only contain the actually requested data and will not include any additional contextual information that may be returned by the remote service (e.g. Pagination information, additional validation or error data). Furthermore they will only provide access to properties that are formally declared by the API (version "v3.0.0") .TheTVDBApi.Extended
This layout may be used for slightly advance API integration. Like the common layout it'll take care of parsing the received JSON into Java DTO's but it will also provide access to any additional contextual information. Methods of this layout will always return a singleAPIResponse
object which consists of the actual data, parsed as DTO, as well as all additional information which is available in the given context, like additional error or pagination information. This layout does not provide any shortcut-methods.TheTVDBApi.JSON
This layout may be used if you do not want any post-processing being applied to the actual remote service response data. All methods within this layout will return the raw, unmodified JSON data as it was received from the API. This might be useful if you prefer to map the JSON data yourself, want to use your own Java data models or if you don't want to parse the JSON data at all (but forward it to some other service for example). It would also be the preferred layout in case you need access to additional (e.g. experimental) properties that are not yet officially declared by the formal API description. This layout does not provide any shortcut-methods though.
Once an API instance has been created, the additional layouts can be accessed via theextended()
orjson()
method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
TheTVDBApi.Extended
Interface representing the API'sExtended
layout.static interface
TheTVDBApi.JSON
Interface representing the API'sJSON
layout.static class
TheTVDBApi.Version
Specifies the version of the TheTVDB.com remote API to be used by this connector
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<String>
addToFavorites(long seriesId)
Adds the supplied series ID to the user’s favorite’s list and returns the updated list as plain Strings.List<Rating>
addToRatings(String itemType, long itemId, long itemRating)
Updates a given rating of a given type and returns the modified rating, mapped as Java DTO.List<String>
deleteFromFavorites(long seriesId)
Deletes the given series ID from the user’s favorite’s list and returns the updated list as plain Strings.void
deleteFromRatings(String itemType, long itemId)
Deletes a given rating of a given type.TheTVDBApi.Extended
extended()
Provides access to the API'sExtended
layout.Series
filterSeries(long seriesId, QueryParameters queryParameters)
Returns a filtered series record based on the given parameters, mapped as Java DTO.Series
filterSeries(long seriesId, String filterKeys)
Returns a series records, filtered by the supplied comma-separated list of keys, mapped as Java DTO.List<Actor>
getActors(long seriesId)
Returns a list of actors for a specific series mapped as Java DTO.List<String>
getAvailableEpisodeQueryParameters(long seriesId)
Returns a list of keys which are valid parameters for querying episodes, as plain Strings.List<ImageQueryParameter>
getAvailableImageQueryParameters(long seriesId)
Returns a list of valid parameters for querying a series images, mapped as Java DTO.List<Language>
getAvailableLanguages()
Returns a list of all supported languages mapped as Java DTO.List<String>
getAvailableLastUpdatedQueryParameters()
Returns a list of valid parameters for querying series which have been updated lately, as plain Strings.List<String>
getAvailableRatingsQueryParameters()
Returns a list of valid parameters for querying user ratings, as plain Strings.List<String>
getAvailableSeriesFilterParameters(long seriesId)
Returns a list of keys which are valid parameters for filtering series, as plain Strings.List<String>
getAvailableSeriesSearchParameters()
Returns possible query parameters, which can be used to search for series, mapped as Java DTO.Episode
getEpisode(long episodeId)
Returns the full information for a given episode id as mapped Java DTO.List<Episode>
getEpisodes(long seriesId)
Returns the first 100 episodes of a specific series mapped as Java DTO.List<Episode>
getEpisodes(long seriesId, long page)
Returns a list of episodes of a specific series mapped as Java DTO.List<Episode>
getEpisodes(long seriesId, QueryParameters queryParameters)
Returns all episodes of a specific series mapped as Java DTO.List<String>
getFavorites()
Returns a list of favorite series for a given user, as plain Strings.Language
getLanguage(long languageId)
Returns further language information for a given language ID mapped as Java DTO.Movie
getMovie(long movieId)
Returns detailed information for a specific movie mapped as Java DTO.List<Long>
getMovieUpdates(long since)
Returns a list of ID's of all movies that have been updated since the given epoch timestamp.List<Rating>
getRatings()
Returns a list of ratings for the given user, mapped as Java DTO.Series
getSeries(long seriesId)
Returns detailed information for a specific series mapped as Java DTO.SeriesSummary
getSeriesEpisodesSummary(long seriesId)
Returns a summary of the episodes and seasons available for a series, mapped as Java DTO.Map<String,String>
getSeriesHeaderInformation(long seriesId)
Returns header information for a specific series as key/value pairs.ImageSummary
getSeriesImagesSummary(long seriesId)
Returns a summary of the images types and counts available for a particular series, mapped as Java DTO.Optional<String>
getToken()
Returns the JSON Web Token used for authentication of all requests that are sent to the remote service by this API instance.User
getUser()
Returns basic information about the currently authenticated user, mapped as Java DTO.void
init()
Initializes the current API session by requesting a new token from the remote API.void
init(String token)
Initializes the current API with the given token.TheTVDBApi.JSON
json()
Provides access to the API'sJSON
layout.void
login()
Initializes the current API session by requesting a new token from the remote API.List<Episode>
queryEpisodes(long seriesId, QueryParameters queryParameters)
Returns all matching episodes of a specific series mapped as Java DTO.List<Episode>
queryEpisodesByAbsoluteNumber(long seriesId, long absoluteNumber)
Returns a specific episode of a series, mapped as Java DTO.List<Episode>
queryEpisodesByAiredEpisode(long seriesId, long airedEpisode)
Returns all episodes of a specific series, matching theairedEpisode
parameter, mapped as Java DTO.List<Episode>
queryEpisodesByAiredSeason(long seriesId, long airedSeason)
Returns all episodes of a specific series and season mapped as Java DTO.List<Episode>
queryEpisodesByAiredSeason(long seriesId, long airedSeason, long page)
Returns all episodes of a specific series and season mapped as Java DTO.List<Image>
queryImages(long seriesId, QueryParameters queryParameters)
Returns the matching result of querying images for a specific series, mapped as Java DTO.List<Image>
queryImages(long seriesId, String keyType, String resolution)
Returns all images for a specific series, matching the given parameters, mapped as Java DTO.List<Image>
queryImages(long seriesId, String keyType, String resolution, String subKey)
Returns all images for a specific series, matching the given parameters, mapped as Java DTO.List<Image>
queryImagesByKeyType(long seriesId, String keyType)
Returns all images of a specific type for a series, mapped as Java DTO.List<Image>
queryImagesByResolution(long seriesId, String resolution)
Returns all images of a specific resolution for a series, mapped as Java DTO.List<Image>
queryImagesBySubKey(long seriesId, String subKey)
Returns all images of a specific sub key for a series, mapped as Java DTO.Map<Long,Long>
queryLastUpdated(long fromTime)
Returns a map of series that have changed in the (one) week since the providedfromTime
query parameter.Map<Long,Long>
queryLastUpdated(long fromTime, long toTime)
Returns a map of series that have changed in between the given timeframe, but with a maximum of one week, starting at the providedfromTime
query parameter.Map<Long,Long>
queryLastUpdated(QueryParameters queryParameters)
Returns a map of series that have changed in a maximum of one week blocks since the providedfromTime
query parameter.List<Rating>
queryRatings(QueryParameters queryParameters)
Returns a list of ratings for a given user that match the query, mapped as Java DTO.List<Rating>
queryRatingsByItemType(String itemType)
Returns a list of ratings for a given user that match theitemType
parameter, mapped as Java DTO.void
refreshToken()
Refreshes the current, valid JWT session token.List<SeriesSearchResult>
searchSeries(QueryParameters queryParameters)
Returns a list of series search results based on the given query parameters mapped as Java DTO.List<SeriesSearchResult>
searchSeriesByImdbId(String imdbId)
Search for series by IMDB-Id.List<SeriesSearchResult>
searchSeriesByName(String name)
Search for series by name.List<SeriesSearchResult>
searchSeriesByZap2itId(String zap2itId)
Search for series by Zap2it-Id.void
setLanguage(String languageCode)
Sets the preferred language to be used for communication with the remote service.
-
-
-
Method Detail
-
init
void init() throws APIException
Initializes the current API session by requesting a new token from the remote API. This token will be used for authentication of all requests that are sent to the remote service by this API instance. The initialization will be performed based on the constructor parameters used to create this API instance. Actually this method will do the same aslogin()
.- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.
-
init
void init(@Nonnull String token) throws APIException
Initializes the current API with the given token. This token will be used for authentication of all requests that are sent to the remote service by this API instance. The given string must be a valid Base64 encoded token in the regular JWT format "{header}.{payload}.{signature}".
If the given token is (or becomes) expired it will be replaced by a new JWT automatically. The new token will be requested from the remove service based on the constructor parameters used to create this API instance.- Parameters:
token
- JSON Web Token to be used for remote API communication/authorization- Throws:
APIException
- If the given string does not match the JSON Web Token format
-
getToken
Optional<String> getToken()
Returns the JSON Web Token used for authentication of all requests that are sent to the remote service by this API instance. If the current API has not yet been initialized an empty Optional instance will be returned.- Returns:
- The JWT used by this API or an empty Optional if the API has not been initialized
-
setLanguage
void setLanguage(String languageCode)
Sets the preferred language to be used for communication with the remote service. Some of the API calls might use this setting in order to only return results that match the given language. If available, the data returned by the remote API will be translated to the given language. The default language code is "en". For a list of supported languages seegetAvailableLanguages()
.- Parameters:
languageCode
- The language in which the results are to be returned- See Also:
getAvailableLanguages()
-
login
void login() throws APIException
Initializes the current API session by requesting a new token from the remote API. This token will be used for authentication of all requests that are sent to the remote service by this API instance. The initialization will be performed based on the constructor parameters used to create this API instance. It is recommended to login/initialize the session before making the first API call. However, if an API call is made without proper initialization, an implicit login will be performed.
Corresponds to remote API route: [POST] /login- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.
-
refreshToken
void refreshToken() throws APIException
Refreshes the current, valid JWT session token. This method can be used to extend the expiration date (24 hours) of the current session token without the need of a complete new login.
Corresponds to remote API route: [GET] /refresh_token- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.
-
getEpisode
Episode getEpisode(long episodeId) throws APIException
Returns the full information for a given episode id as mapped Java DTO.
Corresponds to remote API route: [GET] /episodes/{id}- Parameters:
episodeId
- The ID of the episode- Returns:
- Mapped Java DTO containing the full episode information based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given episode ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getEpisode(episodeId)
,TheTVDBApi.Extended.getEpisode(episodeId)
-
getAvailableLanguages
List<Language> getAvailableLanguages() throws APIException
Returns a list of all supported languages mapped as Java DTO. These language abbreviations can be used to set the preferred language for the communication with the remote service (seesetLanguage(String)
.
Corresponds to remote API route: [GET] /languages- Returns:
- List of available languages mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.- See Also:
TheTVDBApi.JSON.getAvailableLanguages()
,TheTVDBApi.Extended.getAvailableLanguages()
-
getLanguage
Language getLanguage(long languageId) throws APIException
Returns further language information for a given language ID mapped as Java DTO. The language abbreviation can be used to set the preferred language for the communication with the remote service (seesetLanguage(String)
.
Corresponds to remote API route: [GET] /languages/{id}- Parameters:
languageId
- The ID of the language- Returns:
- Mapped Java DTO containing detailed language information based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if the given language ID does not exist.- See Also:
TheTVDBApi.JSON.getLanguage(languageId)
,TheTVDBApi.Extended.getLanguage(languageId)
-
getMovie
Movie getMovie(long movieId) throws APIException
Returns detailed information for a specific movie mapped as Java DTO.
Corresponds to remote API route: [GET] /movies/{id}- Parameters:
movieId
- The TheTVDB.com movie ID- Returns:
- Detailed information for a specific movie mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given movie ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getMovie(movieId)
,TheTVDBApi.Extended.getMovie(movieId)
-
getMovieUpdates
List<Long> getMovieUpdates(long since) throws APIException
Returns a list of ID's of all movies that have been updated since the given epoch timestamp.
Corresponds to remote API route: [GET] /movieupdates- Parameters:
since
- Epoch time to start your date range- Returns:
- A list of updated movies ID's beginning at the given
since
time, based on the JSON data returned by the remote service - Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.- See Also:
TheTVDBApi.JSON.getMovieUpdates(since)
,TheTVDBApi.Extended.getMovieUpdates(since)
-
searchSeries
List<SeriesSearchResult> searchSeries(QueryParameters queryParameters) throws APIException
Returns a list of series search results based on the given query parameters mapped as Java DTO. The list contains basic information of all series matching the query parameters.
Corresponds to remote API route: [GET] /search/series- Parameters:
queryParameters
- Object containing key/value pairs of query search parameters. For a complete list of possible search parameters see the API documentation or usegetAvailableSeriesSearchParameters()
.- Returns:
- List of series search results mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no records are found that match your query.- See Also:
TheTVDBApi.JSON.searchSeries(queryParameters)
,TheTVDBApi.Extended.searchSeries(queryParameters)
-
searchSeriesByName
List<SeriesSearchResult> searchSeriesByName(@Nonnull String name) throws APIException
Search for series by name. Returns a list of series search results mapped as Java DTO. The search results contain basic information of all series matching the given name. This is a shortcut-method forsearchSeries(queryParameters)
with a single "name" query parameter.- Parameters:
name
- The name of the series to search for- Returns:
- List of series search results mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no records are found that match your query.
-
searchSeriesByImdbId
List<SeriesSearchResult> searchSeriesByImdbId(@Nonnull String imdbId) throws APIException
Search for series by IMDB-Id. Returns a list of series search results mapped as Java DTO. The search results contain basic information of all series matching the given IMDB-Id. This is a shortcut-method forsearchSeries(queryParameters)
with a single "imdbId" query parameter.- Parameters:
imdbId
- The IMDB-Id of the series to search for- Returns:
- List of series search results mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no records are found that match your query.
-
searchSeriesByZap2itId
List<SeriesSearchResult> searchSeriesByZap2itId(@Nonnull String zap2itId) throws APIException
Search for series by Zap2it-Id. Returns a list of series search results mapped as Java DTO. The search results contain basic information of all series matching the given Zap2it-Id. This is a shortcut-method forsearchSeries(queryParameters)
with a single "zap2itId" query parameter.- Parameters:
zap2itId
- The Zap2it-Id of the series to search for- Returns:
- List of series search results mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no records are found that match your query.
-
getAvailableSeriesSearchParameters
List<String> getAvailableSeriesSearchParameters() throws APIException
Returns possible query parameters, which can be used to search for series, mapped as Java DTO.
Corresponds to remote API route: [GET] /search/series/params- Returns:
- List of possible parameters to query by in the series search route
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.- See Also:
TheTVDBApi.JSON.getAvailableSeriesSearchParameters()
,TheTVDBApi.Extended.getAvailableSeriesSearchParameters()
,TheTVDBApi.JSON.searchSeries(queryParams)
,TheTVDBApi.Extended.searchSeries(queryParams)
,searchSeries(queryParams)
-
getSeries
Series getSeries(long seriesId) throws APIException
Returns detailed information for a specific series mapped as Java DTO.
Corresponds to remote API route: [GET] /series/{id}- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- Detailed information for a specific series mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getSeries(seriesId)
,TheTVDBApi.Extended.getSeries(seriesId)
-
getSeriesHeaderInformation
Map<String,String> getSeriesHeaderInformation(long seriesId) throws APIException
Returns header information for a specific series as key/value pairs. Good for getting the Last-Updated header to find out when the series was last modified.
Corresponds to remote API route: [HEAD] /series/{id}- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- HTML header information returned by the remote service mapped as key/value pairs
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getSeriesHeaderInformation(seriesId)
,TheTVDBApi.Extended.getSeriesHeaderInformation(seriesId)
-
getActors
List<Actor> getActors(long seriesId) throws APIException
Returns a list of actors for a specific series mapped as Java DTO.
Corresponds to remote API route: [GET] /series/{id}/actors- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- List of actors mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getActors(seriesId)
,TheTVDBApi.Extended.getActors(seriesId)
-
getEpisodes
List<Episode> getEpisodes(long seriesId, QueryParameters queryParameters) throws APIException
Returns all episodes of a specific series mapped as Java DTO. Results will be paginated with 100 results per page. UsequeryParameters
to select a specific result page.
Corresponds to remote API route: [GET] /series/{id}/episodes- Parameters:
seriesId
- The TheTVDB.com series IDqueryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible parameters see the API documentation.- Returns:
- List of episodes mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getEpisodes(seriesId, queryParameters)
,TheTVDBApi.Extended.getEpisodes(seriesId, queryParameters)
-
getEpisodes
List<Episode> getEpisodes(long seriesId) throws APIException
Returns the first 100 episodes of a specific series mapped as Java DTO. Note that this method is deterministic and will always return the first result page of the available episodes. This is a shortcut-method forgetEpisodes(seriesId, queryParameters)
with an empty query parameter.- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- List of episodes mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
getEpisodes(seriesId, page)
-
getEpisodes
List<Episode> getEpisodes(long seriesId, long page) throws APIException
Returns a list of episodes of a specific series mapped as Java DTO. The result list will contain 100 episodes at most. For series with more episodes use thepage
parameter to browse to a specific result page. This is a shortcut-method forgetEpisodes(seriesId, queryParameters)
with a single "page" query parameter.- Parameters:
seriesId
- The TheTVDB.com series IDpage
- The result page to be returned- Returns:
- List of episodes mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
getEpisodes(seriesId)
-
queryEpisodes
List<Episode> queryEpisodes(long seriesId, QueryParameters queryParameters) throws APIException
Returns all matching episodes of a specific series mapped as Java DTO. Results will be paginated. Note that this method is deterministic and will always return the first result page of the available episodes.
Corresponds to remote API route: [GET] /series/{id}/episodes/query- Parameters:
seriesId
- The TheTVDB.com series IDqueryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible query parameters see the API documentation or usegetAvailableEpisodeQueryParameters(seriesId)
.- Returns:
- List of episodes matching the query parameters, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
TheTVDBApi.JSON.queryEpisodes(seriesId, queryParameters)
,TheTVDBApi.Extended.queryEpisodes(seriesId, queryParameters)
-
queryEpisodesByAiredSeason
List<Episode> queryEpisodesByAiredSeason(long seriesId, long airedSeason) throws APIException
Returns all episodes of a specific series and season mapped as Java DTO. Results will be paginated. Note that this method is deterministic and will always return the first result page of the available episodes. This is a shortcut-method forqueryEpisodes(seriesId, queryParameters)
with a single "airedSeason" query parameter.- Parameters:
seriesId
- The TheTVDB.com series IDairedSeason
- The number of the aired season to query for- Returns:
- List of episodes for a specific season, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
queryEpisodesByAiredSeason(seriesId, airedSeason, page)
-
queryEpisodesByAiredSeason
List<Episode> queryEpisodesByAiredSeason(long seriesId, long airedSeason, long page) throws APIException
Returns all episodes of a specific series and season mapped as Java DTO. Results will be paginated. For seasons with a high number of episodes use thepage
parameter to browse to a specific result page. This is a shortcut-method forqueryEpisodes(seriesId, queryParameters)
with a "airedSeason" and "page" query parameter.- Parameters:
seriesId
- The TheTVDB.com series IDairedSeason
- The number of the aired season to query forpage
- The result page to be returned- Returns:
- List of episodes for a specific season, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
queryEpisodesByAiredSeason(seriesId, airedSeason)
-
queryEpisodesByAiredEpisode
List<Episode> queryEpisodesByAiredEpisode(long seriesId, long airedEpisode) throws APIException
Returns all episodes of a specific series, matching theairedEpisode
parameter, mapped as Java DTO. Results will be paginated. This is a shortcut-method forqueryEpisodes(seriesId, queryParameters)
with a single "airedEpisode" query parameter.
Note that an aired episode number might be associated with a specific season. If the series consists of more than one season this method will return the matching aired episodes from all the seasons. UsequeryEpisodesByAbsoluteNumber(long, long)
in order to query for a single episode.- Parameters:
seriesId
- The TheTVDB.com series IDairedEpisode
- The number of the aired episode to query for- Returns:
- List of episodes for a specific season and aired episode number, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
queryEpisodesByAbsoluteNumber(seriesId, absoluteNumber)
-
queryEpisodesByAbsoluteNumber
List<Episode> queryEpisodesByAbsoluteNumber(long seriesId, long absoluteNumber) throws APIException
Returns a specific episode of a series, mapped as Java DTO. Results will be paginated. This is a shortcut-method forqueryEpisodes(seriesId, queryParameters)
with a single "absoluteNumber" query parameter.
Note that (unlike an aired episode number) an absolute episode number should most likely be unique throughout all episodes of a specific series. So in most cases the returned list will consist of only one element. However, as the remote API doesn't give any guarantees that querying with an "absoluteNumber" parameter always returns one episode record at most this method will return all episode data as received from the remote service.- Parameters:
seriesId
- The TheTVDB.com series IDabsoluteNumber
- The absolute number of the episode to query for (this is not the episode ID!)- Returns:
- List of episodes for an absolute episode number, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
getEpisode(episodeId)
-
getAvailableEpisodeQueryParameters
List<String> getAvailableEpisodeQueryParameters(long seriesId) throws APIException
Returns a list of keys which are valid parameters for querying episodes, as plain Strings. These keys are permitted to be used inQueryParameters
objects when querying for specific episodes of a series.
Corresponds to remote API route: [GET] /series/{id}/episodes/query/params- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- List of allowed keys to be used for querying episodes, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
queryEpisodes(seriesId, queryParameters)
,TheTVDBApi.JSON.getAvailableEpisodeQueryParameters(seriesId)
,TheTVDBApi.Extended.getAvailableEpisodeQueryParameters(seriesId)
-
getSeriesEpisodesSummary
SeriesSummary getSeriesEpisodesSummary(long seriesId) throws APIException
Returns a summary of the episodes and seasons available for a series, mapped as Java DTO.
Note: Season "0" is for all episodes that are considered to be specials.
Corresponds to remote API route: [GET] /series/{id}/episodes/summary- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- A summary of the episodes and seasons available for the given series, mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getSeriesEpisodesSummary(seriesId)
,TheTVDBApi.Extended.getSeriesEpisodesSummary(seriesId)
-
filterSeries
Series filterSeries(long seriesId, QueryParameters queryParameters) throws APIException
Returns a filtered series record based on the given parameters, mapped as Java DTO.
Corresponds to remote API route: [GET] /series/{id}/filter- Parameters:
seriesId
- The TheTVDB.com series IDqueryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible query parameters see the API documentation or usegetAvailableSeriesFilterParameters(seriesId)
.- Returns:
- A filtered series record, mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.filterSeries(seriesId, queryParameters)
,TheTVDBApi.Extended.filterSeries(seriesId, queryParameters)
-
filterSeries
Series filterSeries(long seriesId, @Nonnull String filterKeys) throws APIException
Returns a series records, filtered by the supplied comma-separated list of keys, mapped as Java DTO. This is a shortcut-method forfilterSeries(seriesId, queryParameters)
with a single "keys" query parameter.- Parameters:
seriesId
- The TheTVDB.com series IDfilterKeys
- Comma-separated list of keys to filter by- Returns:
- A filtered series record, mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.
-
getAvailableSeriesFilterParameters
List<String> getAvailableSeriesFilterParameters(long seriesId) throws APIException
Returns a list of keys which are valid parameters for filtering series, as plain Strings. These keys are permitted to be used inQueryParameters
objects when filtering for a specific series.
Corresponds to remote API route: [GET] /series/{id}/filter/params- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- A list of keys to filter by, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
filterSeries(seriesId, queryParameters)
,TheTVDBApi.JSON.getAvailableSeriesFilterParameters(seriesId)
,TheTVDBApi.Extended.getAvailableSeriesFilterParameters(seriesId)
-
getSeriesImagesSummary
ImageSummary getSeriesImagesSummary(long seriesId) throws APIException
Returns a summary of the images types and counts available for a particular series, mapped as Java DTO.
Corresponds to remote API route: [GET] /series/{id}/images- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- A summary of the image types and counts available for the given series, mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
TheTVDBApi.JSON.getSeriesImagesSummary(seriesId)
,TheTVDBApi.Extended.getSeriesImagesSummary(seriesId)
-
queryImages
List<Image> queryImages(long seriesId, QueryParameters queryParameters) throws APIException
Returns the matching result of querying images for a specific series, mapped as Java DTO.
Corresponds to remote API route: [GET] /series/{id}/images/query- Parameters:
seriesId
- The TheTVDB.com series IDqueryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
.- Returns:
- List of images that matched the query, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
TheTVDBApi.JSON.queryImages(seriesId, queryParameters)
,TheTVDBApi.Extended.queryImages(seriesId, queryParameters)
-
queryImages
List<Image> queryImages(long seriesId, @Nonnull String keyType, @Nonnull String resolution) throws APIException
Returns all images for a specific series, matching the given parameters, mapped as Java DTO. This is a shortcut-method forqueryImages(seriesId, queryParameters)
with a "keyType" and "resolution" query parameter.
Note: For more details regarding valid values for the method specific query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
- Parameters:
seriesId
- The TheTVDB.com series IDkeyType
- Type of image you're querying for (fanart, poster, etc.)resolution
- Resolution to filter by (1280x1024, for example)- Returns:
- List of images that matched the given parameters, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
queryImages(seriesId, keyType, resolution, subKey)
-
queryImages
List<Image> queryImages(long seriesId, @Nonnull String keyType, @Nonnull String resolution, @Nonnull String subKey) throws APIException
Returns all images for a specific series, matching the given parameters, mapped as Java DTO. This is a shortcut-method forqueryImages(seriesId, queryParameters)
with a "keyType", a "resolution" and a "subKey" query parameter.
Note: For more details regarding valid values for the method specific query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
- Parameters:
seriesId
- The TheTVDB.com series IDkeyType
- Type of image you're querying for (fanart, poster, etc.)resolution
- Resolution to filter by (1280x1024, for example)subKey
- Subkey for the other method query parameters- Returns:
- List of images that matched the given parameters, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.- See Also:
queryImages(seriesId, keyType, resolution)
-
queryImagesByKeyType
List<Image> queryImagesByKeyType(long seriesId, @Nonnull String keyType) throws APIException
Returns all images of a specific type for a series, mapped as Java DTO. This is a shortcut-method forqueryImages(seriesId, queryParameters)
with a single "keyType" query parameter.
Note: For more details regarding valid values for the method specific query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
- Parameters:
seriesId
- The TheTVDB.com series IDkeyType
- Type of image you're querying for (fanart, poster, etc.)- Returns:
- List of images of the given key type, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.
-
queryImagesByResolution
List<Image> queryImagesByResolution(long seriesId, @Nonnull String resolution) throws APIException
Returns all images of a specific resolution for a series, mapped as Java DTO. This is a shortcut-method forqueryImages(seriesId, queryParameters)
with a single "resolution" query parameter.
Note: For more details regarding valid values for the method specific query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
- Parameters:
seriesId
- The TheTVDB.com series IDresolution
- Resolution to filter by (1280x1024, for example)- Returns:
- List of images with the given resolution, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.
-
queryImagesBySubKey
List<Image> queryImagesBySubKey(long seriesId, @Nonnull String subKey) throws APIException
Returns all images of a specific sub key for a series, mapped as Java DTO. This is a shortcut-method forqueryImages(seriesId, queryParameters)
with a single "subKey" query parameter.
Note: For more details regarding valid values for the method specific query parameters see the API documentation or usegetAvailableImageQueryParameters(seriesId)
- Parameters:
seriesId
- The TheTVDB.com series IDsubKey
- Subkey to query for- Returns:
- List of images matching the given sub key, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc. or if no records are found that match your query.
-
getAvailableImageQueryParameters
List<ImageQueryParameter> getAvailableImageQueryParameters(long seriesId) throws APIException
Returns a list of valid parameters for querying a series images, mapped as Java DTO. Unlike other routes, querying for a series images may be restricted to certain combinations of query keys. The allowed combinations are clustered in the singleImageQueryParameter
objects returned by this method.
Corresponds to remote API route: [GET] /series/{id}/images/query/params- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- A list of possible parameters which may be used to query a series images, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, the given series ID does not exist, etc.- See Also:
queryImages(seriesId, queryParameters)
,TheTVDBApi.JSON.getAvailableImageQueryParameters(seriesId)
,TheTVDBApi.Extended.getAvailableImageQueryParameters(seriesId)
-
queryLastUpdated
Map<Long,Long> queryLastUpdated(QueryParameters queryParameters) throws APIException
Returns a map of series that have changed in a maximum of one week blocks since the providedfromTime
query parameter. The key/value pairs of the returned map represent a TheTVDB.com series ID (key) and when it was updated the last time (value) as Epoch time. Note that the given query parameters must always contain a validfromTime
Epoch timestamp key.
The user may specify an additionaltoTime
query key to grab results for less than a week. Any timespan larger than a week will be reduced down to one week automatically.
Corresponds to remote API route: [GET] /updated/query- Parameters:
queryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible query parameters see the API documentation or usegetAvailableLastUpdatedQueryParameters()
.- Returns:
- A map of updated objects that match the given timeframe, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or no records exist for the given timespan.- See Also:
TheTVDBApi.JSON.queryLastUpdated(queryParameters)
,TheTVDBApi.Extended.queryLastUpdated(queryParameters)
-
queryLastUpdated
Map<Long,Long> queryLastUpdated(long fromTime) throws APIException
Returns a map of series that have changed in the (one) week since the providedfromTime
query parameter. The key/value pairs of the returned map represent a TheTVDB.com series ID (key) and when it was updated the last time (value) as Epoch time. This is a shortcut-method forqueryLastUpdated(queryParameters)
with a single "fromTime" query parameter.- Parameters:
fromTime
- Epoch time to start your date range- Returns:
- A map of updated objects beginning at the given
fromTime
, based on the JSON data returned by the remote service - Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or no records exist for the given timespan.- See Also:
queryLastUpdated(fromTime, toTime)
-
queryLastUpdated
Map<Long,Long> queryLastUpdated(long fromTime, long toTime) throws APIException
Returns a map of series that have changed in between the given timeframe, but with a maximum of one week, starting at the providedfromTime
query parameter. ThetoTime
parameter may be specified to grab results for less than a week. Any timespan larger than a week will be reduced down to one week automatically. The key/value pairs of the returned map represent a TheTVDB.com series ID (key) and when it was updated the last time (value) as Epoch time. This is a shortcut-method forqueryLastUpdated(queryParameters)
with a "fromTime" and a "toTime" query parameter.- Parameters:
fromTime
- Epoch time to start your date rangetoTime
- Epoch time to end your date range. Must not be greater than one week fromfromTime
.- Returns:
- A map of updated objects matching the given timeframe, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or no records exist for the given timespan.- See Also:
queryLastUpdated(fromTime)
-
getAvailableLastUpdatedQueryParameters
List<String> getAvailableLastUpdatedQueryParameters() throws APIException
Returns a list of valid parameters for querying series which have been updated lately, as plain Strings. These keys are permitted to be used inQueryParameters
objects when querying for recently updated series.
Corresponds to remote API route: [GET] /updated/query/params- Returns:
- A list of possible parameters which may be used to query for last updated series, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.- See Also:
queryLastUpdated(queryParameters)
,TheTVDBApi.JSON.getAvailableLastUpdatedQueryParameters()
,TheTVDBApi.Extended.getAvailableLastUpdatedQueryParameters()
-
getUser
User getUser() throws APIException
Returns basic information about the currently authenticated user, mapped as Java DTO.
Corresponds to remote API route: [GET] /user- Returns:
- Basic user information, mapped as Java DTO based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user- See Also:
TheTVDBApi.JSON.getUser()
,TheTVDBApi.Extended.getUser()
-
getFavorites
List<String> getFavorites() throws APIException
Returns a list of favorite series for a given user, as plain Strings. Will be an empty list if no favorites exist.
Corresponds to remote API route: [GET] /user/favorites- Returns:
- The user favorites, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user- See Also:
TheTVDBApi.JSON.getFavorites()
,TheTVDBApi.Extended.getFavorites()
-
deleteFromFavorites
List<String> deleteFromFavorites(long seriesId) throws APIException
Deletes the given series ID from the user’s favorite’s list and returns the updated list as plain Strings.
Corresponds to remote API route: [DELETE] /user/favorites/{id}- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- Updated list of user favorites, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user or the requested record could not be deleted- See Also:
addToFavorites(seriesId)
,TheTVDBApi.JSON.deleteFromFavorites(seriesId)
,TheTVDBApi.Extended.deleteFromFavorites(seriesId)
-
addToFavorites
List<String> addToFavorites(long seriesId) throws APIException
Adds the supplied series ID to the user’s favorite’s list and returns the updated list as plain Strings.
Corresponds to remote API route: [PUT] /user/favorites/{id}- Parameters:
seriesId
- The TheTVDB.com series ID- Returns:
- Updated list of user favorites, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user or the requested record could not be updated- See Also:
deleteFromFavorites(seriesId)
,TheTVDBApi.JSON.addToFavorites(seriesId)
,TheTVDBApi.Extended.addToFavorites(seriesId)
-
getRatings
List<Rating> getRatings() throws APIException
Returns a list of ratings for the given user, mapped as Java DTO.
Corresponds to remote API route: [GET] /user/ratings- Returns:
- List of user ratings, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user- See Also:
TheTVDBApi.JSON.getRatings()
,TheTVDBApi.Extended.getRatings()
-
queryRatings
List<Rating> queryRatings(QueryParameters queryParameters) throws APIException
Returns a list of ratings for a given user that match the query, mapped as Java DTO.
Corresponds to remote API route: [GET] /user/ratings/query- Parameters:
queryParameters
- Object containing key/value pairs of query parameters. For a complete list of possible query parameters see the API documentation or usegetAvailableRatingsQueryParameters()
.- Returns:
- List of user ratings that match the given query, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user- See Also:
TheTVDBApi.JSON.queryRatings(queryParameters)
,TheTVDBApi.Extended.queryRatings(queryParameters)
-
queryRatingsByItemType
List<Rating> queryRatingsByItemType(@Nonnull String itemType) throws APIException
Returns a list of ratings for a given user that match theitemType
parameter, mapped as Java DTO. This is a shortcut-method forqueryRatings(queryParameters)
with a single "itemType" query parameter.- Parameters:
itemType
- Item to query. Can be either 'series', 'episode', or 'banner'.- Returns:
- List of user ratings with the given item type, mapped as Java DTO's based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc.
-
getAvailableRatingsQueryParameters
List<String> getAvailableRatingsQueryParameters() throws APIException
Returns a list of valid parameters for querying user ratings, as plain Strings. These keys are permitted to be used inQueryParameters
objects when querying for ratings.
Corresponds to remote API route: [GET] /user/ratings/query/params- Returns:
- A list of possible parameters which may be used to query for user ratings, based on the JSON data returned by the remote service
- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no information exists for the current user- See Also:
queryRatings(queryParameters)
,TheTVDBApi.JSON.getAvailableRatingsQueryParameters()
,TheTVDBApi.Extended.getAvailableRatingsQueryParameters()
-
deleteFromRatings
void deleteFromRatings(@Nonnull String itemType, long itemId) throws APIException
Deletes a given rating of a given type.
Corresponds to remote API route: [DELETE] /user/ratings/{itemType}/{itemId}- Parameters:
itemType
- Item to update. Can be either 'series', 'episode', or 'image'.itemId
- ID of the ratings record that you wish to delete- Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no rating is found that matches your given parameters- See Also:
addToRatings(itemType, itemId, itemRating)
,TheTVDBApi.JSON.deleteFromRatings(itemType, itemId)
,TheTVDBApi.Extended.deleteFromRatings(itemType, itemId)
-
addToRatings
List<Rating> addToRatings(@Nonnull String itemType, long itemId, long itemRating) throws APIException
Updates a given rating of a given type and returns the modified rating, mapped as Java DTO. If no rating exists yet, a new rating will be created.
Corresponds to remote API route: [PUT] /user/ratings/{itemType}/{itemId}/{itemRating}- Parameters:
itemType
- Item to update. Can be either 'series', 'episode', or 'image'.itemId
- ID of the ratings record that you wish to modifyitemRating
- The updated rating number- Returns:
- The modified rating (whether it was added or updated), mapped as Java DTO based on the JSON data returned
by the remote service
Note: It seems that the data returned by the remote service for this route is quite unreliable! It might not always return the modified rating but an empty data array instead. - Throws:
APIException
- If an exception with the remote API occurs, e.g. authentication failure, IO error, resource not found, etc. or if no rating is found that matches your given parameters- See Also:
deleteFromRatings(itemType, itemId)
,TheTVDBApi.JSON.addToRatings(itemType, itemId, itemRating)
,TheTVDBApi.Extended.addToRatings(itemType, itemId, itemRating)
-
json
TheTVDBApi.JSON json()
Provides access to the API'sJSON
layout.
In this layout, all methods will return the raw, unmodified JSON as received from the remove service.- Returns:
- Instance representing the the API's
JSON
layout
-
extended
TheTVDBApi.Extended extended()
Provides access to the API'sExtended
layout.
In this layout, all methods will return a singleAPIResponse
object, containing the actual request data, mapped as DTO, as well as all additional information that is available in the corresponding context.- Returns:
- Instance representing the the API's
Extended
layout
-
-