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

com.seeq.api.AssistantsApi 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.AssistantStatusV1;


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

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

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

    public AssistantsApi(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 the status of the Seeq AI Assistant service.
    * 
    * @return AssistantStatusV1
    * @throws ApiException if fails to make API call
    */
    public AssistantStatusV1 status() throws ApiException {
        ApiClient.ApiResponse localVarResponse = statusWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get the status of the Seeq AI Assistant service.
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse statusWithHttpInfo() throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return statusWithHeadersAndHttpInfo(localVarHeaderParams);
        
    }

    /**
    * Get the status of the Seeq AI Assistant service.
    * 
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse statusWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return statusInternal(localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse statusInternal(List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // create path and map variables
        String localVarPath = "/assistants/status";

        // query params
        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", queryParams, localVarPostBody, headerParams, 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
    }
    // OVERLOADS START
    // OVERLOADS END
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy