Package com.ngrok
Interface NgrokApiClient
- All Known Implementing Classes:
DefaultNgrokApiClient
public interface NgrokApiClient
API client interface.
Concrete implementations can be written and passed to
Ngrok
on construction
in order to make HTTP requests or test business logic.- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final URI
The default base URI for the public ngrok API server -
Method Summary
Modifier and TypeMethodDescription<O> CompletionStage<O>
sendRequest
(NgrokApiClient.HttpMethod method, String endpoint, Stream<Map.Entry<String, Optional<Object>>> queryParams, Stream<Map.Entry<String, Optional<Object>>> bodyParams, Optional<Class<O>> responseClass) Sends a request to the ngrok API.<O> CompletionStage<O>
sendRequest
(URI uri, Class<O> responseClass) Sends a GET request directly to the specified URI.
-
Field Details
-
DEFAULT_BASE_URI
The default base URI for the public ngrok API server
-
-
Method Details
-
sendRequest
Sends a GET request directly to the specified URI.- Type Parameters:
O
- the return type for the API response- Parameters:
uri
- a URI to send the request toresponseClass
- the type of a Jackson-annotated POJO representing the HTTP response body- Returns:
- a future encapsulating the response type
-
sendRequest
<O> CompletionStage<O> sendRequest(NgrokApiClient.HttpMethod method, String endpoint, Stream<Map.Entry<String, Optional<Object>>> queryParams, Stream<Map.Entry<String, Optional<Object>>> bodyParams, Optional<Class<O>> responseClass) Sends a request to the ngrok API.- Type Parameters:
O
- the return type for the API response- Parameters:
method
- the HTTP method to useendpoint
- the endpoint (under the base URI) to send the request toqueryParams
- any query parameters to send along with the request (parameters with an empty value will not be sent)bodyParams
- any JSON body parameters to send along withthe request (parameters with an empty value will not be sent). If this stream is empty, no body should be sent.responseClass
- an optional type for a Jackson-annotated POJO representing the HTTP response body- Returns:
- a future encapsulating the response type (will be
Void
for empty responses)
-