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

com.seeq.api.AuditApi 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.AuditOutputListV1;


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

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

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

  public AuditApi(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;
  }

    /**
    * Get a collection of Audit Trail entries
    * 
      * @param startTime The start time for the query, formatted as an ISO 8601 timestamp (YYYY-MM-DDThh:mm:ss.sssssssss±hh:mm) (optional)
      * @param endTime The end time for the query, formatted as an ISO 8601 timestamp (YYYY-MM-DDThh:mm:ss.sssssssss±hh:mm) (optional)
      * @param userID User ID(s) to filter on (optional)
      * @param itemID Item ID(s) to filter on (optional)
      * @param itemType Item type(s) to filter on (optional)
      * @param changeType Change type(s) to filter on (Create, Update, Delete) (optional)
      * @param offset The pagination offset, the index of the first collection item that will be returned in this page of results (optional, default to 0)
      * @param limit The pagination limit, the total number of collection items that will be returned in this page of results (optional, default to 100)
      * @param sortAsc When true sorts by oldest entries first, when false sorts by newest entries first (optional, default to true)
      * @return AuditOutputListV1
    * @throws ApiException if fails to make API call
    */
    public AuditOutputListV1 getAuditEntries(String startTime, String endTime, List userID, List itemID, List itemType, List changeType, Integer offset, Integer limit, Boolean sortAsc) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getAuditEntriesWithHttpInfo(startTime, endTime, userID, itemID, itemType, changeType, offset, limit, sortAsc);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a collection of Audit Trail entries
    * 
      * @param startTime The start time for the query, formatted as an ISO 8601 timestamp (YYYY-MM-DDThh:mm:ss.sssssssss±hh:mm) (optional)
      * @param endTime The end time for the query, formatted as an ISO 8601 timestamp (YYYY-MM-DDThh:mm:ss.sssssssss±hh:mm) (optional)
      * @param userID User ID(s) to filter on (optional)
      * @param itemID Item ID(s) to filter on (optional)
      * @param itemType Item type(s) to filter on (optional)
      * @param changeType Change type(s) to filter on (Create, Update, Delete) (optional)
      * @param offset The pagination offset, the index of the first collection item that will be returned in this page of results (optional, default to 0)
      * @param limit The pagination limit, the total number of collection items that will be returned in this page of results (optional, default to 100)
      * @param sortAsc When true sorts by oldest entries first, when false sorts by newest entries first (optional, default to true)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getAuditEntriesWithHttpInfo(String startTime, String endTime, List userID, List itemID, List itemType, List changeType, Integer offset, Integer limit, Boolean sortAsc) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/audit";

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

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "startTime", startTime));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "endTime", endTime));
      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "userID", userID));
      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "itemID", itemID));
      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "itemType", itemType));
      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "changeType", changeType));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortAsc", sortAsc));

    
    
      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
      }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy