@teemill/projects 1.0.0 → 1.0.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.
Files changed (57) hide show
  1. package/.openapi-generator/FILES +13 -6
  2. package/README.md +3 -3
  3. package/dist/apis/IntegrationsApi.d.ts +58 -0
  4. package/dist/apis/IntegrationsApi.js +221 -0
  5. package/dist/apis/ProjectsApi.d.ts +77 -0
  6. package/dist/apis/ProjectsApi.js +304 -0
  7. package/dist/apis/index.d.ts +2 -0
  8. package/dist/apis/index.js +20 -0
  9. package/dist/index.d.ts +3 -13
  10. package/dist/index.js +5 -15
  11. package/dist/models/ApiError.d.ts +37 -0
  12. package/dist/models/ApiError.js +53 -0
  13. package/dist/models/Integration.d.ts +56 -0
  14. package/dist/models/Integration.js +62 -0
  15. package/dist/models/IntegrationInfo.d.ts +49 -0
  16. package/dist/models/IntegrationInfo.js +59 -0
  17. package/dist/models/IntegrationsResponse.d.ts +32 -0
  18. package/dist/models/IntegrationsResponse.js +51 -0
  19. package/dist/models/Project.d.ts +50 -0
  20. package/dist/models/Project.js +60 -0
  21. package/dist/models/ProjectLogo.d.ts +37 -0
  22. package/dist/models/ProjectLogo.js +52 -0
  23. package/dist/models/ProjectsResponse.d.ts +32 -0
  24. package/dist/models/ProjectsResponse.js +51 -0
  25. package/dist/models/index.d.ts +7 -0
  26. package/dist/models/index.js +25 -0
  27. package/dist/runtime.d.ts +182 -0
  28. package/dist/runtime.js +562 -0
  29. package/package.json +3 -15
  30. package/src/apis/IntegrationsApi.ts +149 -0
  31. package/src/apis/ProjectsApi.ts +200 -0
  32. package/src/apis/index.ts +4 -0
  33. package/src/index.ts +5 -0
  34. package/src/models/ApiError.ts +74 -0
  35. package/src/models/Integration.ts +107 -0
  36. package/src/models/IntegrationInfo.ts +93 -0
  37. package/src/models/IntegrationsResponse.ts +73 -0
  38. package/src/models/Project.ts +99 -0
  39. package/src/models/ProjectLogo.ts +73 -0
  40. package/src/models/ProjectsResponse.ts +73 -0
  41. package/src/models/index.ts +9 -0
  42. package/src/runtime.ts +431 -0
  43. package/tsconfig.json +2 -3
  44. package/api.ts +0 -462
  45. package/base.ts +0 -72
  46. package/common.ts +0 -150
  47. package/configuration.ts +0 -101
  48. package/dist/api.d.ts +0 -274
  49. package/dist/api.js +0 -489
  50. package/dist/base.d.ts +0 -54
  51. package/dist/base.js +0 -80
  52. package/dist/common.d.ts +0 -65
  53. package/dist/common.js +0 -252
  54. package/dist/configuration.d.ts +0 -83
  55. package/dist/configuration.js +0 -44
  56. package/git_push.sh +0 -57
  57. package/index.ts +0 -18
