Package com.github.tadukoo.web.rest
Interface Endpoint<ResponseType>
- Type Parameters:
ResponseType
- The type of the response
public interface Endpoint<ResponseType>
Endpoint represents a HTTP endpoint that can be accessed and run
- Version:
- Alpha v.0.1
- Author:
- Logan Ferree (Tadukoo)
-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpRequest.BodyPublisher
getURL()
default ResponseType
Runs the endpoint and returns the result - this version builds a newclient
default ResponseType
runEndpoint
(HttpClient client) Runs the endpoint and returns the result - this version takes in aclient
-
Method Details
-
getURL
String getURL()- Returns:
- The URL to use for this endpoint
-
getMethodType
MethodType getMethodType()- Returns:
- The
MethodType
to use for this endpoint
-
getHeaders
- Returns:
- The headers to use for this endpoint - defaults to an empty map
-
getBodyPublisher
- Returns:
- A
BodyPublisher
to use for this endpoint - defaults to no body
-
getBodyHandler
HttpResponse.BodyHandler<ResponseType> getBodyHandler()- Returns:
- A
BodyHandler
to use for this endpoint
-
runEndpoint
Runs the endpoint and returns the result - this version builds a newclient
- Returns:
- The response, formatted using the BodyHandler
- Throws:
IOException
- If anything goes wrong during sending/receivingInterruptedException
- If the operation gets interrupted
-
runEndpoint
Runs the endpoint and returns the result - this version takes in aclient
- Parameters:
client
- TheHttpClient
to be used- Returns:
- The response, formatted using the BodyHandler
- Throws:
IOException
- If anything goes wrong during sending/receivingInterruptedException
- If the operation gets interrupted
-