Skip to content

Commit

Permalink
BC-6453 - Add authorization service client module (#5050)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergatco authored Jun 13, 2024
1 parent 8d91f5f commit 28a998e
Show file tree
Hide file tree
Showing 29 changed files with 1,396 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

# ignore some general files
.gitignore
.npmignore
git_push.sh

# ignore all files in the "models" folder
models/*

# list of allowed files in the "models" folder
!models/action.ts
!models/authorization-body-params.ts
!models/authorization-context-params.ts
!models/authorized-reponse.ts
!models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
api.ts
api/authorization-api.ts
base.ts
common.ts
configuration.ts
index.ts
models/action.ts
models/authorization-body-params.ts
models/authorization-context-params.ts
models/authorized-reponse.ts
models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
/**
* Schulcloud-Verbund-Software Server API
* This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
*
* The version of the OpenAPI document: 3.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/authorization-api';

Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/* tslint:disable */
/* eslint-disable */
/**
* Schulcloud-Verbund-Software Server API
* This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
*
* The version of the OpenAPI document: 3.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 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 } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { ApiValidationError } from '../models';
// @ts-ignore
import type { AuthorizationBodyParams } from '../models';
// @ts-ignore
import type { AuthorizedReponse } from '../models';
/**
* AuthorizationApi - axios parameter creator
* @export
*/
export const AuthorizationApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Checks if user is authorized to perform the given operation.
* @param {AuthorizationBodyParams} authorizationBodyParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
authorizationReferenceControllerAuthorizeByReference: async (authorizationBodyParams: AuthorizationBodyParams, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'authorizationBodyParams' is not null or undefined
assertParamExists('authorizationReferenceControllerAuthorizeByReference', 'authorizationBodyParams', authorizationBodyParams)
const localVarPath = `/authorization/by-reference`;
// 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
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)



localVarHeaderParameter['Content-Type'] = 'application/json';

setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(authorizationBodyParams, localVarRequestOptions, configuration)

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* AuthorizationApi - functional programming interface
* @export
*/
export const AuthorizationApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = AuthorizationApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Checks if user is authorized to perform the given operation.
* @param {AuthorizationBodyParams} authorizationBodyParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams: AuthorizationBodyParams, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AuthorizedReponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['AuthorizationApi.authorizationReferenceControllerAuthorizeByReference']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};

/**
* AuthorizationApi - factory interface
* @export
*/
export const AuthorizationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = AuthorizationApiFp(configuration)
return {
/**
*
* @summary Checks if user is authorized to perform the given operation.
* @param {AuthorizationBodyParams} authorizationBodyParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams: AuthorizationBodyParams, options?: any): AxiosPromise<AuthorizedReponse> {
return localVarFp.authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams, options).then((request) => request(axios, basePath));
},
};
};

/**
* AuthorizationApi - interface
* @export
* @interface AuthorizationApi
*/
export interface AuthorizationApiInterface {
/**
*
* @summary Checks if user is authorized to perform the given operation.
* @param {AuthorizationBodyParams} authorizationBodyParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthorizationApiInterface
*/
authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams: AuthorizationBodyParams, options?: RawAxiosRequestConfig): AxiosPromise<AuthorizedReponse>;

}

/**
* AuthorizationApi - object-oriented interface
* @export
* @class AuthorizationApi
* @extends {BaseAPI}
*/
export class AuthorizationApi extends BaseAPI implements AuthorizationApiInterface {
/**
*
* @summary Checks if user is authorized to perform the given operation.
* @param {AuthorizationBodyParams} authorizationBodyParams
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthorizationApi
*/
public authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams: AuthorizationBodyParams, options?: RawAxiosRequestConfig) {
return AuthorizationApiFp(this.configuration).authorizationReferenceControllerAuthorizeByReference(authorizationBodyParams, options).then((request) => request(this.axios, this.basePath));
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Schulcloud-Verbund-Software Server API
* This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1.
*
* The version of the OpenAPI document: 3.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 type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';

export const BASE_PATH = "http://localhost:3030/api/v3".replace(/\/+$/, "");

/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};

/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: RawAxiosRequestConfig;
}

/**
*
* @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 ?? basePath;
}
}
};

/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}

interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}

/**
*
* @export
*/
export const operationServerMap: ServerMap = {
}
Loading

0 comments on commit 28a998e

Please sign in to comment.