/* tslint:disable */ /* eslint-disable */ /** * EMIL AuthService * The EMIL AuthService API description * * The version of the OpenAPI document: 1.0 * Contact: kontakt@emil.de * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { ListWorkspacesResponseClass } from '../models'; // @ts-ignore import { SwitchWorkspaceRequestWithoutRefreshTokenDto } from '../models'; // @ts-ignore import { SwitchWorkspaceResponseClass } from '../models'; // URLSearchParams not necessarily used // @ts-ignore import { URL, URLSearchParams } from 'url'; const FormData = require('form-data'); /** * WorkspacesApi - axios parameter creator * @export */ export const WorkspacesApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Returns a list of workspaces you have access to. Note that this endpoint does not support sorting or pagination. * @summary List workspaces * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listWorkspaces: async (authorization?: string, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/authservice/v1/workspaces`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; let baseAccessToken; if (configuration) { baseOptions = configuration.baseOptions; baseAccessToken = configuration.accessToken; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearer required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) { localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Switch to a different workspace and get new access and refresh tokens. * @summary Switch workspace * @param {SwitchWorkspaceRequestWithoutRefreshTokenDto} switchWorkspaceRequestWithoutRefreshTokenDto * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {string} [cookie] HTTP only cookie that was sent during login * @param {*} [options] Override http request option. * @throws {RequiredError} */ switchWorkspace: async (switchWorkspaceRequestWithoutRefreshTokenDto: SwitchWorkspaceRequestWithoutRefreshTokenDto, authorization?: string, cookie?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'switchWorkspaceRequestWithoutRefreshTokenDto' is not null or undefined assertParamExists('switchWorkspace', 'switchWorkspaceRequestWithoutRefreshTokenDto', switchWorkspaceRequestWithoutRefreshTokenDto) const localVarPath = `/authservice/v1/workspaces/switch`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; let baseAccessToken; if (configuration) { baseOptions = configuration.baseOptions; baseAccessToken = configuration.accessToken; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearer required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) { localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken); } if (cookie !== undefined && cookie !== null || baseAccessToken !== undefined && baseAccessToken !== null) { localVarHeaderParameter['Cookie'] = String(cookie ? cookie : baseAccessToken); } localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(switchWorkspaceRequestWithoutRefreshTokenDto, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * WorkspacesApi - functional programming interface * @export */ export const WorkspacesApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = WorkspacesApiAxiosParamCreator(configuration) return { /** * Returns a list of workspaces you have access to. Note that this endpoint does not support sorting or pagination. * @summary List workspaces * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listWorkspaces(authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listWorkspaces(authorization, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * Switch to a different workspace and get new access and refresh tokens. * @summary Switch workspace * @param {SwitchWorkspaceRequestWithoutRefreshTokenDto} switchWorkspaceRequestWithoutRefreshTokenDto * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {string} [cookie] HTTP only cookie that was sent during login * @param {*} [options] Override http request option. * @throws {RequiredError} */ async switchWorkspace(switchWorkspaceRequestWithoutRefreshTokenDto: SwitchWorkspaceRequestWithoutRefreshTokenDto, authorization?: string, cookie?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.switchWorkspace(switchWorkspaceRequestWithoutRefreshTokenDto, authorization, cookie, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * WorkspacesApi - factory interface * @export */ export const WorkspacesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = WorkspacesApiFp(configuration) return { /** * Returns a list of workspaces you have access to. Note that this endpoint does not support sorting or pagination. * @summary List workspaces * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listWorkspaces(authorization?: string, options?: any): AxiosPromise { return localVarFp.listWorkspaces(authorization, options).then((request) => request(axios, basePath)); }, /** * Switch to a different workspace and get new access and refresh tokens. * @summary Switch workspace * @param {SwitchWorkspaceRequestWithoutRefreshTokenDto} switchWorkspaceRequestWithoutRefreshTokenDto * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken. * @param {string} [cookie] HTTP only cookie that was sent during login * @param {*} [options] Override http request option. * @throws {RequiredError} */ switchWorkspace(switchWorkspaceRequestWithoutRefreshTokenDto: SwitchWorkspaceRequestWithoutRefreshTokenDto, authorization?: string, cookie?: string, options?: any): AxiosPromise { return localVarFp.switchWorkspace(switchWorkspaceRequestWithoutRefreshTokenDto, authorization, cookie, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for listWorkspaces operation in WorkspacesApi. * @export * @interface WorkspacesApiListWorkspacesRequest */ export interface WorkspacesApiListWorkspacesRequest { /** * Bearer Token: provided by the login endpoint under the name accessToken. * @type {string} * @memberof WorkspacesApiListWorkspaces */ readonly authorization?: string } /** * Request parameters for switchWorkspace operation in WorkspacesApi. * @export * @interface WorkspacesApiSwitchWorkspaceRequest */ export interface WorkspacesApiSwitchWorkspaceRequest { /** * * @type {SwitchWorkspaceRequestWithoutRefreshTokenDto} * @memberof WorkspacesApiSwitchWorkspace */ readonly switchWorkspaceRequestWithoutRefreshTokenDto: SwitchWorkspaceRequestWithoutRefreshTokenDto /** * Bearer Token: provided by the login endpoint under the name accessToken. * @type {string} * @memberof WorkspacesApiSwitchWorkspace */ readonly authorization?: string /** * HTTP only cookie that was sent during login * @type {string} * @memberof WorkspacesApiSwitchWorkspace */ readonly cookie?: string } /** * WorkspacesApi - object-oriented interface * @export * @class WorkspacesApi * @extends {BaseAPI} */ export class WorkspacesApi extends BaseAPI { /** * Returns a list of workspaces you have access to. Note that this endpoint does not support sorting or pagination. * @summary List workspaces * @param {WorkspacesApiListWorkspacesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WorkspacesApi */ public listWorkspaces(requestParameters: WorkspacesApiListWorkspacesRequest = {}, options?: AxiosRequestConfig) { return WorkspacesApiFp(this.configuration).listWorkspaces(requestParameters.authorization, options).then((request) => request(this.axios, this.basePath)); } /** * Switch to a different workspace and get new access and refresh tokens. * @summary Switch workspace * @param {WorkspacesApiSwitchWorkspaceRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WorkspacesApi */ public switchWorkspace(requestParameters: WorkspacesApiSwitchWorkspaceRequest, options?: AxiosRequestConfig) { return WorkspacesApiFp(this.configuration).switchWorkspace(requestParameters.switchWorkspaceRequestWithoutRefreshTokenDto, requestParameters.authorization, requestParameters.cookie, options).then((request) => request(this.axios, this.basePath)); } }