package/api.ts DELETED
@@ -1,462 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Projects API
5
- * Manage Teemill Projects For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
- *
7
- * The version of the OpenAPI document: 1.0.0
8
- * Contact: hello@teemill.com
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, AxiosRequestConfig } 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 } from './base';
25
-
26
- /**
27
- *
28
- * @export
29
- * @interface List200Response
30
- */
31
- export interface List200Response {
32
- /**
33
- *
34
- * @type {Array<Project>}
35
- * @memberof List200Response
36
- */
37
- 'projects': Array<Project>;
38
- }
39
- /**
40
- *
41
- * @export
42
- * @interface ModelError
43
- */
44
- export interface ModelError {
45
- /**
46
- *
47
- * @type {string}
48
- * @memberof ModelError
49
- */
50
- 'code'?: string;
51
- /**
52
- *
53
- * @type {string}
54
- * @memberof ModelError
55
- */
56
- 'message': string;
57
- }
58
- /**
59
- *
60
- * @export
61
- * @interface Project
62
- */
63
- export interface Project {
64
- /**
65
- *
66
- * @type {string}
67
- * @memberof Project
68
- */
69
- 'id': string;
70
- /**
71
- *
72
- * @type {string}
73
- * @memberof Project
74
- */
75
- 'name': string;
76
- /**
77
- *
78
- * @type {ProjectLogo}
79
- * @memberof Project
80
- */
81
- 'logo': ProjectLogo;
82
- }
83
- /**
84
- *
85
- * @export
86
- * @interface ProjectLogo
87
- */
88
- export interface ProjectLogo {
89
- /**
90
- *
91
- * @type {string}
92
- * @memberof ProjectLogo
93
- */
94
- 'url'?: string;
95
- /**
96
- *
97
- * @type {string}
98
- * @memberof ProjectLogo
99
- */
100
- 'backgroundColor'?: string;
101
- }
102
-
103
- /**
104
- * ProjectsApi - axios parameter creator
105
- * @export
106
- */
107
- export const ProjectsApiAxiosParamCreator = function (configuration?: Configuration) {
108
- return {
109
- /**
110
- * Delete a project
111
- * @summary Delete project
112
- * @param {string} projectId Projects unique identifier
113
- * @param {*} [options] Override http request option.
114
- * @throws {RequiredError}
115
- */
116
- _delete: async (projectId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
117
- // verify required parameter 'projectId' is not null or undefined
118
- assertParamExists('_delete', 'projectId', projectId)
119
- const localVarPath = `/dashboard/projects/{projectId}`
120
- .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId)));
121
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
122
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
123
- let baseOptions;
124
- if (configuration) {
125
- baseOptions = configuration.baseOptions;
126
- }
127
-
128
- const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
129
- const localVarHeaderParameter = {} as any;
130
- const localVarQueryParameter = {} as any;
131
-
132
-
133
-
134
- setSearchParams(localVarUrlObj, localVarQueryParameter);
135
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
136
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
137
-
138
- return {
139
- url: toPathString(localVarUrlObj),
140
- options: localVarRequestOptions,
141
- };
142
- },
143
- /**
144
- * Create a new projects
145
- * @summary Create project
146
- * @param {*} [options] Override http request option.
147
- * @throws {RequiredError}
148
- */
149
- create: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
150
- const localVarPath = `/dashboard/projects`;
151
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
152
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
153
- let baseOptions;
154
- if (configuration) {
155
- baseOptions = configuration.baseOptions;
156
- }
157
-
158
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
159
- const localVarHeaderParameter = {} as any;
160
- const localVarQueryParameter = {} as any;
161
-
162
-
163
-
164
- setSearchParams(localVarUrlObj, localVarQueryParameter);
165
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
166
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
167
-
168
- return {
169
- url: toPathString(localVarUrlObj),
170
- options: localVarRequestOptions,
171
- };
172
- },
173
- /**
174
- * Get a project
175
- * @summary Get project
176
- * @param {string} projectId Projects unique identifier
177
- * @param {*} [options] Override http request option.
178
- * @throws {RequiredError}
179
- */
180
- get: async (projectId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
181
- // verify required parameter 'projectId' is not null or undefined
182
- assertParamExists('get', 'projectId', projectId)
183
- const localVarPath = `/dashboard/projects/{projectId}`
184
- .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId)));
185
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
186
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
187
- let baseOptions;
188
- if (configuration) {
189
- baseOptions = configuration.baseOptions;
190
- }
191
-
192
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
193
- const localVarHeaderParameter = {} as any;
194
- const localVarQueryParameter = {} as any;
195
-
196
-
197
-
198
- setSearchParams(localVarUrlObj, localVarQueryParameter);
199
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
200
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
201
-
202
- return {
203
- url: toPathString(localVarUrlObj),
204
- options: localVarRequestOptions,
205
- };
206
- },
207
- /**
208
- * List all projects available
209
- * @summary List projects
210
- * @param {*} [options] Override http request option.
211
- * @throws {RequiredError}
212
- */
213
- list: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
214
- const localVarPath = `/dashboard/projects`;
215
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
216
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
217
- let baseOptions;
218
- if (configuration) {
219
- baseOptions = configuration.baseOptions;
220
- }
221
-
222
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
223
- const localVarHeaderParameter = {} as any;
224
- const localVarQueryParameter = {} as any;
225
-
226
-
227
-
228
- setSearchParams(localVarUrlObj, localVarQueryParameter);
229
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
230
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
231
-
232
- return {
233
- url: toPathString(localVarUrlObj),
234
- options: localVarRequestOptions,
235
- };
236
- },
237
- /**
238
- * Update a project
239
- * @summary Update project
240
- * @param {string} projectId Projects unique identifier
241
- * @param {*} [options] Override http request option.
242
- * @throws {RequiredError}
243
- */
244
- update: async (projectId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
245
- // verify required parameter 'projectId' is not null or undefined
246
- assertParamExists('update', 'projectId', projectId)
247
- const localVarPath = `/dashboard/projects/{projectId}`
248
- .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId)));
249
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
250
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
251
- let baseOptions;
252
- if (configuration) {
253
- baseOptions = configuration.baseOptions;
254
- }
255
-
256
- const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
257
- const localVarHeaderParameter = {} as any;
258
- const localVarQueryParameter = {} as any;
259
-
260
-
261
-
262
- setSearchParams(localVarUrlObj, localVarQueryParameter);
263
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
264
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
265
-
266
- return {
267
- url: toPathString(localVarUrlObj),
268
- options: localVarRequestOptions,
269
- };
270
- },
271
- }
272
- };
273
-
274
- /**
275
- * ProjectsApi - functional programming interface
276
- * @export
277
- */
278
- export const ProjectsApiFp = function(configuration?: Configuration) {
279
- const localVarAxiosParamCreator = ProjectsApiAxiosParamCreator(configuration)
280
- return {
281
- /**
282
- * Delete a project
283
- * @summary Delete project
284
- * @param {string} projectId Projects unique identifier
285
- * @param {*} [options] Override http request option.
286
- * @throws {RequiredError}
287
- */
288
- async _delete(projectId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Project>> {
289
- const localVarAxiosArgs = await localVarAxiosParamCreator._delete(projectId, options);
290
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
291
- },
292
- /**
293
- * Create a new projects
294
- * @summary Create project
295
- * @param {*} [options] Override http request option.
296
- * @throws {RequiredError}
297
- */
298
- async create(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Project>> {
299
- const localVarAxiosArgs = await localVarAxiosParamCreator.create(options);
300
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
301
- },
302
- /**
303
- * Get a project
304
- * @summary Get project
305
- * @param {string} projectId Projects unique identifier
306
- * @param {*} [options] Override http request option.
307
- * @throws {RequiredError}
308
- */
309
- async get(projectId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Project>> {
310
- const localVarAxiosArgs = await localVarAxiosParamCreator.get(projectId, options);
311
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
312
- },
313
- /**
314
- * List all projects available
315
- * @summary List projects
316
- * @param {*} [options] Override http request option.
317
- * @throws {RequiredError}
318
- */
319
- async list(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<List200Response>> {
320
- const localVarAxiosArgs = await localVarAxiosParamCreator.list(options);
321
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
322
- },
323
- /**
324
- * Update a project
325
- * @summary Update project
326
- * @param {string} projectId Projects unique identifier
327
- * @param {*} [options] Override http request option.
328
- * @throws {RequiredError}
329
- */
330
- async update(projectId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Project>> {
331
- const localVarAxiosArgs = await localVarAxiosParamCreator.update(projectId, options);
332
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
333
- },
334
- }
335
- };
336
-
337
- /**
338
- * ProjectsApi - factory interface
339
- * @export
340
- */
341
- export const ProjectsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
342
- const localVarFp = ProjectsApiFp(configuration)
343
- return {
344
- /**
345
- * Delete a project
346
- * @summary Delete project
347
- * @param {string} projectId Projects unique identifier
348
- * @param {*} [options] Override http request option.
349
- * @throws {RequiredError}
350
- */
351
- _delete(projectId: string, options?: any): AxiosPromise<Project> {
352
- return localVarFp._delete(projectId, options).then((request) => request(axios, basePath));
353
- },
354
- /**
355
- * Create a new projects
356
- * @summary Create project
357
- * @param {*} [options] Override http request option.
358
- * @throws {RequiredError}
359
- */
360
- create(options?: any): AxiosPromise<Project> {
361
- return localVarFp.create(options).then((request) => request(axios, basePath));
362
- },
363
- /**
364
- * Get a project
365
- * @summary Get project
366
- * @param {string} projectId Projects unique identifier
367
- * @param {*} [options] Override http request option.
368
- * @throws {RequiredError}
369
- */
370
- get(projectId: string, options?: any): AxiosPromise<Project> {
371
- return localVarFp.get(projectId, options).then((request) => request(axios, basePath));
372
- },
373
- /**
374
- * List all projects available
375
- * @summary List projects
376
- * @param {*} [options] Override http request option.
377
- * @throws {RequiredError}
378
- */
379
- list(options?: any): AxiosPromise<List200Response> {
380
- return localVarFp.list(options).then((request) => request(axios, basePath));
381
- },
382
- /**
383
- * Update a project
384
- * @summary Update project
385
- * @param {string} projectId Projects unique identifier
386
- * @param {*} [options] Override http request option.
387
- * @throws {RequiredError}
388
- */
389
- update(projectId: string, options?: any): AxiosPromise<Project> {
390
- return localVarFp.update(projectId, options).then((request) => request(axios, basePath));
391
- },
392
- };
393
- };
394
-
395
- /**
396
- * ProjectsApi - object-oriented interface
397
- * @export
398
- * @class ProjectsApi
399
- * @extends {BaseAPI}
400
- */
401
- export class ProjectsApi extends BaseAPI {
402
- /**
403
- * Delete a project
404
- * @summary Delete project
405
- * @param {string} projectId Projects unique identifier
406
- * @param {*} [options] Override http request option.
407
- * @throws {RequiredError}
408
- * @memberof ProjectsApi
409
- */
410
- public _delete(projectId: string, options?: AxiosRequestConfig) {
411
- return ProjectsApiFp(this.configuration)._delete(projectId, options).then((request) => request(this.axios, this.basePath));
412
- }
413
-
414
- /**
415
- * Create a new projects
416
- * @summary Create project
417
- * @param {*} [options] Override http request option.
418
- * @throws {RequiredError}
419
- * @memberof ProjectsApi
420
- */
421
- public create(options?: AxiosRequestConfig) {
422
- return ProjectsApiFp(this.configuration).create(options).then((request) => request(this.axios, this.basePath));
423
- }
424
-
425
- /**
426
- * Get a project
427
- * @summary Get project
428
- * @param {string} projectId Projects unique identifier
429
- * @param {*} [options] Override http request option.
430
- * @throws {RequiredError}
431
- * @memberof ProjectsApi
432
- */
433
- public get(projectId: string, options?: AxiosRequestConfig) {
434
- return ProjectsApiFp(this.configuration).get(projectId, options).then((request) => request(this.axios, this.basePath));
435
- }
436
-
437
- /**
438
- * List all projects available
439
- * @summary List projects
440
- * @param {*} [options] Override http request option.
441
- * @throws {RequiredError}
442
- * @memberof ProjectsApi
443
- */
444
- public list(options?: AxiosRequestConfig) {
445
- return ProjectsApiFp(this.configuration).list(options).then((request) => request(this.axios, this.basePath));
446
- }
447
-
448
- /**
449
- * Update a project
450
- * @summary Update project
451
- * @param {string} projectId Projects unique identifier
452
- * @param {*} [options] Override http request option.
453
- * @throws {RequiredError}
454
- * @memberof ProjectsApi
455
- */
456
- public update(projectId: string, options?: AxiosRequestConfig) {
457
- return ProjectsApiFp(this.configuration).update(projectId, options).then((request) => request(this.axios, this.basePath));
458
- }
459
- }
460
-
461
-
462
-
package/base.ts DELETED
@@ -1,72 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Projects API
5
- * Manage Teemill Projects For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
- *
7
- * The version of the OpenAPI document: 1.0.0
8
- * Contact: hello@teemill.com
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, AxiosRequestConfig } from 'axios';
20
- import globalAxios from 'axios';
21
-
22
- export const BASE_PATH = "https://localhost:8080/omnis/v3".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: AxiosRequestConfig;
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 || this.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
- }
package/common.ts DELETED
@@ -1,150 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Projects API
5
- * Manage Teemill Projects For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
- *
7
- * The version of the OpenAPI document: 1.0.0
8
- * Contact: hello@teemill.com
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));
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 = 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: (configuration?.basePath || axios.defaults.baseURL || basePath) + axiosArgs.url};
148
- return axios.request<T, R>(axiosRequestArgs);
149
- };
150
- }