@horpynka/api-sdk 1.0.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 +58 -0
- package/dist/client/index.cjs +454 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +3 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +448 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index-B1nmGKYw.d.cts +645 -0
- package/dist/index-B1nmGKYw.d.ts +645 -0
- package/dist/index.cjs +473 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/package.json +74 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { O as Order } from './index-B1nmGKYw.cjs';
|
|
2
|
+
export { i as initApiClient, o as ordersApi, t as tanstackClient } from './index-B1nmGKYw.cjs';
|
|
3
|
+
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
+
import * as axios from 'axios';
|
|
6
|
+
|
|
7
|
+
declare const useOrdersApi: () => {
|
|
8
|
+
mutateDeleteReceipt: _tanstack_react_query.UseMutationResult<axios.AxiosResponse<Order, any, {}, any>, Error, {
|
|
9
|
+
params: {
|
|
10
|
+
id: number;
|
|
11
|
+
};
|
|
12
|
+
onSettledCallback?: () => void;
|
|
13
|
+
}, unknown>;
|
|
14
|
+
getOrdersQuery: (params?: {
|
|
15
|
+
page?: number;
|
|
16
|
+
limit?: number;
|
|
17
|
+
status?: string;
|
|
18
|
+
}) => _tanstack_query_core.OmitKeyof<_tanstack_react_query.UseQueryOptions<Order[], Error, Order[], (string | {
|
|
19
|
+
page?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
status?: string;
|
|
22
|
+
} | undefined)[]>, "queryFn"> & {
|
|
23
|
+
queryFn?: _tanstack_query_core.QueryFunction<Order[], (string | {
|
|
24
|
+
page?: number;
|
|
25
|
+
limit?: number;
|
|
26
|
+
status?: string;
|
|
27
|
+
} | undefined)[], never> | undefined;
|
|
28
|
+
} & _tanstack_query_core.QueryKeyWithDataTag<(string | {
|
|
29
|
+
page?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
status?: string;
|
|
32
|
+
} | undefined)[], Order[], Error>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { useOrdersApi };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { O as Order } from './index-B1nmGKYw.js';
|
|
2
|
+
export { i as initApiClient, o as ordersApi, t as tanstackClient } from './index-B1nmGKYw.js';
|
|
3
|
+
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
+
import * as axios from 'axios';
|
|
6
|
+
|
|
7
|
+
declare const useOrdersApi: () => {
|
|
8
|
+
mutateDeleteReceipt: _tanstack_react_query.UseMutationResult<axios.AxiosResponse<Order, any, {}, any>, Error, {
|
|
9
|
+
params: {
|
|
10
|
+
id: number;
|
|
11
|
+
};
|
|
12
|
+
onSettledCallback?: () => void;
|
|
13
|
+
}, unknown>;
|
|
14
|
+
getOrdersQuery: (params?: {
|
|
15
|
+
page?: number;
|
|
16
|
+
limit?: number;
|
|
17
|
+
status?: string;
|
|
18
|
+
}) => _tanstack_query_core.OmitKeyof<_tanstack_react_query.UseQueryOptions<Order[], Error, Order[], (string | {
|
|
19
|
+
page?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
status?: string;
|
|
22
|
+
} | undefined)[]>, "queryFn"> & {
|
|
23
|
+
queryFn?: _tanstack_query_core.QueryFunction<Order[], (string | {
|
|
24
|
+
page?: number;
|
|
25
|
+
limit?: number;
|
|
26
|
+
status?: string;
|
|
27
|
+
} | undefined)[], never> | undefined;
|
|
28
|
+
} & _tanstack_query_core.QueryKeyWithDataTag<(string | {
|
|
29
|
+
page?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
status?: string;
|
|
32
|
+
} | undefined)[], Order[], Error>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { useOrdersApi };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import globalAxios2 from 'axios';
|
|
2
|
+
import { QueryClient, useQueryClient, useMutation, queryOptions } from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
// src/client/clients.ts
|
|
5
|
+
var BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
6
|
+
var BaseAPI = class {
|
|
7
|
+
constructor(configuration, basePath = BASE_PATH, axios2 = globalAxios2) {
|
|
8
|
+
this.basePath = basePath;
|
|
9
|
+
this.axios = axios2;
|
|
10
|
+
if (configuration) {
|
|
11
|
+
this.configuration = configuration;
|
|
12
|
+
this.basePath = configuration.basePath ?? basePath;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
basePath;
|
|
16
|
+
axios;
|
|
17
|
+
configuration;
|
|
18
|
+
};
|
|
19
|
+
var RequiredError = class extends Error {
|
|
20
|
+
constructor(field, msg) {
|
|
21
|
+
super(msg);
|
|
22
|
+
this.field = field;
|
|
23
|
+
this.name = "RequiredError";
|
|
24
|
+
}
|
|
25
|
+
field;
|
|
26
|
+
};
|
|
27
|
+
var operationServerMap = {};
|
|
28
|
+
|
|
29
|
+
// src/api/generated/common.ts
|
|
30
|
+
var DUMMY_BASE_URL = "https://example.com";
|
|
31
|
+
var assertParamExists = function(functionName, paramName, paramValue) {
|
|
32
|
+
if (paramValue === null || paramValue === void 0) {
|
|
33
|
+
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
37
|
+
if (parameter == null) return;
|
|
38
|
+
if (typeof parameter === "object") {
|
|
39
|
+
if (Array.isArray(parameter)) {
|
|
40
|
+
parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
41
|
+
} else {
|
|
42
|
+
Object.keys(parameter).forEach(
|
|
43
|
+
(currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== "" ? "." : ""}${currentKey}`)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
if (urlSearchParams.has(key)) {
|
|
48
|
+
urlSearchParams.append(key, parameter);
|
|
49
|
+
} else {
|
|
50
|
+
urlSearchParams.set(key, parameter);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var setSearchParams = function(url, ...objects) {
|
|
55
|
+
const searchParams = new URLSearchParams(url.search);
|
|
56
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
57
|
+
url.search = searchParams.toString();
|
|
58
|
+
};
|
|
59
|
+
var serializeDataIfNeeded = function(value, requestOptions, configuration) {
|
|
60
|
+
const nonString = typeof value !== "string";
|
|
61
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString;
|
|
62
|
+
return needsSerialization ? JSON.stringify(value !== void 0 ? value : {}) : value || "";
|
|
63
|
+
};
|
|
64
|
+
var toPathString = function(url) {
|
|
65
|
+
return url.pathname + url.search + url.hash;
|
|
66
|
+
};
|
|
67
|
+
var createRequestFunction = function(axiosArgs, globalAxios3, BASE_PATH2, configuration) {
|
|
68
|
+
return (axios2 = globalAxios3, basePath = BASE_PATH2) => {
|
|
69
|
+
const axiosRequestArgs = { ...axiosArgs.options, url: (axios2.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
70
|
+
return axios2.request(axiosRequestArgs);
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/api/generated/api.ts
|
|
75
|
+
var OrdersApiAxiosParamCreator = function(configuration) {
|
|
76
|
+
return {
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @param {CreateOrderDto} createOrderDto
|
|
80
|
+
* @param {*} [options] Override http request option.
|
|
81
|
+
* @throws {RequiredError}
|
|
82
|
+
*/
|
|
83
|
+
create: async (createOrderDto, options = {}) => {
|
|
84
|
+
assertParamExists("create", "createOrderDto", createOrderDto);
|
|
85
|
+
const localVarPath = `/orders`;
|
|
86
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
87
|
+
let baseOptions;
|
|
88
|
+
if (configuration) {
|
|
89
|
+
baseOptions = configuration.baseOptions;
|
|
90
|
+
}
|
|
91
|
+
const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
|
|
92
|
+
const localVarHeaderParameter = {};
|
|
93
|
+
const localVarQueryParameter = {};
|
|
94
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
95
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
96
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
97
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
98
|
+
localVarRequestOptions.data = serializeDataIfNeeded(createOrderDto, localVarRequestOptions, configuration);
|
|
99
|
+
return {
|
|
100
|
+
url: toPathString(localVarUrlObj),
|
|
101
|
+
options: localVarRequestOptions
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param {number} [page]
|
|
107
|
+
* @param {number} [limit]
|
|
108
|
+
* @param {string} [status]
|
|
109
|
+
* @param {*} [options] Override http request option.
|
|
110
|
+
* @throws {RequiredError}
|
|
111
|
+
*/
|
|
112
|
+
findAll: async (page, limit, status, options = {}) => {
|
|
113
|
+
const localVarPath = `/orders`;
|
|
114
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
115
|
+
let baseOptions;
|
|
116
|
+
if (configuration) {
|
|
117
|
+
baseOptions = configuration.baseOptions;
|
|
118
|
+
}
|
|
119
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
120
|
+
const localVarHeaderParameter = {};
|
|
121
|
+
const localVarQueryParameter = {};
|
|
122
|
+
if (page !== void 0) {
|
|
123
|
+
localVarQueryParameter["page"] = page;
|
|
124
|
+
}
|
|
125
|
+
if (limit !== void 0) {
|
|
126
|
+
localVarQueryParameter["limit"] = limit;
|
|
127
|
+
}
|
|
128
|
+
if (status !== void 0) {
|
|
129
|
+
localVarQueryParameter["status"] = status;
|
|
130
|
+
}
|
|
131
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
132
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
133
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
134
|
+
return {
|
|
135
|
+
url: toPathString(localVarUrlObj),
|
|
136
|
+
options: localVarRequestOptions
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {number} id
|
|
142
|
+
* @param {*} [options] Override http request option.
|
|
143
|
+
* @throws {RequiredError}
|
|
144
|
+
*/
|
|
145
|
+
findOne: async (id, options = {}) => {
|
|
146
|
+
assertParamExists("findOne", "id", id);
|
|
147
|
+
const localVarPath = `/orders/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
148
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
149
|
+
let baseOptions;
|
|
150
|
+
if (configuration) {
|
|
151
|
+
baseOptions = configuration.baseOptions;
|
|
152
|
+
}
|
|
153
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
154
|
+
const localVarHeaderParameter = {};
|
|
155
|
+
const localVarQueryParameter = {};
|
|
156
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
157
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
158
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
159
|
+
return {
|
|
160
|
+
url: toPathString(localVarUrlObj),
|
|
161
|
+
options: localVarRequestOptions
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param {number} id
|
|
167
|
+
* @param {*} [options] Override http request option.
|
|
168
|
+
* @throws {RequiredError}
|
|
169
|
+
*/
|
|
170
|
+
removeActiveReceipt: async (id, options = {}) => {
|
|
171
|
+
assertParamExists("removeActiveReceipt", "id", id);
|
|
172
|
+
const localVarPath = `/orders/remove-active-receipt/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
173
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
174
|
+
let baseOptions;
|
|
175
|
+
if (configuration) {
|
|
176
|
+
baseOptions = configuration.baseOptions;
|
|
177
|
+
}
|
|
178
|
+
const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
|
|
179
|
+
const localVarHeaderParameter = {};
|
|
180
|
+
const localVarQueryParameter = {};
|
|
181
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
182
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
183
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
184
|
+
return {
|
|
185
|
+
url: toPathString(localVarUrlObj),
|
|
186
|
+
options: localVarRequestOptions
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @param {number} id
|
|
192
|
+
* @param {UpdateOrderDto} updateOrderDto
|
|
193
|
+
* @param {*} [options] Override http request option.
|
|
194
|
+
* @throws {RequiredError}
|
|
195
|
+
*/
|
|
196
|
+
update: async (id, updateOrderDto, options = {}) => {
|
|
197
|
+
assertParamExists("update", "id", id);
|
|
198
|
+
assertParamExists("update", "updateOrderDto", updateOrderDto);
|
|
199
|
+
const localVarPath = `/orders/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
200
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
201
|
+
let baseOptions;
|
|
202
|
+
if (configuration) {
|
|
203
|
+
baseOptions = configuration.baseOptions;
|
|
204
|
+
}
|
|
205
|
+
const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
|
|
206
|
+
const localVarHeaderParameter = {};
|
|
207
|
+
const localVarQueryParameter = {};
|
|
208
|
+
localVarHeaderParameter["Content-Type"] = "application/json";
|
|
209
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
210
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
211
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
212
|
+
localVarRequestOptions.data = serializeDataIfNeeded(updateOrderDto, localVarRequestOptions, configuration);
|
|
213
|
+
return {
|
|
214
|
+
url: toPathString(localVarUrlObj),
|
|
215
|
+
options: localVarRequestOptions
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
var OrdersApiFp = function(configuration) {
|
|
221
|
+
const localVarAxiosParamCreator = OrdersApiAxiosParamCreator(configuration);
|
|
222
|
+
return {
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* @param {CreateOrderDto} createOrderDto
|
|
226
|
+
* @param {*} [options] Override http request option.
|
|
227
|
+
* @throws {RequiredError}
|
|
228
|
+
*/
|
|
229
|
+
async create(createOrderDto, options) {
|
|
230
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.create(createOrderDto, options);
|
|
231
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
232
|
+
const localVarOperationServerBasePath = operationServerMap["OrdersApi.create"]?.[localVarOperationServerIndex]?.url;
|
|
233
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
*
|
|
237
|
+
* @param {number} [page]
|
|
238
|
+
* @param {number} [limit]
|
|
239
|
+
* @param {string} [status]
|
|
240
|
+
* @param {*} [options] Override http request option.
|
|
241
|
+
* @throws {RequiredError}
|
|
242
|
+
*/
|
|
243
|
+
async findAll(page, limit, status, options) {
|
|
244
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findAll(page, limit, status, options);
|
|
245
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
246
|
+
const localVarOperationServerBasePath = operationServerMap["OrdersApi.findAll"]?.[localVarOperationServerIndex]?.url;
|
|
247
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
* @param {number} id
|
|
252
|
+
* @param {*} [options] Override http request option.
|
|
253
|
+
* @throws {RequiredError}
|
|
254
|
+
*/
|
|
255
|
+
async findOne(id, options) {
|
|
256
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.findOne(id, options);
|
|
257
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
258
|
+
const localVarOperationServerBasePath = operationServerMap["OrdersApi.findOne"]?.[localVarOperationServerIndex]?.url;
|
|
259
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
*
|
|
263
|
+
* @param {number} id
|
|
264
|
+
* @param {*} [options] Override http request option.
|
|
265
|
+
* @throws {RequiredError}
|
|
266
|
+
*/
|
|
267
|
+
async removeActiveReceipt(id, options) {
|
|
268
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.removeActiveReceipt(id, options);
|
|
269
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
270
|
+
const localVarOperationServerBasePath = operationServerMap["OrdersApi.removeActiveReceipt"]?.[localVarOperationServerIndex]?.url;
|
|
271
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
272
|
+
},
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
275
|
+
* @param {number} id
|
|
276
|
+
* @param {UpdateOrderDto} updateOrderDto
|
|
277
|
+
* @param {*} [options] Override http request option.
|
|
278
|
+
* @throws {RequiredError}
|
|
279
|
+
*/
|
|
280
|
+
async update(id, updateOrderDto, options) {
|
|
281
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.update(id, updateOrderDto, options);
|
|
282
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
283
|
+
const localVarOperationServerBasePath = operationServerMap["OrdersApi.update"]?.[localVarOperationServerIndex]?.url;
|
|
284
|
+
return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios2, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
var OrdersApi = class extends BaseAPI {
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* @param {CreateOrderDto} createOrderDto
|
|
292
|
+
* @param {*} [options] Override http request option.
|
|
293
|
+
* @throws {RequiredError}
|
|
294
|
+
* @memberof OrdersApi
|
|
295
|
+
*/
|
|
296
|
+
create(createOrderDto, options) {
|
|
297
|
+
return OrdersApiFp(this.configuration).create(createOrderDto, options).then((request) => request(this.axios, this.basePath));
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
*
|
|
301
|
+
* @param {number} [page]
|
|
302
|
+
* @param {number} [limit]
|
|
303
|
+
* @param {string} [status]
|
|
304
|
+
* @param {*} [options] Override http request option.
|
|
305
|
+
* @throws {RequiredError}
|
|
306
|
+
* @memberof OrdersApi
|
|
307
|
+
*/
|
|
308
|
+
findAll(page, limit, status, options) {
|
|
309
|
+
return OrdersApiFp(this.configuration).findAll(page, limit, status, options).then((request) => request(this.axios, this.basePath));
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
*
|
|
313
|
+
* @param {number} id
|
|
314
|
+
* @param {*} [options] Override http request option.
|
|
315
|
+
* @throws {RequiredError}
|
|
316
|
+
* @memberof OrdersApi
|
|
317
|
+
*/
|
|
318
|
+
findOne(id, options) {
|
|
319
|
+
return OrdersApiFp(this.configuration).findOne(id, options).then((request) => request(this.axios, this.basePath));
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
*
|
|
323
|
+
* @param {number} id
|
|
324
|
+
* @param {*} [options] Override http request option.
|
|
325
|
+
* @throws {RequiredError}
|
|
326
|
+
* @memberof OrdersApi
|
|
327
|
+
*/
|
|
328
|
+
removeActiveReceipt(id, options) {
|
|
329
|
+
return OrdersApiFp(this.configuration).removeActiveReceipt(id, options).then((request) => request(this.axios, this.basePath));
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
*
|
|
333
|
+
* @param {number} id
|
|
334
|
+
* @param {UpdateOrderDto} updateOrderDto
|
|
335
|
+
* @param {*} [options] Override http request option.
|
|
336
|
+
* @throws {RequiredError}
|
|
337
|
+
* @memberof OrdersApi
|
|
338
|
+
*/
|
|
339
|
+
update(id, updateOrderDto, options) {
|
|
340
|
+
return OrdersApiFp(this.configuration).update(id, updateOrderDto, options).then((request) => request(this.axios, this.basePath));
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// src/api/generated/configuration.ts
|
|
345
|
+
var Configuration = class {
|
|
346
|
+
/**
|
|
347
|
+
* parameter for apiKey security
|
|
348
|
+
* @param name security name
|
|
349
|
+
* @memberof Configuration
|
|
350
|
+
*/
|
|
351
|
+
apiKey;
|
|
352
|
+
/**
|
|
353
|
+
* parameter for basic security
|
|
354
|
+
*
|
|
355
|
+
* @type {string}
|
|
356
|
+
* @memberof Configuration
|
|
357
|
+
*/
|
|
358
|
+
username;
|
|
359
|
+
/**
|
|
360
|
+
* parameter for basic security
|
|
361
|
+
*
|
|
362
|
+
* @type {string}
|
|
363
|
+
* @memberof Configuration
|
|
364
|
+
*/
|
|
365
|
+
password;
|
|
366
|
+
/**
|
|
367
|
+
* parameter for oauth2 security
|
|
368
|
+
* @param name security name
|
|
369
|
+
* @param scopes oauth2 scope
|
|
370
|
+
* @memberof Configuration
|
|
371
|
+
*/
|
|
372
|
+
accessToken;
|
|
373
|
+
/**
|
|
374
|
+
* override base path
|
|
375
|
+
*
|
|
376
|
+
* @type {string}
|
|
377
|
+
* @memberof Configuration
|
|
378
|
+
*/
|
|
379
|
+
basePath;
|
|
380
|
+
/**
|
|
381
|
+
* override server index
|
|
382
|
+
*
|
|
383
|
+
* @type {number}
|
|
384
|
+
* @memberof Configuration
|
|
385
|
+
*/
|
|
386
|
+
serverIndex;
|
|
387
|
+
/**
|
|
388
|
+
* base options for axios calls
|
|
389
|
+
*
|
|
390
|
+
* @type {any}
|
|
391
|
+
* @memberof Configuration
|
|
392
|
+
*/
|
|
393
|
+
baseOptions;
|
|
394
|
+
/**
|
|
395
|
+
* The FormData constructor that will be used to create multipart form data
|
|
396
|
+
* requests. You can inject this here so that execution environments that
|
|
397
|
+
* do not support the FormData class can still run the generated client.
|
|
398
|
+
*
|
|
399
|
+
* @type {new () => FormData}
|
|
400
|
+
*/
|
|
401
|
+
formDataCtor;
|
|
402
|
+
constructor(param = {}) {
|
|
403
|
+
this.apiKey = param.apiKey;
|
|
404
|
+
this.username = param.username;
|
|
405
|
+
this.password = param.password;
|
|
406
|
+
this.accessToken = param.accessToken;
|
|
407
|
+
this.basePath = param.basePath;
|
|
408
|
+
this.serverIndex = param.serverIndex;
|
|
409
|
+
this.baseOptions = {
|
|
410
|
+
...param.baseOptions,
|
|
411
|
+
headers: {
|
|
412
|
+
...param.baseOptions?.headers
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
this.formDataCtor = param.formDataCtor;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Check if the given MIME is a JSON MIME.
|
|
419
|
+
* JSON MIME examples:
|
|
420
|
+
* application/json
|
|
421
|
+
* application/json; charset=UTF8
|
|
422
|
+
* APPLICATION/JSON
|
|
423
|
+
* application/vnd.company+json
|
|
424
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
425
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
426
|
+
*/
|
|
427
|
+
isJsonMime(mime) {
|
|
428
|
+
const jsonMime = new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$", "i");
|
|
429
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === "application/json-patch+json");
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
var tanstackClient;
|
|
433
|
+
var ordersApi;
|
|
434
|
+
function initApiClient(config) {
|
|
435
|
+
const apiClient = globalAxios2.create({
|
|
436
|
+
baseURL: config.baseURL,
|
|
437
|
+
timeout: config.timeout ?? 1e4
|
|
438
|
+
});
|
|
439
|
+
const configuration = new Configuration({
|
|
440
|
+
basePath: config.baseURL
|
|
441
|
+
});
|
|
442
|
+
tanstackClient = new QueryClient();
|
|
443
|
+
ordersApi = new OrdersApi(configuration, void 0, apiClient);
|
|
444
|
+
}
|
|
445
|
+
var getOrdersQuery = (params) => queryOptions({
|
|
446
|
+
queryKey: ["orders", params],
|
|
447
|
+
queryFn: () => ordersApi.findAll(params?.page, params?.limit, params?.status).then((res) => res.data)
|
|
448
|
+
});
|
|
449
|
+
var useOrdersApi = () => {
|
|
450
|
+
const queryClient = useQueryClient();
|
|
451
|
+
const mutateDeleteReceipt = useMutation({
|
|
452
|
+
mutationFn: ({ params: { id } }) => ordersApi.removeActiveReceipt(id),
|
|
453
|
+
onSettled: (_data, _error, { onSettledCallback }) => {
|
|
454
|
+
queryClient.invalidateQueries({ queryKey: ["orders"] });
|
|
455
|
+
onSettledCallback && onSettledCallback();
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
return {
|
|
459
|
+
mutateDeleteReceipt,
|
|
460
|
+
getOrdersQuery
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
export { initApiClient, ordersApi, tanstackClient, useOrdersApi };
|
|
465
|
+
//# sourceMappingURL=index.js.map
|
|
466
|
+
//# sourceMappingURL=index.js.map
|