Interface ZulipHttpClient


public interface ZulipHttpClient
An abstraction for implementing a HTTP client for interacting with Zulip APIs.
  • Method Details

    • get

      <T extends ZulipApiResponse> T get(String path, Map<String,Object> parameters, Class<T> responseAs) throws ZulipClientException
      Performs 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 endpoint
      parameters - Map of URL query parameters that should be used on the API request
      responseAs - 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 ZulipClientException
      Performs 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 endpoint
      parameters - Map of URL query parameters that should be used on the API request
      responseTimeoutSeconds - 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 ZulipClientException
      Performs 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 endpoint
      parameters - Map of URL query parameters that should be used on the API request
      responseAs - 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 ZulipClientException
      Performs 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 endpoint
      parameters - Map of URL query parameters that should be used on the API request
      responseAs - 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 ZulipClientException
      Performs 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 endpoint
      parameters - Map of URL query parameters that should be used on the API request
      responseAs - 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 endpoint
      file - The file to upload
      responseAs - The expected class of the API response
      Returns:
      The ZulipApiResponse
      Throws:
      ZulipClientException
    • close

      void close()
      Closes the underlying HTTP client.