Class TheTVDBApiFactory


  • public final class TheTVDBApiFactory
    extends Object
    Factory used to create new API instances


    Provides methods to create new TheTVDBApi instances with a given set of initialization parameters. Also offers factory methods for creating additional objects that are commonly used in the context of working with the API.

    • Method Detail

      • createApi

        public static TheTVDBApi createApi​(@Nonnull
                                           String apiKey)
        Creates a new TheTVDBApi instance. The given apiKey must be a valid TheTVDB.com API Key which will be used for remote service authentication. To authenticate and generate a new session token use the TheTVDBApi.init() or TheTVDBApi.login() methods right after creating a new instance of this API.


        NOTE: Objects created with this constructor can not be used for calls to the remote API's /users routes. These calls require extended authentication using an additional userKey and userName.

        Parameters:
        apiKey - Valid TheTVDB.com API-Key
        Returns:
        A new TheTVDBApi instance using the given API key for authentication
        See Also:
        createApi(apiKey, userName, userKey)
      • createApi

        public static TheTVDBApi createApi​(@Nonnull
                                           String apiKey,
                                           @Nonnull
                                           Proxy proxy)
        Creates a new TheTVDBApi instance. The given apiKey must be a valid TheTVDB.com API Key which will be used for remote service authentication. To authenticate and generate a new session token use the TheTVDBApi.init() or TheTVDBApi.login() methods right after creating a new instance of this API. All communication to the remote API will be forwarded to the given proxy.


        NOTE: Objects created with this constructor can not be used for calls to the remote API's /users routes. These calls require extended authentication using an additional userKey and userName.

        Parameters:
        apiKey - Valid TheTVDB.com API-Key
        proxy - The proxy service to be used for remote API communication
        Returns:
        A new TheTVDBApi instance using the given API key for authentication
        See Also:
        createApi(apiKey, userName, userKey, proxy)
      • createApi

        public static TheTVDBApi createApi​(@Nonnull
                                           String apiKey,
                                           @Nonnull
                                           String userKey,
                                           @Nonnull
                                           String userName)
        Creates a new TheTVDBApi instance. The given apiKey must be a valid TheTVDB.com API Key. The userKey and userName must refer to a registered TheTVDB.com user account. The given parameters will be used for the initial remote service authentication. To authenticate and generate a new session token use the TheTVDBApi.init() or TheTVDBApi.login() methods right after creating a new instance of this API.
        Parameters:
        apiKey - Valid TheTVDB.com API-Key
        userKey - Valid TheTVDB.com user key (also referred to as "Unique ID")
        userName - Registered TheTVDB.com user name
        Returns:
        A new TheTVDBApi instance using the given API key, user key and user name for authentication
      • createApi

        public static TheTVDBApi createApi​(@Nonnull
                                           String apiKey,
                                           @Nonnull
                                           String userKey,
                                           @Nonnull
                                           String userName,
                                           @Nonnull
                                           Proxy proxy)
        Creates a new TheTVDBApi instance. The given apiKey must be a valid TheTVDB.com API Key. The userKey and userName must refer to a registered TheTVDB.com user account. The given parameters will be used for the initial remote service authentication. To authenticate and generate a new session token use the TheTVDBApi.init() or TheTVDBApi.login() methods right after creating a new instance of this API. All communication to the remote API will be forwarded to the given proxy.
        Parameters:
        apiKey - Valid TheTVDB.com API-Key
        userKey - Valid TheTVDB.com user key (also referred to as "Unique ID")
        userName - Registered TheTVDB.com user name
        proxy - The proxy service to be used for remote API communication
        Returns:
        A new TheTVDBApi instance using the given API key, user key and user name for authentication
      • createQueryParameters

        public static QueryParameters createQueryParameters()
        Creates a new query parameter objects to be used with some of the API calls. The returned object is empty and does not contain any preset query parameters. Those parameters have to be added manually by using the QueryParameters#addParameter(key, value) method.
        Returns:
        A new, empty query parameter object
      • createQueryParameters

        public static QueryParameters createQueryParameters​(@Nonnull
                                                            Map<String,String> parameters)
        Creates a new query parameter objects to be used with some of the API calls. The returned object is contain a preset collection of query parameters based on the given map of key/value pairs. Additional parameters may be added manually to this object by using the QueryParameters#addParameter(key, value) method.
        Parameters:
        parameters - Map containing key/value pairs of query parameters to be initially added to the object returned by this method. Might be empty but not null.
        Returns:
        A new query parameter object with a preset collection of individual parameters
      • createProxy

        public static Proxy createProxy​(@Nonnull
                                        String protocol,
                                        @Nonnull
                                        String host,
                                        int port)
        Creates a new proxy object based on the given parameters. A proxy may be provided when creating a new TheTVDBApi instance in order to forward all communication towards this proxy instead of directly communicating with the remote TheTVDB.com API. The returned proxy object represents a URI in the following format: "protocol://host:port".
        Parameters:
        protocol - The protocol used by the proxy
        host - The host name of the proxy
        port - The port number to be used for communication
        Returns:
        New immutable proxy object based on the given parameters
        See Also:
        createProxy(protocol, host, path, port)
      • createProxy

        public static Proxy createProxy​(@Nonnull
                                        String protocol,
                                        @Nonnull
                                        String host,
                                        @Nonnull
                                        String path,
                                        int port)
        Creates a new proxy object based on the given parameters. A proxy may be provided when creating a new TheTVDBApi instance in order to forward all communication towards this proxy instead of directly communicating with the remote TheTVDB.com API. The returned proxy object represents a URI in the following format: "protocol://host:port/path".
        Parameters:
        protocol - The protocol used by the proxy
        host - The host name of the proxy
        path - The path component with a leading '/'. Will be appended to the authority component.
        port - The port number to be used for communication
        Returns:
        New immutable proxy object based on the given parameters
        See Also:
        createProxy(protocol, host, port)