All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.seeq.api.RequestsApi Maven / Gradle / Ivy

There is a newer version: 66.0.0-v202407310200
Show newest version
package com.seeq.api;

import com.seeq.ApiException;
import com.seeq.ApiClient;
import com.seeq.Configuration;
import com.seeq.model.*;
import com.seeq.Pair;

import javax.ws.rs.core.GenericType;
import javax.ws.rs.ProcessingException;

import com.seeq.model.GetRequestOutputV1;
import com.seeq.model.GetRequestsOutputV1;
import com.seeq.model.StatusMessageBase;


  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;

  public class RequestsApi {
  private ApiClient apiClient;
  private long retryTimeout = 5_000; // Default of 5 seconds

  public RequestsApi() {
  this(Configuration.getDefaultApiClient());
  }

  public RequestsApi(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

  public void setRetryTimeout(long retryTimeout) {
    this.retryTimeout = retryTimeout;
  }

  public long getRetryTimeout() {
    return this.retryTimeout;
  }

  public ApiClient getApiClient() {
  return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

    /**
    * Cancel all requests
    * 
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase cancelAllRequests() throws ApiException {
        ApiClient.ApiResponse localVarResponse = cancelAllRequestsWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Cancel all requests
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse cancelAllRequestsWithHttpInfo() throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/requests/all";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Cancel all requests made by the invoking user
    * 
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase cancelMyRequests() throws ApiException {
        ApiClient.ApiResponse localVarResponse = cancelMyRequestsWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Cancel all requests made by the invoking user
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse cancelMyRequestsWithHttpInfo() throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/requests/me";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Cancel all requests made by the invoking user for a specific session
    * 
      * @param sessionId ID of the current session (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase cancelMyRequestsBySessionId(String sessionId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = cancelMyRequestsBySessionIdWithHttpInfo(sessionId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Cancel all requests made by the invoking user for a specific session
    * 
      * @param sessionId ID of the current session (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse cancelMyRequestsBySessionIdWithHttpInfo(String sessionId) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'sessionId' is set
      if (sessionId == null) {
      throw new ApiException(400, "Missing the required parameter 'sessionId' when calling cancelMyRequestsBySessionId");
      }
    // create path and map variables
    String localVarPath = "/requests/me/{sessionId}"
      .replaceAll("\\{" + "sessionId" + "\\}", apiClient.escapeString(sessionId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Cancel a request
    * 
      * @param requestId ID of the request to cancel (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase cancelRequest(String requestId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = cancelRequestWithHttpInfo(requestId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Cancel a request
    * 
      * @param requestId ID of the request to cancel (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse cancelRequestWithHttpInfo(String requestId) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'requestId' is set
      if (requestId == null) {
      throw new ApiException(400, "Missing the required parameter 'requestId' when calling cancelRequest");
      }
    // create path and map variables
    String localVarPath = "/requests/{requestId}"
      .replaceAll("\\{" + "requestId" + "\\}", apiClient.escapeString(requestId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Cancel multiple requests, optionally filtering by a user and/or datasource. If you don't specify any filters, all of the requests currently running in Seeq will be cancelled. If you specify multiple filters, only requests matching all filters will be cancelled.
    * 
      * @param userId userId (optional)
      * @param datasourceClass datasourceClass (optional)
      * @param datasourceId datasourceId (optional)
      * @param dataId dataId (optional)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase cancelRequests(String userId, String datasourceClass, String datasourceId, String dataId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = cancelRequestsWithHttpInfo(userId, datasourceClass, datasourceId, dataId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Cancel multiple requests, optionally filtering by a user and/or datasource. If you don't specify any filters, all of the requests currently running in Seeq will be cancelled. If you specify multiple filters, only requests matching all filters will be cancelled.
    * 
      * @param userId userId (optional)
      * @param datasourceClass datasourceClass (optional)
      * @param datasourceId datasourceId (optional)
      * @param dataId dataId (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse cancelRequestsWithHttpInfo(String userId, String datasourceClass, String datasourceId, String dataId) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/requests";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "userId", userId));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasourceClass", datasourceClass));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "datasourceId", datasourceId));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "dataId", dataId));

    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Get progress information for the request identified by the supplied ID
    * 
      * @param requestId ID of the request for which to retrieve progress information (required)
      * @return GetRequestOutputV1
    * @throws ApiException if fails to make API call
    */
    public GetRequestOutputV1 getRequest(String requestId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getRequestWithHttpInfo(requestId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get progress information for the request identified by the supplied ID
    * 
      * @param requestId ID of the request for which to retrieve progress information (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getRequestWithHttpInfo(String requestId) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'requestId' is set
      if (requestId == null) {
      throw new ApiException(400, "Missing the required parameter 'requestId' when calling getRequest");
      }
    // create path and map variables
    String localVarPath = "/requests/{requestId}"
      .replaceAll("\\{" + "requestId" + "\\}", apiClient.escapeString(requestId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Get the collection of requests
    * 
      * @param limit The maximum number of requests that will be returned (optional, default to 250)
      * @return GetRequestsOutputV1
    * @throws ApiException if fails to make API call
    */
    public GetRequestsOutputV1 getRequests(Integer limit) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getRequestsWithHttpInfo(limit);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get the collection of requests
    * 
      * @param limit The maximum number of requests that will be returned (optional, default to 250)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getRequestsWithHttpInfo(Integer limit) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/requests";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));

    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Restart a request, sending it to the back of the line
    * 
      * @param requestId ID of the request to restart (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase restartRequest(String requestId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = restartRequestWithHttpInfo(requestId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Restart a request, sending it to the back of the line
    * 
      * @param requestId ID of the request to restart (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse restartRequestWithHttpInfo(String requestId) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'requestId' is set
      if (requestId == null) {
      throw new ApiException(400, "Missing the required parameter 'requestId' when calling restartRequest");
      }
    // create path and map variables
    String localVarPath = "/requests/{requestId}/restart"
      .replaceAll("\\{" + "requestId" + "\\}", apiClient.escapeString(requestId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy