Class HttpClient

java.lang.Object
dev.resms.core.net.impl.HttpClient
All Implemented Interfaces:
IHttpClient<okhttp3.Response>

public class HttpClient extends Object implements IHttpClient<okhttp3.Response>
An implementation of the IHttpClient interface for performing HTTP requests. This implementation uses the OkHttp library for handling HTTP communication.
  • Field Details

  • Constructor Details

    • HttpClient

      public HttpClient()
      Constructs an instance of the HttpClient.
  • Method Details

    • perform

      public AbstractHttpResponse perform(String path, String apiKey, HttpMethod method, String payload)
      Performs an HTTP request with the specified path, HTTP method, and payload.
      Specified by:
      perform in interface IHttpClient<okhttp3.Response>
      Parameters:
      path - The path or endpoint of the request.
      apiKey - The API Key used to authenticate the request.
      method - The HTTP method (GET, POST, PUT, DELETE, etc.).
      payload - The payload or data to send with the request.
      Returns:
      An AbstractHttpResponse representing the response from the server.