Class Request.Builder

java.lang.Object
dev.adlin.vts4j.core.Request.Builder
Enclosing class:
Request

public static class Request.Builder extends Object
Builder for simplified Request creation.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setApiName

      public Request.Builder setApiName(@NotNull @NotNull String apiName)
      Sets the name of the API for the request.
      Parameters:
      apiName - The name of the API. Cannot be null.
      Returns:
      This Builder instance to allow method chaining.
    • setApiVersion

      public Request.Builder setApiVersion(@NotNull @NotNull String apiVersion)
      Sets the version of the API for the request.
      Parameters:
      apiVersion - The version of the API. Cannot be null.
      Returns:
      This Builder instance to allow method chaining.
    • setRequestId

      public Request.Builder setRequestId(@NotNull @NotNull String requestId)
      Sets the unique identifier for the request.
      Parameters:
      requestId - The unique identifier for the request. Cannot be null.
      Returns:
      This Builder instance to allow method chaining.
    • setMessageType

      public Request.Builder setMessageType(@NotNull @NotNull RequestType type)
      Sets the type of the message for the request using a RequestType enum.
      Parameters:
      type - The type of the message as a RequestType enum. Cannot be null.
      Returns:
      This Builder instance to allow method chaining.
    • setMessageType

      public Request.Builder setMessageType(@NotNull @NotNull String type)
      Sets the type of the message for the request using a String.
      Parameters:
      type - The type of the message as a String. Cannot be null.
      Returns:
      This Builder instance to allow method chaining.
    • setPayload

      public Request.Builder setPayload(@NotNull @NotNull com.google.gson.JsonObject payload)
      Sets payload required for certain types of requests. More details about the payload structure can be found at this page.
      Parameters:
      payload - Additional information required for certain types of requests
      Returns:
      This Builder instance to allow method chaining
    • build

      public Request build()
      Builds and returns a new Request object with the configured parameters. If messageType is not set, an IllegalArgumentException is thrown.
      Returns:
      A new Request object with the configured parameters.
      Throws:
      IllegalArgumentException - If messageType is null.