@teemill/teemill-clients 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.
@@ -0,0 +1,17 @@
1
+ .gitignore
2
+ .npmignore
3
+ .openapi-generator-ignore
4
+ README.md
5
+ api.ts
6
+ base.ts
7
+ common.ts
8
+ configuration.ts
9
+ docs/ApiError.md
10
+ docs/Client.md
11
+ docs/TeemillClientsApi.md
12
+ docs/UpdateClientRequest.md
13
+ git_push.sh
14
+ index.ts
15
+ package.json
16
+ tsconfig.esm.json
17
+ tsconfig.json
@@ -0,0 +1 @@
1
+ 7.21.0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ ## @teemill/teemill-clients@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/teemill-clients@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*
51
+
52
+ Class | Method | HTTP request | Description
53
+ ------------ | ------------- | ------------- | -------------
54
+ *TeemillClientsApi* | [**getClient**](docs/TeemillClientsApi.md#getclient) | **GET** /v1/teemill-clients/{clientId} | Get Teemill client
55
+ *TeemillClientsApi* | [**updateClient**](docs/TeemillClientsApi.md#updateclient) | **PATCH** /v1/teemill-clients/{clientId} | Update Teemill client
56
+
57
+
58
+ ### Documentation For Models
59
+
60
+ - [ApiError](docs/ApiError.md)
61
+ - [Client](docs/Client.md)
62
+ - [UpdateClientRequest](docs/UpdateClientRequest.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,285 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Teemill Clients
5
+ * Manage Teemill Client Projects.
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, replaceWithSerializableTypeIfNeeded } from './common';
22
+ import type { RequestArgs } from './base';
23
+ // @ts-ignore
24
+ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
25
+
26
+ export interface ApiError {
27
+ 'code'?: string;
28
+ 'message': string;
29
+ }
30
+ /**
31
+ * Teemill Client
32
+ */
33
+ export interface Client {
34
+ /**
35
+ * Whether the client has a Teemill Pro subscription
36
+ */
37
+ 'proEnabled': boolean;
38
+ }
39
+ export interface UpdateClientRequest {
40
+ /**
41
+ * Whether to enable Teemill Pro for the client
42
+ */
43
+ 'enablePro'?: boolean;
44
+ }
45
+
46
+ /**
47
+ * TeemillClientsApi - axios parameter creator
48
+ */
49
+ export const TeemillClientsApiAxiosParamCreator = function (configuration?: Configuration) {
50
+ return {
51
+ /**
52
+ * Get a Teemill client
53
+ * @summary Get Teemill client
54
+ * @param {string} project The project being accessed
55
+ * @param {string} clientId The client unique identifier
56
+ * @param {*} [options] Override http request option.
57
+ * @throws {RequiredError}
58
+ */
59
+ getClient: async (project: string, clientId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
60
+ // verify required parameter 'project' is not null or undefined
61
+ assertParamExists('getClient', 'project', project)
62
+ // verify required parameter 'clientId' is not null or undefined
63
+ assertParamExists('getClient', 'clientId', clientId)
64
+ const localVarPath = `/v1/teemill-clients/{clientId}`
65
+ .replace(`{${"clientId"}}`, encodeURIComponent(String(clientId)));
66
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
67
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
68
+ let baseOptions;
69
+ if (configuration) {
70
+ baseOptions = configuration.baseOptions;
71
+ }
72
+
73
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
74
+ const localVarHeaderParameter = {} as any;
75
+ const localVarQueryParameter = {} as any;
76
+
77
+ // authentication session-oauth required
78
+ // oauth required
79
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
80
+
81
+ // authentication api-key required
82
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
83
+
84
+ if (project !== undefined) {
85
+ localVarQueryParameter['project'] = project;
86
+ }
87
+
88
+ localVarHeaderParameter['Accept'] = 'application/json';
89
+
90
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
91
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
92
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
93
+
94
+ return {
95
+ url: toPathString(localVarUrlObj),
96
+ options: localVarRequestOptions,
97
+ };
98
+ },
99
+ /**
100
+ * Update a Teemill client
101
+ * @summary Update Teemill client
102
+ * @param {string} project The project being accessed
103
+ * @param {string} clientId The client unique identifier
104
+ * @param {UpdateClientRequest} updateClientRequest Teemill client to update
105
+ * @param {*} [options] Override http request option.
106
+ * @throws {RequiredError}
107
+ */
108
+ updateClient: async (project: string, clientId: string, updateClientRequest: UpdateClientRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
109
+ // verify required parameter 'project' is not null or undefined
110
+ assertParamExists('updateClient', 'project', project)
111
+ // verify required parameter 'clientId' is not null or undefined
112
+ assertParamExists('updateClient', 'clientId', clientId)
113
+ // verify required parameter 'updateClientRequest' is not null or undefined
114
+ assertParamExists('updateClient', 'updateClientRequest', updateClientRequest)
115
+ const localVarPath = `/v1/teemill-clients/{clientId}`
116
+ .replace(`{${"clientId"}}`, encodeURIComponent(String(clientId)));
117
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
118
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
119
+ let baseOptions;
120
+ if (configuration) {
121
+ baseOptions = configuration.baseOptions;
122
+ }
123
+
124
+ const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
125
+ const localVarHeaderParameter = {} as any;
126
+ const localVarQueryParameter = {} as any;
127
+
128
+ // authentication session-oauth required
129
+ // oauth required
130
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
131
+
132
+ // authentication api-key required
133
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
134
+
135
+ if (project !== undefined) {
136
+ localVarQueryParameter['project'] = project;
137
+ }
138
+
139
+ localVarHeaderParameter['Content-Type'] = 'application/json';
140
+ localVarHeaderParameter['Accept'] = 'application/json';
141
+
142
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
143
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
144
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
145
+ localVarRequestOptions.data = serializeDataIfNeeded(updateClientRequest, localVarRequestOptions, configuration)
146
+
147
+ return {
148
+ url: toPathString(localVarUrlObj),
149
+ options: localVarRequestOptions,
150
+ };
151
+ },
152
+ }
153
+ };
154
+
155
+ /**
156
+ * TeemillClientsApi - functional programming interface
157
+ */
158
+ export const TeemillClientsApiFp = function(configuration?: Configuration) {
159
+ const localVarAxiosParamCreator = TeemillClientsApiAxiosParamCreator(configuration)
160
+ return {
161
+ /**
162
+ * Get a Teemill client
163
+ * @summary Get Teemill client
164
+ * @param {string} project The project being accessed
165
+ * @param {string} clientId The client unique identifier
166
+ * @param {*} [options] Override http request option.
167
+ * @throws {RequiredError}
168
+ */
169
+ async getClient(project: string, clientId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Client>> {
170
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getClient(project, clientId, options);
171
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
172
+ const localVarOperationServerBasePath = operationServerMap['TeemillClientsApi.getClient']?.[localVarOperationServerIndex]?.url;
173
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
174
+ },
175
+ /**
176
+ * Update a Teemill client
177
+ * @summary Update Teemill client
178
+ * @param {string} project The project being accessed
179
+ * @param {string} clientId The client unique identifier
180
+ * @param {UpdateClientRequest} updateClientRequest Teemill client to update
181
+ * @param {*} [options] Override http request option.
182
+ * @throws {RequiredError}
183
+ */
184
+ async updateClient(project: string, clientId: string, updateClientRequest: UpdateClientRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Client>> {
185
+ const localVarAxiosArgs = await localVarAxiosParamCreator.updateClient(project, clientId, updateClientRequest, options);
186
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
187
+ const localVarOperationServerBasePath = operationServerMap['TeemillClientsApi.updateClient']?.[localVarOperationServerIndex]?.url;
188
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
189
+ },
190
+ }
191
+ };
192
+
193
+ /**
194
+ * TeemillClientsApi - factory interface
195
+ */
196
+ export const TeemillClientsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
197
+ const localVarFp = TeemillClientsApiFp(configuration)
198
+ return {
199
+ /**
200
+ * Get a Teemill client
201
+ * @summary Get Teemill client
202
+ * @param {TeemillClientsApiGetClientRequest} requestParameters Request parameters.
203
+ * @param {*} [options] Override http request option.
204
+ * @throws {RequiredError}
205
+ */
206
+ getClient(requestParameters: TeemillClientsApiGetClientRequest, options?: RawAxiosRequestConfig): AxiosPromise<Client> {
207
+ return localVarFp.getClient(requestParameters.project, requestParameters.clientId, options).then((request) => request(axios, basePath));
208
+ },
209
+ /**
210
+ * Update a Teemill client
211
+ * @summary Update Teemill client
212
+ * @param {TeemillClientsApiUpdateClientRequest} requestParameters Request parameters.
213
+ * @param {*} [options] Override http request option.
214
+ * @throws {RequiredError}
215
+ */
216
+ updateClient(requestParameters: TeemillClientsApiUpdateClientRequest, options?: RawAxiosRequestConfig): AxiosPromise<Client> {
217
+ return localVarFp.updateClient(requestParameters.project, requestParameters.clientId, requestParameters.updateClientRequest, options).then((request) => request(axios, basePath));
218
+ },
219
+ };
220
+ };
221
+
222
+ /**
223
+ * Request parameters for getClient operation in TeemillClientsApi.
224
+ */
225
+ export interface TeemillClientsApiGetClientRequest {
226
+ /**
227
+ * The project being accessed
228
+ */
229
+ readonly project: string
230
+
231
+ /**
232
+ * The client unique identifier
233
+ */
234
+ readonly clientId: string
235
+ }
236
+
237
+ /**
238
+ * Request parameters for updateClient operation in TeemillClientsApi.
239
+ */
240
+ export interface TeemillClientsApiUpdateClientRequest {
241
+ /**
242
+ * The project being accessed
243
+ */
244
+ readonly project: string
245
+
246
+ /**
247
+ * The client unique identifier
248
+ */
249
+ readonly clientId: string
250
+
251
+ /**
252
+ * Teemill client to update
253
+ */
254
+ readonly updateClientRequest: UpdateClientRequest
255
+ }
256
+
257
+ /**
258
+ * TeemillClientsApi - object-oriented interface
259
+ */
260
+ export class TeemillClientsApi extends BaseAPI {
261
+ /**
262
+ * Get a Teemill client
263
+ * @summary Get Teemill client
264
+ * @param {TeemillClientsApiGetClientRequest} requestParameters Request parameters.
265
+ * @param {*} [options] Override http request option.
266
+ * @throws {RequiredError}
267
+ */
268
+ public getClient(requestParameters: TeemillClientsApiGetClientRequest, options?: RawAxiosRequestConfig) {
269
+ return TeemillClientsApiFp(this.configuration).getClient(requestParameters.project, requestParameters.clientId, options).then((request) => request(this.axios, this.basePath));
270
+ }
271
+
272
+ /**
273
+ * Update a Teemill client
274
+ * @summary Update Teemill client
275
+ * @param {TeemillClientsApiUpdateClientRequest} requestParameters Request parameters.
276
+ * @param {*} [options] Override http request option.
277
+ * @throws {RequiredError}
278
+ */
279
+ public updateClient(requestParameters: TeemillClientsApiUpdateClientRequest, options?: RawAxiosRequestConfig) {
280
+ return TeemillClientsApiFp(this.configuration).updateClient(requestParameters.project, requestParameters.clientId, requestParameters.updateClientRequest, options).then((request) => request(this.axios, this.basePath));
281
+ }
282
+ }
283
+
284
+
285
+
package/base.ts ADDED
@@ -0,0 +1,62 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Teemill Clients
5
+ * Manage Teemill Client Projects.
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".replace(/\/+$/, "");
23
+
24
+ export const COLLECTION_FORMATS = {
25
+ csv: ",",
26
+ ssv: " ",
27
+ tsv: "\t",
28
+ pipes: "|",
29
+ };
30
+
31
+ export interface RequestArgs {
32
+ url: string;
33
+ options: RawAxiosRequestConfig;
34
+ }
35
+
36
+ export class BaseAPI {
37
+ protected configuration: Configuration | undefined;
38
+
39
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
40
+ if (configuration) {
41
+ this.configuration = configuration;
42
+ this.basePath = configuration.basePath ?? basePath;
43
+ }
44
+ }
45
+ };
46
+
47
+ export class RequiredError extends Error {
48
+ constructor(public field: string, msg?: string) {
49
+ super(msg);
50
+ this.name = "RequiredError"
51
+ }
52
+ }
53
+
54
+ interface ServerMap {
55
+ [key: string]: {
56
+ url: string,
57
+ description: string,
58
+ }[];
59
+ }
60
+
61
+ export const operationServerMap: ServerMap = {
62
+ }
package/common.ts ADDED
@@ -0,0 +1,149 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Teemill Clients
5
+ * Manage Teemill Client Projects.
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
+ import type { Configuration } from "./configuration";
16
+ import type { RequestArgs } from "./base";
17
+ import type { AxiosInstance, AxiosResponse } from 'axios';
18
+ import { RequiredError } from "./base";
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
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
87
+ if (parameter == null) return;
88
+ if (typeof parameter === "object") {
89
+ if (Array.isArray(parameter)) {
90
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key !== '' ? `${key}[]` : key));
91
+ }
92
+ else {
93
+ Object.keys(parameter).forEach(currentKey =>
94
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
95
+ );
96
+ }
97
+ }
98
+ else {
99
+ if (urlSearchParams.has(key)) {
100
+ urlSearchParams.append(key, parameter);
101
+ }
102
+ else {
103
+ urlSearchParams.set(key, parameter);
104
+ }
105
+ }
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @export
111
+ */
112
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
113
+ const searchParams = new URLSearchParams(url.search);
114
+ setFlattenedQueryParams(searchParams, objects);
115
+ url.search = decodeURIComponent(searchParams.toString());
116
+ }
117
+
118
+ /**
119
+ *
120
+ * @export
121
+ */
122
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
123
+ const nonString = typeof value !== 'string';
124
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
125
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
126
+ : nonString;
127
+ return needsSerialization
128
+ ? JSON.stringify(value !== undefined ? value : {})
129
+ : (value || "");
130
+ }
131
+
132
+ /**
133
+ *
134
+ * @export
135
+ */
136
+ export const toPathString = function (url: URL) {
137
+ return url.pathname + url.search + url.hash
138
+ }
139
+
140
+ /**
141
+ *
142
+ * @export
143
+ */
144
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
145
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
146
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
147
+ return axios.request<T, R>(axiosRequestArgs);
148
+ };
149
+ }