Package org.azd.http

Class ClientRequest

java.lang.Object
org.azd.http.ClientRequest
Direct Known Subclasses:
ClientRequestAdapter

public abstract class ClientRequest extends Object
Request builder invalid input: '&' executor that builds and executes the request for given parameters.
  • Constructor Details

    • ClientRequest

      protected ClientRequest()
      Default constructor.
  • Method Details

    • builder

      public static ClientRequest.Builder builder(AccessTokenCredential accessTokenCredential)
      Client request builder to build the request information such as url and headers.
      Parameters:
      accessTokenCredential - Access token credential object. AccessTokenCredential
      Returns:
      Client request builder. ClientRequest.Builder
    • builder

      public static ClientRequest.Builder builder()
      Client request builder to build the request information such as url and headers.
      Returns:
      Client request builder. ClientRequest.Builder
    • execute

      public abstract <T extends SerializableEntity> T execute(Class<T> model) throws AzDException
      Executes the request built by ClientRequest.Builder and deserializes the response for given entity/model.
      Parameters:
      model - Represents the entity or model for which the response should be deserialized to.
      Returns:
      Deserialized POJO model.
      Throws:
      AzDException - Default Api exception handler.
    • executeAsync

      public abstract <T extends SerializableEntity> CompletableFuture<T> executeAsync(Class<T> model) throws AzDException
      Executes the request built by ClientRequest.Builder and deserializes the response for given entity/model.
      Parameters:
      model - Represents the entity or model for which the response should be deserialized to.
      Returns:
      Deserialized POJO model of future object.
      Throws:
      AzDException - Default Api exception handler.
    • executeStringAsync

      public abstract CompletableFuture<String> executeStringAsync() throws AzDException
      Executes the request built by ClientRequest.Builder and returns the response.
      Returns:
      Future string object.
      Throws:
      AzDException - Default Api exception handler.
    • executeStreamAsync

      public abstract CompletableFuture<InputStream> executeStreamAsync() throws AzDException
      Executes the request built by ClientRequest.Builder and return the input stream of object. If this is meant to be a zip file or any kind of stream, use StreamHelper to download or convert the contents.
      Returns:
      Input stream object.
      Throws:
      AzDException - Default Api exception handler.
    • executePrimitiveAsync

      public abstract CompletableFuture<Void> executePrimitiveAsync() throws AzDException
      Executes the request built by ClientRequest.Builder and doesn't return any response. This is mainly used for Api calls that returns 201 or any operation that doesn't return response.
      Returns:
      Future void.
      Throws:
      AzDException - Default Api exception handler.
    • executeString

      public abstract String executeString() throws AzDException
      Executes the request built by ClientRequest.Builder and returns the response.
      Returns:
      String object.
      Throws:
      AzDException - Default Api exception handler.
    • executeStream

      public abstract InputStream executeStream() throws AzDException
      Executes the request built by ClientRequest.Builder and return the input stream of object. If this is meant to be a zip file or any kind of stream, use StreamHelper to download or convert the contents.
      Returns:
      Input stream object.
      Throws:
      AzDException - Default Api exception handler.
    • executePrimitive

      public abstract Void executePrimitive() throws AzDException
      Executes the request built by ClientRequest.Builder and doesn't return any response. This is mainly used for Api calls that returns 201 or any operation that doesn't return response.
      Returns:
      Void.
      Throws:
      AzDException - Default Api exception handler.
    • request

      public abstract RequestInformation request()
      Returns the request information constructed by ClientRequest.Builder. ClientRequest.Builder
      Returns:
      Request information object. RequestInformation
    • accessTokenCredential

      public abstract AccessTokenCredential accessTokenCredential()
      Returns the access token credential used to construct and execute the requests.
      Returns:
      Access token credential object. AccessTokenCredential