From 64fab12e7b7398ef013ef4d7d0683a48cfb3b5eb Mon Sep 17 00:00:00 2001 From: "L. Ellenbeck" <ellenbeck@itc.rwth-aachen.de> Date: Wed, 12 Jul 2023 16:47:00 +0200 Subject: [PATCH] New: Token API migration (coscine/issues#2440) --- src/Coscine.Api.Token/.gitignore | 4 - src/Coscine.Api.Token/.npmignore | 1 - .../.openapi-generator-ignore | 23 - .../.openapi-generator/FILES | 9 - .../.openapi-generator/VERSION | 1 - src/Coscine.Api.Token/api.ts | 519 ------------------ src/Coscine.Api.Token/base.ts | 71 --- src/Coscine.Api.Token/common.ts | 138 ----- src/Coscine.Api.Token/configuration.ts | 101 ---- src/Coscine.Api.Token/git_push.sh | 58 -- src/Coscine.Api.Token/index.ts | 18 - src/Coscine.Api/api.ts | 496 +++++++++++++++++ src/Coscine.Api/base.ts | 2 +- src/Coscine.Api/common.ts | 2 +- src/apis.ts | 4 +- 15 files changed, 500 insertions(+), 947 deletions(-) delete mode 100644 src/Coscine.Api.Token/.gitignore delete mode 100644 src/Coscine.Api.Token/.npmignore delete mode 100644 src/Coscine.Api.Token/.openapi-generator-ignore delete mode 100644 src/Coscine.Api.Token/.openapi-generator/FILES delete mode 100644 src/Coscine.Api.Token/.openapi-generator/VERSION delete mode 100644 src/Coscine.Api.Token/api.ts delete mode 100644 src/Coscine.Api.Token/base.ts delete mode 100644 src/Coscine.Api.Token/common.ts delete mode 100644 src/Coscine.Api.Token/configuration.ts delete mode 100644 src/Coscine.Api.Token/git_push.sh delete mode 100644 src/Coscine.Api.Token/index.ts diff --git a/src/Coscine.Api.Token/.gitignore b/src/Coscine.Api.Token/.gitignore deleted file mode 100644 index 149b576..0000000 --- a/src/Coscine.Api.Token/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/src/Coscine.Api.Token/.npmignore b/src/Coscine.Api.Token/.npmignore deleted file mode 100644 index 999d88d..0000000 --- a/src/Coscine.Api.Token/.npmignore +++ /dev/null @@ -1 +0,0 @@ -# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/src/Coscine.Api.Token/.openapi-generator-ignore b/src/Coscine.Api.Token/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/src/Coscine.Api.Token/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/Coscine.Api.Token/.openapi-generator/FILES b/src/Coscine.Api.Token/.openapi-generator/FILES deleted file mode 100644 index 16b445e..0000000 --- a/src/Coscine.Api.Token/.openapi-generator/FILES +++ /dev/null @@ -1,9 +0,0 @@ -.gitignore -.npmignore -.openapi-generator-ignore -api.ts -base.ts -common.ts -configuration.ts -git_push.sh -index.ts diff --git a/src/Coscine.Api.Token/.openapi-generator/VERSION b/src/Coscine.Api.Token/.openapi-generator/VERSION deleted file mode 100644 index 8044406..0000000 --- a/src/Coscine.Api.Token/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.2.1 \ No newline at end of file diff --git a/src/Coscine.Api.Token/api.ts b/src/Coscine.Api.Token/api.ts deleted file mode 100644 index 646f326..0000000 --- a/src/Coscine.Api.Token/api.ts +++ /dev/null @@ -1,519 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Coscine.Api.Token - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.2.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } 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 } from './common'; -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; - -/** - * Used to parse the json request for add token. - * @export - * @interface AddApiTokenParameter - */ -export interface AddApiTokenParameter { - /** - * Gets or sets the name of the token. - * @type {string} - * @memberof AddApiTokenParameter - */ - name?: string | null; - /** - * Gets or sets the expiration of the token. - * @type {number} - * @memberof AddApiTokenParameter - */ - expiration?: number | null; -} -/** - * - * @export - * @interface ApiTokenObject - */ -export interface ApiTokenObject { - /** - * - * @type {string} - * @memberof ApiTokenObject - */ - tokenId?: string; - /** - * - * @type {string} - * @memberof ApiTokenObject - */ - name?: string | null; - /** - * - * @type {string} - * @memberof ApiTokenObject - */ - created?: string; - /** - * - * @type {string} - * @memberof ApiTokenObject - */ - expires?: string; -} -/** - * - * @export - * @interface CreatedApiTokenObject - */ -export interface CreatedApiTokenObject { - /** - * - * @type {string} - * @memberof CreatedApiTokenObject - */ - tokenId?: string; - /** - * - * @type {string} - * @memberof CreatedApiTokenObject - */ - name?: string | null; - /** - * - * @type {string} - * @memberof CreatedApiTokenObject - */ - created?: string; - /** - * - * @type {string} - * @memberof CreatedApiTokenObject - */ - expires?: string; - /** - * Gets or sets the jwt token value of the token. - * @type {string} - * @memberof CreatedApiTokenObject - */ - token?: string | null; -} -/** - * Retuned upon creation of a new token. Contains the jwt token. - * @export - * @interface CreatedApiTokenObjectAllOf - */ -export interface CreatedApiTokenObjectAllOf { - /** - * Gets or sets the jwt token value of the token. - * @type {string} - * @memberof CreatedApiTokenObjectAllOf - */ - token?: string | null; -} -/** - * Contains the minimum and maximum token validity in days from today. - * @export - * @interface TokenValidityObject - */ -export interface TokenValidityObject { - /** - * Object holding the specified token minumum and maximum validity in days from today. - * @type {number} - * @memberof TokenValidityObject - */ - minDays?: number; - /** - * - * @type {number} - * @memberof TokenValidityObject - */ - maxDays?: number; -} - -/** - * TokenApi - axios parameter creator - * @export - */ -export const TokenApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Add a new token for the user. - * @param {AddApiTokenParameter} addApiTokenParameter Parsed from json - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenAddToken: async (addApiTokenParameter: AddApiTokenParameter, options: any = {}): Promise<RequestArgs> => { - // verify required parameter 'addApiTokenParameter' is not null or undefined - assertParamExists('tokenAddToken', 'addApiTokenParameter', addApiTokenParameter) - const localVarPath = `/Token`; - // 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: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication JWT token required - await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(addApiTokenParameter, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the specified token minumum and maximum validity in days. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetTokenValidityBounds: async (options: any = {}): Promise<RequestArgs> => { - const localVarPath = `/Token/getValidity`; - // 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: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication JWT token required - await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the specific token values. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetUserToken: async (tokenId: string, options: any = {}): Promise<RequestArgs> => { - // verify required parameter 'tokenId' is not null or undefined - assertParamExists('tokenGetUserToken', 'tokenId', tokenId) - const localVarPath = `/Token/{tokenId}` - .replace(`{${"tokenId"}}`, encodeURIComponent(String(tokenId))); - // 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: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication JWT token required - await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List all tokens of the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetUserTokens: async (options: any = {}): Promise<RequestArgs> => { - const localVarPath = `/Token`; - // 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: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication JWT token required - await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Revoke a specific token. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenRevokeToken: async (tokenId: string, options: any = {}): Promise<RequestArgs> => { - // verify required parameter 'tokenId' is not null or undefined - assertParamExists('tokenRevokeToken', 'tokenId', tokenId) - const localVarPath = `/Token/{tokenId}` - .replace(`{${"tokenId"}}`, encodeURIComponent(String(tokenId))); - // 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: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication JWT token required - await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * TokenApi - functional programming interface - * @export - */ -export const TokenApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = TokenApiAxiosParamCreator(configuration) - return { - /** - * - * @summary Add a new token for the user. - * @param {AddApiTokenParameter} addApiTokenParameter Parsed from json - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async tokenAddToken(addApiTokenParameter: AddApiTokenParameter, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreatedApiTokenObject>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.tokenAddToken(addApiTokenParameter, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Get the specified token minumum and maximum validity in days. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async tokenGetTokenValidityBounds(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TokenValidityObject>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.tokenGetTokenValidityBounds(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Get the specific token values. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async tokenGetUserToken(tokenId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiTokenObject>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.tokenGetUserToken(tokenId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary List all tokens of the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async tokenGetUserTokens(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ApiTokenObject>>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.tokenGetUserTokens(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - /** - * - * @summary Revoke a specific token. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async tokenRevokeToken(tokenId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.tokenRevokeToken(tokenId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, - } -}; - -/** - * TokenApi - factory interface - * @export - */ -export const TokenApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = TokenApiFp(configuration) - return { - /** - * - * @summary Add a new token for the user. - * @param {AddApiTokenParameter} addApiTokenParameter Parsed from json - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenAddToken(addApiTokenParameter: AddApiTokenParameter, options?: any): AxiosPromise<CreatedApiTokenObject> { - return localVarFp.tokenAddToken(addApiTokenParameter, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Get the specified token minumum and maximum validity in days. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetTokenValidityBounds(options?: any): AxiosPromise<TokenValidityObject> { - return localVarFp.tokenGetTokenValidityBounds(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Get the specific token values. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetUserToken(tokenId: string, options?: any): AxiosPromise<ApiTokenObject> { - return localVarFp.tokenGetUserToken(tokenId, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary List all tokens of the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenGetUserTokens(options?: any): AxiosPromise<Array<ApiTokenObject>> { - return localVarFp.tokenGetUserTokens(options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Revoke a specific token. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - tokenRevokeToken(tokenId: string, options?: any): AxiosPromise<any> { - return localVarFp.tokenRevokeToken(tokenId, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * TokenApi - object-oriented interface - * @export - * @class TokenApi - * @extends {BaseAPI} - */ -export class TokenApi extends BaseAPI { - /** - * - * @summary Add a new token for the user. - * @param {AddApiTokenParameter} addApiTokenParameter Parsed from json - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TokenApi - */ - public tokenAddToken(addApiTokenParameter: AddApiTokenParameter, options?: any) { - return TokenApiFp(this.configuration).tokenAddToken(addApiTokenParameter, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Get the specified token minumum and maximum validity in days. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TokenApi - */ - public tokenGetTokenValidityBounds(options?: any) { - return TokenApiFp(this.configuration).tokenGetTokenValidityBounds(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Get the specific token values. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TokenApi - */ - public tokenGetUserToken(tokenId: string, options?: any) { - return TokenApiFp(this.configuration).tokenGetUserToken(tokenId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary List all tokens of the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TokenApi - */ - public tokenGetUserTokens(options?: any) { - return TokenApiFp(this.configuration).tokenGetUserTokens(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Revoke a specific token. - * @param {string} tokenId User tokenId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TokenApi - */ - public tokenRevokeToken(tokenId: string, options?: any) { - return TokenApiFp(this.configuration).tokenRevokeToken(tokenId, options).then((request) => request(this.axios, this.basePath)); - } -} - - diff --git a/src/Coscine.Api.Token/base.ts b/src/Coscine.Api.Token/base.ts deleted file mode 100644 index f1053ff..0000000 --- a/src/Coscine.Api.Token/base.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Coscine.Api.Token - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.2.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { Configuration } from "./configuration"; -// Some imports not used depending on template conditions -// @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; - -export const BASE_PATH = "https://d-sp12.devlef.campus.rwth-aachen.de/coscine/api/Coscine.Api.Token".replace(/\/+$/, ""); - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -/** - * - * @export - * @interface RequestArgs - */ -export interface RequestArgs { - url: string; - options: any; -} - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPI { - protected configuration: Configuration | undefined; - - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } - } -}; - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} diff --git a/src/Coscine.Api.Token/common.ts b/src/Coscine.Api.Token/common.ts deleted file mode 100644 index 3b8fa06..0000000 --- a/src/Coscine.Api.Token/common.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Coscine.Api.Token - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.2.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; - -/** - * - * @export - */ -export const DUMMY_BASE_URL = 'https://example.com' - -/** - * - * @throws {RequiredError} - * @export - */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { - if (paramValue === null || paramValue === undefined) { - throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); - } -} - -/** - * - * @export - */ -export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey(keyParamName) - : await configuration.apiKey; - object[keyParamName] = localVarApiKeyValue; - } -} - -/** - * - * @export - */ -export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { - if (configuration && (configuration.username || configuration.password)) { - object["auth"] = { username: configuration.username, password: configuration.password }; - } -} - -/** - * - * @export - */ -export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - object["Authorization"] = "Bearer " + accessToken; - } -} - -/** - * - * @export - */ -export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken(name, scopes) - : await configuration.accessToken; - object["Authorization"] = "Bearer " + localVarAccessTokenValue; - } -} - -/** - * - * @export - */ -export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } - url.search = searchParams.toString(); -} - -/** - * - * @export - */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { - const nonString = typeof value !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(requestOptions.headers['Content-Type']) - : nonString; - return needsSerialization - ? JSON.stringify(value !== undefined ? value : {}) - : (value || ""); -} - -/** - * - * @export - */ -export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash -} - -/** - * - * @export - */ -export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); - }; -} diff --git a/src/Coscine.Api.Token/configuration.ts b/src/Coscine.Api.Token/configuration.ts deleted file mode 100644 index 419b969..0000000 --- a/src/Coscine.Api.Token/configuration.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Coscine.Api.Token - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.2.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface ConfigurationParameters { - apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); - username?: string; - password?: string; - accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>); - basePath?: string; - baseOptions?: any; - formDataCtor?: new () => any; -} - -export class Configuration { - /** - * parameter for apiKey security - * @param name security name - * @memberof Configuration - */ - apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - username?: string; - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - password?: string; - /** - * parameter for oauth2 security - * @param name security name - * @param scopes oauth2 scope - * @memberof Configuration - */ - accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>); - /** - * override base path - * - * @type {string} - * @memberof Configuration - */ - basePath?: string; - /** - * base options for axios calls - * - * @type {any} - * @memberof Configuration - */ - baseOptions?: any; - /** - * The FormData constructor that will be used to create multipart form data - * requests. You can inject this here so that execution environments that - * do not support the FormData class can still run the generated client. - * - * @type {new () => FormData} - */ - formDataCtor?: new () => any; - - constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.baseOptions = param.baseOptions; - this.formDataCtor = param.formDataCtor; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } -} diff --git a/src/Coscine.Api.Token/git_push.sh b/src/Coscine.Api.Token/git_push.sh deleted file mode 100644 index ced3be2..0000000 --- a/src/Coscine.Api.Token/git_push.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/src/Coscine.Api.Token/index.ts b/src/Coscine.Api.Token/index.ts deleted file mode 100644 index c335637..0000000 --- a/src/Coscine.Api.Token/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Coscine.Api.Token - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 2.2.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export * from "./api"; -export * from "./configuration"; - diff --git a/src/Coscine.Api/api.ts b/src/Coscine.Api/api.ts index 2738f96..34fcf1b 100644 --- a/src/Coscine.Api/api.ts +++ b/src/Coscine.Api/api.ts @@ -21,6 +21,124 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +/** + * + * @export + * @interface ApiTokenDto + */ +export interface ApiTokenDto { + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + id?: string; + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + name?: string | null; + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + created?: string; + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + expires?: string; + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + token?: string | null; + /** + * + * @type {string} + * @memberof ApiTokenDto + */ + ownerId?: string; +} +/** + * + * @export + * @interface ApiTokenDtoIEnumerablePagedResponse + */ +export interface ApiTokenDtoIEnumerablePagedResponse { + /** + * + * @type {Array<ApiTokenDto>} + * @memberof ApiTokenDtoIEnumerablePagedResponse + */ + data?: Array<ApiTokenDto> | null; + /** + * + * @type {number} + * @memberof ApiTokenDtoIEnumerablePagedResponse + */ + statusCode?: number | null; + /** + * + * @type {boolean} + * @memberof ApiTokenDtoIEnumerablePagedResponse + */ + isSuccess?: boolean; + /** + * + * @type {Pagination} + * @memberof ApiTokenDtoIEnumerablePagedResponse + */ + pagination?: Pagination; +} +/** + * + * @export + * @interface ApiTokenDtoResponse + */ +export interface ApiTokenDtoResponse { + /** + * + * @type {ApiTokenDto} + * @memberof ApiTokenDtoResponse + */ + data?: ApiTokenDto; + /** + * + * @type {number} + * @memberof ApiTokenDtoResponse + */ + statusCode?: number | null; + /** + * + * @type {boolean} + * @memberof ApiTokenDtoResponse + */ + isSuccess?: boolean; +} +/** + * + * @export + * @interface ApiTokenForCreationDto + */ +export interface ApiTokenForCreationDto { + /** + * + * @type {string} + * @memberof ApiTokenForCreationDto + */ + name: string; + /** + * + * @type {number} + * @memberof ApiTokenForCreationDto + */ + expiresInDays: number; +} /** * * @export @@ -8535,6 +8653,384 @@ export class UserApi extends BaseAPI { } +/** + * UserApiTokenApi - axios parameter creator + * @export + */ +export const UserApiTokenApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2UsersSelfTokensOptions: async (options: any = {}): Promise<RequestArgs> => { + const localVarPath = `/api/v2/users/self/tokens`; + // 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: 'OPTIONS', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {ApiTokenForCreationDto} [apiTokenForCreationDto] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createApiToken: async (apiTokenForCreationDto?: ApiTokenForCreationDto, options: any = {}): Promise<RequestArgs> => { + const localVarPath = `/api/v2/users/self/tokens`; + // 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 Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(apiTokenForCreationDto, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getApiToken: async (apiTokenId: string, options: any = {}): Promise<RequestArgs> => { + // verify required parameter 'apiTokenId' is not null or undefined + assertParamExists('getApiToken', 'apiTokenId', apiTokenId) + const localVarPath = `/api/v2/users/self/tokens/{apiTokenId}` + .replace(`{${"apiTokenId"}}`, encodeURIComponent(String(apiTokenId))); + // 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: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {number} [pageNumber] + * @param {number} [pageSize] + * @param {string} [orderBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getApiTokens: async (pageNumber?: number, pageSize?: number, orderBy?: string, options: any = {}): Promise<RequestArgs> => { + const localVarPath = `/api/v2/users/self/tokens`; + // 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: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + if (pageNumber !== undefined) { + localVarQueryParameter['PageNumber'] = pageNumber; + } + + if (pageSize !== undefined) { + localVarQueryParameter['PageSize'] = pageSize; + } + + if (orderBy !== undefined) { + localVarQueryParameter['OrderBy'] = orderBy; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokeToken: async (apiTokenId: string, options: any = {}): Promise<RequestArgs> => { + // verify required parameter 'apiTokenId' is not null or undefined + assertParamExists('revokeToken', 'apiTokenId', apiTokenId) + const localVarPath = `/api/v2/users/self/tokens/{apiTokenId}` + .replace(`{${"apiTokenId"}}`, encodeURIComponent(String(apiTokenId))); + // 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: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApiTokenApi - functional programming interface + * @export + */ +export const UserApiTokenApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiTokenApiAxiosParamCreator(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiV2UsersSelfTokensOptions(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiV2UsersSelfTokensOptions(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {ApiTokenForCreationDto} [apiTokenForCreationDto] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createApiToken(apiTokenForCreationDto?: ApiTokenForCreationDto, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProjectDtoResponse>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createApiToken(apiTokenForCreationDto, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getApiToken(apiTokenId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiTokenDtoResponse>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getApiToken(apiTokenId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {number} [pageNumber] + * @param {number} [pageSize] + * @param {string} [orderBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getApiTokens(pageNumber?: number, pageSize?: number, orderBy?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiTokenDtoIEnumerablePagedResponse>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getApiTokens(pageNumber, pageSize, orderBy, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async revokeToken(apiTokenId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.revokeToken(apiTokenId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * UserApiTokenApi - factory interface + * @export + */ +export const UserApiTokenApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiTokenApiFp(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiV2UsersSelfTokensOptions(options?: any): AxiosPromise<void> { + return localVarFp.apiV2UsersSelfTokensOptions(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {ApiTokenForCreationDto} [apiTokenForCreationDto] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createApiToken(apiTokenForCreationDto?: ApiTokenForCreationDto, options?: any): AxiosPromise<ProjectDtoResponse> { + return localVarFp.createApiToken(apiTokenForCreationDto, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getApiToken(apiTokenId: string, options?: any): AxiosPromise<ApiTokenDtoResponse> { + return localVarFp.getApiToken(apiTokenId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {number} [pageNumber] + * @param {number} [pageSize] + * @param {string} [orderBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getApiTokens(pageNumber?: number, pageSize?: number, orderBy?: string, options?: any): AxiosPromise<ApiTokenDtoIEnumerablePagedResponse> { + return localVarFp.getApiTokens(pageNumber, pageSize, orderBy, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokeToken(apiTokenId: string, options?: any): AxiosPromise<void> { + return localVarFp.revokeToken(apiTokenId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * UserApiTokenApi - object-oriented interface + * @export + * @class UserApiTokenApi + * @extends {BaseAPI} + */ +export class UserApiTokenApi extends BaseAPI { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiTokenApi + */ + public apiV2UsersSelfTokensOptions(options?: any) { + return UserApiTokenApiFp(this.configuration).apiV2UsersSelfTokensOptions(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {ApiTokenForCreationDto} [apiTokenForCreationDto] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiTokenApi + */ + public createApiToken(apiTokenForCreationDto?: ApiTokenForCreationDto, options?: any) { + return UserApiTokenApiFp(this.configuration).createApiToken(apiTokenForCreationDto, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiTokenApi + */ + public getApiToken(apiTokenId: string, options?: any) { + return UserApiTokenApiFp(this.configuration).getApiToken(apiTokenId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {number} [pageNumber] + * @param {number} [pageSize] + * @param {string} [orderBy] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiTokenApi + */ + public getApiTokens(pageNumber?: number, pageSize?: number, orderBy?: string, options?: any) { + return UserApiTokenApiFp(this.configuration).getApiTokens(pageNumber, pageSize, orderBy, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} apiTokenId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiTokenApi + */ + public revokeToken(apiTokenId: string, options?: any) { + return UserApiTokenApiFp(this.configuration).revokeToken(apiTokenId, options).then((request) => request(this.axios, this.basePath)); + } +} + + /** * VisibilityApi - axios parameter creator * @export diff --git a/src/Coscine.Api/base.ts b/src/Coscine.Api/base.ts index fca9e6b..2c35b8d 100644 --- a/src/Coscine.Api/base.ts +++ b/src/Coscine.Api/base.ts @@ -18,7 +18,7 @@ import { Configuration } from "./configuration"; // @ts-ignore import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; -export const BASE_PATH = "https://d-sp16.devlef.campus.rwth-aachen.de/coscine".replace(/\/+$/, ""); +export const BASE_PATH = "https://d-sp12.devlef.campus.rwth-aachen.de/coscine".replace(/\/+$/, ""); /** * diff --git a/src/Coscine.Api/common.ts b/src/Coscine.Api/common.ts index 4ae43f5..b84ee59 100644 --- a/src/Coscine.Api/common.ts +++ b/src/Coscine.Api/common.ts @@ -14,7 +14,7 @@ import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; +import { RequiredError, RequestArgs } from "./base"; import { AxiosInstance } from 'axios'; /** diff --git a/src/apis.ts b/src/apis.ts index afa3688..8f4f1fc 100644 --- a/src/apis.ts +++ b/src/apis.ts @@ -23,7 +23,7 @@ import { HomeApiFactory } from './Coscine.Api.STS/api'; import { MergeApiFactory } from './Coscine.Api.STS/api'; import { ORCiDApiFactory } from './Coscine.Api.STS/api'; import { ShibbolethApiFactory } from './Coscine.Api.STS/api'; -import { TokenApiFactory } from './Coscine.Api.Token/api'; +import { UserApiTokenApiFactory } from './Coscine.Api/api'; import { TreeApiFactory } from './Coscine.Api.Tree/api'; import { LanguageApiFactory } from './Coscine.Api/api'; import { ToSApiFactory } from './Coscine.Api/api'; @@ -81,7 +81,7 @@ function implementations(axios?: AxiosInstance) { SearchApi: SearchApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine/api/Coscine.Api.Search', axios), ShibbolethApi: ShibbolethApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine/api/Coscine.Api.STS', axios), TitleApi: TitleApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), - TokenApi: TokenApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine/api/Coscine.Api.Token', axios), + TokenApi: UserApiTokenApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine/api/Coscine.Api.Token', axios), ToSApi: ToSApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), TreeApi: TreeApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine/api/Coscine.Api.Tree', axios), UserApi: UserApiFactory(new Configuration({ 'accessToken': accessToken }), 'https://' + getHostName() + '/coscine', axios), -- GitLab