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

com.seeq.api.PluginsApi 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 java.io.File;
import com.seeq.model.PluginOutputListV1;
import com.seeq.model.StatusMessageBase;


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

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

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

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

    /**
    * Delete a plugin
    * 
      * @param id The ID of the plugin (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase deletePlugin(String id) throws ApiException {
        ApiClient.ApiResponse localVarResponse = deletePluginWithHttpInfo(id);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Delete a plugin
    * 
      * @param id The ID of the plugin (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse deletePluginWithHttpInfo(String id) 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 deletePlugin");
      }
    // create path and map variables
    String localVarPath = "/plugins/{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" };

      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 a plugin file
    * 
      * @param id The ID of the plugin (required)
      * @param fileName The name of the file from the plugin (required)
    * @throws ApiException if fails to make API call
    */
    public void getFile(String id, String fileName) throws ApiException {
        getFileWithHttpInfo(id, fileName);
    }
    
    /**
    * Get a plugin file
    * 
      * @param id The ID of the plugin (required)
      * @param fileName The name of the file from the plugin (required)
    * @throws ApiException if fails to make API call
    */
    public void getFileWithHttpInfo(String id, String fileName) 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 getFile");
      }
      // verify the required parameter 'fileName' is set
      if (fileName == null) {
      throw new ApiException(400, "Missing the required parameter 'fileName' when calling getFile");
      }
    // create path and map variables
    String localVarPath = "/plugins/{id}/files/{fileName}"
      .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()))
      .replaceAll("\\{" + "fileName" + "\\}", apiClient.escapeString(fileName.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 {
      apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", 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
      }
    /**
    * Get a collection of plugins
    * 
      * @param nameSearch Search text by which to filter plugins' names. (optional)
      * @param identifierSearch Search text by which to filter plugins' identifiers. (optional)
      * @param categorySearch Search text by which to filter plugins' categories. (optional)
      * @param sortOrder A field by which to order the plugins followed by a space and 'asc' or 'desc'. Field name can be one of: name, identifier, category (optional, default to name asc)
      * @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 40)
      * @return PluginOutputListV1
    * @throws ApiException if fails to make API call
    */
    public PluginOutputListV1 getPlugins(String nameSearch, String identifierSearch, String categorySearch, String sortOrder, Integer offset, Integer limit) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getPluginsWithHttpInfo(nameSearch, identifierSearch, categorySearch, sortOrder, offset, limit);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a collection of plugins
    * 
      * @param nameSearch Search text by which to filter plugins' names. (optional)
      * @param identifierSearch Search text by which to filter plugins' identifiers. (optional)
      * @param categorySearch Search text by which to filter plugins' categories. (optional)
      * @param sortOrder A field by which to order the plugins followed by a space and 'asc' or 'desc'. Field name can be one of: name, identifier, category (optional, default to name asc)
      * @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 40)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getPluginsWithHttpInfo(String nameSearch, String identifierSearch, String categorySearch, String sortOrder, Integer offset, Integer limit) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/plugins";

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

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "nameSearch", nameSearch));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "identifierSearch", identifierSearch));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "categorySearch", categorySearch));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortOrder", sortOrder));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
      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
      }
    /**
    * Upload a plugin
    * 
      * @param file  (optional)
      * @param inDevelopment Whether this item is in Development Mode, meaning that it is not allowed to be shared with any other users. Non-administrators may only install Plugins in Development Mode. (optional, default to false)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase uploadPlugin(File file, Boolean inDevelopment) throws ApiException {
        ApiClient.ApiResponse localVarResponse = uploadPluginWithHttpInfo(file, inDevelopment);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Upload a plugin
    * 
      * @param file  (optional)
      * @param inDevelopment Whether this item is in Development Mode, meaning that it is not allowed to be shared with any other users. Non-administrators may only install Plugins in Development Mode. (optional, default to false)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse uploadPluginWithHttpInfo(File file, Boolean inDevelopment) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/plugins";

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

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

    
    if (file != null)
    localVarFormParams.put("file", file);

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

      final String[] localVarContentTypes = {
    "multipart/form-data"
      };
      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