@squonk/account-server-client 4.2.1 → 4.3.1
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/asset/asset.cjs +99 -126
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +99 -99
- package/asset/asset.d.ts +99 -99
- package/asset/asset.js +107 -134
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs +73 -85
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.d.cts +47 -47
- package/charges/charges.d.ts +47 -47
- package/charges/charges.js +78 -90
- package/charges/charges.js.map +1 -1
- package/chunk-3WKSNKHE.js +25 -0
- package/chunk-3WKSNKHE.js.map +1 -0
- package/chunk-NY2VJJG7.cjs +25 -0
- package/chunk-NY2VJJG7.cjs.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/event-stream/event-stream.cjs +53 -61
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +45 -45
- package/event-stream/event-stream.d.ts +45 -45
- package/event-stream/event-stream.js +58 -66
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +49 -57
- package/index.cjs.map +1 -1
- package/index.d.cts +796 -773
- package/index.d.ts +796 -773
- package/index.js +48 -56
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +38 -45
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +25 -25
- package/merchant/merchant.d.ts +25 -25
- package/merchant/merchant.js +42 -49
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +77 -87
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +72 -70
- package/organisation/organisation.d.ts +72 -70
- package/organisation/organisation.js +83 -93
- package/organisation/organisation.js.map +1 -1
- package/package.json +13 -16
- package/product/product.cjs +143 -153
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +100 -100
- package/product/product.d.ts +100 -100
- package/product/product.js +153 -163
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +863 -856
- package/src/asset/asset.ts +899 -634
- package/src/charges/charges.ts +822 -498
- package/src/custom-instance.ts +3 -3
- package/src/event-stream/event-stream.ts +531 -345
- package/src/index.ts +2 -2
- package/src/merchant/merchant.ts +355 -234
- package/src/options-mutator.ts +27 -0
- package/src/organisation/organisation.ts +812 -504
- package/src/product/product.ts +1373 -841
- package/src/state/state.ts +174 -127
- package/src/unit/unit.ts +1273 -603
- package/src/user/user.ts +895 -564
- package/state/state.cjs +22 -24
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +14 -14
- package/state/state.d.ts +14 -14
- package/state/state.js +24 -26
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +171 -106
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +200 -90
- package/unit/unit.d.ts +200 -90
- package/unit/unit.js +179 -114
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +94 -110
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +77 -77
- package/user/user.d.ts +77 -77
- package/user/user.js +101 -117
- package/user/user.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
package/src/product/product.ts
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.10.0 🍺
|
|
4
3
|
* Do not edit manually.
|
|
5
4
|
* Account Server API
|
|
6
5
|
* The Informatics Matters Account Server API.
|
|
7
6
|
|
|
8
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
8
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.3
|
|
11
10
|
*/
|
|
12
|
-
import {
|
|
13
|
-
useMutation,
|
|
14
|
-
useQuery,
|
|
15
|
-
useSuspenseQuery
|
|
16
|
-
} from '@tanstack/react-query'
|
|
11
|
+
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
17
12
|
import type {
|
|
18
13
|
DataTag,
|
|
19
14
|
DefinedInitialDataOptions,
|
|
20
15
|
DefinedUseQueryResult,
|
|
21
16
|
MutationFunction,
|
|
17
|
+
QueryClient,
|
|
22
18
|
QueryFunction,
|
|
23
19
|
QueryKey,
|
|
24
20
|
UndefinedInitialDataOptions,
|
|
@@ -27,8 +23,9 @@ import type {
|
|
|
27
23
|
UseQueryOptions,
|
|
28
24
|
UseQueryResult,
|
|
29
25
|
UseSuspenseQueryOptions,
|
|
30
|
-
UseSuspenseQueryResult
|
|
31
|
-
} from
|
|
26
|
+
UseSuspenseQueryResult,
|
|
27
|
+
} from "@tanstack/react-query";
|
|
28
|
+
|
|
32
29
|
import type {
|
|
33
30
|
AsError,
|
|
34
31
|
ProductPatchBodyBody,
|
|
@@ -37,14 +34,15 @@ import type {
|
|
|
37
34
|
ProductsGetResponse,
|
|
38
35
|
ProductsGetTypesResponse,
|
|
39
36
|
UnitProductPostBodyBody,
|
|
40
|
-
UnitProductPostResponse
|
|
41
|
-
} from
|
|
42
|
-
import { customInstance } from '.././custom-instance';
|
|
43
|
-
import type { ErrorType } from '.././custom-instance';
|
|
44
|
-
|
|
37
|
+
UnitProductPostResponse,
|
|
38
|
+
} from "../account-server-api.schemas";
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
import { customInstance } from ".././custom-instance";
|
|
41
|
+
import type { ErrorType } from ".././custom-instance";
|
|
42
|
+
import { queryMutator } from ".././options-mutator";
|
|
43
|
+
import { mutationMutator } from ".././options-mutator";
|
|
47
44
|
|
|
45
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
48
|
* Gets Product Types you can purchase (subscribe to)
|
|
@@ -52,572 +50,890 @@ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
|
52
50
|
* @summary Gets all Product Types
|
|
53
51
|
*/
|
|
54
52
|
export const getProductTypes = (
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
options?: SecondParameter<typeof customInstance>,
|
|
54
|
+
signal?: AbortSignal,
|
|
57
55
|
) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
options);
|
|
64
|
-
}
|
|
65
|
-
|
|
56
|
+
return customInstance<ProductsGetTypesResponse>(
|
|
57
|
+
{ url: `/product-type`, method: "GET", signal },
|
|
58
|
+
options,
|
|
59
|
+
);
|
|
60
|
+
};
|
|
66
61
|
|
|
67
62
|
export const getGetProductTypesQueryKey = () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export
|
|
95
|
-
|
|
63
|
+
return [`/product-type`] as const;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const useGetProductTypesQueryOptions = <
|
|
67
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
68
|
+
TError = ErrorType<AsError | void>,
|
|
69
|
+
>(options?: {
|
|
70
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>>;
|
|
71
|
+
request?: SecondParameter<typeof customInstance>;
|
|
72
|
+
}) => {
|
|
73
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
74
|
+
|
|
75
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();
|
|
76
|
+
|
|
77
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({ signal }) =>
|
|
78
|
+
getProductTypes(requestOptions, signal);
|
|
79
|
+
|
|
80
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
81
|
+
|
|
82
|
+
return customOptions as UseQueryOptions<
|
|
83
|
+
Awaited<ReturnType<typeof getProductTypes>>,
|
|
84
|
+
TError,
|
|
85
|
+
TData
|
|
86
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type GetProductTypesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductTypes>>>;
|
|
90
|
+
export type GetProductTypesQueryError = ErrorType<AsError | void>;
|
|
91
|
+
|
|
92
|
+
export function useGetProductTypes<
|
|
93
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
94
|
+
TError = ErrorType<AsError | void>,
|
|
95
|
+
>(
|
|
96
|
+
options: {
|
|
97
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>> &
|
|
98
|
+
Pick<
|
|
96
99
|
DefinedInitialDataOptions<
|
|
97
100
|
Awaited<ReturnType<typeof getProductTypes>>,
|
|
98
101
|
TError,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
Awaited<ReturnType<typeof getProductTypes>>
|
|
103
|
+
>,
|
|
104
|
+
"initialData"
|
|
105
|
+
>;
|
|
106
|
+
request?: SecondParameter<typeof customInstance>;
|
|
107
|
+
},
|
|
108
|
+
queryClient?: QueryClient,
|
|
109
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
110
|
+
export function useGetProductTypes<
|
|
111
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
112
|
+
TError = ErrorType<AsError | void>,
|
|
113
|
+
>(
|
|
114
|
+
options?: {
|
|
115
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>> &
|
|
116
|
+
Pick<
|
|
106
117
|
UndefinedInitialDataOptions<
|
|
107
118
|
Awaited<ReturnType<typeof getProductTypes>>,
|
|
108
119
|
TError,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
Awaited<ReturnType<typeof getProductTypes>>
|
|
121
|
+
>,
|
|
122
|
+
"initialData"
|
|
123
|
+
>;
|
|
124
|
+
request?: SecondParameter<typeof customInstance>;
|
|
125
|
+
},
|
|
126
|
+
queryClient?: QueryClient,
|
|
127
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
128
|
+
export function useGetProductTypes<
|
|
129
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
130
|
+
TError = ErrorType<AsError | void>,
|
|
131
|
+
>(
|
|
132
|
+
options?: {
|
|
133
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>>;
|
|
134
|
+
request?: SecondParameter<typeof customInstance>;
|
|
135
|
+
},
|
|
136
|
+
queryClient?: QueryClient,
|
|
137
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
118
138
|
/**
|
|
119
139
|
* @summary Gets all Product Types
|
|
120
140
|
*/
|
|
121
141
|
|
|
122
|
-
export function useGetProductTypes<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
export function useGetProductTypes<
|
|
143
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
144
|
+
TError = ErrorType<AsError | void>,
|
|
145
|
+
>(
|
|
146
|
+
options?: {
|
|
147
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>>;
|
|
148
|
+
request?: SecondParameter<typeof customInstance>;
|
|
149
|
+
},
|
|
150
|
+
queryClient?: QueryClient,
|
|
151
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
152
|
+
const queryOptions = useGetProductTypesQueryOptions(options);
|
|
126
153
|
|
|
127
|
-
const
|
|
154
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
155
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
156
|
+
};
|
|
128
157
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
query.queryKey = queryOptions.queryKey ;
|
|
158
|
+
query.queryKey = queryOptions.queryKey;
|
|
132
159
|
|
|
133
160
|
return query;
|
|
134
161
|
}
|
|
135
162
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
export
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
export const useGetProductTypesSuspenseQueryOptions = <
|
|
164
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
165
|
+
TError = ErrorType<AsError | void>,
|
|
166
|
+
>(options?: {
|
|
167
|
+
query?: Partial<
|
|
168
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>
|
|
169
|
+
>;
|
|
170
|
+
request?: SecondParameter<typeof customInstance>;
|
|
171
|
+
}) => {
|
|
172
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
173
|
+
|
|
174
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();
|
|
175
|
+
|
|
176
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({ signal }) =>
|
|
177
|
+
getProductTypes(requestOptions, signal);
|
|
178
|
+
|
|
179
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
180
|
+
|
|
181
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
182
|
+
Awaited<ReturnType<typeof getProductTypes>>,
|
|
183
|
+
TError,
|
|
184
|
+
TData
|
|
185
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export type GetProductTypesSuspenseQueryResult = NonNullable<
|
|
189
|
+
Awaited<ReturnType<typeof getProductTypes>>
|
|
190
|
+
>;
|
|
191
|
+
export type GetProductTypesSuspenseQueryError = ErrorType<AsError | void>;
|
|
192
|
+
|
|
193
|
+
export function useGetProductTypesSuspense<
|
|
194
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
195
|
+
TError = ErrorType<AsError | void>,
|
|
196
|
+
>(
|
|
197
|
+
options: {
|
|
198
|
+
query: Partial<
|
|
199
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>
|
|
200
|
+
>;
|
|
201
|
+
request?: SecondParameter<typeof customInstance>;
|
|
202
|
+
},
|
|
203
|
+
queryClient?: QueryClient,
|
|
204
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
205
|
+
export function useGetProductTypesSuspense<
|
|
206
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
207
|
+
TError = ErrorType<AsError | void>,
|
|
208
|
+
>(
|
|
209
|
+
options?: {
|
|
210
|
+
query?: Partial<
|
|
211
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>
|
|
212
|
+
>;
|
|
213
|
+
request?: SecondParameter<typeof customInstance>;
|
|
214
|
+
},
|
|
215
|
+
queryClient?: QueryClient,
|
|
216
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
217
|
+
export function useGetProductTypesSuspense<
|
|
218
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
219
|
+
TError = ErrorType<AsError | void>,
|
|
220
|
+
>(
|
|
221
|
+
options?: {
|
|
222
|
+
query?: Partial<
|
|
223
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>
|
|
224
|
+
>;
|
|
225
|
+
request?: SecondParameter<typeof customInstance>;
|
|
226
|
+
},
|
|
227
|
+
queryClient?: QueryClient,
|
|
228
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
172
229
|
/**
|
|
173
230
|
* @summary Gets all Product Types
|
|
174
231
|
*/
|
|
175
232
|
|
|
176
|
-
export function useGetProductTypesSuspense<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
233
|
+
export function useGetProductTypesSuspense<
|
|
234
|
+
TData = Awaited<ReturnType<typeof getProductTypes>>,
|
|
235
|
+
TError = ErrorType<AsError | void>,
|
|
236
|
+
>(
|
|
237
|
+
options?: {
|
|
238
|
+
query?: Partial<
|
|
239
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>
|
|
240
|
+
>;
|
|
241
|
+
request?: SecondParameter<typeof customInstance>;
|
|
242
|
+
},
|
|
243
|
+
queryClient?: QueryClient,
|
|
244
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
245
|
+
const queryOptions = useGetProductTypesSuspenseQueryOptions(options);
|
|
246
|
+
|
|
247
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
248
|
+
TData,
|
|
249
|
+
TError
|
|
250
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
251
|
+
|
|
252
|
+
query.queryKey = queryOptions.queryKey;
|
|
186
253
|
|
|
187
254
|
return query;
|
|
188
255
|
}
|
|
189
256
|
|
|
190
|
-
|
|
191
|
-
|
|
192
257
|
/**
|
|
193
258
|
* The storage cost is returned along with its measurement units, typically a Coin value based on the the peak storage that was measured on each billable day.
|
|
194
259
|
|
|
195
260
|
* @summary Gets the default cross-product storage cost
|
|
196
261
|
*/
|
|
197
262
|
export const getProductDefaultStorageCost = (
|
|
198
|
-
|
|
199
|
-
|
|
263
|
+
options?: SecondParameter<typeof customInstance>,
|
|
264
|
+
signal?: AbortSignal,
|
|
200
265
|
) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
options);
|
|
207
|
-
}
|
|
208
|
-
|
|
266
|
+
return customInstance<ProductsGetDefaultStorageCost>(
|
|
267
|
+
{ url: `/product-default-storage-cost`, method: "GET", signal },
|
|
268
|
+
options,
|
|
269
|
+
);
|
|
270
|
+
};
|
|
209
271
|
|
|
210
272
|
export const getGetProductDefaultStorageCostQueryKey = () => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
273
|
+
return [`/product-default-storage-cost`] as const;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const useGetProductDefaultStorageCostQueryOptions = <
|
|
277
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
278
|
+
TError = ErrorType<AsError | void>,
|
|
279
|
+
>(options?: {
|
|
280
|
+
query?: Partial<
|
|
281
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
282
|
+
>;
|
|
283
|
+
request?: SecondParameter<typeof customInstance>;
|
|
284
|
+
}) => {
|
|
285
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
286
|
+
|
|
287
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();
|
|
288
|
+
|
|
289
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductDefaultStorageCost>>> = ({
|
|
290
|
+
signal,
|
|
291
|
+
}) => getProductDefaultStorageCost(requestOptions, signal);
|
|
292
|
+
|
|
293
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
294
|
+
|
|
295
|
+
return customOptions as UseQueryOptions<
|
|
296
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
297
|
+
TError,
|
|
298
|
+
TData
|
|
299
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export type GetProductDefaultStorageCostQueryResult = NonNullable<
|
|
303
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>
|
|
304
|
+
>;
|
|
305
|
+
export type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;
|
|
306
|
+
|
|
307
|
+
export function useGetProductDefaultStorageCost<
|
|
308
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
309
|
+
TError = ErrorType<AsError | void>,
|
|
310
|
+
>(
|
|
311
|
+
options: {
|
|
312
|
+
query: Partial<
|
|
313
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
314
|
+
> &
|
|
315
|
+
Pick<
|
|
239
316
|
DefinedInitialDataOptions<
|
|
240
317
|
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
241
318
|
TError,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
319
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>
|
|
320
|
+
>,
|
|
321
|
+
"initialData"
|
|
322
|
+
>;
|
|
323
|
+
request?: SecondParameter<typeof customInstance>;
|
|
324
|
+
},
|
|
325
|
+
queryClient?: QueryClient,
|
|
326
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
327
|
+
export function useGetProductDefaultStorageCost<
|
|
328
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
329
|
+
TError = ErrorType<AsError | void>,
|
|
330
|
+
>(
|
|
331
|
+
options?: {
|
|
332
|
+
query?: Partial<
|
|
333
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
334
|
+
> &
|
|
335
|
+
Pick<
|
|
249
336
|
UndefinedInitialDataOptions<
|
|
250
337
|
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
251
338
|
TError,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
339
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>
|
|
340
|
+
>,
|
|
341
|
+
"initialData"
|
|
342
|
+
>;
|
|
343
|
+
request?: SecondParameter<typeof customInstance>;
|
|
344
|
+
},
|
|
345
|
+
queryClient?: QueryClient,
|
|
346
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
347
|
+
export function useGetProductDefaultStorageCost<
|
|
348
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
349
|
+
TError = ErrorType<AsError | void>,
|
|
350
|
+
>(
|
|
351
|
+
options?: {
|
|
352
|
+
query?: Partial<
|
|
353
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
354
|
+
>;
|
|
355
|
+
request?: SecondParameter<typeof customInstance>;
|
|
356
|
+
},
|
|
357
|
+
queryClient?: QueryClient,
|
|
358
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
261
359
|
/**
|
|
262
360
|
* @summary Gets the default cross-product storage cost
|
|
263
361
|
*/
|
|
264
362
|
|
|
265
|
-
export function useGetProductDefaultStorageCost<
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
363
|
+
export function useGetProductDefaultStorageCost<
|
|
364
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
365
|
+
TError = ErrorType<AsError | void>,
|
|
366
|
+
>(
|
|
367
|
+
options?: {
|
|
368
|
+
query?: Partial<
|
|
369
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
370
|
+
>;
|
|
371
|
+
request?: SecondParameter<typeof customInstance>;
|
|
372
|
+
},
|
|
373
|
+
queryClient?: QueryClient,
|
|
374
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
375
|
+
const queryOptions = useGetProductDefaultStorageCostQueryOptions(options);
|
|
376
|
+
|
|
377
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
378
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
query.queryKey = queryOptions.queryKey;
|
|
275
382
|
|
|
276
383
|
return query;
|
|
277
384
|
}
|
|
278
385
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
386
|
+
export const useGetProductDefaultStorageCostSuspenseQueryOptions = <
|
|
387
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
388
|
+
TError = ErrorType<AsError | void>,
|
|
389
|
+
>(options?: {
|
|
390
|
+
query?: Partial<
|
|
391
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>
|
|
392
|
+
>;
|
|
393
|
+
request?: SecondParameter<typeof customInstance>;
|
|
394
|
+
}) => {
|
|
395
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
396
|
+
|
|
397
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();
|
|
398
|
+
|
|
399
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductDefaultStorageCost>>> = ({
|
|
400
|
+
signal,
|
|
401
|
+
}) => getProductDefaultStorageCost(requestOptions, signal);
|
|
402
|
+
|
|
403
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
404
|
+
|
|
405
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
406
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
407
|
+
TError,
|
|
408
|
+
TData
|
|
409
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export type GetProductDefaultStorageCostSuspenseQueryResult = NonNullable<
|
|
413
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>
|
|
414
|
+
>;
|
|
415
|
+
export type GetProductDefaultStorageCostSuspenseQueryError = ErrorType<AsError | void>;
|
|
416
|
+
|
|
417
|
+
export function useGetProductDefaultStorageCostSuspense<
|
|
418
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
419
|
+
TError = ErrorType<AsError | void>,
|
|
420
|
+
>(
|
|
421
|
+
options: {
|
|
422
|
+
query: Partial<
|
|
423
|
+
UseSuspenseQueryOptions<
|
|
424
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
425
|
+
TError,
|
|
426
|
+
TData
|
|
427
|
+
>
|
|
428
|
+
>;
|
|
429
|
+
request?: SecondParameter<typeof customInstance>;
|
|
430
|
+
},
|
|
431
|
+
queryClient?: QueryClient,
|
|
432
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
433
|
+
export function useGetProductDefaultStorageCostSuspense<
|
|
434
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
435
|
+
TError = ErrorType<AsError | void>,
|
|
436
|
+
>(
|
|
437
|
+
options?: {
|
|
438
|
+
query?: Partial<
|
|
439
|
+
UseSuspenseQueryOptions<
|
|
440
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
441
|
+
TError,
|
|
442
|
+
TData
|
|
443
|
+
>
|
|
444
|
+
>;
|
|
445
|
+
request?: SecondParameter<typeof customInstance>;
|
|
446
|
+
},
|
|
447
|
+
queryClient?: QueryClient,
|
|
448
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
449
|
+
export function useGetProductDefaultStorageCostSuspense<
|
|
450
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
451
|
+
TError = ErrorType<AsError | void>,
|
|
452
|
+
>(
|
|
453
|
+
options?: {
|
|
454
|
+
query?: Partial<
|
|
455
|
+
UseSuspenseQueryOptions<
|
|
456
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
457
|
+
TError,
|
|
458
|
+
TData
|
|
459
|
+
>
|
|
460
|
+
>;
|
|
461
|
+
request?: SecondParameter<typeof customInstance>;
|
|
462
|
+
},
|
|
463
|
+
queryClient?: QueryClient,
|
|
464
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
315
465
|
/**
|
|
316
466
|
* @summary Gets the default cross-product storage cost
|
|
317
467
|
*/
|
|
318
468
|
|
|
319
|
-
export function useGetProductDefaultStorageCostSuspense<
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
469
|
+
export function useGetProductDefaultStorageCostSuspense<
|
|
470
|
+
TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
471
|
+
TError = ErrorType<AsError | void>,
|
|
472
|
+
>(
|
|
473
|
+
options?: {
|
|
474
|
+
query?: Partial<
|
|
475
|
+
UseSuspenseQueryOptions<
|
|
476
|
+
Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
|
|
477
|
+
TError,
|
|
478
|
+
TData
|
|
479
|
+
>
|
|
480
|
+
>;
|
|
481
|
+
request?: SecondParameter<typeof customInstance>;
|
|
482
|
+
},
|
|
483
|
+
queryClient?: QueryClient,
|
|
484
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
485
|
+
const queryOptions = useGetProductDefaultStorageCostSuspenseQueryOptions(options);
|
|
486
|
+
|
|
487
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
488
|
+
TData,
|
|
489
|
+
TError
|
|
490
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
491
|
+
|
|
492
|
+
query.queryKey = queryOptions.queryKey;
|
|
329
493
|
|
|
330
494
|
return query;
|
|
331
495
|
}
|
|
332
496
|
|
|
333
|
-
|
|
334
|
-
|
|
335
497
|
/**
|
|
336
498
|
* Gets Products you have access to, across all **Units** and **Organisations**
|
|
337
499
|
|
|
338
500
|
* @summary Gets all Products
|
|
339
501
|
*/
|
|
340
502
|
export const getProducts = (
|
|
341
|
-
|
|
342
|
-
|
|
503
|
+
options?: SecondParameter<typeof customInstance>,
|
|
504
|
+
signal?: AbortSignal,
|
|
343
505
|
) => {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
return customInstance<ProductsGetResponse>(
|
|
347
|
-
{url: `/product`, method: 'GET', signal
|
|
348
|
-
},
|
|
349
|
-
options);
|
|
350
|
-
}
|
|
351
|
-
|
|
506
|
+
return customInstance<ProductsGetResponse>({ url: `/product`, method: "GET", signal }, options);
|
|
507
|
+
};
|
|
352
508
|
|
|
353
509
|
export const getGetProductsQueryKey = () => {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
export
|
|
381
|
-
|
|
510
|
+
return [`/product`] as const;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
export const useGetProductsQueryOptions = <
|
|
514
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
515
|
+
TError = ErrorType<AsError | void>,
|
|
516
|
+
>(options?: {
|
|
517
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>>;
|
|
518
|
+
request?: SecondParameter<typeof customInstance>;
|
|
519
|
+
}) => {
|
|
520
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
521
|
+
|
|
522
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();
|
|
523
|
+
|
|
524
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({ signal }) =>
|
|
525
|
+
getProducts(requestOptions, signal);
|
|
526
|
+
|
|
527
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
528
|
+
|
|
529
|
+
return customOptions as UseQueryOptions<
|
|
530
|
+
Awaited<ReturnType<typeof getProducts>>,
|
|
531
|
+
TError,
|
|
532
|
+
TData
|
|
533
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export type GetProductsQueryResult = NonNullable<Awaited<ReturnType<typeof getProducts>>>;
|
|
537
|
+
export type GetProductsQueryError = ErrorType<AsError | void>;
|
|
538
|
+
|
|
539
|
+
export function useGetProducts<
|
|
540
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
541
|
+
TError = ErrorType<AsError | void>,
|
|
542
|
+
>(
|
|
543
|
+
options: {
|
|
544
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>> &
|
|
545
|
+
Pick<
|
|
382
546
|
DefinedInitialDataOptions<
|
|
383
547
|
Awaited<ReturnType<typeof getProducts>>,
|
|
384
548
|
TError,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
549
|
+
Awaited<ReturnType<typeof getProducts>>
|
|
550
|
+
>,
|
|
551
|
+
"initialData"
|
|
552
|
+
>;
|
|
553
|
+
request?: SecondParameter<typeof customInstance>;
|
|
554
|
+
},
|
|
555
|
+
queryClient?: QueryClient,
|
|
556
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
557
|
+
export function useGetProducts<
|
|
558
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
559
|
+
TError = ErrorType<AsError | void>,
|
|
560
|
+
>(
|
|
561
|
+
options?: {
|
|
562
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>> &
|
|
563
|
+
Pick<
|
|
392
564
|
UndefinedInitialDataOptions<
|
|
393
565
|
Awaited<ReturnType<typeof getProducts>>,
|
|
394
566
|
TError,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
567
|
+
Awaited<ReturnType<typeof getProducts>>
|
|
568
|
+
>,
|
|
569
|
+
"initialData"
|
|
570
|
+
>;
|
|
571
|
+
request?: SecondParameter<typeof customInstance>;
|
|
572
|
+
},
|
|
573
|
+
queryClient?: QueryClient,
|
|
574
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
575
|
+
export function useGetProducts<
|
|
576
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
577
|
+
TError = ErrorType<AsError | void>,
|
|
578
|
+
>(
|
|
579
|
+
options?: {
|
|
580
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>>;
|
|
581
|
+
request?: SecondParameter<typeof customInstance>;
|
|
582
|
+
},
|
|
583
|
+
queryClient?: QueryClient,
|
|
584
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
404
585
|
/**
|
|
405
586
|
* @summary Gets all Products
|
|
406
587
|
*/
|
|
407
588
|
|
|
408
|
-
export function useGetProducts<
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
589
|
+
export function useGetProducts<
|
|
590
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
591
|
+
TError = ErrorType<AsError | void>,
|
|
592
|
+
>(
|
|
593
|
+
options?: {
|
|
594
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>>;
|
|
595
|
+
request?: SecondParameter<typeof customInstance>;
|
|
596
|
+
},
|
|
597
|
+
queryClient?: QueryClient,
|
|
598
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
599
|
+
const queryOptions = useGetProductsQueryOptions(options);
|
|
414
600
|
|
|
415
|
-
const query = useQuery(queryOptions) as
|
|
601
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
602
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
603
|
+
};
|
|
416
604
|
|
|
417
|
-
query.queryKey = queryOptions.queryKey
|
|
605
|
+
query.queryKey = queryOptions.queryKey;
|
|
418
606
|
|
|
419
607
|
return query;
|
|
420
608
|
}
|
|
421
609
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
export
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
610
|
+
export const useGetProductsSuspenseQueryOptions = <
|
|
611
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
612
|
+
TError = ErrorType<AsError | void>,
|
|
613
|
+
>(options?: {
|
|
614
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>>;
|
|
615
|
+
request?: SecondParameter<typeof customInstance>;
|
|
616
|
+
}) => {
|
|
617
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
618
|
+
|
|
619
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();
|
|
620
|
+
|
|
621
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({ signal }) =>
|
|
622
|
+
getProducts(requestOptions, signal);
|
|
623
|
+
|
|
624
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
625
|
+
|
|
626
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
627
|
+
Awaited<ReturnType<typeof getProducts>>,
|
|
628
|
+
TError,
|
|
629
|
+
TData
|
|
630
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export type GetProductsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getProducts>>>;
|
|
634
|
+
export type GetProductsSuspenseQueryError = ErrorType<AsError | void>;
|
|
635
|
+
|
|
636
|
+
export function useGetProductsSuspense<
|
|
637
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
638
|
+
TError = ErrorType<AsError | void>,
|
|
639
|
+
>(
|
|
640
|
+
options: {
|
|
641
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>>;
|
|
642
|
+
request?: SecondParameter<typeof customInstance>;
|
|
643
|
+
},
|
|
644
|
+
queryClient?: QueryClient,
|
|
645
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
646
|
+
export function useGetProductsSuspense<
|
|
647
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
648
|
+
TError = ErrorType<AsError | void>,
|
|
649
|
+
>(
|
|
650
|
+
options?: {
|
|
651
|
+
query?: Partial<
|
|
652
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>
|
|
653
|
+
>;
|
|
654
|
+
request?: SecondParameter<typeof customInstance>;
|
|
655
|
+
},
|
|
656
|
+
queryClient?: QueryClient,
|
|
657
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
658
|
+
export function useGetProductsSuspense<
|
|
659
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
660
|
+
TError = ErrorType<AsError | void>,
|
|
661
|
+
>(
|
|
662
|
+
options?: {
|
|
663
|
+
query?: Partial<
|
|
664
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>
|
|
665
|
+
>;
|
|
666
|
+
request?: SecondParameter<typeof customInstance>;
|
|
667
|
+
},
|
|
668
|
+
queryClient?: QueryClient,
|
|
669
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
458
670
|
/**
|
|
459
671
|
* @summary Gets all Products
|
|
460
672
|
*/
|
|
461
673
|
|
|
462
|
-
export function useGetProductsSuspense<
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
674
|
+
export function useGetProductsSuspense<
|
|
675
|
+
TData = Awaited<ReturnType<typeof getProducts>>,
|
|
676
|
+
TError = ErrorType<AsError | void>,
|
|
677
|
+
>(
|
|
678
|
+
options?: {
|
|
679
|
+
query?: Partial<
|
|
680
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>
|
|
681
|
+
>;
|
|
682
|
+
request?: SecondParameter<typeof customInstance>;
|
|
683
|
+
},
|
|
684
|
+
queryClient?: QueryClient,
|
|
685
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
686
|
+
const queryOptions = useGetProductsSuspenseQueryOptions(options);
|
|
687
|
+
|
|
688
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
689
|
+
TData,
|
|
690
|
+
TError
|
|
691
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
692
|
+
|
|
693
|
+
query.queryKey = queryOptions.queryKey;
|
|
472
694
|
|
|
473
695
|
return query;
|
|
474
696
|
}
|
|
475
697
|
|
|
476
|
-
|
|
477
|
-
|
|
478
698
|
/**
|
|
479
699
|
* Gets Products you have access to based on an **Organisation**
|
|
480
700
|
|
|
481
701
|
* @summary Gets Products for an Organisation
|
|
482
702
|
*/
|
|
483
703
|
export const getProductsForOrganisation = (
|
|
484
|
-
|
|
485
|
-
|
|
704
|
+
orgId: string,
|
|
705
|
+
options?: SecondParameter<typeof customInstance>,
|
|
706
|
+
signal?: AbortSignal,
|
|
486
707
|
) => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
708
|
+
return customInstance<ProductsGetResponse>(
|
|
709
|
+
{ url: `/product/organisation/${orgId}`, method: "GET", signal },
|
|
710
|
+
options,
|
|
711
|
+
);
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
export const getGetProductsForOrganisationQueryKey = (orgId: string) => {
|
|
715
|
+
return [`/product/organisation/${orgId}`] as const;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
export const useGetProductsForOrganisationQueryOptions = <
|
|
719
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
720
|
+
TError = ErrorType<void | AsError>,
|
|
721
|
+
>(
|
|
722
|
+
orgId: string,
|
|
723
|
+
options?: {
|
|
724
|
+
query?: Partial<
|
|
725
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
726
|
+
>;
|
|
727
|
+
request?: SecondParameter<typeof customInstance>;
|
|
728
|
+
},
|
|
502
729
|
) => {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
export type
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
export
|
|
524
|
-
|
|
730
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
731
|
+
|
|
732
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);
|
|
733
|
+
|
|
734
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForOrganisation>>> = ({
|
|
735
|
+
signal,
|
|
736
|
+
}) => getProductsForOrganisation(orgId, requestOptions, signal);
|
|
737
|
+
|
|
738
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
739
|
+
|
|
740
|
+
return customOptions as UseQueryOptions<
|
|
741
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
742
|
+
TError,
|
|
743
|
+
TData
|
|
744
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
export type GetProductsForOrganisationQueryResult = NonNullable<
|
|
748
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>
|
|
749
|
+
>;
|
|
750
|
+
export type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;
|
|
751
|
+
|
|
752
|
+
export function useGetProductsForOrganisation<
|
|
753
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
754
|
+
TError = ErrorType<void | AsError>,
|
|
755
|
+
>(
|
|
756
|
+
orgId: string,
|
|
757
|
+
options: {
|
|
758
|
+
query: Partial<
|
|
759
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
760
|
+
> &
|
|
761
|
+
Pick<
|
|
525
762
|
DefinedInitialDataOptions<
|
|
526
763
|
Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
527
764
|
TError,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
765
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>
|
|
766
|
+
>,
|
|
767
|
+
"initialData"
|
|
768
|
+
>;
|
|
769
|
+
request?: SecondParameter<typeof customInstance>;
|
|
770
|
+
},
|
|
771
|
+
queryClient?: QueryClient,
|
|
772
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
773
|
+
export function useGetProductsForOrganisation<
|
|
774
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
775
|
+
TError = ErrorType<void | AsError>,
|
|
776
|
+
>(
|
|
777
|
+
orgId: string,
|
|
778
|
+
options?: {
|
|
779
|
+
query?: Partial<
|
|
780
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
781
|
+
> &
|
|
782
|
+
Pick<
|
|
535
783
|
UndefinedInitialDataOptions<
|
|
536
784
|
Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
537
785
|
TError,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
786
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>
|
|
787
|
+
>,
|
|
788
|
+
"initialData"
|
|
789
|
+
>;
|
|
790
|
+
request?: SecondParameter<typeof customInstance>;
|
|
791
|
+
},
|
|
792
|
+
queryClient?: QueryClient,
|
|
793
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
794
|
+
export function useGetProductsForOrganisation<
|
|
795
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
796
|
+
TError = ErrorType<void | AsError>,
|
|
797
|
+
>(
|
|
798
|
+
orgId: string,
|
|
799
|
+
options?: {
|
|
800
|
+
query?: Partial<
|
|
801
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
802
|
+
>;
|
|
803
|
+
request?: SecondParameter<typeof customInstance>;
|
|
804
|
+
},
|
|
805
|
+
queryClient?: QueryClient,
|
|
806
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
547
807
|
/**
|
|
548
808
|
* @summary Gets Products for an Organisation
|
|
549
809
|
*/
|
|
550
810
|
|
|
551
|
-
export function useGetProductsForOrganisation<
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
811
|
+
export function useGetProductsForOrganisation<
|
|
812
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
813
|
+
TError = ErrorType<void | AsError>,
|
|
814
|
+
>(
|
|
815
|
+
orgId: string,
|
|
816
|
+
options?: {
|
|
817
|
+
query?: Partial<
|
|
818
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
819
|
+
>;
|
|
820
|
+
request?: SecondParameter<typeof customInstance>;
|
|
821
|
+
},
|
|
822
|
+
queryClient?: QueryClient,
|
|
823
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
824
|
+
const queryOptions = useGetProductsForOrganisationQueryOptions(orgId, options);
|
|
825
|
+
|
|
826
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
827
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
query.queryKey = queryOptions.queryKey;
|
|
561
831
|
|
|
562
832
|
return query;
|
|
563
833
|
}
|
|
564
834
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
835
|
+
export const useGetProductsForOrganisationSuspenseQueryOptions = <
|
|
836
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
837
|
+
TError = ErrorType<void | AsError>,
|
|
838
|
+
>(
|
|
839
|
+
orgId: string,
|
|
840
|
+
options?: {
|
|
841
|
+
query?: Partial<
|
|
842
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
843
|
+
>;
|
|
844
|
+
request?: SecondParameter<typeof customInstance>;
|
|
845
|
+
},
|
|
568
846
|
) => {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
export type
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
export
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
847
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
848
|
+
|
|
849
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);
|
|
850
|
+
|
|
851
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForOrganisation>>> = ({
|
|
852
|
+
signal,
|
|
853
|
+
}) => getProductsForOrganisation(orgId, requestOptions, signal);
|
|
854
|
+
|
|
855
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
856
|
+
|
|
857
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
858
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
859
|
+
TError,
|
|
860
|
+
TData
|
|
861
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
export type GetProductsForOrganisationSuspenseQueryResult = NonNullable<
|
|
865
|
+
Awaited<ReturnType<typeof getProductsForOrganisation>>
|
|
866
|
+
>;
|
|
867
|
+
export type GetProductsForOrganisationSuspenseQueryError = ErrorType<void | AsError>;
|
|
868
|
+
|
|
869
|
+
export function useGetProductsForOrganisationSuspense<
|
|
870
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
871
|
+
TError = ErrorType<void | AsError>,
|
|
872
|
+
>(
|
|
873
|
+
orgId: string,
|
|
874
|
+
options: {
|
|
875
|
+
query: Partial<
|
|
876
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
877
|
+
>;
|
|
878
|
+
request?: SecondParameter<typeof customInstance>;
|
|
879
|
+
},
|
|
880
|
+
queryClient?: QueryClient,
|
|
881
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
882
|
+
export function useGetProductsForOrganisationSuspense<
|
|
883
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
884
|
+
TError = ErrorType<void | AsError>,
|
|
885
|
+
>(
|
|
886
|
+
orgId: string,
|
|
887
|
+
options?: {
|
|
888
|
+
query?: Partial<
|
|
889
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
890
|
+
>;
|
|
891
|
+
request?: SecondParameter<typeof customInstance>;
|
|
892
|
+
},
|
|
893
|
+
queryClient?: QueryClient,
|
|
894
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
895
|
+
export function useGetProductsForOrganisationSuspense<
|
|
896
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
897
|
+
TError = ErrorType<void | AsError>,
|
|
898
|
+
>(
|
|
899
|
+
orgId: string,
|
|
900
|
+
options?: {
|
|
901
|
+
query?: Partial<
|
|
902
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
903
|
+
>;
|
|
904
|
+
request?: SecondParameter<typeof customInstance>;
|
|
905
|
+
},
|
|
906
|
+
queryClient?: QueryClient,
|
|
907
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
601
908
|
/**
|
|
602
909
|
* @summary Gets Products for an Organisation
|
|
603
910
|
*/
|
|
604
911
|
|
|
605
|
-
export function useGetProductsForOrganisationSuspense<
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
912
|
+
export function useGetProductsForOrganisationSuspense<
|
|
913
|
+
TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
|
|
914
|
+
TError = ErrorType<void | AsError>,
|
|
915
|
+
>(
|
|
916
|
+
orgId: string,
|
|
917
|
+
options?: {
|
|
918
|
+
query?: Partial<
|
|
919
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>
|
|
920
|
+
>;
|
|
921
|
+
request?: SecondParameter<typeof customInstance>;
|
|
922
|
+
},
|
|
923
|
+
queryClient?: QueryClient,
|
|
924
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
925
|
+
const queryOptions = useGetProductsForOrganisationSuspenseQueryOptions(orgId, options);
|
|
926
|
+
|
|
927
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
928
|
+
TData,
|
|
929
|
+
TError
|
|
930
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
931
|
+
|
|
932
|
+
query.queryKey = queryOptions.queryKey;
|
|
615
933
|
|
|
616
934
|
return query;
|
|
617
935
|
}
|
|
618
936
|
|
|
619
|
-
|
|
620
|
-
|
|
621
937
|
/**
|
|
622
938
|
* Products are **Subscriptions** that you create in a **Unit** that allow you to use services provided by a **Merchant**. To create products you need to be a member of the **Unit** or the Unit's **Organisation**.
|
|
623
939
|
|
|
@@ -627,420 +943,615 @@ The `DATA_MANAGER_STORAGE_SUBSCRIPTION` **type** needs a **name**, an **allowanc
|
|
|
627
943
|
|
|
628
944
|
The `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` **type** needs a **name**, and a **flavour**. The **flavour**, a string, should typically be one of `EVALUATION`, `BRONZE`, `SILVER` or `GOLD`.
|
|
629
945
|
|
|
630
|
-
Users who are **Evaluators** can only create products in their Personal Unit, and where products support flavours, are restricted to `EVALUATION
|
|
946
|
+
Users who are **Evaluators** can only create products in their Personal Unit, and where products support flavours, are restricted to `EVALUATION` flavours .
|
|
631
947
|
|
|
632
948
|
* @summary Creates a Product for a Unit
|
|
633
949
|
*/
|
|
634
950
|
export const createUnitProduct = (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
951
|
+
unitId: string,
|
|
952
|
+
unitProductPostBodyBody: UnitProductPostBodyBody,
|
|
953
|
+
options?: SecondParameter<typeof customInstance>,
|
|
954
|
+
signal?: AbortSignal,
|
|
638
955
|
) => {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
headers: {
|
|
644
|
-
data: unitProductPostBodyBody,
|
|
956
|
+
return customInstance<UnitProductPostResponse>(
|
|
957
|
+
{
|
|
958
|
+
url: `/product/unit/${unitId}`,
|
|
959
|
+
method: "POST",
|
|
960
|
+
headers: { "Content-Type": "application/json" },
|
|
961
|
+
data: unitProductPostBodyBody,
|
|
962
|
+
signal,
|
|
645
963
|
},
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
964
|
+
options,
|
|
965
|
+
);
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
export const useCreateUnitProductMutationOptions = <
|
|
969
|
+
TError = ErrorType<AsError | void>,
|
|
970
|
+
TContext = unknown,
|
|
971
|
+
>(options?: {
|
|
972
|
+
mutation?: UseMutationOptions<
|
|
973
|
+
Awaited<ReturnType<typeof createUnitProduct>>,
|
|
974
|
+
TError,
|
|
975
|
+
{ unitId: string; data: UnitProductPostBodyBody },
|
|
976
|
+
TContext
|
|
977
|
+
>;
|
|
978
|
+
request?: SecondParameter<typeof customInstance>;
|
|
979
|
+
}): UseMutationOptions<
|
|
980
|
+
Awaited<ReturnType<typeof createUnitProduct>>,
|
|
981
|
+
TError,
|
|
982
|
+
{ unitId: string; data: UnitProductPostBodyBody },
|
|
983
|
+
TContext
|
|
984
|
+
> => {
|
|
985
|
+
const mutationKey = ["createUnitProduct"];
|
|
986
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
987
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
988
|
+
? options
|
|
989
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
990
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
991
|
+
|
|
992
|
+
const mutationFn: MutationFunction<
|
|
993
|
+
Awaited<ReturnType<typeof createUnitProduct>>,
|
|
994
|
+
{ unitId: string; data: UnitProductPostBodyBody }
|
|
995
|
+
> = (props) => {
|
|
996
|
+
const { unitId, data } = props ?? {};
|
|
997
|
+
|
|
998
|
+
return createUnitProduct(unitId, data, requestOptions);
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
1002
|
+
|
|
1003
|
+
return customOptions;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
export type CreateUnitProductMutationResult = NonNullable<
|
|
1007
|
+
Awaited<ReturnType<typeof createUnitProduct>>
|
|
1008
|
+
>;
|
|
1009
|
+
export type CreateUnitProductMutationBody = UnitProductPostBodyBody;
|
|
1010
|
+
export type CreateUnitProductMutationError = ErrorType<AsError | void>;
|
|
663
1011
|
|
|
664
|
-
|
|
665
|
-
const {unitId,data} = props ?? {};
|
|
666
|
-
|
|
667
|
-
return createUnitProduct(unitId,data,requestOptions)
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext>}
|
|
674
|
-
|
|
675
|
-
export type CreateUnitProductMutationResult = NonNullable<Awaited<ReturnType<typeof createUnitProduct>>>
|
|
676
|
-
export type CreateUnitProductMutationBody = UnitProductPostBodyBody
|
|
677
|
-
export type CreateUnitProductMutationError = ErrorType<AsError | void>
|
|
678
|
-
|
|
679
|
-
/**
|
|
1012
|
+
/**
|
|
680
1013
|
* @summary Creates a Product for a Unit
|
|
681
1014
|
*/
|
|
682
|
-
export const useCreateUnitProduct = <
|
|
683
|
-
|
|
1015
|
+
export const useCreateUnitProduct = <TError = ErrorType<AsError | void>, TContext = unknown>(
|
|
1016
|
+
options?: {
|
|
1017
|
+
mutation?: UseMutationOptions<
|
|
1018
|
+
Awaited<ReturnType<typeof createUnitProduct>>,
|
|
1019
|
+
TError,
|
|
1020
|
+
{ unitId: string; data: UnitProductPostBodyBody },
|
|
1021
|
+
TContext
|
|
1022
|
+
>;
|
|
1023
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1024
|
+
},
|
|
1025
|
+
queryClient?: QueryClient,
|
|
684
1026
|
): UseMutationResult<
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
/**
|
|
1027
|
+
Awaited<ReturnType<typeof createUnitProduct>>,
|
|
1028
|
+
TError,
|
|
1029
|
+
{ unitId: string; data: UnitProductPostBodyBody },
|
|
1030
|
+
TContext
|
|
1031
|
+
> => {
|
|
1032
|
+
const mutationOptions = useCreateUnitProductMutationOptions(options);
|
|
1033
|
+
|
|
1034
|
+
return useMutation(mutationOptions, queryClient);
|
|
1035
|
+
};
|
|
1036
|
+
/**
|
|
696
1037
|
* Gets products you have access to based on an Organisational **Unit**
|
|
697
1038
|
|
|
698
1039
|
* @summary Gets Products for an Organisational Unit
|
|
699
1040
|
*/
|
|
700
1041
|
export const getProductsForUnit = (
|
|
701
|
-
|
|
702
|
-
|
|
1042
|
+
unitId: string,
|
|
1043
|
+
options?: SecondParameter<typeof customInstance>,
|
|
1044
|
+
signal?: AbortSignal,
|
|
703
1045
|
) => {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
1046
|
+
return customInstance<ProductsGetResponse>(
|
|
1047
|
+
{ url: `/product/unit/${unitId}`, method: "GET", signal },
|
|
1048
|
+
options,
|
|
1049
|
+
);
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
export const getGetProductsForUnitQueryKey = (unitId: string) => {
|
|
1053
|
+
return [`/product/unit/${unitId}`] as const;
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
export const useGetProductsForUnitQueryOptions = <
|
|
1057
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1058
|
+
TError = ErrorType<void | AsError>,
|
|
1059
|
+
>(
|
|
1060
|
+
unitId: string,
|
|
1061
|
+
options?: {
|
|
1062
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>>;
|
|
1063
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1064
|
+
},
|
|
719
1065
|
) => {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
export type GetProductsForUnitQueryResult = NonNullable<
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
1066
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1067
|
+
|
|
1068
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);
|
|
1069
|
+
|
|
1070
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForUnit>>> = ({ signal }) =>
|
|
1071
|
+
getProductsForUnit(unitId, requestOptions, signal);
|
|
1072
|
+
|
|
1073
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
1074
|
+
|
|
1075
|
+
return customOptions as UseQueryOptions<
|
|
1076
|
+
Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1077
|
+
TError,
|
|
1078
|
+
TData
|
|
1079
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
export type GetProductsForUnitQueryResult = NonNullable<
|
|
1083
|
+
Awaited<ReturnType<typeof getProductsForUnit>>
|
|
1084
|
+
>;
|
|
1085
|
+
export type GetProductsForUnitQueryError = ErrorType<void | AsError>;
|
|
1086
|
+
|
|
1087
|
+
export function useGetProductsForUnit<
|
|
1088
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1089
|
+
TError = ErrorType<void | AsError>,
|
|
1090
|
+
>(
|
|
1091
|
+
unitId: string,
|
|
1092
|
+
options: {
|
|
1093
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>> &
|
|
1094
|
+
Pick<
|
|
742
1095
|
DefinedInitialDataOptions<
|
|
743
1096
|
Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
744
1097
|
TError,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1098
|
+
Awaited<ReturnType<typeof getProductsForUnit>>
|
|
1099
|
+
>,
|
|
1100
|
+
"initialData"
|
|
1101
|
+
>;
|
|
1102
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1103
|
+
},
|
|
1104
|
+
queryClient?: QueryClient,
|
|
1105
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1106
|
+
export function useGetProductsForUnit<
|
|
1107
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1108
|
+
TError = ErrorType<void | AsError>,
|
|
1109
|
+
>(
|
|
1110
|
+
unitId: string,
|
|
1111
|
+
options?: {
|
|
1112
|
+
query?: Partial<
|
|
1113
|
+
UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1114
|
+
> &
|
|
1115
|
+
Pick<
|
|
752
1116
|
UndefinedInitialDataOptions<
|
|
753
1117
|
Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
754
1118
|
TError,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1119
|
+
Awaited<ReturnType<typeof getProductsForUnit>>
|
|
1120
|
+
>,
|
|
1121
|
+
"initialData"
|
|
1122
|
+
>;
|
|
1123
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1124
|
+
},
|
|
1125
|
+
queryClient?: QueryClient,
|
|
1126
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1127
|
+
export function useGetProductsForUnit<
|
|
1128
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1129
|
+
TError = ErrorType<void | AsError>,
|
|
1130
|
+
>(
|
|
1131
|
+
unitId: string,
|
|
1132
|
+
options?: {
|
|
1133
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>>;
|
|
1134
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1135
|
+
},
|
|
1136
|
+
queryClient?: QueryClient,
|
|
1137
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
764
1138
|
/**
|
|
765
1139
|
* @summary Gets Products for an Organisational Unit
|
|
766
1140
|
*/
|
|
767
1141
|
|
|
768
|
-
export function useGetProductsForUnit<
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1142
|
+
export function useGetProductsForUnit<
|
|
1143
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1144
|
+
TError = ErrorType<void | AsError>,
|
|
1145
|
+
>(
|
|
1146
|
+
unitId: string,
|
|
1147
|
+
options?: {
|
|
1148
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>>;
|
|
1149
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1150
|
+
},
|
|
1151
|
+
queryClient?: QueryClient,
|
|
1152
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1153
|
+
const queryOptions = useGetProductsForUnitQueryOptions(unitId, options);
|
|
1154
|
+
|
|
1155
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
1156
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
query.queryKey = queryOptions.queryKey;
|
|
778
1160
|
|
|
779
1161
|
return query;
|
|
780
1162
|
}
|
|
781
1163
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1164
|
+
export const useGetProductsForUnitSuspenseQueryOptions = <
|
|
1165
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1166
|
+
TError = ErrorType<void | AsError>,
|
|
1167
|
+
>(
|
|
1168
|
+
unitId: string,
|
|
1169
|
+
options?: {
|
|
1170
|
+
query?: Partial<
|
|
1171
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1172
|
+
>;
|
|
1173
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1174
|
+
},
|
|
785
1175
|
) => {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
export type GetProductsForUnitSuspenseQueryResult = NonNullable<
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1176
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1177
|
+
|
|
1178
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);
|
|
1179
|
+
|
|
1180
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForUnit>>> = ({ signal }) =>
|
|
1181
|
+
getProductsForUnit(unitId, requestOptions, signal);
|
|
1182
|
+
|
|
1183
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
1184
|
+
|
|
1185
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
1186
|
+
Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1187
|
+
TError,
|
|
1188
|
+
TData
|
|
1189
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
export type GetProductsForUnitSuspenseQueryResult = NonNullable<
|
|
1193
|
+
Awaited<ReturnType<typeof getProductsForUnit>>
|
|
1194
|
+
>;
|
|
1195
|
+
export type GetProductsForUnitSuspenseQueryError = ErrorType<void | AsError>;
|
|
1196
|
+
|
|
1197
|
+
export function useGetProductsForUnitSuspense<
|
|
1198
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1199
|
+
TError = ErrorType<void | AsError>,
|
|
1200
|
+
>(
|
|
1201
|
+
unitId: string,
|
|
1202
|
+
options: {
|
|
1203
|
+
query: Partial<
|
|
1204
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1205
|
+
>;
|
|
1206
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1207
|
+
},
|
|
1208
|
+
queryClient?: QueryClient,
|
|
1209
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1210
|
+
export function useGetProductsForUnitSuspense<
|
|
1211
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1212
|
+
TError = ErrorType<void | AsError>,
|
|
1213
|
+
>(
|
|
1214
|
+
unitId: string,
|
|
1215
|
+
options?: {
|
|
1216
|
+
query?: Partial<
|
|
1217
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1218
|
+
>;
|
|
1219
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1220
|
+
},
|
|
1221
|
+
queryClient?: QueryClient,
|
|
1222
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1223
|
+
export function useGetProductsForUnitSuspense<
|
|
1224
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1225
|
+
TError = ErrorType<void | AsError>,
|
|
1226
|
+
>(
|
|
1227
|
+
unitId: string,
|
|
1228
|
+
options?: {
|
|
1229
|
+
query?: Partial<
|
|
1230
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1231
|
+
>;
|
|
1232
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1233
|
+
},
|
|
1234
|
+
queryClient?: QueryClient,
|
|
1235
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
818
1236
|
/**
|
|
819
1237
|
* @summary Gets Products for an Organisational Unit
|
|
820
1238
|
*/
|
|
821
1239
|
|
|
822
|
-
export function useGetProductsForUnitSuspense<
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1240
|
+
export function useGetProductsForUnitSuspense<
|
|
1241
|
+
TData = Awaited<ReturnType<typeof getProductsForUnit>>,
|
|
1242
|
+
TError = ErrorType<void | AsError>,
|
|
1243
|
+
>(
|
|
1244
|
+
unitId: string,
|
|
1245
|
+
options?: {
|
|
1246
|
+
query?: Partial<
|
|
1247
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>
|
|
1248
|
+
>;
|
|
1249
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1250
|
+
},
|
|
1251
|
+
queryClient?: QueryClient,
|
|
1252
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1253
|
+
const queryOptions = useGetProductsForUnitSuspenseQueryOptions(unitId, options);
|
|
1254
|
+
|
|
1255
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
1256
|
+
TData,
|
|
1257
|
+
TError
|
|
1258
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1259
|
+
|
|
1260
|
+
query.queryKey = queryOptions.queryKey;
|
|
832
1261
|
|
|
833
1262
|
return query;
|
|
834
1263
|
}
|
|
835
1264
|
|
|
836
|
-
|
|
837
|
-
|
|
838
1265
|
/**
|
|
839
1266
|
* Gets details of a specific Product that you have access to.
|
|
840
1267
|
|
|
841
1268
|
* @summary Gets a Product
|
|
842
1269
|
*/
|
|
843
1270
|
export const getProduct = (
|
|
844
|
-
|
|
845
|
-
|
|
1271
|
+
productId: string,
|
|
1272
|
+
options?: SecondParameter<typeof customInstance>,
|
|
1273
|
+
signal?: AbortSignal,
|
|
846
1274
|
) => {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1275
|
+
return customInstance<ProductUnitGetResponse>(
|
|
1276
|
+
{ url: `/product/${productId}`, method: "GET", signal },
|
|
1277
|
+
options,
|
|
1278
|
+
);
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
export const getGetProductQueryKey = (productId: string) => {
|
|
1282
|
+
return [`/product/${productId}`] as const;
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1285
|
+
export const useGetProductQueryOptions = <
|
|
1286
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1287
|
+
TError = ErrorType<AsError | void>,
|
|
1288
|
+
>(
|
|
1289
|
+
productId: string,
|
|
1290
|
+
options?: {
|
|
1291
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1292
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1293
|
+
},
|
|
862
1294
|
) => {
|
|
1295
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
863
1296
|
|
|
864
|
-
const
|
|
1297
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);
|
|
865
1298
|
|
|
866
|
-
const
|
|
1299
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({ signal }) =>
|
|
1300
|
+
getProduct(productId, requestOptions, signal);
|
|
867
1301
|
|
|
868
|
-
|
|
1302
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
869
1303
|
|
|
870
|
-
|
|
1304
|
+
return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {
|
|
1305
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
1306
|
+
};
|
|
1307
|
+
};
|
|
871
1308
|
|
|
872
|
-
|
|
1309
|
+
export type GetProductQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>;
|
|
1310
|
+
export type GetProductQueryError = ErrorType<AsError | void>;
|
|
873
1311
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
export function useGetProduct<TData = Awaited<ReturnType<typeof getProduct>>, TError = ErrorType<AsError | void>>(
|
|
884
|
-
productId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>> & Pick<
|
|
1312
|
+
export function useGetProduct<
|
|
1313
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1314
|
+
TError = ErrorType<AsError | void>,
|
|
1315
|
+
>(
|
|
1316
|
+
productId: string,
|
|
1317
|
+
options: {
|
|
1318
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>> &
|
|
1319
|
+
Pick<
|
|
885
1320
|
DefinedInitialDataOptions<
|
|
886
1321
|
Awaited<ReturnType<typeof getProduct>>,
|
|
887
1322
|
TError,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1323
|
+
Awaited<ReturnType<typeof getProduct>>
|
|
1324
|
+
>,
|
|
1325
|
+
"initialData"
|
|
1326
|
+
>;
|
|
1327
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1328
|
+
},
|
|
1329
|
+
queryClient?: QueryClient,
|
|
1330
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1331
|
+
export function useGetProduct<
|
|
1332
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1333
|
+
TError = ErrorType<AsError | void>,
|
|
1334
|
+
>(
|
|
1335
|
+
productId: string,
|
|
1336
|
+
options?: {
|
|
1337
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>> &
|
|
1338
|
+
Pick<
|
|
895
1339
|
UndefinedInitialDataOptions<
|
|
896
1340
|
Awaited<ReturnType<typeof getProduct>>,
|
|
897
1341
|
TError,
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1342
|
+
Awaited<ReturnType<typeof getProduct>>
|
|
1343
|
+
>,
|
|
1344
|
+
"initialData"
|
|
1345
|
+
>;
|
|
1346
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1347
|
+
},
|
|
1348
|
+
queryClient?: QueryClient,
|
|
1349
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1350
|
+
export function useGetProduct<
|
|
1351
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1352
|
+
TError = ErrorType<AsError | void>,
|
|
1353
|
+
>(
|
|
1354
|
+
productId: string,
|
|
1355
|
+
options?: {
|
|
1356
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1357
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1358
|
+
},
|
|
1359
|
+
queryClient?: QueryClient,
|
|
1360
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
907
1361
|
/**
|
|
908
1362
|
* @summary Gets a Product
|
|
909
1363
|
*/
|
|
910
1364
|
|
|
911
|
-
export function useGetProduct<
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1365
|
+
export function useGetProduct<
|
|
1366
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1367
|
+
TError = ErrorType<AsError | void>,
|
|
1368
|
+
>(
|
|
1369
|
+
productId: string,
|
|
1370
|
+
options?: {
|
|
1371
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1372
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1373
|
+
},
|
|
1374
|
+
queryClient?: QueryClient,
|
|
1375
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1376
|
+
const queryOptions = useGetProductQueryOptions(productId, options);
|
|
1377
|
+
|
|
1378
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
1379
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
query.queryKey = queryOptions.queryKey;
|
|
921
1383
|
|
|
922
1384
|
return query;
|
|
923
1385
|
}
|
|
924
1386
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1387
|
+
export const useGetProductSuspenseQueryOptions = <
|
|
1388
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1389
|
+
TError = ErrorType<AsError | void>,
|
|
1390
|
+
>(
|
|
1391
|
+
productId: string,
|
|
1392
|
+
options?: {
|
|
1393
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1394
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1395
|
+
},
|
|
928
1396
|
) => {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
export type GetProductSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct
|
|
946
|
-
export type GetProductSuspenseQueryError = ErrorType<AsError | void
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1397
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1398
|
+
|
|
1399
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);
|
|
1400
|
+
|
|
1401
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({ signal }) =>
|
|
1402
|
+
getProduct(productId, requestOptions, signal);
|
|
1403
|
+
|
|
1404
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
1405
|
+
|
|
1406
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
1407
|
+
Awaited<ReturnType<typeof getProduct>>,
|
|
1408
|
+
TError,
|
|
1409
|
+
TData
|
|
1410
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
export type GetProductSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>;
|
|
1414
|
+
export type GetProductSuspenseQueryError = ErrorType<AsError | void>;
|
|
1415
|
+
|
|
1416
|
+
export function useGetProductSuspense<
|
|
1417
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1418
|
+
TError = ErrorType<AsError | void>,
|
|
1419
|
+
>(
|
|
1420
|
+
productId: string,
|
|
1421
|
+
options: {
|
|
1422
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1423
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1424
|
+
},
|
|
1425
|
+
queryClient?: QueryClient,
|
|
1426
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1427
|
+
export function useGetProductSuspense<
|
|
1428
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1429
|
+
TError = ErrorType<AsError | void>,
|
|
1430
|
+
>(
|
|
1431
|
+
productId: string,
|
|
1432
|
+
options?: {
|
|
1433
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1434
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1435
|
+
},
|
|
1436
|
+
queryClient?: QueryClient,
|
|
1437
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1438
|
+
export function useGetProductSuspense<
|
|
1439
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1440
|
+
TError = ErrorType<AsError | void>,
|
|
1441
|
+
>(
|
|
1442
|
+
productId: string,
|
|
1443
|
+
options?: {
|
|
1444
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1445
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1446
|
+
},
|
|
1447
|
+
queryClient?: QueryClient,
|
|
1448
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
961
1449
|
/**
|
|
962
1450
|
* @summary Gets a Product
|
|
963
1451
|
*/
|
|
964
1452
|
|
|
965
|
-
export function useGetProductSuspense<
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1453
|
+
export function useGetProductSuspense<
|
|
1454
|
+
TData = Awaited<ReturnType<typeof getProduct>>,
|
|
1455
|
+
TError = ErrorType<AsError | void>,
|
|
1456
|
+
>(
|
|
1457
|
+
productId: string,
|
|
1458
|
+
options?: {
|
|
1459
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>>;
|
|
1460
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1461
|
+
},
|
|
1462
|
+
queryClient?: QueryClient,
|
|
1463
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1464
|
+
const queryOptions = useGetProductSuspenseQueryOptions(productId, options);
|
|
1465
|
+
|
|
1466
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
1467
|
+
TData,
|
|
1468
|
+
TError
|
|
1469
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1470
|
+
|
|
1471
|
+
query.queryKey = queryOptions.queryKey;
|
|
975
1472
|
|
|
976
1473
|
return query;
|
|
977
1474
|
}
|
|
978
1475
|
|
|
979
|
-
|
|
980
|
-
|
|
981
1476
|
/**
|
|
982
1477
|
* You need access to the Product and, if the Product is *claimable* the claim must be removed before the Product can be removed. An example claimable Product is a `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` where the *claimable* commodity is a Data Manager **Project**. In this case you will need to delete the Data Manager **Project** before you can delete the Account Server **Product**.
|
|
983
1478
|
|
|
984
1479
|
* @summary Deletes an existing Product
|
|
985
1480
|
*/
|
|
986
1481
|
export const deleteProduct = (
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
return customInstance<void>(
|
|
992
|
-
{url: `/product/${productId}`, method: 'DELETE'
|
|
993
|
-
},
|
|
994
|
-
options);
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
export const getDeleteProductMutationOptions = <TData = Awaited<ReturnType<typeof deleteProduct>>, TError = ErrorType<void | AsError>,
|
|
1000
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{productId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
1482
|
+
productId: string,
|
|
1483
|
+
options?: SecondParameter<typeof customInstance>,
|
|
1001
1484
|
) => {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1485
|
+
return customInstance<void>({ url: `/product/${productId}`, method: "DELETE" }, options);
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
export const useDeleteProductMutationOptions = <
|
|
1489
|
+
TError = ErrorType<void | AsError>,
|
|
1490
|
+
TContext = unknown,
|
|
1491
|
+
>(options?: {
|
|
1492
|
+
mutation?: UseMutationOptions<
|
|
1493
|
+
Awaited<ReturnType<typeof deleteProduct>>,
|
|
1494
|
+
TError,
|
|
1495
|
+
{ productId: string },
|
|
1496
|
+
TContext
|
|
1497
|
+
>;
|
|
1498
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1499
|
+
}): UseMutationOptions<
|
|
1500
|
+
Awaited<ReturnType<typeof deleteProduct>>,
|
|
1501
|
+
TError,
|
|
1502
|
+
{ productId: string },
|
|
1503
|
+
TContext
|
|
1504
|
+
> => {
|
|
1505
|
+
const mutationKey = ["deleteProduct"];
|
|
1506
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
1507
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
1508
|
+
? options
|
|
1509
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
1510
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
1511
|
+
|
|
1512
|
+
const mutationFn: MutationFunction<
|
|
1513
|
+
Awaited<ReturnType<typeof deleteProduct>>,
|
|
1514
|
+
{ productId: string }
|
|
1515
|
+
> = (props) => {
|
|
1516
|
+
const { productId } = props ?? {};
|
|
1517
|
+
|
|
1518
|
+
return deleteProduct(productId, requestOptions);
|
|
1519
|
+
};
|
|
1520
|
+
|
|
1521
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
1522
|
+
|
|
1523
|
+
return customOptions;
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
export type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>;
|
|
1527
|
+
|
|
1528
|
+
export type DeleteProductMutationError = ErrorType<void | AsError>;
|
|
1010
1529
|
|
|
1011
|
-
|
|
1012
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteProduct>>, {productId: string}> = (props) => {
|
|
1013
|
-
const {productId} = props ?? {};
|
|
1014
|
-
|
|
1015
|
-
return deleteProduct(productId,requestOptions)
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{productId: string}, TContext>}
|
|
1022
|
-
|
|
1023
|
-
export type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>
|
|
1024
|
-
|
|
1025
|
-
export type DeleteProductMutationError = ErrorType<void | AsError>
|
|
1026
|
-
|
|
1027
|
-
/**
|
|
1530
|
+
/**
|
|
1028
1531
|
* @summary Deletes an existing Product
|
|
1029
1532
|
*/
|
|
1030
|
-
export const useDeleteProduct = <
|
|
1031
|
-
|
|
1533
|
+
export const useDeleteProduct = <TError = ErrorType<void | AsError>, TContext = unknown>(
|
|
1534
|
+
options?: {
|
|
1535
|
+
mutation?: UseMutationOptions<
|
|
1536
|
+
Awaited<ReturnType<typeof deleteProduct>>,
|
|
1537
|
+
TError,
|
|
1538
|
+
{ productId: string },
|
|
1539
|
+
TContext
|
|
1540
|
+
>;
|
|
1541
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1542
|
+
},
|
|
1543
|
+
queryClient?: QueryClient,
|
|
1032
1544
|
): UseMutationResult<
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1545
|
+
Awaited<ReturnType<typeof deleteProduct>>,
|
|
1546
|
+
TError,
|
|
1547
|
+
{ productId: string },
|
|
1548
|
+
TContext
|
|
1549
|
+
> => {
|
|
1550
|
+
const mutationOptions = useDeleteProductMutationOptions(options);
|
|
1551
|
+
|
|
1552
|
+
return useMutation(mutationOptions, queryClient);
|
|
1553
|
+
};
|
|
1554
|
+
/**
|
|
1044
1555
|
* Used to update some adjustable parameters of a Product, i.e. to extend its **Allowance** or **Limit**.
|
|
1045
1556
|
|
|
1046
1557
|
You must be a member of the **Unit**, or its **Organisation**, or an administrator to use this method.
|
|
@@ -1050,63 +1561,84 @@ At the moment we only support Products associated with the Data Manager, and the
|
|
|
1050
1561
|
* @summary Adjust an existing Product
|
|
1051
1562
|
*/
|
|
1052
1563
|
export const patchProduct = (
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
return customInstance<void>(
|
|
1059
|
-
{url: `/product/${productId}`, method: 'PATCH',
|
|
1060
|
-
headers: {'Content-Type': 'application/json', },
|
|
1061
|
-
data: productPatchBodyBody
|
|
1062
|
-
},
|
|
1063
|
-
options);
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
export const getPatchProductMutationOptions = <TData = Awaited<ReturnType<typeof patchProduct>>, TError = ErrorType<void | AsError>,
|
|
1069
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{productId: string;data: ProductPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
1564
|
+
productId: string,
|
|
1565
|
+
productPatchBodyBody: ProductPatchBodyBody,
|
|
1566
|
+
options?: SecondParameter<typeof customInstance>,
|
|
1070
1567
|
) => {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
: {
|
|
1076
|
-
:
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1568
|
+
return customInstance<void>(
|
|
1569
|
+
{
|
|
1570
|
+
url: `/product/${productId}`,
|
|
1571
|
+
method: "PATCH",
|
|
1572
|
+
headers: { "Content-Type": "application/json" },
|
|
1573
|
+
data: productPatchBodyBody,
|
|
1574
|
+
},
|
|
1575
|
+
options,
|
|
1576
|
+
);
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
export const usePatchProductMutationOptions = <
|
|
1580
|
+
TError = ErrorType<void | AsError>,
|
|
1581
|
+
TContext = unknown,
|
|
1582
|
+
>(options?: {
|
|
1583
|
+
mutation?: UseMutationOptions<
|
|
1584
|
+
Awaited<ReturnType<typeof patchProduct>>,
|
|
1585
|
+
TError,
|
|
1586
|
+
{ productId: string; data: ProductPatchBodyBody },
|
|
1587
|
+
TContext
|
|
1588
|
+
>;
|
|
1589
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1590
|
+
}): UseMutationOptions<
|
|
1591
|
+
Awaited<ReturnType<typeof patchProduct>>,
|
|
1592
|
+
TError,
|
|
1593
|
+
{ productId: string; data: ProductPatchBodyBody },
|
|
1594
|
+
TContext
|
|
1595
|
+
> => {
|
|
1596
|
+
const mutationKey = ["patchProduct"];
|
|
1597
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
1598
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
1599
|
+
? options
|
|
1600
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
1601
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
1602
|
+
|
|
1603
|
+
const mutationFn: MutationFunction<
|
|
1604
|
+
Awaited<ReturnType<typeof patchProduct>>,
|
|
1605
|
+
{ productId: string; data: ProductPatchBodyBody }
|
|
1606
|
+
> = (props) => {
|
|
1607
|
+
const { productId, data } = props ?? {};
|
|
1608
|
+
|
|
1609
|
+
return patchProduct(productId, data, requestOptions);
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
1613
|
+
|
|
1614
|
+
return customOptions;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
export type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>;
|
|
1618
|
+
export type PatchProductMutationBody = ProductPatchBodyBody;
|
|
1619
|
+
export type PatchProductMutationError = ErrorType<void | AsError>;
|
|
1095
1620
|
|
|
1096
|
-
|
|
1621
|
+
/**
|
|
1097
1622
|
* @summary Adjust an existing Product
|
|
1098
1623
|
*/
|
|
1099
|
-
export const usePatchProduct = <
|
|
1100
|
-
|
|
1624
|
+
export const usePatchProduct = <TError = ErrorType<void | AsError>, TContext = unknown>(
|
|
1625
|
+
options?: {
|
|
1626
|
+
mutation?: UseMutationOptions<
|
|
1627
|
+
Awaited<ReturnType<typeof patchProduct>>,
|
|
1628
|
+
TError,
|
|
1629
|
+
{ productId: string; data: ProductPatchBodyBody },
|
|
1630
|
+
TContext
|
|
1631
|
+
>;
|
|
1632
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1633
|
+
},
|
|
1634
|
+
queryClient?: QueryClient,
|
|
1101
1635
|
): UseMutationResult<
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1636
|
+
Awaited<ReturnType<typeof patchProduct>>,
|
|
1637
|
+
TError,
|
|
1638
|
+
{ productId: string; data: ProductPatchBodyBody },
|
|
1639
|
+
TContext
|
|
1640
|
+
> => {
|
|
1641
|
+
const mutationOptions = usePatchProductMutationOptions(options);
|
|
1642
|
+
|
|
1643
|
+
return useMutation(mutationOptions, queryClient);
|
|
1644
|
+
};
|