@teemill/schema 0.1.2
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/README.md +46 -0
- package/api.ts +347 -0
- package/base.ts +86 -0
- package/common.ts +150 -0
- package/configuration.ts +110 -0
- package/dist/api.d.ts +231 -0
- package/dist/api.js +216 -0
- package/dist/base.d.ts +66 -0
- package/dist/base.js +65 -0
- package/dist/common.d.ts +65 -0
- package/dist/common.js +161 -0
- package/dist/configuration.d.ts +91 -0
- package/dist/configuration.js +43 -0
- package/dist/esm/api.d.ts +231 -0
- package/dist/esm/api.js +209 -0
- package/dist/esm/base.d.ts +66 -0
- package/dist/esm/base.js +60 -0
- package/dist/esm/common.d.ts +65 -0
- package/dist/esm/common.js +149 -0
- package/dist/esm/configuration.d.ts +91 -0
- package/dist/esm/configuration.js +39 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +15 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -0
- package/git_push.sh +57 -0
- package/index.ts +18 -0
- package/package.json +33 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
## @teemill/schema@0.1.2
|
|
2
|
+
|
|
3
|
+
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
|
4
|
+
|
|
5
|
+
Environment
|
|
6
|
+
* Node.js
|
|
7
|
+
* Webpack
|
|
8
|
+
* Browserify
|
|
9
|
+
|
|
10
|
+
Language level
|
|
11
|
+
* ES5 - you must have a Promises/A+ library installed
|
|
12
|
+
* ES6
|
|
13
|
+
|
|
14
|
+
Module system
|
|
15
|
+
* CommonJS
|
|
16
|
+
* ES6 module system
|
|
17
|
+
|
|
18
|
+
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
|
|
19
|
+
|
|
20
|
+
### Building
|
|
21
|
+
|
|
22
|
+
To build and compile the typescript sources to javascript use:
|
|
23
|
+
```
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Publishing
|
|
29
|
+
|
|
30
|
+
First build the package then run `npm publish`
|
|
31
|
+
|
|
32
|
+
### Consuming
|
|
33
|
+
|
|
34
|
+
navigate to the folder of your consuming project and run one of the following commands.
|
|
35
|
+
|
|
36
|
+
_published:_
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
npm install @teemill/schema@0.1.2 --save
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
_unPublished (not recommended):_
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npm install PATH_TO_GENERATED_PACKAGE --save
|
|
46
|
+
```
|
package/api.ts
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Schema API
|
|
5
|
+
* View PodOS API Schemas Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.2
|
|
8
|
+
* Contact: hello@podos.io
|
|
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 type { Configuration } from './configuration';
|
|
17
|
+
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
18
|
+
import globalAxios from 'axios';
|
|
19
|
+
// Some imports not used depending on template conditions
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
|
|
22
|
+
import type { RequestArgs } from './base';
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @interface ApiError
|
|
30
|
+
*/
|
|
31
|
+
export interface ApiError {
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @memberof ApiError
|
|
36
|
+
*/
|
|
37
|
+
'code'?: string;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @memberof ApiError
|
|
42
|
+
*/
|
|
43
|
+
'message': string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @interface Schema
|
|
49
|
+
*/
|
|
50
|
+
export interface Schema {
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @memberof Schema
|
|
55
|
+
*/
|
|
56
|
+
'name': string;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @memberof Schema
|
|
61
|
+
*/
|
|
62
|
+
'description': string;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @memberof Schema
|
|
67
|
+
*/
|
|
68
|
+
'version': string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @type {Array<string>}
|
|
72
|
+
* @memberof Schema
|
|
73
|
+
*/
|
|
74
|
+
'paths': Array<string>;
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @type {object}
|
|
78
|
+
* @memberof Schema
|
|
79
|
+
*/
|
|
80
|
+
'schema'?: object;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @export
|
|
85
|
+
* @interface Schemas
|
|
86
|
+
*/
|
|
87
|
+
export interface Schemas {
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @type {Array<Schema>}
|
|
91
|
+
* @memberof Schemas
|
|
92
|
+
*/
|
|
93
|
+
'schemas': Array<Schema>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @export
|
|
98
|
+
* @interface ValidationError
|
|
99
|
+
*/
|
|
100
|
+
export interface ValidationError {
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @type {string}
|
|
104
|
+
* @memberof ValidationError
|
|
105
|
+
*/
|
|
106
|
+
'message': string;
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @type {{ [key: string]: Array<string>; }}
|
|
110
|
+
* @memberof ValidationError
|
|
111
|
+
*/
|
|
112
|
+
'errors': { [key: string]: Array<string>; };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* SchemasApi - axios parameter creator
|
|
117
|
+
* @export
|
|
118
|
+
*/
|
|
119
|
+
export const SchemasApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
120
|
+
return {
|
|
121
|
+
/**
|
|
122
|
+
* Get an API schema
|
|
123
|
+
* @summary Get schema
|
|
124
|
+
* @param {string} api API name
|
|
125
|
+
* @param {string} [project] Project unique identifier
|
|
126
|
+
* @param {*} [options] Override http request option.
|
|
127
|
+
* @throws {RequiredError}
|
|
128
|
+
*/
|
|
129
|
+
getSchema: async (api: string, project?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
130
|
+
// verify required parameter 'api' is not null or undefined
|
|
131
|
+
assertParamExists('getSchema', 'api', api)
|
|
132
|
+
const localVarPath = `/{api}`
|
|
133
|
+
.replace(`{${"api"}}`, encodeURIComponent(String(api)));
|
|
134
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
135
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
136
|
+
let baseOptions;
|
|
137
|
+
if (configuration) {
|
|
138
|
+
baseOptions = configuration.baseOptions;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
142
|
+
const localVarHeaderParameter = {} as any;
|
|
143
|
+
const localVarQueryParameter = {} as any;
|
|
144
|
+
|
|
145
|
+
// authentication session-oauth required
|
|
146
|
+
// oauth required
|
|
147
|
+
await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
|
|
148
|
+
|
|
149
|
+
// authentication api-key required
|
|
150
|
+
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
|
151
|
+
|
|
152
|
+
if (project !== undefined) {
|
|
153
|
+
localVarQueryParameter['project'] = project;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
159
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
160
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
url: toPathString(localVarUrlObj),
|
|
164
|
+
options: localVarRequestOptions,
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* List all available schemas
|
|
169
|
+
* @summary List schemas
|
|
170
|
+
* @param {string} [project] Project unique identifier
|
|
171
|
+
* @param {*} [options] Override http request option.
|
|
172
|
+
* @throws {RequiredError}
|
|
173
|
+
*/
|
|
174
|
+
listSchemas: async (project?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
175
|
+
const localVarPath = `/`;
|
|
176
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
177
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
178
|
+
let baseOptions;
|
|
179
|
+
if (configuration) {
|
|
180
|
+
baseOptions = configuration.baseOptions;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
|
184
|
+
const localVarHeaderParameter = {} as any;
|
|
185
|
+
const localVarQueryParameter = {} as any;
|
|
186
|
+
|
|
187
|
+
// authentication session-oauth required
|
|
188
|
+
// oauth required
|
|
189
|
+
await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
|
|
190
|
+
|
|
191
|
+
// authentication api-key required
|
|
192
|
+
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
|
193
|
+
|
|
194
|
+
if (project !== undefined) {
|
|
195
|
+
localVarQueryParameter['project'] = project;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
201
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
202
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
203
|
+
|
|
204
|
+
return {
|
|
205
|
+
url: toPathString(localVarUrlObj),
|
|
206
|
+
options: localVarRequestOptions,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* SchemasApi - functional programming interface
|
|
214
|
+
* @export
|
|
215
|
+
*/
|
|
216
|
+
export const SchemasApiFp = function(configuration?: Configuration) {
|
|
217
|
+
const localVarAxiosParamCreator = SchemasApiAxiosParamCreator(configuration)
|
|
218
|
+
return {
|
|
219
|
+
/**
|
|
220
|
+
* Get an API schema
|
|
221
|
+
* @summary Get schema
|
|
222
|
+
* @param {string} api API name
|
|
223
|
+
* @param {string} [project] Project unique identifier
|
|
224
|
+
* @param {*} [options] Override http request option.
|
|
225
|
+
* @throws {RequiredError}
|
|
226
|
+
*/
|
|
227
|
+
async getSchema(api: string, project?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Schemas>> {
|
|
228
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getSchema(api, project, options);
|
|
229
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
230
|
+
const localVarOperationServerBasePath = operationServerMap['SchemasApi.getSchema']?.[localVarOperationServerIndex]?.url;
|
|
231
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* List all available schemas
|
|
235
|
+
* @summary List schemas
|
|
236
|
+
* @param {string} [project] Project unique identifier
|
|
237
|
+
* @param {*} [options] Override http request option.
|
|
238
|
+
* @throws {RequiredError}
|
|
239
|
+
*/
|
|
240
|
+
async listSchemas(project?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Schema>> {
|
|
241
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.listSchemas(project, options);
|
|
242
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
243
|
+
const localVarOperationServerBasePath = operationServerMap['SchemasApi.listSchemas']?.[localVarOperationServerIndex]?.url;
|
|
244
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
245
|
+
},
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* SchemasApi - factory interface
|
|
251
|
+
* @export
|
|
252
|
+
*/
|
|
253
|
+
export const SchemasApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
254
|
+
const localVarFp = SchemasApiFp(configuration)
|
|
255
|
+
return {
|
|
256
|
+
/**
|
|
257
|
+
* Get an API schema
|
|
258
|
+
* @summary Get schema
|
|
259
|
+
* @param {SchemasApiGetSchemaRequest} requestParameters Request parameters.
|
|
260
|
+
* @param {*} [options] Override http request option.
|
|
261
|
+
* @throws {RequiredError}
|
|
262
|
+
*/
|
|
263
|
+
getSchema(requestParameters: SchemasApiGetSchemaRequest, options?: RawAxiosRequestConfig): AxiosPromise<Schemas> {
|
|
264
|
+
return localVarFp.getSchema(requestParameters.api, requestParameters.project, options).then((request) => request(axios, basePath));
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* List all available schemas
|
|
268
|
+
* @summary List schemas
|
|
269
|
+
* @param {SchemasApiListSchemasRequest} requestParameters Request parameters.
|
|
270
|
+
* @param {*} [options] Override http request option.
|
|
271
|
+
* @throws {RequiredError}
|
|
272
|
+
*/
|
|
273
|
+
listSchemas(requestParameters: SchemasApiListSchemasRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<Schema> {
|
|
274
|
+
return localVarFp.listSchemas(requestParameters.project, options).then((request) => request(axios, basePath));
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Request parameters for getSchema operation in SchemasApi.
|
|
281
|
+
* @export
|
|
282
|
+
* @interface SchemasApiGetSchemaRequest
|
|
283
|
+
*/
|
|
284
|
+
export interface SchemasApiGetSchemaRequest {
|
|
285
|
+
/**
|
|
286
|
+
* API name
|
|
287
|
+
* @type {string}
|
|
288
|
+
* @memberof SchemasApiGetSchema
|
|
289
|
+
*/
|
|
290
|
+
readonly api: string
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Project unique identifier
|
|
294
|
+
* @type {string}
|
|
295
|
+
* @memberof SchemasApiGetSchema
|
|
296
|
+
*/
|
|
297
|
+
readonly project?: string
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Request parameters for listSchemas operation in SchemasApi.
|
|
302
|
+
* @export
|
|
303
|
+
* @interface SchemasApiListSchemasRequest
|
|
304
|
+
*/
|
|
305
|
+
export interface SchemasApiListSchemasRequest {
|
|
306
|
+
/**
|
|
307
|
+
* Project unique identifier
|
|
308
|
+
* @type {string}
|
|
309
|
+
* @memberof SchemasApiListSchemas
|
|
310
|
+
*/
|
|
311
|
+
readonly project?: string
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* SchemasApi - object-oriented interface
|
|
316
|
+
* @export
|
|
317
|
+
* @class SchemasApi
|
|
318
|
+
* @extends {BaseAPI}
|
|
319
|
+
*/
|
|
320
|
+
export class SchemasApi extends BaseAPI {
|
|
321
|
+
/**
|
|
322
|
+
* Get an API schema
|
|
323
|
+
* @summary Get schema
|
|
324
|
+
* @param {SchemasApiGetSchemaRequest} requestParameters Request parameters.
|
|
325
|
+
* @param {*} [options] Override http request option.
|
|
326
|
+
* @throws {RequiredError}
|
|
327
|
+
* @memberof SchemasApi
|
|
328
|
+
*/
|
|
329
|
+
public getSchema(requestParameters: SchemasApiGetSchemaRequest, options?: RawAxiosRequestConfig) {
|
|
330
|
+
return SchemasApiFp(this.configuration).getSchema(requestParameters.api, requestParameters.project, options).then((request) => request(this.axios, this.basePath));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* List all available schemas
|
|
335
|
+
* @summary List schemas
|
|
336
|
+
* @param {SchemasApiListSchemasRequest} requestParameters Request parameters.
|
|
337
|
+
* @param {*} [options] Override http request option.
|
|
338
|
+
* @throws {RequiredError}
|
|
339
|
+
* @memberof SchemasApi
|
|
340
|
+
*/
|
|
341
|
+
public listSchemas(requestParameters: SchemasApiListSchemasRequest = {}, options?: RawAxiosRequestConfig) {
|
|
342
|
+
return SchemasApiFp(this.configuration).listSchemas(requestParameters.project, options).then((request) => request(this.axios, this.basePath));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
package/base.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Schema API
|
|
5
|
+
* View PodOS API Schemas Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.2
|
|
8
|
+
* Contact: hello@podos.io
|
|
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 type { Configuration } from './configuration';
|
|
17
|
+
// Some imports not used depending on template conditions
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
20
|
+
import globalAxios from 'axios';
|
|
21
|
+
|
|
22
|
+
export const BASE_PATH = "https://localhost:8080/v1/schema".replace(/\/+$/, "");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
*/
|
|
28
|
+
export const COLLECTION_FORMATS = {
|
|
29
|
+
csv: ",",
|
|
30
|
+
ssv: " ",
|
|
31
|
+
tsv: "\t",
|
|
32
|
+
pipes: "|",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @interface RequestArgs
|
|
39
|
+
*/
|
|
40
|
+
export interface RequestArgs {
|
|
41
|
+
url: string;
|
|
42
|
+
options: RawAxiosRequestConfig;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @class BaseAPI
|
|
49
|
+
*/
|
|
50
|
+
export class BaseAPI {
|
|
51
|
+
protected configuration: Configuration | undefined;
|
|
52
|
+
|
|
53
|
+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
54
|
+
if (configuration) {
|
|
55
|
+
this.configuration = configuration;
|
|
56
|
+
this.basePath = configuration.basePath ?? basePath;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
* @class RequiredError
|
|
65
|
+
* @extends {Error}
|
|
66
|
+
*/
|
|
67
|
+
export class RequiredError extends Error {
|
|
68
|
+
constructor(public field: string, msg?: string) {
|
|
69
|
+
super(msg);
|
|
70
|
+
this.name = "RequiredError"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ServerMap {
|
|
75
|
+
[key: string]: {
|
|
76
|
+
url: string,
|
|
77
|
+
description: string,
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @export
|
|
84
|
+
*/
|
|
85
|
+
export const operationServerMap: ServerMap = {
|
|
86
|
+
}
|
package/common.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Schema API
|
|
5
|
+
* View PodOS API Schemas Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.2
|
|
8
|
+
* Contact: hello@podos.io
|
|
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 type { Configuration } from "./configuration";
|
|
17
|
+
import type { RequestArgs } from "./base";
|
|
18
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
19
|
+
import { RequiredError } from "./base";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export const DUMMY_BASE_URL = 'https://example.com'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @throws {RequiredError}
|
|
30
|
+
* @export
|
|
31
|
+
*/
|
|
32
|
+
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
|
33
|
+
if (paramValue === null || paramValue === undefined) {
|
|
34
|
+
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
*/
|
|
42
|
+
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
|
43
|
+
if (configuration && configuration.apiKey) {
|
|
44
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
45
|
+
? await configuration.apiKey(keyParamName)
|
|
46
|
+
: await configuration.apiKey;
|
|
47
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
|
56
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
57
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
|
66
|
+
if (configuration && configuration.accessToken) {
|
|
67
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
68
|
+
? await configuration.accessToken()
|
|
69
|
+
: await configuration.accessToken;
|
|
70
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @export
|
|
77
|
+
*/
|
|
78
|
+
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
|
79
|
+
if (configuration && configuration.accessToken) {
|
|
80
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
81
|
+
? await configuration.accessToken(name, scopes)
|
|
82
|
+
: await configuration.accessToken;
|
|
83
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
|
88
|
+
if (parameter == null) return;
|
|
89
|
+
if (typeof parameter === "object") {
|
|
90
|
+
if (Array.isArray(parameter)) {
|
|
91
|
+
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key !== '' ? `${key}[]` : key));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
Object.keys(parameter).forEach(currentKey =>
|
|
95
|
+
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (urlSearchParams.has(key)) {
|
|
101
|
+
urlSearchParams.append(key, parameter);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
urlSearchParams.set(key, parameter);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @export
|
|
112
|
+
*/
|
|
113
|
+
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
|
114
|
+
const searchParams = new URLSearchParams(url.search);
|
|
115
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
116
|
+
url.search = decodeURIComponent(searchParams.toString());
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @export
|
|
122
|
+
*/
|
|
123
|
+
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
|
124
|
+
const nonString = typeof value !== 'string';
|
|
125
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
126
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
127
|
+
: nonString;
|
|
128
|
+
return needsSerialization
|
|
129
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
130
|
+
: (value || "");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @export
|
|
136
|
+
*/
|
|
137
|
+
export const toPathString = function (url: URL) {
|
|
138
|
+
return url.pathname + url.search + url.hash
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @export
|
|
144
|
+
*/
|
|
145
|
+
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
|
146
|
+
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
147
|
+
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
|
148
|
+
return axios.request<T, R>(axiosRequestArgs);
|
|
149
|
+
};
|
|
150
|
+
}
|