Class RemoteAPI

  • All Implemented Interfaces:
    Proxy

    @Immutable
    @WithHiddenImplementation
    public abstract class RemoteAPI
    extends Object
    implements Proxy
    Object representing the technical remote endpoint of the RESTful remote API. It defines the remote service from which the individual resources will be requested. Without further initialization, objects of this class will represent the TheTVDB.com remote API service by default. However, new instances can also be configured to point to an endpoint other than the actual TheTVDB.com API, e.g. if you want to forward the API communication via a proxy service.


    Objects of this class represent a specific remote and are immutable so that their content can not be changed once an instance has been created. New objects of this class may be created by using the corresponding RemoteAPI.Builder.

    • Constructor Detail

      • RemoteAPI

        public RemoteAPI()
    • Method Detail

      • getProtocol

        @Default
        public String getProtocol()
        Returns the name of the communication protocol used for this remote. The default value is "https".
        Specified by:
        getProtocol in interface Proxy
        Returns:
        The protocol name used by this remote
      • getHost

        @Default
        public String getHost()
        Returns the name of the remote host. The default value is "api.thetvdb.com".
        Specified by:
        getHost in interface Proxy
        Returns:
        The host name of the remote service
      • getPort

        @Default
        public int getPort()
        Returns the port number used for communication with the remote. The default value is 443.
        Specified by:
        getPort in interface Proxy
        Returns:
        The port number of this remote
      • forResource

        public URL forResource​(@Nonnull
                               String resource)
                        throws MalformedURLException
        Creates a new Uniform Resource Identifier for the given resource of the remote API represented by this object.
        Parameters:
        resource - The remote resource to create a new URI for
        Returns:
        The URI for the given resource of this remote API
        Throws:
        MalformedURLException - If an unknown protocol is used or the port is a negative number other than -1