@squonk/account-server-client 2.1.0-rc.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/admin/admin.cjs +19 -4
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +23 -6
- package/admin/admin.d.ts +23 -6
- package/admin/admin.js +19 -4
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +33 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +31 -14
- package/asset/asset.d.ts +31 -14
- package/asset/asset.js +25 -10
- package/asset/asset.js.map +1 -1
- package/{chunk-UKA7G3OB.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-UKA7G3OB.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-J22A7LHX.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/event-stream/event-stream.cjs +39 -10
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +51 -17
- package/event-stream/event-stream.d.ts +51 -17
- package/event-stream/event-stream.js +36 -7
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +702 -2
- package/index.d.ts +702 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +35 -6
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +42 -8
- package/merchant/merchant.d.ts +42 -8
- package/merchant/merchant.js +34 -5
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +73 -16
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +84 -16
- package/organisation/organisation.d.ts +84 -16
- package/organisation/organisation.js +66 -9
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +121 -22
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +141 -22
- package/product/product.d.ts +141 -22
- package/product/product.js +111 -12
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +4 -2
- package/src/admin/admin.ts +50 -14
- package/src/asset/asset.ts +57 -35
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +100 -29
- package/src/merchant/merchant.ts +93 -18
- package/src/organisation/organisation.ts +184 -35
- package/src/product/product.ts +313 -47
- package/src/state/state.ts +50 -14
- package/src/unit/unit.ts +190 -45
- package/src/user/user.ts +140 -34
- package/state/state.cjs +19 -4
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +23 -6
- package/state/state.d.ts +23 -6
- package/state/state.js +19 -4
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +77 -20
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +91 -23
- package/unit/unit.d.ts +91 -23
- package/unit/unit.js +68 -11
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +59 -16
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +66 -15
- package/user/user.d.ts +66 -15
- package/user/user.js +53 -10
- package/user/user.js.map +1 -1
- package/chunk-J22A7LHX.cjs.map +0 -1
- package/custom-instance-6780910b.d.ts +0 -700
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -10,7 +10,8 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
12
|
useMutation,
|
|
13
|
-
useQuery
|
|
13
|
+
useQuery,
|
|
14
|
+
useSuspenseQuery
|
|
14
15
|
} from '@tanstack/react-query'
|
|
15
16
|
import type {
|
|
16
17
|
MutationFunction,
|
|
@@ -18,7 +19,9 @@ import type {
|
|
|
18
19
|
QueryKey,
|
|
19
20
|
UseMutationOptions,
|
|
20
21
|
UseQueryOptions,
|
|
21
|
-
UseQueryResult
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
22
25
|
} from '@tanstack/react-query'
|
|
23
26
|
import type {
|
|
24
27
|
AsError,
|
|
@@ -28,13 +31,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
28
31
|
import type { ErrorType } from '.././custom-instance';
|
|
29
32
|
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
33
|
-
config: any,
|
|
34
|
-
args: infer P,
|
|
35
|
-
) => any
|
|
36
|
-
? P
|
|
37
|
-
: never;
|
|
34
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
38
35
|
|
|
39
36
|
|
|
40
37
|
/**
|
|
@@ -49,19 +46,18 @@ export const getEventStream = (
|
|
|
49
46
|
|
|
50
47
|
|
|
51
48
|
return customInstance<EventStreamGetPostResponse>(
|
|
52
|
-
{url: `/event-stream`, method: '
|
|
49
|
+
{url: `/event-stream`, method: 'GET', signal
|
|
53
50
|
},
|
|
54
51
|
options);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
export const getGetEventStreamQueryKey = () => {
|
|
59
|
-
|
|
60
56
|
return ["account-server-api", `/event-stream`] as const;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
|
|
64
|
-
export const getGetEventStreamQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData
|
|
60
|
+
export const getGetEventStreamQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
65
61
|
) => {
|
|
66
62
|
|
|
67
63
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -86,7 +82,7 @@ export type GetEventStreamQueryError = ErrorType<void | AsError>
|
|
|
86
82
|
* @summary Gets the details of your EventStream
|
|
87
83
|
*/
|
|
88
84
|
export const useGetEventStream = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
89
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData
|
|
85
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
90
86
|
|
|
91
87
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
92
88
|
|
|
@@ -101,6 +97,46 @@ export const useGetEventStream = <TData = Awaited<ReturnType<typeof getEventStre
|
|
|
101
97
|
|
|
102
98
|
|
|
103
99
|
|
|
100
|
+
export const getGetEventStreamSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
101
|
+
) => {
|
|
102
|
+
|
|
103
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
104
|
+
|
|
105
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamQueryKey();
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStream>>> = ({ signal }) => getEventStream(requestOptions, signal);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData> & { queryKey: QueryKey }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type GetEventStreamSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStream>>>
|
|
119
|
+
export type GetEventStreamSuspenseQueryError = ErrorType<void | AsError>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @summary Gets the details of your EventStream
|
|
123
|
+
*/
|
|
124
|
+
export const useGetEventStreamSuspense = <TData = Awaited<ReturnType<typeof getEventStream>>, TError = ErrorType<void | AsError>>(
|
|
125
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStream>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
126
|
+
|
|
127
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
128
|
+
|
|
129
|
+
const queryOptions = getGetEventStreamSuspenseQueryOptions(options)
|
|
130
|
+
|
|
131
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
132
|
+
|
|
133
|
+
query.queryKey = queryOptions.queryKey ;
|
|
134
|
+
|
|
135
|
+
return query;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
104
140
|
/**
|
|
105
141
|
* Creates a new event stream (based on the **Server Sent Events** framework) for the authenticated user.
|
|
106
142
|
|
|
@@ -114,7 +150,7 @@ export const createEventStream = (
|
|
|
114
150
|
|
|
115
151
|
|
|
116
152
|
return customInstance<EventStreamGetPostResponse>(
|
|
117
|
-
{url: `/event-stream`, method: '
|
|
153
|
+
{url: `/event-stream`, method: 'POST'
|
|
118
154
|
},
|
|
119
155
|
options);
|
|
120
156
|
}
|
|
@@ -122,15 +158,14 @@ export const createEventStream = (
|
|
|
122
158
|
|
|
123
159
|
|
|
124
160
|
export const getCreateEventStreamMutationOptions = <TError = ErrorType<AsError | void>,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
): UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,TVariables, TContext> => {
|
|
161
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
162
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext> => {
|
|
128
163
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
129
164
|
|
|
130
165
|
|
|
131
166
|
|
|
132
167
|
|
|
133
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>,
|
|
168
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createEventStream>>, void> = () => {
|
|
134
169
|
|
|
135
170
|
|
|
136
171
|
return createEventStream(requestOptions)
|
|
@@ -149,8 +184,7 @@ export const getCreateEventStreamMutationOptions = <TError = ErrorType<AsError |
|
|
|
149
184
|
* @summary Create a new Server-Sent Events EventStream
|
|
150
185
|
*/
|
|
151
186
|
export const useCreateEventStream = <TError = ErrorType<AsError | void>,
|
|
152
|
-
|
|
153
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
187
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createEventStream>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
154
188
|
) => {
|
|
155
189
|
|
|
156
190
|
const mutationOptions = getCreateEventStreamMutationOptions(options);
|
|
@@ -160,7 +194,7 @@ export const useCreateEventStream = <TError = ErrorType<AsError | void>,
|
|
|
160
194
|
/**
|
|
161
195
|
* Gets events that you are entitled to receive. Events are delivered as **Server Sent Events** and you are expected to continuously read form this endpoint or it will be closed.
|
|
162
196
|
|
|
163
|
-
This is an un-authenticated endpoint. In order to read from the stream the caller must provide the **read token**
|
|
197
|
+
This is an un-authenticated endpoint. In order to read from the stream the caller must provide either the User access token that belongs to the event stream or the **read token** that was allocated when the stream was created. The **read token** must be provided in the request header property `X-IM-AS-EventStreamReadToken`.
|
|
164
198
|
|
|
165
199
|
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
166
200
|
*/
|
|
@@ -171,19 +205,18 @@ export const getEventStreamEvents = (
|
|
|
171
205
|
|
|
172
206
|
|
|
173
207
|
return customInstance<string>(
|
|
174
|
-
{url: `/event-stream/${eventStreamId}`, method: '
|
|
208
|
+
{url: `/event-stream/${eventStreamId}`, method: 'GET', signal
|
|
175
209
|
},
|
|
176
210
|
options);
|
|
177
211
|
}
|
|
178
212
|
|
|
179
213
|
|
|
180
214
|
export const getGetEventStreamEventsQueryKey = (eventStreamId: number,) => {
|
|
181
|
-
|
|
182
215
|
return ["account-server-api", `/event-stream/${eventStreamId}`] as const;
|
|
183
216
|
}
|
|
184
217
|
|
|
185
218
|
|
|
186
|
-
export const getGetEventStreamEventsQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData
|
|
219
|
+
export const getGetEventStreamEventsQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
187
220
|
) => {
|
|
188
221
|
|
|
189
222
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -208,7 +241,7 @@ export type GetEventStreamEventsQueryError = ErrorType<void | AsError>
|
|
|
208
241
|
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
209
242
|
*/
|
|
210
243
|
export const useGetEventStreamEvents = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
|
|
211
|
-
eventStreamId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData
|
|
244
|
+
eventStreamId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
212
245
|
|
|
213
246
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
214
247
|
|
|
@@ -223,6 +256,46 @@ export const useGetEventStreamEvents = <TData = Awaited<ReturnType<typeof getEve
|
|
|
223
256
|
|
|
224
257
|
|
|
225
258
|
|
|
259
|
+
export const getGetEventStreamEventsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
260
|
+
) => {
|
|
261
|
+
|
|
262
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
263
|
+
|
|
264
|
+
const queryKey = queryOptions?.queryKey ?? getGetEventStreamEventsQueryKey(eventStreamId);
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getEventStreamEvents>>> = ({ signal }) => getEventStreamEvents(eventStreamId, requestOptions, signal);
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
return { queryKey, queryFn, enabled: !!(eventStreamId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData> & { queryKey: QueryKey }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export type GetEventStreamEventsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getEventStreamEvents>>>
|
|
278
|
+
export type GetEventStreamEventsSuspenseQueryError = ErrorType<void | AsError>
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @summary Subscribe to Server-Sent Events events from an EventStream
|
|
282
|
+
*/
|
|
283
|
+
export const useGetEventStreamEventsSuspense = <TData = Awaited<ReturnType<typeof getEventStreamEvents>>, TError = ErrorType<void | AsError>>(
|
|
284
|
+
eventStreamId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getEventStreamEvents>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
285
|
+
|
|
286
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
287
|
+
|
|
288
|
+
const queryOptions = getGetEventStreamEventsSuspenseQueryOptions(eventStreamId,options)
|
|
289
|
+
|
|
290
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
291
|
+
|
|
292
|
+
query.queryKey = queryOptions.queryKey ;
|
|
293
|
+
|
|
294
|
+
return query;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
226
299
|
/**
|
|
227
300
|
* Deletes an Event Stream.
|
|
228
301
|
|
|
@@ -236,7 +309,7 @@ export const deleteEventStream = (
|
|
|
236
309
|
|
|
237
310
|
|
|
238
311
|
return customInstance<void>(
|
|
239
|
-
{url: `/event-stream/${eventStreamId}`, method: '
|
|
312
|
+
{url: `/event-stream/${eventStreamId}`, method: 'DELETE'
|
|
240
313
|
},
|
|
241
314
|
options);
|
|
242
315
|
}
|
|
@@ -244,7 +317,6 @@ export const deleteEventStream = (
|
|
|
244
317
|
|
|
245
318
|
|
|
246
319
|
export const getDeleteEventStreamMutationOptions = <TError = ErrorType<AsError>,
|
|
247
|
-
|
|
248
320
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
249
321
|
): UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext> => {
|
|
250
322
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -271,7 +343,6 @@ export const getDeleteEventStreamMutationOptions = <TError = ErrorType<AsError>,
|
|
|
271
343
|
* @summary Deletes an existing EventStream (that you created)
|
|
272
344
|
*/
|
|
273
345
|
export const useDeleteEventStream = <TError = ErrorType<AsError>,
|
|
274
|
-
|
|
275
346
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteEventStream>>, TError,{eventStreamId: number}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
276
347
|
) => {
|
|
277
348
|
|
package/src/merchant/merchant.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -9,13 +9,16 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
9
9
|
* OpenAPI spec version: 2.1
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
|
-
useQuery
|
|
12
|
+
useQuery,
|
|
13
|
+
useSuspenseQuery
|
|
13
14
|
} from '@tanstack/react-query'
|
|
14
15
|
import type {
|
|
15
16
|
QueryFunction,
|
|
16
17
|
QueryKey,
|
|
17
18
|
UseQueryOptions,
|
|
18
|
-
UseQueryResult
|
|
19
|
+
UseQueryResult,
|
|
20
|
+
UseSuspenseQueryOptions,
|
|
21
|
+
UseSuspenseQueryResult
|
|
19
22
|
} from '@tanstack/react-query'
|
|
20
23
|
import type {
|
|
21
24
|
AsError,
|
|
@@ -26,13 +29,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
26
29
|
import type { ErrorType } from '.././custom-instance';
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
31
|
-
config: any,
|
|
32
|
-
args: infer P,
|
|
33
|
-
) => any
|
|
34
|
-
? P
|
|
35
|
-
: never;
|
|
32
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
36
33
|
|
|
37
34
|
|
|
38
35
|
/**
|
|
@@ -49,19 +46,18 @@ export const getMerchants = (
|
|
|
49
46
|
|
|
50
47
|
|
|
51
48
|
return customInstance<MerchantsGetResponse>(
|
|
52
|
-
{url: `/merchant`, method: '
|
|
49
|
+
{url: `/merchant`, method: 'GET', signal
|
|
53
50
|
},
|
|
54
51
|
options);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
export const getGetMerchantsQueryKey = () => {
|
|
59
|
-
|
|
60
56
|
return ["account-server-api", `/merchant`] as const;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
|
|
64
|
-
export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData
|
|
60
|
+
export const getGetMerchantsQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
65
61
|
) => {
|
|
66
62
|
|
|
67
63
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -86,7 +82,7 @@ export type GetMerchantsQueryError = ErrorType<AsError | void>
|
|
|
86
82
|
* @summary Gets all Merchants
|
|
87
83
|
*/
|
|
88
84
|
export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
89
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData
|
|
85
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
90
86
|
|
|
91
87
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
92
88
|
|
|
@@ -101,6 +97,46 @@ export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>
|
|
|
101
97
|
|
|
102
98
|
|
|
103
99
|
|
|
100
|
+
export const getGetMerchantsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
101
|
+
) => {
|
|
102
|
+
|
|
103
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
104
|
+
|
|
105
|
+
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData> & { queryKey: QueryKey }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type GetMerchantsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
|
|
119
|
+
export type GetMerchantsSuspenseQueryError = ErrorType<AsError | void>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @summary Gets all Merchants
|
|
123
|
+
*/
|
|
124
|
+
export const useGetMerchantsSuspense = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
125
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
126
|
+
|
|
127
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
128
|
+
|
|
129
|
+
const queryOptions = getGetMerchantsSuspenseQueryOptions(options)
|
|
130
|
+
|
|
131
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
132
|
+
|
|
133
|
+
query.queryKey = queryOptions.queryKey ;
|
|
134
|
+
|
|
135
|
+
return query;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
104
140
|
/**
|
|
105
141
|
* Gets a known Merchant
|
|
106
142
|
|
|
@@ -113,19 +149,18 @@ export const getService = (
|
|
|
113
149
|
|
|
114
150
|
|
|
115
151
|
return customInstance<MerchantDetail>(
|
|
116
|
-
{url: `/merchant/${mId}`, method: '
|
|
152
|
+
{url: `/merchant/${mId}`, method: 'GET', signal
|
|
117
153
|
},
|
|
118
154
|
options);
|
|
119
155
|
}
|
|
120
156
|
|
|
121
157
|
|
|
122
158
|
export const getGetServiceQueryKey = (mId: number,) => {
|
|
123
|
-
|
|
124
159
|
return ["account-server-api", `/merchant/${mId}`] as const;
|
|
125
160
|
}
|
|
126
161
|
|
|
127
162
|
|
|
128
|
-
export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData
|
|
163
|
+
export const getGetServiceQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
129
164
|
) => {
|
|
130
165
|
|
|
131
166
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -150,7 +185,7 @@ export type GetServiceQueryError = ErrorType<AsError | void>
|
|
|
150
185
|
* @summary Gets a specific Merchant
|
|
151
186
|
*/
|
|
152
187
|
export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
153
|
-
mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData
|
|
188
|
+
mId: number, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
154
189
|
|
|
155
190
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
156
191
|
|
|
@@ -165,3 +200,43 @@ export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TE
|
|
|
165
200
|
|
|
166
201
|
|
|
167
202
|
|
|
203
|
+
export const getGetServiceSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
204
|
+
) => {
|
|
205
|
+
|
|
206
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
207
|
+
|
|
208
|
+
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
return { queryKey, queryFn, enabled: !!(mId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData> & { queryKey: QueryKey }
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type GetServiceSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
|
|
222
|
+
export type GetServiceSuspenseQueryError = ErrorType<AsError | void>
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @summary Gets a specific Merchant
|
|
226
|
+
*/
|
|
227
|
+
export const useGetServiceSuspense = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
228
|
+
mId: number, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
229
|
+
|
|
230
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
231
|
+
|
|
232
|
+
const queryOptions = getGetServiceSuspenseQueryOptions(mId,options)
|
|
233
|
+
|
|
234
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
235
|
+
|
|
236
|
+
query.queryKey = queryOptions.queryKey ;
|
|
237
|
+
|
|
238
|
+
return query;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|