Class PassageHttpClientImpl

java.lang.Object
id.passageidentity.passage4j.core.http.PassageHttpClientImpl
All Implemented Interfaces:
PassageHttpClient

public class PassageHttpClientImpl extends Object implements PassageHttpClient
Implementation of the PassageHttpClient interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a PassageHttpClientImpl object without an authorization header.
    PassageHttpClientImpl(String authorizationHeader)
    Constructs a PassageHttpClientImpl object with the specified authorization header.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> HTTPResponse<T>
    delete(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
    Sends an HTTP DELETE request to the specified URL and returns the response.
    <T> HTTPResponse<T>
    get(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
    Sends an HTTP GET request to the specified URL and returns the response.
    <T> HTTPResponse<T>
    patch(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
    Sends an HTTP PATCH request to the specified URL and returns the response.
    <T> HTTPResponse<T>
    patch(String url, Object requestBody, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
    Sends an HTTP PATCH request to the specified URL with the given request body and returns the response.
    <T> HTTPResponse<T>
    post(String url, Object requestBody, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
    Sends an HTTP POST request to the specified URL with the given request body and returns the response.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PassageHttpClientImpl

      public PassageHttpClientImpl(String authorizationHeader)
      Constructs a PassageHttpClientImpl object with the specified authorization header.
      Parameters:
      authorizationHeader - The authorization header to be used in requests.
    • PassageHttpClientImpl

      public PassageHttpClientImpl()
      Constructs a PassageHttpClientImpl object without an authorization header.
  • Method Details

    • get

      public <T> HTTPResponse<T> get(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType) throws Exception
      Sends an HTTP GET request to the specified URL and returns the response.
      Specified by:
      get in interface PassageHttpClient
      Type Parameters:
      T - The type of the response.
      Parameters:
      url - The URL to send the request to.
      responseType - The type of the response.
      Returns:
      The HTTP response.
      Throws:
      Exception - if an error occurs while making the request.
    • post

      public <T> HTTPResponse<T> post(String url, Object requestBody, com.fasterxml.jackson.core.type.TypeReference<T> responseType) throws Exception
      Sends an HTTP POST request to the specified URL with the given request body and returns the response.
      Specified by:
      post in interface PassageHttpClient
      Type Parameters:
      T - The type of the response.
      Parameters:
      url - The URL to send the request to.
      requestBody - The request body.
      responseType - The type of the response.
      Returns:
      The HTTP response.
      Throws:
      Exception - if an error occurs while making the request.
    • delete

      public <T> HTTPResponse<T> delete(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType) throws Exception
      Sends an HTTP DELETE request to the specified URL and returns the response.
      Specified by:
      delete in interface PassageHttpClient
      Type Parameters:
      T - The type of the response.
      Parameters:
      url - The URL to send the request to.
      responseType - The type of the response.
      Returns:
      The HTTP response.
      Throws:
      Exception - if an error occurs while making the request.
    • patch

      public <T> HTTPResponse<T> patch(String url, Object requestBody, com.fasterxml.jackson.core.type.TypeReference<T> responseType) throws Exception
      Sends an HTTP PATCH request to the specified URL with the given request body and returns the response.
      Specified by:
      patch in interface PassageHttpClient
      Type Parameters:
      T - The type of the response.
      Parameters:
      url - The URL to send the request to.
      requestBody - The request body.
      responseType - The type of the response.
      Returns:
      The HTTP response.
      Throws:
      Exception - if an error occurs while making the request.
    • patch

      public <T> HTTPResponse<T> patch(String url, com.fasterxml.jackson.core.type.TypeReference<T> responseType) throws Exception
      Sends an HTTP PATCH request to the specified URL and returns the response.
      Specified by:
      patch in interface PassageHttpClient
      Type Parameters:
      T - The type of the response.
      Parameters:
      url - The URL to send the request to.
      responseType - The type of the response.
      Returns:
      The HTTP response.
      Throws:
      Exception - if an error occurs while making the request.