@squonk/account-server-client 2.0.4-rc.1 → 2.0.4-rc.3
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/admin/admin.cjs +10 -14
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +9 -3
- package/admin/admin.js +9 -13
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +59 -28
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +71 -3
- package/asset/asset.js +58 -27
- package/asset/asset.js.map +1 -1
- package/{custom-instance-85497958.d.ts → custom-instance-8a11f2d1.d.ts} +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +19 -16
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +16 -4
- package/merchant/merchant.js +18 -15
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +64 -40
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +56 -6
- package/organisation/organisation.js +63 -39
- package/organisation/organisation.js.map +1 -1
- package/package.json +10 -9
- package/product/product.cjs +92 -55
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +79 -9
- package/product/product.js +91 -54
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +1 -1
- package/src/admin/admin.ts +34 -18
- package/src/asset/asset.ts +223 -88
- package/src/merchant/merchant.ts +60 -27
- package/src/organisation/organisation.ts +215 -97
- package/src/product/product.ts +310 -134
- package/src/state/state.ts +30 -15
- package/src/unit/unit.ts +263 -117
- package/src/user/user.ts +207 -88
- package/state/state.cjs +10 -11
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +9 -3
- package/state/state.js +9 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +74 -46
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +70 -6
- package/unit/unit.js +73 -45
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -31
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +63 -5
- package/user/user.js +55 -30
- package/user/user.js.map +1 -1
- package/chunk-7XN3IQYV.cjs +0 -13
- package/chunk-7XN3IQYV.cjs.map +0 -1
- package/chunk-YEX2SGER.js +0 -13
- package/chunk-YEX2SGER.js.map +0 -1
- package/src/queryMutator.ts +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.15.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -30,7 +30,6 @@ import type {
|
|
|
30
30
|
} from "../account-server-api.schemas";
|
|
31
31
|
import { customInstance } from ".././custom-instance";
|
|
32
32
|
import type { ErrorType } from ".././custom-instance";
|
|
33
|
-
import { queryMutator } from ".././queryMutator";
|
|
34
33
|
|
|
35
34
|
// eslint-disable-next-line
|
|
36
35
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
@@ -55,14 +54,9 @@ export const getOrganisations = (
|
|
|
55
54
|
);
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
export const getGetOrganisationsQueryKey = () => [`/organisation`];
|
|
57
|
+
export const getGetOrganisationsQueryKey = () => ["account-server-api", `/organisation`] as const;
|
|
59
58
|
|
|
60
|
-
export
|
|
61
|
-
Awaited<ReturnType<typeof getOrganisations>>
|
|
62
|
-
>;
|
|
63
|
-
export type GetOrganisationsQueryError = ErrorType<void | AsError>;
|
|
64
|
-
|
|
65
|
-
export const useGetOrganisations = <
|
|
59
|
+
export const getGetOrganisationsQueryOptions = <
|
|
66
60
|
TData = Awaited<ReturnType<typeof getOrganisations>>,
|
|
67
61
|
TError = ErrorType<void | AsError>
|
|
68
62
|
>(options?: {
|
|
@@ -72,7 +66,11 @@ export const useGetOrganisations = <
|
|
|
72
66
|
TData
|
|
73
67
|
>;
|
|
74
68
|
request?: SecondParameter<typeof customInstance>;
|
|
75
|
-
}):
|
|
69
|
+
}): UseQueryOptions<
|
|
70
|
+
Awaited<ReturnType<typeof getOrganisations>>,
|
|
71
|
+
TError,
|
|
72
|
+
TData
|
|
73
|
+
> & { queryKey: QueryKey } => {
|
|
76
74
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
77
75
|
|
|
78
76
|
const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
|
|
@@ -81,15 +79,32 @@ export const useGetOrganisations = <
|
|
|
81
79
|
Awaited<ReturnType<typeof getOrganisations>>
|
|
82
80
|
> = ({ signal }) => getOrganisations(requestOptions, signal);
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type GetOrganisationsQueryResult = NonNullable<
|
|
86
|
+
Awaited<ReturnType<typeof getOrganisations>>
|
|
87
|
+
>;
|
|
88
|
+
export type GetOrganisationsQueryError = ErrorType<void | AsError>;
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
export const useGetOrganisations = <
|
|
91
|
+
TData = Awaited<ReturnType<typeof getOrganisations>>,
|
|
92
|
+
TError = ErrorType<void | AsError>
|
|
93
|
+
>(options?: {
|
|
94
|
+
query?: UseQueryOptions<
|
|
87
95
|
Awaited<ReturnType<typeof getOrganisations>>,
|
|
88
96
|
TError,
|
|
89
97
|
TData
|
|
90
|
-
|
|
98
|
+
>;
|
|
99
|
+
request?: SecondParameter<typeof customInstance>;
|
|
100
|
+
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
101
|
+
const queryOptions = getGetOrganisationsQueryOptions(options);
|
|
91
102
|
|
|
92
|
-
query
|
|
103
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
104
|
+
queryKey: QueryKey;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
query.queryKey = queryOptions.queryKey;
|
|
93
108
|
|
|
94
109
|
return query;
|
|
95
110
|
};
|
|
@@ -116,13 +131,7 @@ export const createOrganisation = (
|
|
|
116
131
|
);
|
|
117
132
|
};
|
|
118
133
|
|
|
119
|
-
export
|
|
120
|
-
Awaited<ReturnType<typeof createOrganisation>>
|
|
121
|
-
>;
|
|
122
|
-
export type CreateOrganisationMutationBody = OrganisationPostBodyBody;
|
|
123
|
-
export type CreateOrganisationMutationError = ErrorType<AsError | void>;
|
|
124
|
-
|
|
125
|
-
export const useCreateOrganisation = <
|
|
134
|
+
export const getCreateOrganisationMutationOptions = <
|
|
126
135
|
TError = ErrorType<AsError | void>,
|
|
127
136
|
TContext = unknown
|
|
128
137
|
>(options?: {
|
|
@@ -133,7 +142,12 @@ export const useCreateOrganisation = <
|
|
|
133
142
|
TContext
|
|
134
143
|
>;
|
|
135
144
|
request?: SecondParameter<typeof customInstance>;
|
|
136
|
-
})
|
|
145
|
+
}): UseMutationOptions<
|
|
146
|
+
Awaited<ReturnType<typeof createOrganisation>>,
|
|
147
|
+
TError,
|
|
148
|
+
{ data: OrganisationPostBodyBody },
|
|
149
|
+
TContext
|
|
150
|
+
> => {
|
|
137
151
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
138
152
|
|
|
139
153
|
const mutationFn: MutationFunction<
|
|
@@ -145,12 +159,30 @@ export const useCreateOrganisation = <
|
|
|
145
159
|
return createOrganisation(data, requestOptions);
|
|
146
160
|
};
|
|
147
161
|
|
|
148
|
-
return
|
|
162
|
+
return { mutationFn, ...mutationOptions };
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type CreateOrganisationMutationResult = NonNullable<
|
|
166
|
+
Awaited<ReturnType<typeof createOrganisation>>
|
|
167
|
+
>;
|
|
168
|
+
export type CreateOrganisationMutationBody = OrganisationPostBodyBody;
|
|
169
|
+
export type CreateOrganisationMutationError = ErrorType<AsError | void>;
|
|
170
|
+
|
|
171
|
+
export const useCreateOrganisation = <
|
|
172
|
+
TError = ErrorType<AsError | void>,
|
|
173
|
+
TContext = unknown
|
|
174
|
+
>(options?: {
|
|
175
|
+
mutation?: UseMutationOptions<
|
|
149
176
|
Awaited<ReturnType<typeof createOrganisation>>,
|
|
150
177
|
TError,
|
|
151
178
|
{ data: OrganisationPostBodyBody },
|
|
152
179
|
TContext
|
|
153
|
-
|
|
180
|
+
>;
|
|
181
|
+
request?: SecondParameter<typeof customInstance>;
|
|
182
|
+
}) => {
|
|
183
|
+
const mutationOptions = getCreateOrganisationMutationOptions(options);
|
|
184
|
+
|
|
185
|
+
return useMutation(mutationOptions);
|
|
154
186
|
};
|
|
155
187
|
/**
|
|
156
188
|
* Gets a specific Organisation
|
|
@@ -168,16 +200,10 @@ export const getOrganisation = (
|
|
|
168
200
|
);
|
|
169
201
|
};
|
|
170
202
|
|
|
171
|
-
export const getGetOrganisationQueryKey = (orgId: string) =>
|
|
172
|
-
`/organisation/${orgId}
|
|
173
|
-
];
|
|
203
|
+
export const getGetOrganisationQueryKey = (orgId: string) =>
|
|
204
|
+
["account-server-api", `/organisation/${orgId}`] as const;
|
|
174
205
|
|
|
175
|
-
export
|
|
176
|
-
Awaited<ReturnType<typeof getOrganisation>>
|
|
177
|
-
>;
|
|
178
|
-
export type GetOrganisationQueryError = ErrorType<void | AsError>;
|
|
179
|
-
|
|
180
|
-
export const useGetOrganisation = <
|
|
206
|
+
export const getGetOrganisationQueryOptions = <
|
|
181
207
|
TData = Awaited<ReturnType<typeof getOrganisation>>,
|
|
182
208
|
TError = ErrorType<void | AsError>
|
|
183
209
|
>(
|
|
@@ -190,7 +216,11 @@ export const useGetOrganisation = <
|
|
|
190
216
|
>;
|
|
191
217
|
request?: SecondParameter<typeof customInstance>;
|
|
192
218
|
}
|
|
193
|
-
):
|
|
219
|
+
): UseQueryOptions<
|
|
220
|
+
Awaited<ReturnType<typeof getOrganisation>>,
|
|
221
|
+
TError,
|
|
222
|
+
TData
|
|
223
|
+
> & { queryKey: QueryKey } => {
|
|
194
224
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
195
225
|
|
|
196
226
|
const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);
|
|
@@ -199,15 +229,35 @@ export const useGetOrganisation = <
|
|
|
199
229
|
signal,
|
|
200
230
|
}) => getOrganisation(orgId, requestOptions, signal);
|
|
201
231
|
|
|
202
|
-
|
|
232
|
+
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
233
|
+
};
|
|
203
234
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
>(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
235
|
+
export type GetOrganisationQueryResult = NonNullable<
|
|
236
|
+
Awaited<ReturnType<typeof getOrganisation>>
|
|
237
|
+
>;
|
|
238
|
+
export type GetOrganisationQueryError = ErrorType<void | AsError>;
|
|
209
239
|
|
|
210
|
-
|
|
240
|
+
export const useGetOrganisation = <
|
|
241
|
+
TData = Awaited<ReturnType<typeof getOrganisation>>,
|
|
242
|
+
TError = ErrorType<void | AsError>
|
|
243
|
+
>(
|
|
244
|
+
orgId: string,
|
|
245
|
+
options?: {
|
|
246
|
+
query?: UseQueryOptions<
|
|
247
|
+
Awaited<ReturnType<typeof getOrganisation>>,
|
|
248
|
+
TError,
|
|
249
|
+
TData
|
|
250
|
+
>;
|
|
251
|
+
request?: SecondParameter<typeof customInstance>;
|
|
252
|
+
}
|
|
253
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
254
|
+
const queryOptions = getGetOrganisationQueryOptions(orgId, options);
|
|
255
|
+
|
|
256
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
257
|
+
queryKey: QueryKey;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
query.queryKey = queryOptions.queryKey;
|
|
211
261
|
|
|
212
262
|
return query;
|
|
213
263
|
};
|
|
@@ -224,29 +274,18 @@ export const patchOrganisation = (
|
|
|
224
274
|
organisationPatchBodyBody: OrganisationPatchBodyBody,
|
|
225
275
|
options?: SecondParameter<typeof customInstance>
|
|
226
276
|
) => {
|
|
227
|
-
const formData = new FormData();
|
|
228
|
-
if (organisationPatchBodyBody.name !== undefined) {
|
|
229
|
-
formData.append("name", organisationPatchBodyBody.name);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
277
|
return customInstance<void>(
|
|
233
278
|
{
|
|
234
279
|
url: `/organisation/${orgId}`,
|
|
235
280
|
method: "patch",
|
|
236
|
-
headers: { "Content-Type": "
|
|
237
|
-
data:
|
|
281
|
+
headers: { "Content-Type": "application/json" },
|
|
282
|
+
data: organisationPatchBodyBody,
|
|
238
283
|
},
|
|
239
284
|
options
|
|
240
285
|
);
|
|
241
286
|
};
|
|
242
287
|
|
|
243
|
-
export
|
|
244
|
-
Awaited<ReturnType<typeof patchOrganisation>>
|
|
245
|
-
>;
|
|
246
|
-
export type PatchOrganisationMutationBody = OrganisationPatchBodyBody;
|
|
247
|
-
export type PatchOrganisationMutationError = ErrorType<AsError>;
|
|
248
|
-
|
|
249
|
-
export const usePatchOrganisation = <
|
|
288
|
+
export const getPatchOrganisationMutationOptions = <
|
|
250
289
|
TError = ErrorType<AsError>,
|
|
251
290
|
TContext = unknown
|
|
252
291
|
>(options?: {
|
|
@@ -257,7 +296,12 @@ export const usePatchOrganisation = <
|
|
|
257
296
|
TContext
|
|
258
297
|
>;
|
|
259
298
|
request?: SecondParameter<typeof customInstance>;
|
|
260
|
-
})
|
|
299
|
+
}): UseMutationOptions<
|
|
300
|
+
Awaited<ReturnType<typeof patchOrganisation>>,
|
|
301
|
+
TError,
|
|
302
|
+
{ orgId: string; data: OrganisationPatchBodyBody },
|
|
303
|
+
TContext
|
|
304
|
+
> => {
|
|
261
305
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
262
306
|
|
|
263
307
|
const mutationFn: MutationFunction<
|
|
@@ -269,12 +313,30 @@ export const usePatchOrganisation = <
|
|
|
269
313
|
return patchOrganisation(orgId, data, requestOptions);
|
|
270
314
|
};
|
|
271
315
|
|
|
272
|
-
return
|
|
316
|
+
return { mutationFn, ...mutationOptions };
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export type PatchOrganisationMutationResult = NonNullable<
|
|
320
|
+
Awaited<ReturnType<typeof patchOrganisation>>
|
|
321
|
+
>;
|
|
322
|
+
export type PatchOrganisationMutationBody = OrganisationPatchBodyBody;
|
|
323
|
+
export type PatchOrganisationMutationError = ErrorType<AsError>;
|
|
324
|
+
|
|
325
|
+
export const usePatchOrganisation = <
|
|
326
|
+
TError = ErrorType<AsError>,
|
|
327
|
+
TContext = unknown
|
|
328
|
+
>(options?: {
|
|
329
|
+
mutation?: UseMutationOptions<
|
|
273
330
|
Awaited<ReturnType<typeof patchOrganisation>>,
|
|
274
331
|
TError,
|
|
275
332
|
{ orgId: string; data: OrganisationPatchBodyBody },
|
|
276
333
|
TContext
|
|
277
|
-
|
|
334
|
+
>;
|
|
335
|
+
request?: SecondParameter<typeof customInstance>;
|
|
336
|
+
}) => {
|
|
337
|
+
const mutationOptions = getPatchOrganisationMutationOptions(options);
|
|
338
|
+
|
|
339
|
+
return useMutation(mutationOptions);
|
|
278
340
|
};
|
|
279
341
|
/**
|
|
280
342
|
* Units must first be deleted before an Organisation can be deleted
|
|
@@ -293,13 +355,7 @@ export const deleteOrganisation = (
|
|
|
293
355
|
);
|
|
294
356
|
};
|
|
295
357
|
|
|
296
|
-
export
|
|
297
|
-
Awaited<ReturnType<typeof deleteOrganisation>>
|
|
298
|
-
>;
|
|
299
|
-
|
|
300
|
-
export type DeleteOrganisationMutationError = ErrorType<AsError>;
|
|
301
|
-
|
|
302
|
-
export const useDeleteOrganisation = <
|
|
358
|
+
export const getDeleteOrganisationMutationOptions = <
|
|
303
359
|
TError = ErrorType<AsError>,
|
|
304
360
|
TContext = unknown
|
|
305
361
|
>(options?: {
|
|
@@ -310,7 +366,12 @@ export const useDeleteOrganisation = <
|
|
|
310
366
|
TContext
|
|
311
367
|
>;
|
|
312
368
|
request?: SecondParameter<typeof customInstance>;
|
|
313
|
-
})
|
|
369
|
+
}): UseMutationOptions<
|
|
370
|
+
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
371
|
+
TError,
|
|
372
|
+
{ orgId: string },
|
|
373
|
+
TContext
|
|
374
|
+
> => {
|
|
314
375
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
315
376
|
|
|
316
377
|
const mutationFn: MutationFunction<
|
|
@@ -322,12 +383,30 @@ export const useDeleteOrganisation = <
|
|
|
322
383
|
return deleteOrganisation(orgId, requestOptions);
|
|
323
384
|
};
|
|
324
385
|
|
|
325
|
-
return
|
|
386
|
+
return { mutationFn, ...mutationOptions };
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
export type DeleteOrganisationMutationResult = NonNullable<
|
|
390
|
+
Awaited<ReturnType<typeof deleteOrganisation>>
|
|
391
|
+
>;
|
|
392
|
+
|
|
393
|
+
export type DeleteOrganisationMutationError = ErrorType<AsError>;
|
|
394
|
+
|
|
395
|
+
export const useDeleteOrganisation = <
|
|
396
|
+
TError = ErrorType<AsError>,
|
|
397
|
+
TContext = unknown
|
|
398
|
+
>(options?: {
|
|
399
|
+
mutation?: UseMutationOptions<
|
|
326
400
|
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
327
401
|
TError,
|
|
328
402
|
{ orgId: string },
|
|
329
403
|
TContext
|
|
330
|
-
|
|
404
|
+
>;
|
|
405
|
+
request?: SecondParameter<typeof customInstance>;
|
|
406
|
+
}) => {
|
|
407
|
+
const mutationOptions = getDeleteOrganisationMutationOptions(options);
|
|
408
|
+
|
|
409
|
+
return useMutation(mutationOptions);
|
|
331
410
|
};
|
|
332
411
|
/**
|
|
333
412
|
* Gets a Organisation charges. The organisation cannot be the **Default** organisation and you need to be a member of the Organisation
|
|
@@ -349,14 +428,9 @@ export const getOrganisationCharges = (
|
|
|
349
428
|
export const getGetOrganisationChargesQueryKey = (
|
|
350
429
|
orgId: string,
|
|
351
430
|
params?: GetOrganisationChargesParams
|
|
352
|
-
) => [`/organisation/${orgId}/charges`, ...(params ? [params] : [])];
|
|
353
|
-
|
|
354
|
-
export type GetOrganisationChargesQueryResult = NonNullable<
|
|
355
|
-
Awaited<ReturnType<typeof getOrganisationCharges>>
|
|
356
|
-
>;
|
|
357
|
-
export type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
|
|
431
|
+
) => ["account-server-api", `/organisation/${orgId}/charges`, ...(params ? [params] : [])] as const;
|
|
358
432
|
|
|
359
|
-
export const
|
|
433
|
+
export const getGetOrganisationChargesQueryOptions = <
|
|
360
434
|
TData = Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
361
435
|
TError = ErrorType<void | AsError>
|
|
362
436
|
>(
|
|
@@ -370,7 +444,11 @@ export const useGetOrganisationCharges = <
|
|
|
370
444
|
>;
|
|
371
445
|
request?: SecondParameter<typeof customInstance>;
|
|
372
446
|
}
|
|
373
|
-
):
|
|
447
|
+
): UseQueryOptions<
|
|
448
|
+
Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
449
|
+
TError,
|
|
450
|
+
TData
|
|
451
|
+
> & { queryKey: QueryKey } => {
|
|
374
452
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
375
453
|
|
|
376
454
|
const queryKey =
|
|
@@ -381,15 +459,40 @@ export const useGetOrganisationCharges = <
|
|
|
381
459
|
> = ({ signal }) =>
|
|
382
460
|
getOrganisationCharges(orgId, params, requestOptions, signal);
|
|
383
461
|
|
|
384
|
-
|
|
462
|
+
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
463
|
+
};
|
|
385
464
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
465
|
+
export type GetOrganisationChargesQueryResult = NonNullable<
|
|
466
|
+
Awaited<ReturnType<typeof getOrganisationCharges>>
|
|
467
|
+
>;
|
|
468
|
+
export type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
|
|
469
|
+
|
|
470
|
+
export const useGetOrganisationCharges = <
|
|
471
|
+
TData = Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
472
|
+
TError = ErrorType<void | AsError>
|
|
473
|
+
>(
|
|
474
|
+
orgId: string,
|
|
475
|
+
params?: GetOrganisationChargesParams,
|
|
476
|
+
options?: {
|
|
477
|
+
query?: UseQueryOptions<
|
|
478
|
+
Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
479
|
+
TError,
|
|
480
|
+
TData
|
|
481
|
+
>;
|
|
482
|
+
request?: SecondParameter<typeof customInstance>;
|
|
483
|
+
}
|
|
484
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
485
|
+
const queryOptions = getGetOrganisationChargesQueryOptions(
|
|
486
|
+
orgId,
|
|
487
|
+
params,
|
|
488
|
+
options
|
|
489
|
+
);
|
|
490
|
+
|
|
491
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
492
|
+
queryKey: QueryKey;
|
|
493
|
+
};
|
|
391
494
|
|
|
392
|
-
query.queryKey =
|
|
495
|
+
query.queryKey = queryOptions.queryKey;
|
|
393
496
|
|
|
394
497
|
return query;
|
|
395
498
|
};
|
|
@@ -409,16 +512,10 @@ export const getDefaultOrganisation = (
|
|
|
409
512
|
);
|
|
410
513
|
};
|
|
411
514
|
|
|
412
|
-
export const getGetDefaultOrganisationQueryKey = () =>
|
|
413
|
-
`/organisation/default
|
|
414
|
-
];
|
|
515
|
+
export const getGetDefaultOrganisationQueryKey = () =>
|
|
516
|
+
["account-server-api", `/organisation/default`] as const;
|
|
415
517
|
|
|
416
|
-
export
|
|
417
|
-
Awaited<ReturnType<typeof getDefaultOrganisation>>
|
|
418
|
-
>;
|
|
419
|
-
export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
|
|
420
|
-
|
|
421
|
-
export const useGetDefaultOrganisation = <
|
|
518
|
+
export const getGetDefaultOrganisationQueryOptions = <
|
|
422
519
|
TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
|
|
423
520
|
TError = ErrorType<void | AsError>
|
|
424
521
|
>(options?: {
|
|
@@ -428,7 +525,11 @@ export const useGetDefaultOrganisation = <
|
|
|
428
525
|
TData
|
|
429
526
|
>;
|
|
430
527
|
request?: SecondParameter<typeof customInstance>;
|
|
431
|
-
}):
|
|
528
|
+
}): UseQueryOptions<
|
|
529
|
+
Awaited<ReturnType<typeof getDefaultOrganisation>>,
|
|
530
|
+
TError,
|
|
531
|
+
TData
|
|
532
|
+
> & { queryKey: QueryKey } => {
|
|
432
533
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
433
534
|
|
|
434
535
|
const queryKey =
|
|
@@ -438,15 +539,32 @@ export const useGetDefaultOrganisation = <
|
|
|
438
539
|
Awaited<ReturnType<typeof getDefaultOrganisation>>
|
|
439
540
|
> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
|
|
440
541
|
|
|
441
|
-
|
|
542
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
543
|
+
};
|
|
442
544
|
|
|
443
|
-
|
|
545
|
+
export type GetDefaultOrganisationQueryResult = NonNullable<
|
|
546
|
+
Awaited<ReturnType<typeof getDefaultOrganisation>>
|
|
547
|
+
>;
|
|
548
|
+
export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
|
|
549
|
+
|
|
550
|
+
export const useGetDefaultOrganisation = <
|
|
551
|
+
TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
|
|
552
|
+
TError = ErrorType<void | AsError>
|
|
553
|
+
>(options?: {
|
|
554
|
+
query?: UseQueryOptions<
|
|
444
555
|
Awaited<ReturnType<typeof getDefaultOrganisation>>,
|
|
445
556
|
TError,
|
|
446
557
|
TData
|
|
447
|
-
|
|
558
|
+
>;
|
|
559
|
+
request?: SecondParameter<typeof customInstance>;
|
|
560
|
+
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
561
|
+
const queryOptions = getGetDefaultOrganisationQueryOptions(options);
|
|
562
|
+
|
|
563
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
564
|
+
queryKey: QueryKey;
|
|
565
|
+
};
|
|
448
566
|
|
|
449
|
-
query.queryKey =
|
|
567
|
+
query.queryKey = queryOptions.queryKey;
|
|
450
568
|
|
|
451
569
|
return query;
|
|
452
570
|
};
|