@teemill/returns 0.1.0

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 ADDED
@@ -0,0 +1,84 @@
1
+ ## @teemill/returns@0.1.0
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/returns@0.1.0 --save
40
+ ```
41
+
42
+ _unPublished (not recommended):_
43
+
44
+ ```
45
+ npm install PATH_TO_GENERATED_PACKAGE --save
46
+ ```
47
+
48
+ ### Documentation for API Endpoints
49
+
50
+ All URIs are relative to *https://api.localhost:8080*
51
+
52
+ Class | Method | HTTP request | Description
53
+ ------------ | ------------- | ------------- | -------------
54
+ *ReturnsApi* | [**getReturnReason**](docs/ReturnsApi.md#getreturnreason) | **GET** /v1/returns/reasons/{id} | Get a return reason
55
+ *ReturnsApi* | [**listReturnReasons**](docs/ReturnsApi.md#listreturnreasons) | **GET** /v1/returns/reasons | List return reasons
56
+
57
+
58
+ ### Documentation For Models
59
+
60
+ - [ApiError](docs/ApiError.md)
61
+ - [ReturnReason](docs/ReturnReason.md)
62
+ - [ReturnReasons](docs/ReturnReasons.md)
63
+
64
+
65
+ <a id="documentation-for-authorization"></a>
66
+ ## Documentation For Authorization
67
+
68
+
69
+ Authentication schemes defined for the API:
70
+ <a id="api-key"></a>
71
+ ### api-key
72
+
73
+ - **Type**: API key
74
+ - **API key parameter name**: Authorization
75
+ - **Location**: HTTP header
76
+
77
+ <a id="session-oauth"></a>
78
+ ### session-oauth
79
+
80
+ - **Type**: OAuth
81
+ - **Flow**: password
82
+ - **Authorization URL**:
83
+ - **Scopes**: N/A
84
+
package/api.ts ADDED
@@ -0,0 +1,383 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Returns API
5
+ * Manage PodOS Returns
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
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 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 ReturnReason
49
+ */
50
+ export interface ReturnReason {
51
+ /**
52
+ * Unique object identifier
53
+ * @type {string}
54
+ * @memberof ReturnReason
55
+ */
56
+ 'id': string;
57
+ /**
58
+ * A reference to the resource location
59
+ * @type {string}
60
+ * @memberof ReturnReason
61
+ */
62
+ 'ref': string;
63
+ /**
64
+ *
65
+ * @type {string}
66
+ * @memberof ReturnReason
67
+ */
68
+ 'name': string;
69
+ /**
70
+ *
71
+ * @type {string}
72
+ * @memberof ReturnReason
73
+ */
74
+ 'code': string;
75
+ /**
76
+ *
77
+ * @type {string}
78
+ * @memberof ReturnReason
79
+ */
80
+ 'createdAt': string;
81
+ /**
82
+ *
83
+ * @type {string}
84
+ * @memberof ReturnReason
85
+ */
86
+ 'updatedAt': string;
87
+ }
88
+ /**
89
+ *
90
+ * @export
91
+ * @interface ReturnReasons
92
+ */
93
+ export interface ReturnReasons {
94
+ /**
95
+ *
96
+ * @type {Array<ReturnReason>}
97
+ * @memberof ReturnReasons
98
+ */
99
+ 'returnReasons': Array<ReturnReason>;
100
+ /**
101
+ *
102
+ * @type {number}
103
+ * @memberof ReturnReasons
104
+ */
105
+ 'nextPageToken': number;
106
+ }
107
+
108
+ /**
109
+ * ReturnsApi - axios parameter creator
110
+ * @export
111
+ */
112
+ export const ReturnsApiAxiosParamCreator = function (configuration?: Configuration) {
113
+ return {
114
+ /**
115
+ * Get a return reason
116
+ * @summary Get a return reason
117
+ * @param {string} project What project it is
118
+ * @param {string} id The ID of the return reason
119
+ * @param {*} [options] Override http request option.
120
+ * @throws {RequiredError}
121
+ */
122
+ getReturnReason: async (project: string, id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
123
+ // verify required parameter 'project' is not null or undefined
124
+ assertParamExists('getReturnReason', 'project', project)
125
+ // verify required parameter 'id' is not null or undefined
126
+ assertParamExists('getReturnReason', 'id', id)
127
+ const localVarPath = `/v1/returns/reasons/{id}`
128
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
129
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
130
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
131
+ let baseOptions;
132
+ if (configuration) {
133
+ baseOptions = configuration.baseOptions;
134
+ }
135
+
136
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
137
+ const localVarHeaderParameter = {} as any;
138
+ const localVarQueryParameter = {} as any;
139
+
140
+ // authentication session-oauth required
141
+ // oauth required
142
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
143
+
144
+ // authentication api-key required
145
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
146
+
147
+ if (project !== undefined) {
148
+ localVarQueryParameter['project'] = project;
149
+ }
150
+
151
+
152
+
153
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
154
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
155
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
156
+
157
+ return {
158
+ url: toPathString(localVarUrlObj),
159
+ options: localVarRequestOptions,
160
+ };
161
+ },
162
+ /**
163
+ * List return reasons
164
+ * @summary List return reasons
165
+ * @param {string} project What project it is
166
+ * @param {string} [search] Search term to filter results
167
+ * @param {number} [pageToken] Page reference token
168
+ * @param {number} [pageSize] Max page size. This is the maximum page size that will be returned, but it might be smaller.
169
+ * @param {*} [options] Override http request option.
170
+ * @throws {RequiredError}
171
+ */
172
+ listReturnReasons: async (project: string, search?: string, pageToken?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
173
+ // verify required parameter 'project' is not null or undefined
174
+ assertParamExists('listReturnReasons', 'project', project)
175
+ const localVarPath = `/v1/returns/reasons`;
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
+ if (search !== undefined) {
199
+ localVarQueryParameter['search'] = search;
200
+ }
201
+
202
+ if (pageToken !== undefined) {
203
+ localVarQueryParameter['pageToken'] = pageToken;
204
+ }
205
+
206
+ if (pageSize !== undefined) {
207
+ localVarQueryParameter['pageSize'] = pageSize;
208
+ }
209
+
210
+
211
+
212
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
213
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
214
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
215
+
216
+ return {
217
+ url: toPathString(localVarUrlObj),
218
+ options: localVarRequestOptions,
219
+ };
220
+ },
221
+ }
222
+ };
223
+
224
+ /**
225
+ * ReturnsApi - functional programming interface
226
+ * @export
227
+ */
228
+ export const ReturnsApiFp = function(configuration?: Configuration) {
229
+ const localVarAxiosParamCreator = ReturnsApiAxiosParamCreator(configuration)
230
+ return {
231
+ /**
232
+ * Get a return reason
233
+ * @summary Get a return reason
234
+ * @param {string} project What project it is
235
+ * @param {string} id The ID of the return reason
236
+ * @param {*} [options] Override http request option.
237
+ * @throws {RequiredError}
238
+ */
239
+ async getReturnReason(project: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ReturnReason>> {
240
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getReturnReason(project, id, options);
241
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
242
+ const localVarOperationServerBasePath = operationServerMap['ReturnsApi.getReturnReason']?.[localVarOperationServerIndex]?.url;
243
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
244
+ },
245
+ /**
246
+ * List return reasons
247
+ * @summary List return reasons
248
+ * @param {string} project What project it is
249
+ * @param {string} [search] Search term to filter results
250
+ * @param {number} [pageToken] Page reference token
251
+ * @param {number} [pageSize] Max page size. This is the maximum page size that will be returned, but it might be smaller.
252
+ * @param {*} [options] Override http request option.
253
+ * @throws {RequiredError}
254
+ */
255
+ async listReturnReasons(project: string, search?: string, pageToken?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ReturnReasons>> {
256
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listReturnReasons(project, search, pageToken, pageSize, options);
257
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
258
+ const localVarOperationServerBasePath = operationServerMap['ReturnsApi.listReturnReasons']?.[localVarOperationServerIndex]?.url;
259
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
260
+ },
261
+ }
262
+ };
263
+
264
+ /**
265
+ * ReturnsApi - factory interface
266
+ * @export
267
+ */
268
+ export const ReturnsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
269
+ const localVarFp = ReturnsApiFp(configuration)
270
+ return {
271
+ /**
272
+ * Get a return reason
273
+ * @summary Get a return reason
274
+ * @param {ReturnsApiGetReturnReasonRequest} requestParameters Request parameters.
275
+ * @param {*} [options] Override http request option.
276
+ * @throws {RequiredError}
277
+ */
278
+ getReturnReason(requestParameters: ReturnsApiGetReturnReasonRequest, options?: RawAxiosRequestConfig): AxiosPromise<ReturnReason> {
279
+ return localVarFp.getReturnReason(requestParameters.project, requestParameters.id, options).then((request) => request(axios, basePath));
280
+ },
281
+ /**
282
+ * List return reasons
283
+ * @summary List return reasons
284
+ * @param {ReturnsApiListReturnReasonsRequest} requestParameters Request parameters.
285
+ * @param {*} [options] Override http request option.
286
+ * @throws {RequiredError}
287
+ */
288
+ listReturnReasons(requestParameters: ReturnsApiListReturnReasonsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ReturnReasons> {
289
+ return localVarFp.listReturnReasons(requestParameters.project, requestParameters.search, requestParameters.pageToken, requestParameters.pageSize, options).then((request) => request(axios, basePath));
290
+ },
291
+ };
292
+ };
293
+
294
+ /**
295
+ * Request parameters for getReturnReason operation in ReturnsApi.
296
+ * @export
297
+ * @interface ReturnsApiGetReturnReasonRequest
298
+ */
299
+ export interface ReturnsApiGetReturnReasonRequest {
300
+ /**
301
+ * What project it is
302
+ * @type {string}
303
+ * @memberof ReturnsApiGetReturnReason
304
+ */
305
+ readonly project: string
306
+
307
+ /**
308
+ * The ID of the return reason
309
+ * @type {string}
310
+ * @memberof ReturnsApiGetReturnReason
311
+ */
312
+ readonly id: string
313
+ }
314
+
315
+ /**
316
+ * Request parameters for listReturnReasons operation in ReturnsApi.
317
+ * @export
318
+ * @interface ReturnsApiListReturnReasonsRequest
319
+ */
320
+ export interface ReturnsApiListReturnReasonsRequest {
321
+ /**
322
+ * What project it is
323
+ * @type {string}
324
+ * @memberof ReturnsApiListReturnReasons
325
+ */
326
+ readonly project: string
327
+
328
+ /**
329
+ * Search term to filter results
330
+ * @type {string}
331
+ * @memberof ReturnsApiListReturnReasons
332
+ */
333
+ readonly search?: string
334
+
335
+ /**
336
+ * Page reference token
337
+ * @type {number}
338
+ * @memberof ReturnsApiListReturnReasons
339
+ */
340
+ readonly pageToken?: number
341
+
342
+ /**
343
+ * Max page size. This is the maximum page size that will be returned, but it might be smaller.
344
+ * @type {number}
345
+ * @memberof ReturnsApiListReturnReasons
346
+ */
347
+ readonly pageSize?: number
348
+ }
349
+
350
+ /**
351
+ * ReturnsApi - object-oriented interface
352
+ * @export
353
+ * @class ReturnsApi
354
+ * @extends {BaseAPI}
355
+ */
356
+ export class ReturnsApi extends BaseAPI {
357
+ /**
358
+ * Get a return reason
359
+ * @summary Get a return reason
360
+ * @param {ReturnsApiGetReturnReasonRequest} requestParameters Request parameters.
361
+ * @param {*} [options] Override http request option.
362
+ * @throws {RequiredError}
363
+ * @memberof ReturnsApi
364
+ */
365
+ public getReturnReason(requestParameters: ReturnsApiGetReturnReasonRequest, options?: RawAxiosRequestConfig) {
366
+ return ReturnsApiFp(this.configuration).getReturnReason(requestParameters.project, requestParameters.id, options).then((request) => request(this.axios, this.basePath));
367
+ }
368
+
369
+ /**
370
+ * List return reasons
371
+ * @summary List return reasons
372
+ * @param {ReturnsApiListReturnReasonsRequest} requestParameters Request parameters.
373
+ * @param {*} [options] Override http request option.
374
+ * @throws {RequiredError}
375
+ * @memberof ReturnsApi
376
+ */
377
+ public listReturnReasons(requestParameters: ReturnsApiListReturnReasonsRequest, options?: RawAxiosRequestConfig) {
378
+ return ReturnsApiFp(this.configuration).listReturnReasons(requestParameters.project, requestParameters.search, requestParameters.pageToken, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
379
+ }
380
+ }
381
+
382
+
383
+
package/base.ts ADDED
@@ -0,0 +1,86 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Returns API
5
+ * Manage PodOS Returns
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
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 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://api.localhost:8080".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
+ * Returns API
5
+ * Manage PodOS Returns
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
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 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
+ }