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

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

There is a newer version: 66.0.0-v202410141803
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.ConditionMonitorInputV1;
import com.seeq.model.ConditionMonitorOutputV1;
import com.seeq.model.GetConditionMonitorItemsOutputV1;


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

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

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

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

    /**
    * Archive a condition monitor
    * 
      * @param id ID of the condition monitor to archive. (required)
    * @throws ApiException if fails to make API call
    */
    public void archiveConditionMonitor(String id) throws ApiException {
        archiveConditionMonitorWithHttpInfo(id);
    }
    
    /**
    * Archive a condition monitor
    * 
      * @param id ID of the condition monitor to archive. (required)
    * @throws ApiException if fails to make API call
    */
    public void archiveConditionMonitorWithHttpInfo(String id) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      
       archiveConditionMonitorWithHeadersAndHttpInfo(id, localVarHeaderParams);
    }

    /**
    * Archive a condition monitor
    * 
      * @param id ID of the condition monitor to archive. (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void archiveConditionMonitorWithHeadersAndHttpInfo(String id, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'id' is set
      if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling archiveConditionMonitor");
      }
    // create path and map variables
    String localVarPath = "/condition-monitors/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
      apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
      return;
          // 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
      }
    /**
    * Create a new condition monitor
    * 
      * @param body  (required)
      * @return ConditionMonitorOutputV1
    * @throws ApiException if fails to make API call
    */
    public ConditionMonitorOutputV1 createConditionMonitor(ConditionMonitorInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = createConditionMonitorWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Create a new condition monitor
    * 
      * @param body  (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse createConditionMonitorWithHttpInfo(ConditionMonitorInputV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return createConditionMonitorWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Create a new condition monitor
    * 
      * @param body  (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse createConditionMonitorWithHeadersAndHttpInfo(ConditionMonitorInputV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
      // verify the required parameter 'body' is set
      if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling createConditionMonitor");
      }
    // create path and map variables
    String localVarPath = "/condition-monitors";

    // 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" };

      localVarHeaderParams.putAll(customHeaders);

      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
      }
    /**
    * Get a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
      * @return ConditionMonitorOutputV1
    * @throws ApiException if fails to make API call
    */
    public ConditionMonitorOutputV1 getConditionMonitor(String id) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getConditionMonitorWithHttpInfo(id);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getConditionMonitorWithHttpInfo(String id) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getConditionMonitorWithHeadersAndHttpInfo(id, localVarHeaderParams);
      
    }

    /**
    * Get a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getConditionMonitorWithHeadersAndHttpInfo(String id, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'id' is set
      if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling getConditionMonitor");
      }
    // create path and map variables
    String localVarPath = "/condition-monitors/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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" };

      localVarHeaderParams.putAll(customHeaders);

      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 a list of condition monitors
    * 
      * @param executorIds Filter condition monitors to only those created by the specified user IDs (optional)
      * @param nameSearch Filter the condition monitors to those whose name match any part of the specified string (optional)
      * @param conditionIds Filter condition monitors to only those that are monitoring one of the specified conditions as specified by the list of IDs (optional)
      * @param enabledFilter Filter condition monitors by their enabled status (optional)
      * @param offset Whether to filter condition monitors to only users who are enabled. (optional, default to 0)
      * @param limit The pagination limit, the total number of condition monitor that will be returned in this page of results (optional, default to 40)
      * @param sortField Orders the condition monitors by either name, createdAt or workbook (optional, default to Name)
      * @param sortAsc Sorts the sort field in ascending order when true and descending when false (optional, default to true)
      * @return GetConditionMonitorItemsOutputV1
    * @throws ApiException if fails to make API call
    */
    public GetConditionMonitorItemsOutputV1 getConditionMonitors(List executorIds, String nameSearch, List conditionIds, Boolean enabledFilter, Integer offset, Integer limit, String sortField, Boolean sortAsc) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getConditionMonitorsWithHttpInfo(executorIds, nameSearch, conditionIds, enabledFilter, offset, limit, sortField, sortAsc);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a list of condition monitors
    * 
      * @param executorIds Filter condition monitors to only those created by the specified user IDs (optional)
      * @param nameSearch Filter the condition monitors to those whose name match any part of the specified string (optional)
      * @param conditionIds Filter condition monitors to only those that are monitoring one of the specified conditions as specified by the list of IDs (optional)
      * @param enabledFilter Filter condition monitors by their enabled status (optional)
      * @param offset Whether to filter condition monitors to only users who are enabled. (optional, default to 0)
      * @param limit The pagination limit, the total number of condition monitor that will be returned in this page of results (optional, default to 40)
      * @param sortField Orders the condition monitors by either name, createdAt or workbook (optional, default to Name)
      * @param sortAsc Sorts the sort field in ascending order when true and descending when false (optional, default to true)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getConditionMonitorsWithHttpInfo(List executorIds, String nameSearch, List conditionIds, Boolean enabledFilter, Integer offset, Integer limit, String sortField, Boolean sortAsc) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getConditionMonitorsWithHeadersAndHttpInfo(executorIds, nameSearch, conditionIds, enabledFilter, offset, limit, sortField, sortAsc, localVarHeaderParams);
      
    }

    /**
    * Get a list of condition monitors
    * 
      * @param executorIds Filter condition monitors to only those created by the specified user IDs (optional)
      * @param nameSearch Filter the condition monitors to those whose name match any part of the specified string (optional)
      * @param conditionIds Filter condition monitors to only those that are monitoring one of the specified conditions as specified by the list of IDs (optional)
      * @param enabledFilter Filter condition monitors by their enabled status (optional)
      * @param offset Whether to filter condition monitors to only users who are enabled. (optional, default to 0)
      * @param limit The pagination limit, the total number of condition monitor that will be returned in this page of results (optional, default to 40)
      * @param sortField Orders the condition monitors by either name, createdAt or workbook (optional, default to Name)
      * @param sortAsc Sorts the sort field in ascending order when true and descending when false (optional, default to true)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getConditionMonitorsWithHeadersAndHttpInfo(List executorIds, String nameSearch, List conditionIds, Boolean enabledFilter, Integer offset, Integer limit, String sortField, Boolean sortAsc, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/condition-monitors";

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

      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "executorIds", executorIds));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "nameSearch", nameSearch));
      localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "conditionIds", conditionIds));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "enabledFilter", enabledFilter));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortField", sortField));
      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" };

      localVarHeaderParams.putAll(customHeaders);

      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
      }
    /**
    * Update a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
      * @param body  (required)
      * @return ConditionMonitorOutputV1
    * @throws ApiException if fails to make API call
    */
    public ConditionMonitorOutputV1 updateConditionMonitor(String id, ConditionMonitorInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = updateConditionMonitorWithHttpInfo(id, body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Update a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
      * @param body  (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse updateConditionMonitorWithHttpInfo(String id, ConditionMonitorInputV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return updateConditionMonitorWithHeadersAndHttpInfo(id, body, localVarHeaderParams);
      
    }

    /**
    * Update a condition monitor
    * 
      * @param id The Seeq ID for the condition monitor (required)
      * @param body  (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse updateConditionMonitorWithHeadersAndHttpInfo(String id, ConditionMonitorInputV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
      // verify the required parameter 'id' is set
      if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling updateConditionMonitor");
      }
      // verify the required parameter 'body' is set
      if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling updateConditionMonitor");
      }
    // create path and map variables
    String localVarPath = "/condition-monitors/{id}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.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" };

      localVarHeaderParams.putAll(customHeaders);

      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