/* tslint:disable */ /* eslint-disable */ /** * apikey/rotation * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v2 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded, } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap, } from '../base'; // @ts-ignore import type { ApiKey } from '../models'; // @ts-ignore import type { ApiKeyRotationResult } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * APIKeysRotationApi - axios parameter creator */ export const APIKeysRotationApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Rotate API key * @param {string} secretkey Secret key used to authenticate to this endpoint in order to perform a rotate key operation. * @param {ApiKey} [apiKey] Represents the action of rotating an existing API key, by providing the API key to be rotated and the time to live (TTL) of the newly created API key. If a TTL is set in preferences, it will have priority over the one provided in the API. If no TTL is set in preferences and none is provided in the API, the generated key will have unlimited TTL by default. * @param {*} [options] Override http request option. * @throws {RequiredError} */ rotateKey: async ( secretkey: string, apiKey?: ApiKey, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'secretkey' is not null or undefined assertParamExists('rotateKey', 'secretkey', secretkey); const localVarPath = `/apikey/rotation`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options, }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json'; if (secretkey != null) { localVarHeaderParameter['secretkey'] = String(secretkey); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; localVarRequestOptions.data = serializeDataIfNeeded( apiKey, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * APIKeysRotationApi - functional programming interface */ export const APIKeysRotationApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = APIKeysRotationApiAxiosParamCreator(configuration); return { /** * * @summary Rotate API key * @param {string} secretkey Secret key used to authenticate to this endpoint in order to perform a rotate key operation. * @param {ApiKey} [apiKey] Represents the action of rotating an existing API key, by providing the API key to be rotated and the time to live (TTL) of the newly created API key. If a TTL is set in preferences, it will have priority over the one provided in the API. If no TTL is set in preferences and none is provided in the API, the generated key will have unlimited TTL by default. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async rotateKey( secretkey: string, apiKey?: ApiKey, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.rotateKey( secretkey, apiKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['APIKeysRotationApi.rotateKey']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * APIKeysRotationApi - factory interface */ export const APIKeysRotationApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = APIKeysRotationApiFp(configuration); return { /** * * @summary Rotate API key * @param {string} secretkey Secret key used to authenticate to this endpoint in order to perform a rotate key operation. * @param {ApiKey} [apiKey] Represents the action of rotating an existing API key, by providing the API key to be rotated and the time to live (TTL) of the newly created API key. If a TTL is set in preferences, it will have priority over the one provided in the API. If no TTL is set in preferences and none is provided in the API, the generated key will have unlimited TTL by default. * @param {*} [options] Override http request option. * @throws {RequiredError} */ rotateKey( secretkey: string, apiKey?: ApiKey, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .rotateKey(secretkey, apiKey, options) .then((request) => request(axios, basePath)); }, }; }; /** * APIKeysRotationApi - object-oriented interface */ export class APIKeysRotationApi extends BaseAPI { /** * * @summary Rotate API key * @param {string} secretkey Secret key used to authenticate to this endpoint in order to perform a rotate key operation. * @param {ApiKey} [apiKey] Represents the action of rotating an existing API key, by providing the API key to be rotated and the time to live (TTL) of the newly created API key. If a TTL is set in preferences, it will have priority over the one provided in the API. If no TTL is set in preferences and none is provided in the API, the generated key will have unlimited TTL by default. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public rotateKey( secretkey: string, apiKey?: ApiKey, options?: RawAxiosRequestConfig, ) { return APIKeysRotationApiFp(this.configuration) .rotateKey(secretkey, apiKey, options) .then((request) => request(this.axios, this.basePath)); } }