@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/merchant/merchant.ts
CHANGED
|
@@ -1,41 +1,35 @@
|
|
|
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
|
-
useQuery,
|
|
14
|
-
useSuspenseQuery
|
|
15
|
-
} from '@tanstack/react-query'
|
|
11
|
+
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
16
12
|
import type {
|
|
17
13
|
DataTag,
|
|
18
14
|
DefinedInitialDataOptions,
|
|
19
15
|
DefinedUseQueryResult,
|
|
16
|
+
QueryClient,
|
|
20
17
|
QueryFunction,
|
|
21
18
|
QueryKey,
|
|
22
19
|
UndefinedInitialDataOptions,
|
|
23
20
|
UseQueryOptions,
|
|
24
21
|
UseQueryResult,
|
|
25
22
|
UseSuspenseQueryOptions,
|
|
26
|
-
UseSuspenseQueryResult
|
|
27
|
-
} from
|
|
28
|
-
import type {
|
|
29
|
-
AsError,
|
|
30
|
-
MerchantDetail,
|
|
31
|
-
MerchantsGetResponse
|
|
32
|
-
} from '../account-server-api.schemas'
|
|
33
|
-
import { customInstance } from '.././custom-instance';
|
|
34
|
-
import type { ErrorType } from '.././custom-instance';
|
|
23
|
+
UseSuspenseQueryResult,
|
|
24
|
+
} from "@tanstack/react-query";
|
|
35
25
|
|
|
26
|
+
import type { AsError, MerchantDetail, MerchantsGetResponse } from "../account-server-api.schemas";
|
|
36
27
|
|
|
37
|
-
|
|
28
|
+
import { customInstance } from ".././custom-instance";
|
|
29
|
+
import type { ErrorType } from ".././custom-instance";
|
|
30
|
+
import { queryMutator } from ".././options-mutator";
|
|
38
31
|
|
|
32
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
39
33
|
|
|
40
34
|
/**
|
|
41
35
|
* Gets Merchants known to the Account Server
|
|
@@ -45,283 +39,410 @@ Merchants are software services (SaaS assets) whose facilities are known to and
|
|
|
45
39
|
* @summary Gets all Merchants
|
|
46
40
|
*/
|
|
47
41
|
export const getMerchants = (
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
options?: SecondParameter<typeof customInstance>,
|
|
43
|
+
signal?: AbortSignal,
|
|
50
44
|
) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return customInstance<MerchantsGetResponse>(
|
|
54
|
-
{url: `/merchant`, method: 'GET', signal
|
|
55
|
-
},
|
|
56
|
-
options);
|
|
57
|
-
}
|
|
58
|
-
|
|
45
|
+
return customInstance<MerchantsGetResponse>({ url: `/merchant`, method: "GET", signal }, options);
|
|
46
|
+
};
|
|
59
47
|
|
|
60
48
|
export const getGetMerchantsQueryKey = () => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export
|
|
88
|
-
|
|
49
|
+
return [`/merchant`] as const;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const useGetMerchantsQueryOptions = <
|
|
53
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
54
|
+
TError = ErrorType<AsError | void>,
|
|
55
|
+
>(options?: {
|
|
56
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
|
|
57
|
+
request?: SecondParameter<typeof customInstance>;
|
|
58
|
+
}) => {
|
|
59
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
60
|
+
|
|
61
|
+
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
62
|
+
|
|
63
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) =>
|
|
64
|
+
getMerchants(requestOptions, signal);
|
|
65
|
+
|
|
66
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
67
|
+
|
|
68
|
+
return customOptions as UseQueryOptions<
|
|
69
|
+
Awaited<ReturnType<typeof getMerchants>>,
|
|
70
|
+
TError,
|
|
71
|
+
TData
|
|
72
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type GetMerchantsQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>;
|
|
76
|
+
export type GetMerchantsQueryError = ErrorType<AsError | void>;
|
|
77
|
+
|
|
78
|
+
export function useGetMerchants<
|
|
79
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
80
|
+
TError = ErrorType<AsError | void>,
|
|
81
|
+
>(
|
|
82
|
+
options: {
|
|
83
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> &
|
|
84
|
+
Pick<
|
|
89
85
|
DefinedInitialDataOptions<
|
|
90
86
|
Awaited<ReturnType<typeof getMerchants>>,
|
|
91
87
|
TError,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
Awaited<ReturnType<typeof getMerchants>>
|
|
89
|
+
>,
|
|
90
|
+
"initialData"
|
|
91
|
+
>;
|
|
92
|
+
request?: SecondParameter<typeof customInstance>;
|
|
93
|
+
},
|
|
94
|
+
queryClient?: QueryClient,
|
|
95
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
96
|
+
export function useGetMerchants<
|
|
97
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
98
|
+
TError = ErrorType<AsError | void>,
|
|
99
|
+
>(
|
|
100
|
+
options?: {
|
|
101
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>> &
|
|
102
|
+
Pick<
|
|
99
103
|
UndefinedInitialDataOptions<
|
|
100
104
|
Awaited<ReturnType<typeof getMerchants>>,
|
|
101
105
|
TError,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
Awaited<ReturnType<typeof getMerchants>>
|
|
107
|
+
>,
|
|
108
|
+
"initialData"
|
|
109
|
+
>;
|
|
110
|
+
request?: SecondParameter<typeof customInstance>;
|
|
111
|
+
},
|
|
112
|
+
queryClient?: QueryClient,
|
|
113
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
114
|
+
export function useGetMerchants<
|
|
115
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
116
|
+
TError = ErrorType<AsError | void>,
|
|
117
|
+
>(
|
|
118
|
+
options?: {
|
|
119
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
|
|
120
|
+
request?: SecondParameter<typeof customInstance>;
|
|
121
|
+
},
|
|
122
|
+
queryClient?: QueryClient,
|
|
123
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
111
124
|
/**
|
|
112
125
|
* @summary Gets all Merchants
|
|
113
126
|
*/
|
|
114
127
|
|
|
115
|
-
export function useGetMerchants<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
export function useGetMerchants<
|
|
129
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
130
|
+
TError = ErrorType<AsError | void>,
|
|
131
|
+
>(
|
|
132
|
+
options?: {
|
|
133
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
|
|
134
|
+
request?: SecondParameter<typeof customInstance>;
|
|
135
|
+
},
|
|
136
|
+
queryClient?: QueryClient,
|
|
137
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
138
|
+
const queryOptions = useGetMerchantsQueryOptions(options);
|
|
119
139
|
|
|
120
|
-
const
|
|
140
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
141
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
142
|
+
};
|
|
121
143
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
query.queryKey = queryOptions.queryKey ;
|
|
144
|
+
query.queryKey = queryOptions.queryKey;
|
|
125
145
|
|
|
126
146
|
return query;
|
|
127
147
|
}
|
|
128
148
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
export
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
149
|
+
export const useGetMerchantsSuspenseQueryOptions = <
|
|
150
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
151
|
+
TError = ErrorType<AsError | void>,
|
|
152
|
+
>(options?: {
|
|
153
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>;
|
|
154
|
+
request?: SecondParameter<typeof customInstance>;
|
|
155
|
+
}) => {
|
|
156
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
157
|
+
|
|
158
|
+
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
159
|
+
|
|
160
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) =>
|
|
161
|
+
getMerchants(requestOptions, signal);
|
|
162
|
+
|
|
163
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
164
|
+
|
|
165
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
166
|
+
Awaited<ReturnType<typeof getMerchants>>,
|
|
167
|
+
TError,
|
|
168
|
+
TData
|
|
169
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type GetMerchantsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>;
|
|
173
|
+
export type GetMerchantsSuspenseQueryError = ErrorType<AsError | void>;
|
|
174
|
+
|
|
175
|
+
export function useGetMerchantsSuspense<
|
|
176
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
177
|
+
TError = ErrorType<AsError | void>,
|
|
178
|
+
>(
|
|
179
|
+
options: {
|
|
180
|
+
query: Partial<
|
|
181
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
|
|
182
|
+
>;
|
|
183
|
+
request?: SecondParameter<typeof customInstance>;
|
|
184
|
+
},
|
|
185
|
+
queryClient?: QueryClient,
|
|
186
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
187
|
+
export function useGetMerchantsSuspense<
|
|
188
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
189
|
+
TError = ErrorType<AsError | void>,
|
|
190
|
+
>(
|
|
191
|
+
options?: {
|
|
192
|
+
query?: Partial<
|
|
193
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
|
|
194
|
+
>;
|
|
195
|
+
request?: SecondParameter<typeof customInstance>;
|
|
196
|
+
},
|
|
197
|
+
queryClient?: QueryClient,
|
|
198
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
199
|
+
export function useGetMerchantsSuspense<
|
|
200
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
201
|
+
TError = ErrorType<AsError | void>,
|
|
202
|
+
>(
|
|
203
|
+
options?: {
|
|
204
|
+
query?: Partial<
|
|
205
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
|
|
206
|
+
>;
|
|
207
|
+
request?: SecondParameter<typeof customInstance>;
|
|
208
|
+
},
|
|
209
|
+
queryClient?: QueryClient,
|
|
210
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
165
211
|
/**
|
|
166
212
|
* @summary Gets all Merchants
|
|
167
213
|
*/
|
|
168
214
|
|
|
169
|
-
export function useGetMerchantsSuspense<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
215
|
+
export function useGetMerchantsSuspense<
|
|
216
|
+
TData = Awaited<ReturnType<typeof getMerchants>>,
|
|
217
|
+
TError = ErrorType<AsError | void>,
|
|
218
|
+
>(
|
|
219
|
+
options?: {
|
|
220
|
+
query?: Partial<
|
|
221
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>
|
|
222
|
+
>;
|
|
223
|
+
request?: SecondParameter<typeof customInstance>;
|
|
224
|
+
},
|
|
225
|
+
queryClient?: QueryClient,
|
|
226
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
227
|
+
const queryOptions = useGetMerchantsSuspenseQueryOptions(options);
|
|
228
|
+
|
|
229
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
230
|
+
TData,
|
|
231
|
+
TError
|
|
232
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
233
|
+
|
|
234
|
+
query.queryKey = queryOptions.queryKey;
|
|
179
235
|
|
|
180
236
|
return query;
|
|
181
237
|
}
|
|
182
238
|
|
|
183
|
-
|
|
184
|
-
|
|
185
239
|
/**
|
|
186
240
|
* Gets a known Merchant
|
|
187
241
|
|
|
188
242
|
* @summary Gets a specific Merchant
|
|
189
243
|
*/
|
|
190
244
|
export const getService = (
|
|
191
|
-
|
|
192
|
-
|
|
245
|
+
mId: number,
|
|
246
|
+
options?: SecondParameter<typeof customInstance>,
|
|
247
|
+
signal?: AbortSignal,
|
|
193
248
|
) => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
249
|
+
return customInstance<MerchantDetail>(
|
|
250
|
+
{ url: `/merchant/${mId}`, method: "GET", signal },
|
|
251
|
+
options,
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const getGetServiceQueryKey = (mId: number) => {
|
|
256
|
+
return [`/merchant/${mId}`] as const;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const useGetServiceQueryOptions = <
|
|
260
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
261
|
+
TError = ErrorType<AsError | void>,
|
|
262
|
+
>(
|
|
263
|
+
mId: number,
|
|
264
|
+
options?: {
|
|
265
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
266
|
+
request?: SecondParameter<typeof customInstance>;
|
|
267
|
+
},
|
|
209
268
|
) => {
|
|
269
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
210
270
|
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
214
|
-
|
|
215
|
-
|
|
271
|
+
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
216
272
|
|
|
217
|
-
|
|
273
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) =>
|
|
274
|
+
getService(mId, requestOptions, signal);
|
|
218
275
|
|
|
219
|
-
|
|
276
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
220
277
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
|
|
227
|
-
export type GetServiceQueryError = ErrorType<AsError | void>
|
|
278
|
+
return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & {
|
|
279
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
228
282
|
|
|
283
|
+
export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>;
|
|
284
|
+
export type GetServiceQueryError = ErrorType<AsError | void>;
|
|
229
285
|
|
|
230
|
-
export function useGetService<
|
|
231
|
-
|
|
286
|
+
export function useGetService<
|
|
287
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
288
|
+
TError = ErrorType<AsError | void>,
|
|
289
|
+
>(
|
|
290
|
+
mId: number,
|
|
291
|
+
options: {
|
|
292
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> &
|
|
293
|
+
Pick<
|
|
232
294
|
DefinedInitialDataOptions<
|
|
233
295
|
Awaited<ReturnType<typeof getService>>,
|
|
234
296
|
TError,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
297
|
+
Awaited<ReturnType<typeof getService>>
|
|
298
|
+
>,
|
|
299
|
+
"initialData"
|
|
300
|
+
>;
|
|
301
|
+
request?: SecondParameter<typeof customInstance>;
|
|
302
|
+
},
|
|
303
|
+
queryClient?: QueryClient,
|
|
304
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
305
|
+
export function useGetService<
|
|
306
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
307
|
+
TError = ErrorType<AsError | void>,
|
|
308
|
+
>(
|
|
309
|
+
mId: number,
|
|
310
|
+
options?: {
|
|
311
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>> &
|
|
312
|
+
Pick<
|
|
242
313
|
UndefinedInitialDataOptions<
|
|
243
314
|
Awaited<ReturnType<typeof getService>>,
|
|
244
315
|
TError,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
316
|
+
Awaited<ReturnType<typeof getService>>
|
|
317
|
+
>,
|
|
318
|
+
"initialData"
|
|
319
|
+
>;
|
|
320
|
+
request?: SecondParameter<typeof customInstance>;
|
|
321
|
+
},
|
|
322
|
+
queryClient?: QueryClient,
|
|
323
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
324
|
+
export function useGetService<
|
|
325
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
326
|
+
TError = ErrorType<AsError | void>,
|
|
327
|
+
>(
|
|
328
|
+
mId: number,
|
|
329
|
+
options?: {
|
|
330
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
331
|
+
request?: SecondParameter<typeof customInstance>;
|
|
332
|
+
},
|
|
333
|
+
queryClient?: QueryClient,
|
|
334
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
254
335
|
/**
|
|
255
336
|
* @summary Gets a specific Merchant
|
|
256
337
|
*/
|
|
257
338
|
|
|
258
|
-
export function useGetService<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
339
|
+
export function useGetService<
|
|
340
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
341
|
+
TError = ErrorType<AsError | void>,
|
|
342
|
+
>(
|
|
343
|
+
mId: number,
|
|
344
|
+
options?: {
|
|
345
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
346
|
+
request?: SecondParameter<typeof customInstance>;
|
|
347
|
+
},
|
|
348
|
+
queryClient?: QueryClient,
|
|
349
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
350
|
+
const queryOptions = useGetServiceQueryOptions(mId, options);
|
|
351
|
+
|
|
352
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
353
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
query.queryKey = queryOptions.queryKey;
|
|
268
357
|
|
|
269
358
|
return query;
|
|
270
359
|
}
|
|
271
360
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
361
|
+
export const useGetServiceSuspenseQueryOptions = <
|
|
362
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
363
|
+
TError = ErrorType<AsError | void>,
|
|
364
|
+
>(
|
|
365
|
+
mId: number,
|
|
366
|
+
options?: {
|
|
367
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
368
|
+
request?: SecondParameter<typeof customInstance>;
|
|
369
|
+
},
|
|
275
370
|
) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService
|
|
293
|
-
export type GetServiceSuspenseQueryError = ErrorType<AsError | void
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
371
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
372
|
+
|
|
373
|
+
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
374
|
+
|
|
375
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) =>
|
|
376
|
+
getService(mId, requestOptions, signal);
|
|
377
|
+
|
|
378
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
379
|
+
|
|
380
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
381
|
+
Awaited<ReturnType<typeof getService>>,
|
|
382
|
+
TError,
|
|
383
|
+
TData
|
|
384
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>;
|
|
388
|
+
export type GetServiceSuspenseQueryError = ErrorType<AsError | void>;
|
|
389
|
+
|
|
390
|
+
export function useGetServiceSuspense<
|
|
391
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
392
|
+
TError = ErrorType<AsError | void>,
|
|
393
|
+
>(
|
|
394
|
+
mId: number,
|
|
395
|
+
options: {
|
|
396
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
397
|
+
request?: SecondParameter<typeof customInstance>;
|
|
398
|
+
},
|
|
399
|
+
queryClient?: QueryClient,
|
|
400
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
401
|
+
export function useGetServiceSuspense<
|
|
402
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
403
|
+
TError = ErrorType<AsError | void>,
|
|
404
|
+
>(
|
|
405
|
+
mId: number,
|
|
406
|
+
options?: {
|
|
407
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
408
|
+
request?: SecondParameter<typeof customInstance>;
|
|
409
|
+
},
|
|
410
|
+
queryClient?: QueryClient,
|
|
411
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
412
|
+
export function useGetServiceSuspense<
|
|
413
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
414
|
+
TError = ErrorType<AsError | void>,
|
|
415
|
+
>(
|
|
416
|
+
mId: number,
|
|
417
|
+
options?: {
|
|
418
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
419
|
+
request?: SecondParameter<typeof customInstance>;
|
|
420
|
+
},
|
|
421
|
+
queryClient?: QueryClient,
|
|
422
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
308
423
|
/**
|
|
309
424
|
* @summary Gets a specific Merchant
|
|
310
425
|
*/
|
|
311
426
|
|
|
312
|
-
export function useGetServiceSuspense<
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
427
|
+
export function useGetServiceSuspense<
|
|
428
|
+
TData = Awaited<ReturnType<typeof getService>>,
|
|
429
|
+
TError = ErrorType<AsError | void>,
|
|
430
|
+
>(
|
|
431
|
+
mId: number,
|
|
432
|
+
options?: {
|
|
433
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>;
|
|
434
|
+
request?: SecondParameter<typeof customInstance>;
|
|
435
|
+
},
|
|
436
|
+
queryClient?: QueryClient,
|
|
437
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
438
|
+
const queryOptions = useGetServiceSuspenseQueryOptions(mId, options);
|
|
439
|
+
|
|
440
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
441
|
+
TData,
|
|
442
|
+
TError
|
|
443
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
444
|
+
|
|
445
|
+
query.queryKey = queryOptions.queryKey;
|
|
322
446
|
|
|
323
447
|
return query;
|
|
324
448
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|