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

io.service84.clients.apikey.api.ApiKeyApi Maven / Gradle / Ivy

The newest version!
package io.service84.clients.apikey.api;

import io.service84.clients.apikey.ApiClient;

import io.service84.clients.apikey.dto.APIKeyAuthenticationDTO;
import io.service84.clients.apikey.dto.APIKeyDTO;
import io.service84.clients.apikey.dto.APIKeyDetailsDTO;
import io.service84.clients.apikey.dto.APIKeyPageDTO;
import io.service84.clients.apikey.dto.APIKeyRequestDTO;
import io.service84.clients.apikey.dto.ErrorDTO;
import java.util.UUID;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;


@Component("io.service84.clients.apikey.api.ApiKeyApi")
public class ApiKeyApi {
    private ApiClient apiClient;

    public ApiKeyApi() {
        this(new ApiClient());
    }

    @Autowired
    public ApiKeyApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Authenticate an API Key
     * 
     * 

200 - Successful operation *

400 - Bad request *

401 - Authentication Failed *

403 - Insufficient Permission *

500 - Internal Server Error * @param apIKeyAuthenticationDTO API Key Authentication (required) * @param authentication The Authentication Header (optional) * @return APIKeyDTO * @throws RestClientException if an error occurs while attempting to invoke the API */ public APIKeyDTO authenticateApiKey(APIKeyAuthenticationDTO apIKeyAuthenticationDTO, String authentication) throws RestClientException { return authenticateApiKeyWithHttpInfo(apIKeyAuthenticationDTO, authentication).getBody(); } /** * Authenticate an API Key * *

200 - Successful operation *

400 - Bad request *

401 - Authentication Failed *

403 - Insufficient Permission *

500 - Internal Server Error * @param apIKeyAuthenticationDTO API Key Authentication (required) * @param authentication The Authentication Header (optional) * @return ResponseEntity<APIKeyDTO> * @throws RestClientException if an error occurs while attempting to invoke the API */ public ResponseEntity authenticateApiKeyWithHttpInfo(APIKeyAuthenticationDTO apIKeyAuthenticationDTO, String authentication) throws RestClientException { Object postBody = apIKeyAuthenticationDTO; // verify the required parameter 'apIKeyAuthenticationDTO' is set if (apIKeyAuthenticationDTO == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'apIKeyAuthenticationDTO' when calling authenticateApiKey"); } String path = apiClient.expandPath("/api_keys/authenticate", Collections.emptyMap()); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (authentication != null) headerParams.add("Authentication", apiClient.parameterToString(authentication)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "BearerAuth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); } /** * Request an API Key * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

500 - Internal Server Error * @param apIKeyRequestDTO API Key Request (required) * @param authentication The Authentication Header (optional) * @return APIKeyDetailsDTO * @throws RestClientException if an error occurs while attempting to invoke the API */ public APIKeyDetailsDTO requestApiKey(APIKeyRequestDTO apIKeyRequestDTO, String authentication) throws RestClientException { return requestApiKeyWithHttpInfo(apIKeyRequestDTO, authentication).getBody(); } /** * Request an API Key * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

500 - Internal Server Error * @param apIKeyRequestDTO API Key Request (required) * @param authentication The Authentication Header (optional) * @return ResponseEntity<APIKeyDetailsDTO> * @throws RestClientException if an error occurs while attempting to invoke the API */ public ResponseEntity requestApiKeyWithHttpInfo(APIKeyRequestDTO apIKeyRequestDTO, String authentication) throws RestClientException { Object postBody = apIKeyRequestDTO; // verify the required parameter 'apIKeyRequestDTO' is set if (apIKeyRequestDTO == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'apIKeyRequestDTO' when calling requestApiKey"); } String path = apiClient.expandPath("/api_keys/request", Collections.emptyMap()); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (authentication != null) headerParams.add("Authentication", apiClient.parameterToString(authentication)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "BearerAuth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); } /** * Retrieve an API Key * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

404 - Not Found *

500 - Internal Server Error * @param id ID of an API Key (required) * @param authentication The Authentication Header (optional) * @return APIKeyDTO * @throws RestClientException if an error occurs while attempting to invoke the API */ public APIKeyDTO retrieveApiKey(UUID id, String authentication) throws RestClientException { return retrieveApiKeyWithHttpInfo(id, authentication).getBody(); } /** * Retrieve an API Key * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

404 - Not Found *

500 - Internal Server Error * @param id ID of an API Key (required) * @param authentication The Authentication Header (optional) * @return ResponseEntity<APIKeyDTO> * @throws RestClientException if an error occurs while attempting to invoke the API */ public ResponseEntity retrieveApiKeyWithHttpInfo(UUID id, String authentication) throws RestClientException { Object postBody = null; // verify the required parameter 'id' is set if (id == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling retrieveApiKey"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("id", id); String path = apiClient.expandPath("/api_keys/{id}", uriVariables); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (authentication != null) headerParams.add("Authentication", apiClient.parameterToString(authentication)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "BearerAuth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); } /** * Retrieve the API Keys * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

500 - Internal Server Error * @param authentication The Authentication Header (optional) * @param cursor The cursor of the page to get (optional) * @param limit The size of the page to get (optional, default to 20) * @return APIKeyPageDTO * @throws RestClientException if an error occurs while attempting to invoke the API */ public APIKeyPageDTO retrieveApiKeys(String authentication, String cursor, Integer limit) throws RestClientException { return retrieveApiKeysWithHttpInfo(authentication, cursor, limit).getBody(); } /** * Retrieve the API Keys * *

200 - Successful operation *

400 - Bad request *

403 - Insufficient Permission *

500 - Internal Server Error * @param authentication The Authentication Header (optional) * @param cursor The cursor of the page to get (optional) * @param limit The size of the page to get (optional, default to 20) * @return ResponseEntity<APIKeyPageDTO> * @throws RestClientException if an error occurs while attempting to invoke the API */ public ResponseEntity retrieveApiKeysWithHttpInfo(String authentication, String cursor, Integer limit) throws RestClientException { Object postBody = null; String path = apiClient.expandPath("/api_keys", Collections.emptyMap()); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "cursor", cursor)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "limit", limit)); if (authentication != null) headerParams.add("Authentication", apiClient.parameterToString(authentication)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "BearerAuth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); } /** * Revoke an API Key * *

204 - API Key Revoked *

400 - Bad request *

403 - Insufficient Permission *

404 - Not Found *

500 - Internal Server Error * @param id ID of an API Key (required) * @param authentication The Authentication Header (optional) * @throws RestClientException if an error occurs while attempting to invoke the API */ public void revokeApiKey(UUID id, String authentication) throws RestClientException { revokeApiKeyWithHttpInfo(id, authentication); } /** * Revoke an API Key * *

204 - API Key Revoked *

400 - Bad request *

403 - Insufficient Permission *

404 - Not Found *

500 - Internal Server Error * @param id ID of an API Key (required) * @param authentication The Authentication Header (optional) * @return ResponseEntity<Void> * @throws RestClientException if an error occurs while attempting to invoke the API */ public ResponseEntity revokeApiKeyWithHttpInfo(UUID id, String authentication) throws RestClientException { Object postBody = null; // verify the required parameter 'id' is set if (id == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling revokeApiKey"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("id", id); String path = apiClient.expandPath("/api_keys/{id}/revoke", uriVariables); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap cookieParams = new LinkedMultiValueMap(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (authentication != null) headerParams.add("Authentication", apiClient.parameterToString(authentication)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "BearerAuth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy