1 |
3e6b15a7
|
Lukáš Vlček
|
/* tslint:disable */
|
2 |
|
|
/* eslint-disable */
|
3 |
|
|
/**
|
4 |
|
|
* AnnotationTool
|
5 |
|
|
* KIV/ASWI ZČU Plzeň, 2022
|
6 |
|
|
*
|
7 |
|
|
* The version of the OpenAPI document: 0.1.1
|
8 |
|
|
*
|
9 |
|
|
*
|
10 |
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
11 |
|
|
* https://openapi-generator.tech
|
12 |
|
|
* Do not edit the class manually.
|
13 |
|
|
*/
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
import { Configuration } from "./configuration";
|
17 |
|
|
import { RequiredError, RequestArgs } from "./base";
|
18 |
|
|
import { AxiosInstance, AxiosResponse } from 'axios';
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
*
|
22 |
|
|
* @export
|
23 |
|
|
*/
|
24 |
|
|
export const DUMMY_BASE_URL = 'https://example.com'
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
*
|
28 |
|
|
* @throws {RequiredError}
|
29 |
|
|
* @export
|
30 |
|
|
*/
|
31 |
|
|
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
32 |
|
|
if (paramValue === null || paramValue === undefined) {
|
33 |
|
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
34 |
|
|
}
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
/**
|
38 |
|
|
*
|
39 |
|
|
* @export
|
40 |
|
|
*/
|
41 |
|
|
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
42 |
|
|
if (configuration && configuration.apiKey) {
|
43 |
|
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
44 |
|
|
? await configuration.apiKey(keyParamName)
|
45 |
|
|
: await configuration.apiKey;
|
46 |
|
|
object[keyParamName] = localVarApiKeyValue;
|
47 |
|
|
}
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
/**
|
51 |
|
|
*
|
52 |
|
|
* @export
|
53 |
|
|
*/
|
54 |
|
|
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
55 |
|
|
if (configuration && (configuration.username || configuration.password)) {
|
56 |
|
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
57 |
|
|
}
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
/**
|
61 |
|
|
*
|
62 |
|
|
* @export
|
63 |
|
|
*/
|
64 |
|
|
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
65 |
|
|
if (configuration && configuration.accessToken) {
|
66 |
|
|
const accessToken = typeof configuration.accessToken === 'function'
|
67 |
|
|
? await configuration.accessToken()
|
68 |
|
|
: await configuration.accessToken;
|
69 |
|
|
object["Authorization"] = "Bearer " + accessToken;
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
/**
|
74 |
|
|
*
|
75 |
|
|
* @export
|
76 |
|
|
*/
|
77 |
|
|
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
78 |
|
|
if (configuration && configuration.accessToken) {
|
79 |
|
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
80 |
|
|
? await configuration.accessToken(name, scopes)
|
81 |
|
|
: await configuration.accessToken;
|
82 |
|
|
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
83 |
|
|
}
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
/**
|
87 |
|
|
*
|
88 |
|
|
* @export
|
89 |
|
|
*/
|
90 |
|
|
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
91 |
|
|
const searchParams = new URLSearchParams(url.search);
|
92 |
|
|
for (const object of objects) {
|
93 |
|
|
for (const key in object) {
|
94 |
|
|
if (Array.isArray(object[key])) {
|
95 |
|
|
searchParams.delete(key);
|
96 |
|
|
for (const item of object[key]) {
|
97 |
|
|
searchParams.append(key, item);
|
98 |
|
|
}
|
99 |
|
|
} else {
|
100 |
|
|
searchParams.set(key, object[key]);
|
101 |
|
|
}
|
102 |
|
|
}
|
103 |
|
|
}
|
104 |
|
|
url.search = searchParams.toString();
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
/**
|
108 |
|
|
*
|
109 |
|
|
* @export
|
110 |
|
|
*/
|
111 |
|
|
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
112 |
|
|
const nonString = typeof value !== 'string';
|
113 |
|
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
114 |
|
|
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
115 |
|
|
: nonString;
|
116 |
|
|
return needsSerialization
|
117 |
|
|
? JSON.stringify(value !== undefined ? value : {})
|
118 |
|
|
: (value || "");
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
/**
|
122 |
|
|
*
|
123 |
|
|
* @export
|
124 |
|
|
*/
|
125 |
|
|
export const toPathString = function (url: URL) {
|
126 |
|
|
return url.pathname + url.search + url.hash
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
/**
|
130 |
|
|
*
|
131 |
|
|
* @export
|
132 |
|
|
*/
|
133 |
|
|
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
134 |
|
|
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
135 |
|
|
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
136 |
|
|
return axios.request<T, R>(axiosRequestArgs);
|
137 |
|
|
};
|
138 |
|
|
}
|