@fenixalliance/abs-api-client 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clients/authService/core/ApiError.js +20 -0
- package/clients/authService/core/ApiError.ts +25 -0
- package/clients/authService/core/ApiRequestOptions.js +2 -0
- package/clients/authService/core/ApiRequestOptions.ts +17 -0
- package/clients/authService/core/ApiResult.js +2 -0
- package/clients/authService/core/ApiResult.ts +11 -0
- package/clients/authService/core/CancelablePromise.js +104 -0
- package/clients/authService/core/CancelablePromise.ts +131 -0
- package/clients/authService/core/OpenAPI.js +14 -0
- package/clients/authService/core/OpenAPI.ts +32 -0
- package/clients/authService/core/request.js +294 -0
- package/clients/authService/core/request.ts +322 -0
- package/clients/authService/index.js +28 -0
- package/clients/authService/index.ts +48 -0
- package/clients/authService/models/AccessTokenResponse.js +2 -0
- package/clients/authService/models/AccessTokenResponse.ts +11 -0
- package/clients/authService/models/AccountHolderCreateDto.js +12 -0
- package/clients/authService/models/AccountHolderCreateDto.ts +41 -0
- package/clients/authService/models/AccountHolderCreateDtoEnvelope.js +2 -0
- package/clients/authService/models/AccountHolderCreateDtoEnvelope.ts +14 -0
- package/clients/authService/models/ApiAuthorizationResult.js +2 -0
- package/clients/authService/models/ApiAuthorizationResult.ts +17 -0
- package/clients/authService/models/ApiAuthorizationResultEnvelope.js +2 -0
- package/clients/authService/models/ApiAuthorizationResultEnvelope.ts +14 -0
- package/clients/authService/models/EnrollmentId.js +2 -0
- package/clients/authService/models/EnrollmentId.ts +5 -0
- package/clients/authService/models/ErrorEnvelope.js +2 -0
- package/clients/authService/models/ErrorEnvelope.ts +12 -0
- package/clients/authService/models/ForgotPasswordRequest.js +2 -0
- package/clients/authService/models/ForgotPasswordRequest.ts +8 -0
- package/clients/authService/models/HttpValidationProblemDetails.js +2 -0
- package/clients/authService/models/HttpValidationProblemDetails.ts +5 -0
- package/clients/authService/models/InfoRequest.js +2 -0
- package/clients/authService/models/InfoRequest.ts +10 -0
- package/clients/authService/models/InfoResponse.js +2 -0
- package/clients/authService/models/InfoResponse.ts +9 -0
- package/clients/authService/models/JsonWebKey.js +2 -0
- package/clients/authService/models/JsonWebKey.ts +13 -0
- package/clients/authService/models/JsonWebKeySet.js +2 -0
- package/clients/authService/models/JsonWebKeySet.ts +9 -0
- package/clients/authService/models/JsonWebKeySetEnvelope.js +2 -0
- package/clients/authService/models/JsonWebKeySetEnvelope.ts +14 -0
- package/clients/authService/models/JsonWebToken.js +2 -0
- package/clients/authService/models/JsonWebToken.ts +15 -0
- package/clients/authService/models/JsonWebTokenEnvelope.js +2 -0
- package/clients/authService/models/JsonWebTokenEnvelope.ts +14 -0
- package/clients/authService/models/JsonWebTokenHeader.js +2 -0
- package/clients/authService/models/JsonWebTokenHeader.ts +11 -0
- package/clients/authService/models/JsonWebTokenPayload.js +2 -0
- package/clients/authService/models/JsonWebTokenPayload.ts +17 -0
- package/clients/authService/models/LoginRequest.js +2 -0
- package/clients/authService/models/LoginRequest.ts +11 -0
- package/clients/authService/models/OAuthTokenRequest.js +2 -0
- package/clients/authService/models/OAuthTokenRequest.ts +12 -0
- package/clients/authService/models/OpenIdConfiguration.js +2 -0
- package/clients/authService/models/OpenIdConfiguration.ts +19 -0
- package/clients/authService/models/OpenIdConfigurationEnvelope.js +2 -0
- package/clients/authService/models/OpenIdConfigurationEnvelope.ts +14 -0
- package/clients/authService/models/RefreshRequest.js +2 -0
- package/clients/authService/models/RefreshRequest.ts +8 -0
- package/clients/authService/models/RegisterRequest.js +2 -0
- package/clients/authService/models/RegisterRequest.ts +9 -0
- package/clients/authService/models/ResendConfirmationEmailRequest.js +2 -0
- package/clients/authService/models/ResendConfirmationEmailRequest.ts +8 -0
- package/clients/authService/models/ResetPasswordRequest.js +2 -0
- package/clients/authService/models/ResetPasswordRequest.ts +10 -0
- package/clients/authService/models/SigninModel.js +2 -0
- package/clients/authService/models/SigninModel.ts +9 -0
- package/clients/authService/models/StringListEnvelope.js +2 -0
- package/clients/authService/models/StringListEnvelope.ts +13 -0
- package/clients/authService/models/TenantId.js +2 -0
- package/clients/authService/models/TenantId.ts +5 -0
- package/clients/authService/models/TwoFactorRequest.js +2 -0
- package/clients/authService/models/TwoFactorRequest.ts +12 -0
- package/clients/authService/models/TwoFactorResponse.js +2 -0
- package/clients/authService/models/TwoFactorResponse.ts +12 -0
- package/clients/authService/models/UserId.js +2 -0
- package/clients/authService/models/UserId.ts +5 -0
- package/clients/authService/services/ApplicationsService.js +112 -0
- package/clients/authService/services/ApplicationsService.ts +132 -0
- package/clients/authService/services/AuthService.js +246 -0
- package/clients/authService/services/AuthService.ts +293 -0
- package/clients/authService/services/CheckerService.js +22 -0
- package/clients/authService/services/CheckerService.ts +25 -0
- package/clients/authService/services/OAuthService.js +152 -0
- package/clients/authService/services/OAuthService.ts +183 -0
- package/clients/authService/services/ResourceService.js +22 -0
- package/clients/authService/services/ResourceService.ts +25 -0
- package/clients/authService/services/UserInfoService.js +36 -0
- package/clients/authService/services/UserInfoService.ts +41 -0
- package/clients/identityService/index.js +3 -1
- package/clients/identityService/index.ts +13 -0
- package/clients/identityService/models/AccessTokenResponse.js +2 -0
- package/clients/identityService/models/AccessTokenResponse.ts +11 -0
- package/clients/identityService/models/ForgotPasswordRequest.js +2 -0
- package/clients/identityService/models/ForgotPasswordRequest.ts +8 -0
- package/clients/identityService/models/HttpValidationProblemDetails.js +2 -0
- package/clients/identityService/models/HttpValidationProblemDetails.ts +5 -0
- package/clients/identityService/models/InfoRequest.js +2 -0
- package/clients/identityService/models/InfoRequest.ts +10 -0
- package/clients/identityService/models/InfoResponse.js +2 -0
- package/clients/identityService/models/InfoResponse.ts +9 -0
- package/clients/identityService/models/LoginRequest.js +2 -0
- package/clients/identityService/models/LoginRequest.ts +11 -0
- package/clients/identityService/models/RefreshRequest.js +2 -0
- package/clients/identityService/models/RefreshRequest.ts +8 -0
- package/clients/identityService/models/RegisterRequest.js +2 -0
- package/clients/identityService/models/RegisterRequest.ts +9 -0
- package/clients/identityService/models/ResendConfirmationEmailRequest.js +2 -0
- package/clients/identityService/models/ResendConfirmationEmailRequest.ts +8 -0
- package/clients/identityService/models/ResetPasswordRequest.js +2 -0
- package/clients/identityService/models/ResetPasswordRequest.ts +10 -0
- package/clients/identityService/models/TwoFactorRequest.js +2 -0
- package/clients/identityService/models/TwoFactorRequest.ts +12 -0
- package/clients/identityService/models/TwoFactorResponse.js +2 -0
- package/clients/identityService/models/TwoFactorResponse.ts +12 -0
- package/clients/identityService/services/FenixAllianceAbsModulesWebService.js +246 -0
- package/clients/identityService/services/FenixAllianceAbsModulesWebService.ts +293 -0
- package/package.json +1 -1
- package/schemas/authService/schema.s.js +6 -0
- package/schemas/authService/schema.s.ts +894 -0
- package/schemas/identityService/schema.s.ts +382 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
url;
|
|
6
|
+
status;
|
|
7
|
+
statusText;
|
|
8
|
+
body;
|
|
9
|
+
request;
|
|
10
|
+
constructor(request, response, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'ApiError';
|
|
13
|
+
this.url = response.url;
|
|
14
|
+
this.status = response.status;
|
|
15
|
+
this.statusText = response.statusText;
|
|
16
|
+
this.body = response.body;
|
|
17
|
+
this.request = request;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
6
|
+
import type { ApiResult } from './ApiResult';
|
|
7
|
+
|
|
8
|
+
export class ApiError extends Error {
|
|
9
|
+
public readonly url: string;
|
|
10
|
+
public readonly status: number;
|
|
11
|
+
public readonly statusText: string;
|
|
12
|
+
public readonly body: any;
|
|
13
|
+
public readonly request: ApiRequestOptions;
|
|
14
|
+
|
|
15
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
|
16
|
+
super(message);
|
|
17
|
+
|
|
18
|
+
this.name = 'ApiError';
|
|
19
|
+
this.url = response.url;
|
|
20
|
+
this.status = response.status;
|
|
21
|
+
this.statusText = response.statusText;
|
|
22
|
+
this.body = response.body;
|
|
23
|
+
this.request = request;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export type ApiRequestOptions = {
|
|
6
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly path?: Record<string, any>;
|
|
9
|
+
readonly cookies?: Record<string, any>;
|
|
10
|
+
readonly headers?: Record<string, any>;
|
|
11
|
+
readonly query?: Record<string, any>;
|
|
12
|
+
readonly formData?: Record<string, any>;
|
|
13
|
+
readonly body?: any;
|
|
14
|
+
readonly mediaType?: string;
|
|
15
|
+
readonly responseHeader?: string;
|
|
16
|
+
readonly errors?: Record<number, string>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export type ApiResult = {
|
|
6
|
+
readonly url: string;
|
|
7
|
+
readonly ok: boolean;
|
|
8
|
+
readonly status: number;
|
|
9
|
+
readonly statusText: string;
|
|
10
|
+
readonly body: any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancelablePromise = exports.CancelError = void 0;
|
|
4
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
class CancelError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'CancelError';
|
|
12
|
+
}
|
|
13
|
+
get isCancelled() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CancelError = CancelError;
|
|
18
|
+
class CancelablePromise {
|
|
19
|
+
#isResolved;
|
|
20
|
+
#isRejected;
|
|
21
|
+
#isCancelled;
|
|
22
|
+
#cancelHandlers;
|
|
23
|
+
#promise;
|
|
24
|
+
#resolve;
|
|
25
|
+
#reject;
|
|
26
|
+
constructor(executor) {
|
|
27
|
+
this.#isResolved = false;
|
|
28
|
+
this.#isRejected = false;
|
|
29
|
+
this.#isCancelled = false;
|
|
30
|
+
this.#cancelHandlers = [];
|
|
31
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
32
|
+
this.#resolve = resolve;
|
|
33
|
+
this.#reject = reject;
|
|
34
|
+
const onResolve = (value) => {
|
|
35
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.#isResolved = true;
|
|
39
|
+
if (this.#resolve)
|
|
40
|
+
this.#resolve(value);
|
|
41
|
+
};
|
|
42
|
+
const onReject = (reason) => {
|
|
43
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.#isRejected = true;
|
|
47
|
+
if (this.#reject)
|
|
48
|
+
this.#reject(reason);
|
|
49
|
+
};
|
|
50
|
+
const onCancel = (cancelHandler) => {
|
|
51
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
57
|
+
get: () => this.#isResolved,
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
60
|
+
get: () => this.#isRejected,
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
63
|
+
get: () => this.#isCancelled,
|
|
64
|
+
});
|
|
65
|
+
return executor(onResolve, onReject, onCancel);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
get [Symbol.toStringTag]() {
|
|
69
|
+
return "Cancellable Promise";
|
|
70
|
+
}
|
|
71
|
+
then(onFulfilled, onRejected) {
|
|
72
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
73
|
+
}
|
|
74
|
+
catch(onRejected) {
|
|
75
|
+
return this.#promise.catch(onRejected);
|
|
76
|
+
}
|
|
77
|
+
finally(onFinally) {
|
|
78
|
+
return this.#promise.finally(onFinally);
|
|
79
|
+
}
|
|
80
|
+
cancel() {
|
|
81
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.#isCancelled = true;
|
|
85
|
+
if (this.#cancelHandlers.length) {
|
|
86
|
+
try {
|
|
87
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
88
|
+
cancelHandler();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.warn('Cancellation threw an error', error);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.#cancelHandlers.length = 0;
|
|
97
|
+
if (this.#reject)
|
|
98
|
+
this.#reject(new CancelError('Request aborted'));
|
|
99
|
+
}
|
|
100
|
+
get isCancelled() {
|
|
101
|
+
return this.#isCancelled;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.CancelablePromise = CancelablePromise;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export class CancelError extends Error {
|
|
6
|
+
|
|
7
|
+
constructor(message: string) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'CancelError';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public get isCancelled(): boolean {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface OnCancel {
|
|
18
|
+
readonly isResolved: boolean;
|
|
19
|
+
readonly isRejected: boolean;
|
|
20
|
+
readonly isCancelled: boolean;
|
|
21
|
+
|
|
22
|
+
(cancelHandler: () => void): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class CancelablePromise<T> implements Promise<T> {
|
|
26
|
+
#isResolved: boolean;
|
|
27
|
+
#isRejected: boolean;
|
|
28
|
+
#isCancelled: boolean;
|
|
29
|
+
readonly #cancelHandlers: (() => void)[];
|
|
30
|
+
readonly #promise: Promise<T>;
|
|
31
|
+
#resolve?: (value: T | PromiseLike<T>) => void;
|
|
32
|
+
#reject?: (reason?: any) => void;
|
|
33
|
+
|
|
34
|
+
constructor(
|
|
35
|
+
executor: (
|
|
36
|
+
resolve: (value: T | PromiseLike<T>) => void,
|
|
37
|
+
reject: (reason?: any) => void,
|
|
38
|
+
onCancel: OnCancel
|
|
39
|
+
) => void
|
|
40
|
+
) {
|
|
41
|
+
this.#isResolved = false;
|
|
42
|
+
this.#isRejected = false;
|
|
43
|
+
this.#isCancelled = false;
|
|
44
|
+
this.#cancelHandlers = [];
|
|
45
|
+
this.#promise = new Promise<T>((resolve, reject) => {
|
|
46
|
+
this.#resolve = resolve;
|
|
47
|
+
this.#reject = reject;
|
|
48
|
+
|
|
49
|
+
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
50
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.#isResolved = true;
|
|
54
|
+
if (this.#resolve) this.#resolve(value);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const onReject = (reason?: any): void => {
|
|
58
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
this.#isRejected = true;
|
|
62
|
+
if (this.#reject) this.#reject(reason);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const onCancel = (cancelHandler: () => void): void => {
|
|
66
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
73
|
+
get: (): boolean => this.#isResolved,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
77
|
+
get: (): boolean => this.#isRejected,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
81
|
+
get: (): boolean => this.#isCancelled,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get [Symbol.toStringTag]() {
|
|
89
|
+
return "Cancellable Promise";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public then<TResult1 = T, TResult2 = never>(
|
|
93
|
+
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
94
|
+
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
|
95
|
+
): Promise<TResult1 | TResult2> {
|
|
96
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public catch<TResult = never>(
|
|
100
|
+
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
|
|
101
|
+
): Promise<T | TResult> {
|
|
102
|
+
return this.#promise.catch(onRejected);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
106
|
+
return this.#promise.finally(onFinally);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public cancel(): void {
|
|
110
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.#isCancelled = true;
|
|
114
|
+
if (this.#cancelHandlers.length) {
|
|
115
|
+
try {
|
|
116
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
117
|
+
cancelHandler();
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.warn('Cancellation threw an error', error);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.#cancelHandlers.length = 0;
|
|
125
|
+
if (this.#reject) this.#reject(new CancelError('Request aborted'));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public get isCancelled(): boolean {
|
|
129
|
+
return this.#isCancelled;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAPI = void 0;
|
|
4
|
+
exports.OpenAPI = {
|
|
5
|
+
BASE: '',
|
|
6
|
+
VERSION: '2.0.0.0',
|
|
7
|
+
WITH_CREDENTIALS: false,
|
|
8
|
+
CREDENTIALS: 'include',
|
|
9
|
+
TOKEN: undefined,
|
|
10
|
+
USERNAME: undefined,
|
|
11
|
+
PASSWORD: undefined,
|
|
12
|
+
HEADERS: undefined,
|
|
13
|
+
ENCODE_PATH: undefined,
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
6
|
+
|
|
7
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
8
|
+
type Headers = Record<string, string>;
|
|
9
|
+
|
|
10
|
+
export type OpenAPIConfig = {
|
|
11
|
+
BASE: string;
|
|
12
|
+
VERSION: string;
|
|
13
|
+
WITH_CREDENTIALS: boolean;
|
|
14
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
15
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
16
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
17
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
18
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
19
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const OpenAPI: OpenAPIConfig = {
|
|
23
|
+
BASE: '',
|
|
24
|
+
VERSION: '2.0.0.0',
|
|
25
|
+
WITH_CREDENTIALS: false,
|
|
26
|
+
CREDENTIALS: 'include',
|
|
27
|
+
TOKEN: undefined,
|
|
28
|
+
USERNAME: undefined,
|
|
29
|
+
PASSWORD: undefined,
|
|
30
|
+
HEADERS: undefined,
|
|
31
|
+
ENCODE_PATH: undefined,
|
|
32
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = exports.isDefined = void 0;
|
|
4
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const ApiError_1 = require("./ApiError");
|
|
9
|
+
const CancelablePromise_1 = require("./CancelablePromise");
|
|
10
|
+
const isDefined = (value) => {
|
|
11
|
+
return value !== undefined && value !== null;
|
|
12
|
+
};
|
|
13
|
+
exports.isDefined = isDefined;
|
|
14
|
+
const isString = (value) => {
|
|
15
|
+
return typeof value === 'string';
|
|
16
|
+
};
|
|
17
|
+
exports.isString = isString;
|
|
18
|
+
const isStringWithValue = (value) => {
|
|
19
|
+
return (0, exports.isString)(value) && value !== '';
|
|
20
|
+
};
|
|
21
|
+
exports.isStringWithValue = isStringWithValue;
|
|
22
|
+
const isBlob = (value) => {
|
|
23
|
+
return (typeof value === 'object' &&
|
|
24
|
+
typeof value.type === 'string' &&
|
|
25
|
+
typeof value.stream === 'function' &&
|
|
26
|
+
typeof value.arrayBuffer === 'function' &&
|
|
27
|
+
typeof value.constructor === 'function' &&
|
|
28
|
+
typeof value.constructor.name === 'string' &&
|
|
29
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
30
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
31
|
+
};
|
|
32
|
+
exports.isBlob = isBlob;
|
|
33
|
+
const isFormData = (value) => {
|
|
34
|
+
return value instanceof FormData;
|
|
35
|
+
};
|
|
36
|
+
exports.isFormData = isFormData;
|
|
37
|
+
const base64 = (str) => {
|
|
38
|
+
try {
|
|
39
|
+
return btoa(str);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return Buffer.from(str).toString('base64');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.base64 = base64;
|
|
47
|
+
const getQueryString = (params) => {
|
|
48
|
+
const qs = [];
|
|
49
|
+
const append = (key, value) => {
|
|
50
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
51
|
+
};
|
|
52
|
+
const process = (key, value) => {
|
|
53
|
+
if ((0, exports.isDefined)(value)) {
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
value.forEach(v => {
|
|
56
|
+
process(key, v);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (typeof value === 'object') {
|
|
60
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
61
|
+
process(`${key}[${k}]`, v);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
append(key, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
70
|
+
process(key, value);
|
|
71
|
+
});
|
|
72
|
+
if (qs.length > 0) {
|
|
73
|
+
return `?${qs.join('&')}`;
|
|
74
|
+
}
|
|
75
|
+
return '';
|
|
76
|
+
};
|
|
77
|
+
exports.getQueryString = getQueryString;
|
|
78
|
+
const getUrl = (config, options) => {
|
|
79
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
80
|
+
const path = options.url
|
|
81
|
+
.replace('{api-version}', config.VERSION)
|
|
82
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
83
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
84
|
+
return encoder(String(options.path[group]));
|
|
85
|
+
}
|
|
86
|
+
return substring;
|
|
87
|
+
});
|
|
88
|
+
const url = `${config.BASE}${path}`;
|
|
89
|
+
if (options.query) {
|
|
90
|
+
return `${url}${(0, exports.getQueryString)(options.query)}`;
|
|
91
|
+
}
|
|
92
|
+
return url;
|
|
93
|
+
};
|
|
94
|
+
const getFormData = (options) => {
|
|
95
|
+
if (options.formData) {
|
|
96
|
+
const formData = new FormData();
|
|
97
|
+
const process = (key, value) => {
|
|
98
|
+
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
99
|
+
formData.append(key, value);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
formData.append(key, JSON.stringify(value));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
Object.entries(options.formData)
|
|
106
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
107
|
+
.forEach(([key, value]) => {
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
value.forEach(v => process(key, v));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
process(key, value);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return formData;
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
};
|
|
119
|
+
exports.getFormData = getFormData;
|
|
120
|
+
const resolve = async (options, resolver) => {
|
|
121
|
+
if (typeof resolver === 'function') {
|
|
122
|
+
return resolver(options);
|
|
123
|
+
}
|
|
124
|
+
return resolver;
|
|
125
|
+
};
|
|
126
|
+
exports.resolve = resolve;
|
|
127
|
+
const getHeaders = async (config, options) => {
|
|
128
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
129
|
+
(0, exports.resolve)(options, config.TOKEN),
|
|
130
|
+
(0, exports.resolve)(options, config.USERNAME),
|
|
131
|
+
(0, exports.resolve)(options, config.PASSWORD),
|
|
132
|
+
(0, exports.resolve)(options, config.HEADERS),
|
|
133
|
+
]);
|
|
134
|
+
const headers = Object.entries({
|
|
135
|
+
Accept: 'application/json',
|
|
136
|
+
...additionalHeaders,
|
|
137
|
+
...options.headers,
|
|
138
|
+
})
|
|
139
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
140
|
+
.reduce((headers, [key, value]) => ({
|
|
141
|
+
...headers,
|
|
142
|
+
[key]: String(value),
|
|
143
|
+
}), {});
|
|
144
|
+
if ((0, exports.isStringWithValue)(token)) {
|
|
145
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
146
|
+
}
|
|
147
|
+
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
148
|
+
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
149
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
150
|
+
}
|
|
151
|
+
if (options.body) {
|
|
152
|
+
if (options.mediaType) {
|
|
153
|
+
headers['Content-Type'] = options.mediaType;
|
|
154
|
+
}
|
|
155
|
+
else if ((0, exports.isBlob)(options.body)) {
|
|
156
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
157
|
+
}
|
|
158
|
+
else if ((0, exports.isString)(options.body)) {
|
|
159
|
+
headers['Content-Type'] = 'text/plain';
|
|
160
|
+
}
|
|
161
|
+
else if (!(0, exports.isFormData)(options.body)) {
|
|
162
|
+
headers['Content-Type'] = 'application/json';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return new Headers(headers);
|
|
166
|
+
};
|
|
167
|
+
exports.getHeaders = getHeaders;
|
|
168
|
+
const getRequestBody = (options) => {
|
|
169
|
+
if (options.body !== undefined) {
|
|
170
|
+
if (options.mediaType?.includes('/json')) {
|
|
171
|
+
return JSON.stringify(options.body);
|
|
172
|
+
}
|
|
173
|
+
else if ((0, exports.isString)(options.body) || (0, exports.isBlob)(options.body) || (0, exports.isFormData)(options.body)) {
|
|
174
|
+
return options.body;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return JSON.stringify(options.body);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return undefined;
|
|
181
|
+
};
|
|
182
|
+
exports.getRequestBody = getRequestBody;
|
|
183
|
+
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
184
|
+
const controller = new AbortController();
|
|
185
|
+
const request = {
|
|
186
|
+
headers,
|
|
187
|
+
body: body ?? formData,
|
|
188
|
+
method: options.method,
|
|
189
|
+
signal: controller.signal,
|
|
190
|
+
};
|
|
191
|
+
if (config.WITH_CREDENTIALS) {
|
|
192
|
+
request.credentials = config.CREDENTIALS;
|
|
193
|
+
}
|
|
194
|
+
onCancel(() => controller.abort());
|
|
195
|
+
return await fetch(url, request);
|
|
196
|
+
};
|
|
197
|
+
exports.sendRequest = sendRequest;
|
|
198
|
+
const getResponseHeader = (response, responseHeader) => {
|
|
199
|
+
if (responseHeader) {
|
|
200
|
+
const content = response.headers.get(responseHeader);
|
|
201
|
+
if ((0, exports.isString)(content)) {
|
|
202
|
+
return content;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return undefined;
|
|
206
|
+
};
|
|
207
|
+
exports.getResponseHeader = getResponseHeader;
|
|
208
|
+
const getResponseBody = async (response) => {
|
|
209
|
+
if (response.status !== 204) {
|
|
210
|
+
try {
|
|
211
|
+
const contentType = response.headers.get('Content-Type');
|
|
212
|
+
if (contentType) {
|
|
213
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
214
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
215
|
+
if (isJSON) {
|
|
216
|
+
return await response.json();
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return await response.text();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error(error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
};
|
|
229
|
+
exports.getResponseBody = getResponseBody;
|
|
230
|
+
const catchErrorCodes = (options, result) => {
|
|
231
|
+
const errors = {
|
|
232
|
+
400: 'Bad Request',
|
|
233
|
+
401: 'Unauthorized',
|
|
234
|
+
403: 'Forbidden',
|
|
235
|
+
404: 'Not Found',
|
|
236
|
+
500: 'Internal Server Error',
|
|
237
|
+
502: 'Bad Gateway',
|
|
238
|
+
503: 'Service Unavailable',
|
|
239
|
+
...options.errors,
|
|
240
|
+
};
|
|
241
|
+
const error = errors[result.status];
|
|
242
|
+
if (error) {
|
|
243
|
+
throw new ApiError_1.ApiError(options, result, error);
|
|
244
|
+
}
|
|
245
|
+
if (!result.ok) {
|
|
246
|
+
const errorStatus = result.status ?? 'unknown';
|
|
247
|
+
const errorStatusText = result.statusText ?? 'unknown';
|
|
248
|
+
const errorBody = (() => {
|
|
249
|
+
try {
|
|
250
|
+
return JSON.stringify(result.body, null, 2);
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
})();
|
|
256
|
+
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
exports.catchErrorCodes = catchErrorCodes;
|
|
260
|
+
/**
|
|
261
|
+
* Request method
|
|
262
|
+
* @param config The OpenAPI configuration object
|
|
263
|
+
* @param options The request options from the service
|
|
264
|
+
* @returns CancelablePromise<T>
|
|
265
|
+
* @throws ApiError
|
|
266
|
+
*/
|
|
267
|
+
const request = (config, options) => {
|
|
268
|
+
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
269
|
+
try {
|
|
270
|
+
const url = getUrl(config, options);
|
|
271
|
+
const formData = (0, exports.getFormData)(options);
|
|
272
|
+
const body = (0, exports.getRequestBody)(options);
|
|
273
|
+
const headers = await (0, exports.getHeaders)(config, options);
|
|
274
|
+
if (!onCancel.isCancelled) {
|
|
275
|
+
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
276
|
+
const responseBody = await (0, exports.getResponseBody)(response);
|
|
277
|
+
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
278
|
+
const result = {
|
|
279
|
+
url,
|
|
280
|
+
ok: response.ok,
|
|
281
|
+
status: response.status,
|
|
282
|
+
statusText: response.statusText,
|
|
283
|
+
body: responseHeader ?? responseBody,
|
|
284
|
+
};
|
|
285
|
+
(0, exports.catchErrorCodes)(options, result);
|
|
286
|
+
resolve(result.body);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
reject(error);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
exports.request = request;
|