content: /*
   * Selling Partner API for Data Kiosk
   * The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
   *
   * OpenAPI spec version: 2023-11-15
   * 
   *
   * NOTE: This class is auto generated by the swagger code generator program.
   * https://github.com/swagger-api/swagger-codegen.git
   * Do not edit the class manually.
   */
  
  
  package io.swagger.client.api;
  
  import io.swagger.client.ApiCallback;
  import io.swagger.client.ApiClient;
  import io.swagger.client.ApiException;
  import io.swagger.client.ApiResponse;
  import io.swagger.client.Configuration;
  import io.swagger.client.Pair;
  import io.swagger.client.ProgressRequestBody;
  import io.swagger.client.ProgressResponseBody;
  import io.swagger.client.StringUtil;
  
  import com.google.gson.reflect.TypeToken;
  
  import java.io.IOException;
  
  
  import io.swagger.client.model.datakiosk.CreateQueryResponse;
  import io.swagger.client.model.datakiosk.CreateQuerySpecification;
  import io.swagger.client.model.datakiosk.GetDocumentResponse;
  import io.swagger.client.model.datakiosk.GetQueriesResponse;
  import org.threeten.bp.OffsetDateTime;
  import io.swagger.client.model.datakiosk.Query;
  
  import java.lang.reflect.Type;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import com.amazon.SellingPartnerAPIAA.LWAAccessTokenCache;
  import com.amazon.SellingPartnerAPIAA.LWAAccessTokenCacheImpl;
  import com.amazon.SellingPartnerAPIAA.LWAAuthorizationCredentials;
  import com.amazon.SellingPartnerAPIAA.LWAAuthorizationSigner;
  import com.amazon.SellingPartnerAPIAA.RateLimitConfiguration;
  import com.amazon.SellingPartnerAPIAA.LWAException;
  
  public class QueriesApi {
      private ApiClient apiClient;
  
      QueriesApi() {
          this(Configuration.getDefaultApiClient());
      }
  
      public QueriesApi(ApiClient apiClient) {
          this.apiClient = apiClient;
      }
  
      public ApiClient getApiClient() {
          return apiClient;
      }
  
      public void setApiClient(ApiClient apiClient) {
          this.apiClient = apiClient;
      }
  
      /**
       * Build call for cancelQuery
       * @param queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID. (required)
       * @param progressListener Progress listener
       * @param progressRequestListener Progress request listener
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call cancelQueryCall(String queryId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          Object localVarPostBody = null;
  
          // create path and map variables
          String localVarPath = "/dataKiosk/2023-11-15/queries/{queryId}"
              .replaceAll("\\{" + "queryId" + "\\}", apiClient.escapeString(queryId.toString()));
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
          localVarHeaderParams.put("Content-Type", localVarContentType);
  
          if(progressListener != null) {
              apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                  @Override
                  public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                      com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                      return originalResponse.newBuilder()
                      .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                      .build();
                  }
              });
          }
  
          String[] localVarAuthNames = new String[] {  };
          return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
      }
  
      @SuppressWarnings("rawtypes")
      private com.squareup.okhttp.Call cancelQueryValidateBeforeCall(String queryId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          
          // verify the required parameter 'queryId' is set
          if (queryId == null) {
              throw new ApiException("Missing the required parameter 'queryId' when calling cancelQuery(Async)");
          }
          
  
          com.squareup.okhttp.Call call = cancelQueryCall(queryId, progressListener, progressRequestListener);
          return call;
  
      }
  
      /**
       * 
       * Cancels the query specified by the &#x60;queryId&#x60; parameter. Only queries with a non-terminal &#x60;processingStatus&#x60; (&#x60;IN_QUEUE&#x60;, &#x60;IN_PROGRESS&#x60;) can be cancelled. Cancelling a query that already has a &#x60;processingStatus&#x60; of &#x60;CANCELLED&#x60; will no-op. Cancelled queries are returned in subsequent calls to the &#x60;getQuery&#x60; and &#x60;getQueries&#x60; operations.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID. (required)
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public void cancelQuery(String queryId) throws ApiException,LWAException {
          cancelQueryWithHttpInfo(queryId);
      }
  
      /**
       * 
       * Cancels the query specified by the &#x60;queryId&#x60; parameter. Only queries with a non-terminal &#x60;processingStatus&#x60; (&#x60;IN_QUEUE&#x60;, &#x60;IN_PROGRESS&#x60;) can be cancelled. Cancelling a query that already has a &#x60;processingStatus&#x60; of &#x60;CANCELLED&#x60; will no-op. Cancelled queries are returned in subsequent calls to the &#x60;getQuery&#x60; and &#x60;getQueries&#x60; operations.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID. (required)
       * @return ApiResponse&lt;Void&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public ApiResponse<Void> cancelQueryWithHttpInfo(String queryId) throws ApiException,LWAException {
          com.squareup.okhttp.Call call = cancelQueryValidateBeforeCall(queryId, null, null);
          return apiClient.execute(call);
      }
  
      /**
       *  (asynchronously)
       * Cancels the query specified by the &#x60;queryId&#x60; parameter. Only queries with a non-terminal &#x60;processingStatus&#x60; (&#x60;IN_QUEUE&#x60;, &#x60;IN_PROGRESS&#x60;) can be cancelled. Cancelling a query that already has a &#x60;processingStatus&#x60; of &#x60;CANCELLED&#x60; will no-op. Cancelled queries are returned in subsequent calls to the &#x60;getQuery&#x60; and &#x60;getQueries&#x60; operations.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The identifier for the query. This identifier is unique only in combination with a selling partner account ID. (required)
       * @param callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call cancelQueryAsync(String queryId, final ApiCallback<Void> callback) throws ApiException, LWAException {
  
          ProgressResponseBody.ProgressListener progressListener = null;
          ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
  
          if (callback != null) {
              progressListener = new ProgressResponseBody.ProgressListener() {
                  @Override
                  public void update(long bytesRead, long contentLength, boolean done) {
                      callback.onDownloadProgress(bytesRead, contentLength, done);
                  }
              };
  
              progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                  @Override
                  public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                      callback.onUploadProgress(bytesWritten, contentLength, done);
                  }
              };
          }
  
          com.squareup.okhttp.Call call = cancelQueryValidateBeforeCall(queryId, progressListener, progressRequestListener);
          apiClient.executeAsync(call, callback);
          return call;
      }
      /**
       * Build call for createQuery
       * @param body The body of the request. (required)
       * @param progressListener Progress listener
       * @param progressRequestListener Progress request listener
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call createQueryCall(CreateQuerySpecification body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          Object localVarPostBody = body;
  
          // create path and map variables
          String localVarPath = "/dataKiosk/2023-11-15/queries";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
          localVarHeaderParams.put("Content-Type", localVarContentType);
  
          if(progressListener != null) {
              apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                  @Override
                  public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                      com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                      return originalResponse.newBuilder()
                      .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                      .build();
                  }
              });
          }
  
          String[] localVarAuthNames = new String[] {  };
          return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
      }
  
      @SuppressWarnings("rawtypes")
      private com.squareup.okhttp.Call createQueryValidateBeforeCall(CreateQuerySpecification body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          
          // verify the required parameter 'body' is set
          if (body == null) {
              throw new ApiException("Missing the required parameter 'body' when calling createQuery(Async)");
          }
          
  
          com.squareup.okhttp.Call call = createQueryCall(body, progressListener, progressRequestListener);
          return call;
  
      }
  
      /**
       * 
       * Creates a Data Kiosk query request.  **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a &#x60;@resultRetention&#x60; directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query&#39;s resulting documents always matches the retention of the query.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param body The body of the request. (required)
       * @return CreateQueryResponse
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public CreateQueryResponse createQuery(CreateQuerySpecification body) throws ApiException,LWAException {
          ApiResponse<CreateQueryResponse> resp = createQueryWithHttpInfo(body);
          return resp.getData();
      }
  
      /**
       * 
       * Creates a Data Kiosk query request.  **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a &#x60;@resultRetention&#x60; directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query&#39;s resulting documents always matches the retention of the query.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param body The body of the request. (required)
       * @return ApiResponse&lt;CreateQueryResponse&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public ApiResponse<CreateQueryResponse> createQueryWithHttpInfo(CreateQuerySpecification body) throws ApiException,LWAException {
          com.squareup.okhttp.Call call = createQueryValidateBeforeCall(body, null, null);
          Type localVarReturnType = new TypeToken<CreateQueryResponse>(){}.getType();
          return apiClient.execute(call, localVarReturnType);
      }
  
      /**
       *  (asynchronously)
       * Creates a Data Kiosk query request.  **Note:** The retention of a query varies based on the fields requested. Each field within a schema is annotated with a &#x60;@resultRetention&#x60; directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query&#39;s resulting documents always matches the retention of the query.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param body The body of the request. (required)
       * @param callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call createQueryAsync(CreateQuerySpecification body, final ApiCallback<CreateQueryResponse> callback) throws ApiException, LWAException {
  
          ProgressResponseBody.ProgressListener progressListener = null;
          ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
  
          if (callback != null) {
              progressListener = new ProgressResponseBody.ProgressListener() {
                  @Override
                  public void update(long bytesRead, long contentLength, boolean done) {
                      callback.onDownloadProgress(bytesRead, contentLength, done);
                  }
              };
  
              progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                  @Override
                  public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                      callback.onUploadProgress(bytesWritten, contentLength, done);
                  }
              };
          }
  
          com.squareup.okhttp.Call call = createQueryValidateBeforeCall(body, progressListener, progressRequestListener);
          Type localVarReturnType = new TypeToken<CreateQueryResponse>(){}.getType();
          apiClient.executeAsync(call, localVarReturnType, callback);
          return call;
      }
      /**
       * Build call for getDocument
       * @param documentId The identifier for the Data Kiosk document. (required)
       * @param progressListener Progress listener
       * @param progressRequestListener Progress request listener
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getDocumentCall(String documentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          Object localVarPostBody = null;
  
          // create path and map variables
          String localVarPath = "/dataKiosk/2023-11-15/documents/{documentId}"
              .replaceAll("\\{" + "documentId" + "\\}", apiClient.escapeString(documentId.toString()));
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
          localVarHeaderParams.put("Content-Type", localVarContentType);
  
          if(progressListener != null) {
              apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                  @Override
                  public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                      com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                      return originalResponse.newBuilder()
                      .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                      .build();
                  }
              });
          }
  
          String[] localVarAuthNames = new String[] {  };
          return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
      }
  
      @SuppressWarnings("rawtypes")
      private com.squareup.okhttp.Call getDocumentValidateBeforeCall(String documentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          
          // verify the required parameter 'documentId' is set
          if (documentId == null) {
              throw new ApiException("Missing the required parameter 'documentId' when calling getDocument(Async)");
          }
          
  
          com.squareup.okhttp.Call call = getDocumentCall(documentId, progressListener, progressRequestListener);
          return call;
  
      }
  
      /**
       * 
       * Returns the information required for retrieving a Data Kiosk document&#39;s contents. See the &#x60;createQuery&#x60; operation for details about document retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param documentId The identifier for the Data Kiosk document. (required)
       * @return GetDocumentResponse
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public GetDocumentResponse getDocument(String documentId) throws ApiException,LWAException {
          ApiResponse<GetDocumentResponse> resp = getDocumentWithHttpInfo(documentId);
          return resp.getData();
      }
  
      /**
       * 
       * Returns the information required for retrieving a Data Kiosk document&#39;s contents. See the &#x60;createQuery&#x60; operation for details about document retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param documentId The identifier for the Data Kiosk document. (required)
       * @return ApiResponse&lt;GetDocumentResponse&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public ApiResponse<GetDocumentResponse> getDocumentWithHttpInfo(String documentId) throws ApiException,LWAException {
          com.squareup.okhttp.Call call = getDocumentValidateBeforeCall(documentId, null, null);
          Type localVarReturnType = new TypeToken<GetDocumentResponse>(){}.getType();
          return apiClient.execute(call, localVarReturnType);
      }
  
      /**
       *  (asynchronously)
       * Returns the information required for retrieving a Data Kiosk document&#39;s contents. See the &#x60;createQuery&#x60; operation for details about document retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param documentId The identifier for the Data Kiosk document. (required)
       * @param callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getDocumentAsync(String documentId, final ApiCallback<GetDocumentResponse> callback) throws ApiException, LWAException {
  
          ProgressResponseBody.ProgressListener progressListener = null;
          ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
  
          if (callback != null) {
              progressListener = new ProgressResponseBody.ProgressListener() {
                  @Override
                  public void update(long bytesRead, long contentLength, boolean done) {
                      callback.onDownloadProgress(bytesRead, contentLength, done);
                  }
              };
  
              progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                  @Override
                  public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                      callback.onUploadProgress(bytesWritten, contentLength, done);
                  }
              };
          }
  
          com.squareup.okhttp.Call call = getDocumentValidateBeforeCall(documentId, progressListener, progressRequestListener);
          Type localVarReturnType = new TypeToken<GetDocumentResponse>(){}.getType();
          apiClient.executeAsync(call, localVarReturnType, callback);
          return call;
      }
      /**
       * Build call for getQueries
       * @param processingStatuses A list of processing statuses used to filter queries. (optional)
       * @param pageSize The maximum number of queries to return in a single call. (optional, default to 10)
       * @param createdSince The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago. (optional)
       * @param createdUntil The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the &#x60;getQueries&#x60; request. (optional)
       * @param paginationToken A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the &#x60;pagination.nextToken&#x60; field returned in the &#x60;GetQueriesResponse&#x60; object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of &#x60;pageSize&#x60; which can be modified between calls to &#x60;getQueries&#x60;. In the absence of this token value, &#x60;getQueries&#x60; returns the first page of results. (optional)
       * @param progressListener Progress listener
       * @param progressRequestListener Progress request listener
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getQueriesCall(List<String> processingStatuses, Integer pageSize, OffsetDateTime createdSince, OffsetDateTime createdUntil, String paginationToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          Object localVarPostBody = null;
  
          // create path and map variables
          String localVarPath = "/dataKiosk/2023-11-15/queries";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
          if (processingStatuses != null)
          localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "processingStatuses", processingStatuses));
          if (pageSize != null)
          localVarQueryParams.addAll(apiClient.parameterToPair("pageSize", pageSize));
          if (createdSince != null)
          localVarQueryParams.addAll(apiClient.parameterToPair("createdSince", createdSince));
          if (createdUntil != null)
          localVarQueryParams.addAll(apiClient.parameterToPair("createdUntil", createdUntil));
          if (paginationToken != null)
          localVarQueryParams.addAll(apiClient.parameterToPair("paginationToken", paginationToken));
  
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
          localVarHeaderParams.put("Content-Type", localVarContentType);
  
          if(progressListener != null) {
              apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                  @Override
                  public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                      com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                      return originalResponse.newBuilder()
                      .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                      .build();
                  }
              });
          }
  
          String[] localVarAuthNames = new String[] {  };
          return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
      }
  
      @SuppressWarnings("rawtypes")
      private com.squareup.okhttp.Call getQueriesValidateBeforeCall(List<String> processingStatuses, Integer pageSize, OffsetDateTime createdSince, OffsetDateTime createdUntil, String paginationToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          
  
          com.squareup.okhttp.Call call = getQueriesCall(processingStatuses, pageSize, createdSince, createdUntil, paginationToken, progressListener, progressRequestListener);
          return call;
  
      }
  
      /**
       * 
       * Returns details for the Data Kiosk queries that match the specified filters. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param processingStatuses A list of processing statuses used to filter queries. (optional)
       * @param pageSize The maximum number of queries to return in a single call. (optional, default to 10)
       * @param createdSince The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago. (optional)
       * @param createdUntil The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the &#x60;getQueries&#x60; request. (optional)
       * @param paginationToken A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the &#x60;pagination.nextToken&#x60; field returned in the &#x60;GetQueriesResponse&#x60; object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of &#x60;pageSize&#x60; which can be modified between calls to &#x60;getQueries&#x60;. In the absence of this token value, &#x60;getQueries&#x60; returns the first page of results. (optional)
       * @return GetQueriesResponse
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public GetQueriesResponse getQueries(List<String> processingStatuses, Integer pageSize, OffsetDateTime createdSince, OffsetDateTime createdUntil, String paginationToken) throws ApiException,LWAException {
          ApiResponse<GetQueriesResponse> resp = getQueriesWithHttpInfo(processingStatuses, pageSize, createdSince, createdUntil, paginationToken);
          return resp.getData();
      }
  
      /**
       * 
       * Returns details for the Data Kiosk queries that match the specified filters. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param processingStatuses A list of processing statuses used to filter queries. (optional)
       * @param pageSize The maximum number of queries to return in a single call. (optional, default to 10)
       * @param createdSince The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago. (optional)
       * @param createdUntil The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the &#x60;getQueries&#x60; request. (optional)
       * @param paginationToken A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the &#x60;pagination.nextToken&#x60; field returned in the &#x60;GetQueriesResponse&#x60; object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of &#x60;pageSize&#x60; which can be modified between calls to &#x60;getQueries&#x60;. In the absence of this token value, &#x60;getQueries&#x60; returns the first page of results. (optional)
       * @return ApiResponse&lt;GetQueriesResponse&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public ApiResponse<GetQueriesResponse> getQueriesWithHttpInfo(List<String> processingStatuses, Integer pageSize, OffsetDateTime createdSince, OffsetDateTime createdUntil, String paginationToken) throws ApiException,LWAException {
          com.squareup.okhttp.Call call = getQueriesValidateBeforeCall(processingStatuses, pageSize, createdSince, createdUntil, paginationToken, null, null);
          Type localVarReturnType = new TypeToken<GetQueriesResponse>(){}.getType();
          return apiClient.execute(call, localVarReturnType);
      }
  
      /**
       *  (asynchronously)
       * Returns details for the Data Kiosk queries that match the specified filters. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param processingStatuses A list of processing statuses used to filter queries. (optional)
       * @param pageSize The maximum number of queries to return in a single call. (optional, default to 10)
       * @param createdSince The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago. (optional)
       * @param createdUntil The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the &#x60;getQueries&#x60; request. (optional)
       * @param paginationToken A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the &#x60;pagination.nextToken&#x60; field returned in the &#x60;GetQueriesResponse&#x60; object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of &#x60;pageSize&#x60; which can be modified between calls to &#x60;getQueries&#x60;. In the absence of this token value, &#x60;getQueries&#x60; returns the first page of results. (optional)
       * @param callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getQueriesAsync(List<String> processingStatuses, Integer pageSize, OffsetDateTime createdSince, OffsetDateTime createdUntil, String paginationToken, final ApiCallback<GetQueriesResponse> callback) throws ApiException, LWAException {
  
          ProgressResponseBody.ProgressListener progressListener = null;
          ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
  
          if (callback != null) {
              progressListener = new ProgressResponseBody.ProgressListener() {
                  @Override
                  public void update(long bytesRead, long contentLength, boolean done) {
                      callback.onDownloadProgress(bytesRead, contentLength, done);
                  }
              };
  
              progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                  @Override
                  public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                      callback.onUploadProgress(bytesWritten, contentLength, done);
                  }
              };
          }
  
          com.squareup.okhttp.Call call = getQueriesValidateBeforeCall(processingStatuses, pageSize, createdSince, createdUntil, paginationToken, progressListener, progressRequestListener);
          Type localVarReturnType = new TypeToken<GetQueriesResponse>(){}.getType();
          apiClient.executeAsync(call, localVarReturnType, callback);
          return call;
      }
      /**
       * Build call for getQuery
       * @param queryId The query identifier. (required)
       * @param progressListener Progress listener
       * @param progressRequestListener Progress request listener
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getQueryCall(String queryId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          Object localVarPostBody = null;
  
          // create path and map variables
          String localVarPath = "/dataKiosk/2023-11-15/queries/{queryId}"
              .replaceAll("\\{" + "queryId" + "\\}", apiClient.escapeString(queryId.toString()));
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
  
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
  
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
          localVarHeaderParams.put("Content-Type", localVarContentType);
  
          if(progressListener != null) {
              apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                  @Override
                  public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                      com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
                      return originalResponse.newBuilder()
                      .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                      .build();
                  }
              });
          }
  
          String[] localVarAuthNames = new String[] {  };
          return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
      }
  
      @SuppressWarnings("rawtypes")
      private com.squareup.okhttp.Call getQueryValidateBeforeCall(String queryId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, LWAException {
          
          // verify the required parameter 'queryId' is set
          if (queryId == null) {
              throw new ApiException("Missing the required parameter 'queryId' when calling getQuery(Async)");
          }
          
  
          com.squareup.okhttp.Call call = getQueryCall(queryId, progressListener, progressRequestListener);
          return call;
  
      }
  
      /**
       * 
       * Returns query details for the query specified by the &#x60;queryId&#x60; parameter. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The query identifier. (required)
       * @return Query
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public Query getQuery(String queryId) throws ApiException,LWAException {
          ApiResponse<Query> resp = getQueryWithHttpInfo(queryId);
          return resp.getData();
      }
  
      /**
       * 
       * Returns query details for the query specified by the &#x60;queryId&#x60; parameter. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The query identifier. (required)
       * @return ApiResponse&lt;Query&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public ApiResponse<Query> getQueryWithHttpInfo(String queryId) throws ApiException,LWAException {
          com.squareup.okhttp.Call call = getQueryValidateBeforeCall(queryId, null, null);
          Type localVarReturnType = new TypeToken<Query>(){}.getType();
          return apiClient.execute(call, localVarReturnType);
      }
  
      /**
       *  (asynchronously)
       * Returns query details for the query specified by the &#x60;queryId&#x60; parameter. See the &#x60;createQuery&#x60; operation for details about query retention.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 |  The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
       * @param queryId The query identifier. (required)
       * @param callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @throws LWAException If calls to fetch LWA access token fails
       */
      public com.squareup.okhttp.Call getQueryAsync(String queryId, final ApiCallback<Query> callback) throws ApiException, LWAException {
  
          ProgressResponseBody.ProgressListener progressListener = null;
          ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
  
          if (callback != null) {
              progressListener = new ProgressResponseBody.ProgressListener() {
                  @Override
                  public void update(long bytesRead, long contentLength, boolean done) {
                      callback.onDownloadProgress(bytesRead, contentLength, done);
                  }
              };
  
              progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                  @Override
                  public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                      callback.onUploadProgress(bytesWritten, contentLength, done);
                  }
              };
          }
  
          com.squareup.okhttp.Call call = getQueryValidateBeforeCall(queryId, progressListener, progressRequestListener);
          Type localVarReturnType = new TypeToken<Query>(){}.getType();
          apiClient.executeAsync(call, localVarReturnType, callback);
          return call;
      }
  
      public static class Builder {
          private LWAAuthorizationCredentials lwaAuthorizationCredentials;
          private String endpoint;
          private LWAAccessTokenCache lwaAccessTokenCache;
          private Boolean disableAccessTokenCache = false;
          private RateLimitConfiguration rateLimitConfiguration;
  
  
          public Builder lwaAuthorizationCredentials(LWAAuthorizationCredentials lwaAuthorizationCredentials) {
              this.lwaAuthorizationCredentials = lwaAuthorizationCredentials;
              return this;
          }
  
          public Builder endpoint(String endpoint) {
              this.endpoint = endpoint;
              return this;
          }
          
          public Builder lwaAccessTokenCache(LWAAccessTokenCache lwaAccessTokenCache) {
              this.lwaAccessTokenCache = lwaAccessTokenCache;
              return this;
          }
  		
  	   public Builder disableAccessTokenCache() {
              this.disableAccessTokenCache = true;
              return this;
          }
  
          public Builder rateLimitConfigurationOnRequests(RateLimitConfiguration rateLimitConfiguration){
              this.rateLimitConfiguration = rateLimitConfiguration;
              return this;
          }
          
          public Builder disableRateLimitOnRequests() {
              this.rateLimitConfiguration = null;
              return this;
          }
  
          public QueriesApi build() {
              if (lwaAuthorizationCredentials == null) {
                  throw new RuntimeException("LWAAuthorizationCredentials not set");
              }
  
              if (StringUtil.isEmpty(endpoint)) {
                  throw new RuntimeException("Endpoint not set");
              }
              
              LWAAuthorizationSigner lwaAuthorizationSigner = null;            
              if (disableAccessTokenCache) {
                  lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials);
              }
              else {
                  if (lwaAccessTokenCache == null) {
                      lwaAccessTokenCache = new LWAAccessTokenCacheImpl();                  
                   }
                   lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials,lwaAccessTokenCache);
              }
  
              return new QueriesApi(new ApiClient()
                  .setLWAAuthorizationSigner(lwaAuthorizationSigner)
                  .setBasePath(endpoint)
                  .setRateLimiter(rateLimitConfiguration));
          }
      }
  }
  