Interface ZulipHttpClient
public interface ZulipHttpClient
An abstraction for implementing a HTTP client for interacting with Zulip APIs.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying HTTP client.<T extends ZulipApiResponse>
TPerforms a HTTP DELETE request on the given API endpoint path and URL parameters.<T extends ZulipApiResponse>
TPerforms a HTTP GET request on the given API endpoint pathSegments and URL parameters.<T extends ZulipApiResponse>
TPerforms a HTTP GET request on the given API endpoint pathSegments and URL parameters.<T extends ZulipApiResponse>
TPerforms a HTTP PATCH request on the given API endpoint path and URL parameters.<T extends ZulipApiResponse>
TPerforms a HTTP POST request on the given API endpoint path and URL parameters.<T extends ZulipApiResponse>
TPerforms a HTTP Multipart form upload of the given file.
-
Method Details
-
get
<T extends ZulipApiResponse> T get(String path, Map<String, Object> parameters, Class<T> responseAs) throws ZulipClientExceptionPerforms a HTTP GET request on the given API endpoint pathSegments and URL parameters. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base pathSegments of the API endpointparameters
- Map of URL query parameters that should be used on the API requestresponseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
get
<T extends ZulipApiResponse> T get(String path, Map<String, Object> parameters, int responseTimeoutSeconds, Class<T> responseAs) throws ZulipClientExceptionPerforms a HTTP GET request on the given API endpoint pathSegments and URL parameters. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base pathSegments of the API endpointparameters
- Map of URL query parameters that should be used on the API requestresponseTimeoutSeconds
- The time in seconds that the request should time out if no response has been received. This is primarily used for the events API.responseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
delete
<T extends ZulipApiResponse> T delete(String path, Map<String, Object> parameters, Class<T> responseAs) throws ZulipClientExceptionPerforms a HTTP DELETE request on the given API endpoint path and URL parameters. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base path of the API endpointparameters
- Map of URL query parameters that should be used on the API requestresponseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
patch
<T extends ZulipApiResponse> T patch(String path, Map<String, Object> parameters, Class<T> responseAs) throws ZulipClientExceptionPerforms a HTTP PATCH request on the given API endpoint path and URL parameters. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base path of the API endpointparameters
- Map of URL query parameters that should be used on the API requestresponseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
post
<T extends ZulipApiResponse> T post(String path, Map<String, Object> parameters, Class<T> responseAs) throws ZulipClientExceptionPerforms a HTTP POST request on the given API endpoint path and URL parameters. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base path of the API endpointparameters
- Map of URL query parameters that should be used on the API requestresponseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
upload
<T extends ZulipApiResponse> T upload(String path, File file, Class<T> responseAs) throws ZulipClientException Performs a HTTP Multipart form upload of the given file. The response type is determined by the type provided via the responseAs argument.- Parameters:
path
- The base path of the API endpointfile
- The file to uploadresponseAs
- The expected class of the API response- Returns:
- The
ZulipApiResponse
- Throws:
ZulipClientException
-
close
void close()Closes the underlying HTTP client.
-