Class RemoteAPI
- java.lang.Object
-
- com.github.m0nk3y2k4.thetvdb.internal.connection.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 correspondingRemoteAPI.Builder
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteAPI.Builder
Builder used to create a new immutableRemoteAPI
implementation
-
Constructor Summary
Constructors Constructor Description RemoteAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URL
forResource(String resource)
Creates a new Uniform Resource Identifier for the givenresource
of the remote API represented by this object.String
getHost()
Returns the name of the remote host.int
getPort()
Returns the port number used for communication with the remote.String
getProtocol()
Returns the name of the communication protocol used for this remote.
-
-
-
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 interfaceProxy
- 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".
-
getPort
@Default public int getPort()
Returns the port number used for communication with the remote. The default value is 443.
-
forResource
public URL forResource(@Nonnull String resource) throws MalformedURLException
Creates a new Uniform Resource Identifier for the givenresource
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
-
-