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

com.seeq.api.AuthApi 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.AuthInputV1;
import com.seeq.model.AuthProvidersOutputV1;
import com.seeq.model.UserOutputV1;


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

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

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

    public AuthApi(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 authentication providers
    * 
    * @return AuthProvidersOutputV1
    * @throws ApiException if fails to make API call
    */
    public AuthProvidersOutputV1 getAuthProviders() throws ApiException {
        ApiClient.ApiResponse localVarResponse = getAuthProvidersWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a collection of authentication providers
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getAuthProvidersWithHttpInfo() throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return getAuthProvidersWithHeadersAndHttpInfo(localVarHeaderParams);
        
    }

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

        // 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
    }
    /**
    * Get a valid CSRF token for this authentication session
    * 
    * @throws ApiException if fails to make API call
    */
    public void getCsrf() throws ApiException {
        getCsrfWithHttpInfo();
    }
    
    /**
    * Get a valid CSRF token for this authentication session
    * 
    * @throws ApiException if fails to make API call
    */
    public void getCsrfWithHttpInfo() throws ApiException {
        Map localVarHeaderParams = new HashMap();
        
         getCsrfWithHeadersAndHttpInfo(localVarHeaderParams);
    }

    /**
    * Get a valid CSRF token for this authentication session
    * 
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void getCsrfWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        getCsrfInternal(localVarQueryParams, localVarHeaderParams);
    }
    
    private void getCsrfInternal(List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // create path and map variables
        String localVarPath = "/auth/csrf";

        // 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 {
                apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", queryParams, localVarPostBody, headerParams, 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
    }
    /**
    * Login
    * 
    * @param body Login information (required)
    * @return UserOutputV1
    * @throws ApiException if fails to make API call
    */
    public UserOutputV1 login(AuthInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = loginWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Login
    * 
    * @param body Login information (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse loginWithHttpInfo(AuthInputV1 body) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return loginWithHeadersAndHttpInfo(body, localVarHeaderParams);
        
    }

    /**
    * Login
    * 
    * @param body Login information (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse loginWithHeadersAndHttpInfo(AuthInputV1 body, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return loginInternal(body, localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse loginInternal(AuthInputV1 body, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = body;
        // verify the required body parameter 'body' is set
        if (body == null) {
            throw new ApiException(400, "Missing the required body parameter 'body' when calling login");
        }
        // create path and map variables
        String localVarPath = "/auth/login";

        // query params
        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", 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
    }
    /**
    * Invalidate the session to be completely unusable
    * 
    * @throws ApiException if fails to make API call
    */
    public void logout() throws ApiException {
        logoutWithHttpInfo();
    }
    
    /**
    * Invalidate the session to be completely unusable
    * 
    * @throws ApiException if fails to make API call
    */
    public void logoutWithHttpInfo() throws ApiException {
        Map localVarHeaderParams = new HashMap();
        
         logoutWithHeadersAndHttpInfo(localVarHeaderParams);
    }

    /**
    * Invalidate the session to be completely unusable
    * 
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void logoutWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        logoutInternal(localVarQueryParams, localVarHeaderParams);
    }
    
    private void logoutInternal(List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // create path and map variables
        String localVarPath = "/auth/logout";

        // 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 {
                apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", queryParams, localVarPostBody, headerParams, 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
    }
    /**
    * Check that the authentication and CSRF tokens present in the request are valid
    * 
    * @throws ApiException if fails to make API call
    */
    public void validate() throws ApiException {
        validateWithHttpInfo();
    }
    
    /**
    * Check that the authentication and CSRF tokens present in the request are valid
    * 
    * @throws ApiException if fails to make API call
    */
    public void validateWithHttpInfo() throws ApiException {
        Map localVarHeaderParams = new HashMap();
        
         validateWithHeadersAndHttpInfo(localVarHeaderParams);
    }

    /**
    * Check that the authentication and CSRF tokens present in the request are valid
    * 
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void validateWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        validateInternal(localVarQueryParams, localVarHeaderParams);
    }
    
    private void validateInternal(List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // create path and map variables
        String localVarPath = "/auth/validate";

        // 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 {
                apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", queryParams, localVarPostBody, headerParams, 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
    }
    // OVERLOADS START
    // OVERLOADS END
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy