Package dev.reuss.tmdb.core.http
Record Class TmdbRequest
java.lang.Object
java.lang.Record
dev.reuss.tmdb.core.http.TmdbRequest
- Record Components:
path- the request path relative to the TMDB API base URLqueryParams- the request query parameters
- All Implemented Interfaces:
Serializable
public record TmdbRequest(String path, Map<String,String> queryParams)
extends Record
implements Serializable
Represents a TMDB HTTP request.
A request consists of a path relative to the configured TMDB base URL
and optional query parameters. Paths must start with /, for example
/configuration or /movie/550.
This record does not contain the HTTP method explicitly yet, because the current SDK core only supports GET requests.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTmdbRequest(String path) Creates a request without query parameters.TmdbRequest(String path, Map<String, String> queryParams) Creates a new TMDB request. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static TmdbRequestCreates a GET request without query parameters.static TmdbRequestget(String path, QueryParams queryParams) Creates a GET request with query parameters.final inthashCode()Returns a hash code value for this object.path()Returns the value of thepathrecord component.Returns the value of thequeryParamsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TmdbRequest
Creates a request without query parameters.- Parameters:
path- the request path relative to the TMDB API base URL
-
TmdbRequest
Creates a new TMDB request.- Throws:
IllegalArgumentException- ifpathisnull, blank, empty or does not start with/
-
-
Method Details
-
get
Creates a GET request without query parameters.- Parameters:
path- the request path relative to the TMDB API base URL- Returns:
- a new TMDB request
-
get
Creates a GET request with query parameters.- Parameters:
path- the request path relative to the TMDB API base URLqueryParams- the query parameters to include- Returns:
- a new TMDB request
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
queryParams
Returns the value of thequeryParamsrecord component.- Returns:
- the value of the
queryParamsrecord component
-