@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
package/src/state/state.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,
|
|
@@ -25,13 +28,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
25
28
|
import type { ErrorType } from '.././custom-instance';
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
30
|
-
config: any,
|
|
31
|
-
args: infer P,
|
|
32
|
-
) => any
|
|
33
|
-
? P
|
|
34
|
-
: never;
|
|
31
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
35
32
|
|
|
36
33
|
|
|
37
34
|
/**
|
|
@@ -44,19 +41,18 @@ export const getVersion = (
|
|
|
44
41
|
|
|
45
42
|
|
|
46
43
|
return customInstance<StateGetVersionResponse>(
|
|
47
|
-
{url: `/version`, method: '
|
|
44
|
+
{url: `/version`, method: 'GET', signal
|
|
48
45
|
},
|
|
49
46
|
options);
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
|
|
53
50
|
export const getGetVersionQueryKey = () => {
|
|
54
|
-
|
|
55
51
|
return ["account-server-api", `/version`] as const;
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
|
|
59
|
-
export const getGetVersionQueryOptions = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData
|
|
55
|
+
export const getGetVersionQueryOptions = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
60
56
|
) => {
|
|
61
57
|
|
|
62
58
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -81,7 +77,7 @@ export type GetVersionQueryError = ErrorType<AsError | void>
|
|
|
81
77
|
* @summary Gets the Account Server version
|
|
82
78
|
*/
|
|
83
79
|
export const useGetVersion = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>(
|
|
84
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData
|
|
80
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
85
81
|
|
|
86
82
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
87
83
|
|
|
@@ -96,3 +92,43 @@ export const useGetVersion = <TData = Awaited<ReturnType<typeof getVersion>>, TE
|
|
|
96
92
|
|
|
97
93
|
|
|
98
94
|
|
|
95
|
+
export const getGetVersionSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
96
|
+
) => {
|
|
97
|
+
|
|
98
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
99
|
+
|
|
100
|
+
const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersion>>> = ({ signal }) => getVersion(requestOptions, signal);
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData> & { queryKey: QueryKey }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type GetVersionSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getVersion>>>
|
|
114
|
+
export type GetVersionSuspenseQueryError = ErrorType<AsError | void>
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @summary Gets the Account Server version
|
|
118
|
+
*/
|
|
119
|
+
export const useGetVersionSuspense = <TData = Awaited<ReturnType<typeof getVersion>>, TError = ErrorType<AsError | void>>(
|
|
120
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getVersion>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
121
|
+
|
|
122
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
123
|
+
|
|
124
|
+
const queryOptions = getGetVersionSuspenseQueryOptions(options)
|
|
125
|
+
|
|
126
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
127
|
+
|
|
128
|
+
query.queryKey = queryOptions.queryKey ;
|
|
129
|
+
|
|
130
|
+
return query;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
package/src/unit/unit.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.
|
|
@@ -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,
|
|
@@ -37,13 +40,7 @@ import { customInstance } from '.././custom-instance';
|
|
|
37
40
|
import type { ErrorType } from '.././custom-instance';
|
|
38
41
|
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
42
|
-
config: any,
|
|
43
|
-
args: infer P,
|
|
44
|
-
) => any
|
|
45
|
-
? P
|
|
46
|
-
: never;
|
|
43
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
47
44
|
|
|
48
45
|
|
|
49
46
|
/**
|
|
@@ -58,19 +55,18 @@ export const getOrganisationUnits = (
|
|
|
58
55
|
|
|
59
56
|
|
|
60
57
|
return customInstance<OrganisationUnitsGetResponse>(
|
|
61
|
-
{url: `/organisation/${orgId}/unit`, method: '
|
|
58
|
+
{url: `/organisation/${orgId}/unit`, method: 'GET', signal
|
|
62
59
|
},
|
|
63
60
|
options);
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
|
|
67
64
|
export const getGetOrganisationUnitsQueryKey = (orgId: string,) => {
|
|
68
|
-
|
|
69
65
|
return ["account-server-api", `/organisation/${orgId}/unit`] as const;
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
|
|
73
|
-
export const getGetOrganisationUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData
|
|
69
|
+
export const getGetOrganisationUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
74
70
|
) => {
|
|
75
71
|
|
|
76
72
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -95,7 +91,7 @@ export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>
|
|
|
95
91
|
* @summary Gets Organisational Units
|
|
96
92
|
*/
|
|
97
93
|
export const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
|
|
98
|
-
orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData
|
|
94
|
+
orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
99
95
|
|
|
100
96
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
101
97
|
|
|
@@ -110,6 +106,46 @@ export const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrg
|
|
|
110
106
|
|
|
111
107
|
|
|
112
108
|
|
|
109
|
+
export const getGetOrganisationUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
110
|
+
) => {
|
|
111
|
+
|
|
112
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
113
|
+
|
|
114
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: QueryKey }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type GetOrganisationUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
|
|
128
|
+
export type GetOrganisationUnitsSuspenseQueryError = ErrorType<void | AsError>
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @summary Gets Organisational Units
|
|
132
|
+
*/
|
|
133
|
+
export const useGetOrganisationUnitsSuspense = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
|
|
134
|
+
orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
135
|
+
|
|
136
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
137
|
+
|
|
138
|
+
const queryOptions = getGetOrganisationUnitsSuspenseQueryOptions(orgId,options)
|
|
139
|
+
|
|
140
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
141
|
+
|
|
142
|
+
query.queryKey = queryOptions.queryKey ;
|
|
143
|
+
|
|
144
|
+
return query;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
113
149
|
/**
|
|
114
150
|
* Creates a new Organisation Unit. You need to be a member of the **Organisation** or have administration rights to use this endpoint
|
|
115
151
|
|
|
@@ -122,7 +158,7 @@ export const createOrganisationUnit = (
|
|
|
122
158
|
|
|
123
159
|
|
|
124
160
|
return customInstance<OrganisationUnitPostResponse>(
|
|
125
|
-
{url: `/organisation/${orgId}/unit`, method: '
|
|
161
|
+
{url: `/organisation/${orgId}/unit`, method: 'POST',
|
|
126
162
|
headers: {'Content-Type': 'application/json', },
|
|
127
163
|
data: organisationUnitPostBodyBody
|
|
128
164
|
},
|
|
@@ -132,7 +168,6 @@ export const createOrganisationUnit = (
|
|
|
132
168
|
|
|
133
169
|
|
|
134
170
|
export const getCreateOrganisationUnitMutationOptions = <TError = ErrorType<AsError | void>,
|
|
135
|
-
|
|
136
171
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
137
172
|
): UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext> => {
|
|
138
173
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -159,7 +194,6 @@ export const getCreateOrganisationUnitMutationOptions = <TError = ErrorType<AsEr
|
|
|
159
194
|
* @summary Create a new Organisational Unit
|
|
160
195
|
*/
|
|
161
196
|
export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>,
|
|
162
|
-
|
|
163
197
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
164
198
|
) => {
|
|
165
199
|
|
|
@@ -179,19 +213,18 @@ export const getUnit = (
|
|
|
179
213
|
|
|
180
214
|
|
|
181
215
|
return customInstance<UnitDetail>(
|
|
182
|
-
{url: `/unit/${unitId}`, method: '
|
|
216
|
+
{url: `/unit/${unitId}`, method: 'GET', signal
|
|
183
217
|
},
|
|
184
218
|
options);
|
|
185
219
|
}
|
|
186
220
|
|
|
187
221
|
|
|
188
222
|
export const getGetUnitQueryKey = (unitId: string,) => {
|
|
189
|
-
|
|
190
223
|
return ["account-server-api", `/unit/${unitId}`] as const;
|
|
191
224
|
}
|
|
192
225
|
|
|
193
226
|
|
|
194
|
-
export const getGetUnitQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData
|
|
227
|
+
export const getGetUnitQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
195
228
|
) => {
|
|
196
229
|
|
|
197
230
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -216,7 +249,7 @@ export type GetUnitQueryError = ErrorType<void | AsError>
|
|
|
216
249
|
* @summary Gets an Organisational Unit
|
|
217
250
|
*/
|
|
218
251
|
export const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
|
|
219
|
-
unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData
|
|
252
|
+
unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
220
253
|
|
|
221
254
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
222
255
|
|
|
@@ -231,6 +264,46 @@ export const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError =
|
|
|
231
264
|
|
|
232
265
|
|
|
233
266
|
|
|
267
|
+
export const getGetUnitSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
268
|
+
) => {
|
|
269
|
+
|
|
270
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
271
|
+
|
|
272
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: QueryKey }
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export type GetUnitSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
|
|
286
|
+
export type GetUnitSuspenseQueryError = ErrorType<void | AsError>
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @summary Gets an Organisational Unit
|
|
290
|
+
*/
|
|
291
|
+
export const useGetUnitSuspense = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
|
|
292
|
+
unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
293
|
+
|
|
294
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
295
|
+
|
|
296
|
+
const queryOptions = getGetUnitSuspenseQueryOptions(unitId,options)
|
|
297
|
+
|
|
298
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
299
|
+
|
|
300
|
+
query.queryKey = queryOptions.queryKey ;
|
|
301
|
+
|
|
302
|
+
return query;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
234
307
|
/**
|
|
235
308
|
* Used to update existing Unit.
|
|
236
309
|
|
|
@@ -245,7 +318,7 @@ export const patchUnit = (
|
|
|
245
318
|
|
|
246
319
|
|
|
247
320
|
return customInstance<void>(
|
|
248
|
-
{url: `/unit/${unitId}`, method: '
|
|
321
|
+
{url: `/unit/${unitId}`, method: 'PATCH',
|
|
249
322
|
headers: {'Content-Type': 'application/json', },
|
|
250
323
|
data: unitPatchBodyBody
|
|
251
324
|
},
|
|
@@ -255,7 +328,6 @@ export const patchUnit = (
|
|
|
255
328
|
|
|
256
329
|
|
|
257
330
|
export const getPatchUnitMutationOptions = <TError = ErrorType<AsError>,
|
|
258
|
-
|
|
259
331
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
260
332
|
): UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext> => {
|
|
261
333
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -282,7 +354,6 @@ export const getPatchUnitMutationOptions = <TError = ErrorType<AsError>,
|
|
|
282
354
|
* @summary Adjust an existing Unit
|
|
283
355
|
*/
|
|
284
356
|
export const usePatchUnit = <TError = ErrorType<AsError>,
|
|
285
|
-
|
|
286
357
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
287
358
|
) => {
|
|
288
359
|
|
|
@@ -305,7 +376,7 @@ export const deleteOrganisationUnit = (
|
|
|
305
376
|
|
|
306
377
|
|
|
307
378
|
return customInstance<void>(
|
|
308
|
-
{url: `/unit/${unitId}`, method: '
|
|
379
|
+
{url: `/unit/${unitId}`, method: 'DELETE'
|
|
309
380
|
},
|
|
310
381
|
options);
|
|
311
382
|
}
|
|
@@ -313,7 +384,6 @@ export const deleteOrganisationUnit = (
|
|
|
313
384
|
|
|
314
385
|
|
|
315
386
|
export const getDeleteOrganisationUnitMutationOptions = <TError = ErrorType<AsError>,
|
|
316
|
-
|
|
317
387
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
318
388
|
): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext> => {
|
|
319
389
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -340,7 +410,6 @@ export const getDeleteOrganisationUnitMutationOptions = <TError = ErrorType<AsEr
|
|
|
340
410
|
* @summary Deletes an Organisational Unit
|
|
341
411
|
*/
|
|
342
412
|
export const useDeleteOrganisationUnit = <TError = ErrorType<AsError>,
|
|
343
|
-
|
|
344
413
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
345
414
|
) => {
|
|
346
415
|
|
|
@@ -360,19 +429,18 @@ export const getUnits = (
|
|
|
360
429
|
|
|
361
430
|
|
|
362
431
|
return customInstance<UnitsGetResponse>(
|
|
363
|
-
{url: `/unit`, method: '
|
|
432
|
+
{url: `/unit`, method: 'GET', signal
|
|
364
433
|
},
|
|
365
434
|
options);
|
|
366
435
|
}
|
|
367
436
|
|
|
368
437
|
|
|
369
438
|
export const getGetUnitsQueryKey = () => {
|
|
370
|
-
|
|
371
439
|
return ["account-server-api", `/unit`] as const;
|
|
372
440
|
}
|
|
373
441
|
|
|
374
442
|
|
|
375
|
-
export const getGetUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData
|
|
443
|
+
export const getGetUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
376
444
|
) => {
|
|
377
445
|
|
|
378
446
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -397,7 +465,7 @@ export type GetUnitsQueryError = ErrorType<void | AsError>
|
|
|
397
465
|
* @summary Gets Units
|
|
398
466
|
*/
|
|
399
467
|
export const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
|
|
400
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData
|
|
468
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
401
469
|
|
|
402
470
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
403
471
|
|
|
@@ -412,6 +480,46 @@ export const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError
|
|
|
412
480
|
|
|
413
481
|
|
|
414
482
|
|
|
483
|
+
export const getGetUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
484
|
+
) => {
|
|
485
|
+
|
|
486
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
487
|
+
|
|
488
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: QueryKey }
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export type GetUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
|
|
502
|
+
export type GetUnitsSuspenseQueryError = ErrorType<void | AsError>
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* @summary Gets Units
|
|
506
|
+
*/
|
|
507
|
+
export const useGetUnitsSuspense = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
|
|
508
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
509
|
+
|
|
510
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
511
|
+
|
|
512
|
+
const queryOptions = getGetUnitsSuspenseQueryOptions(options)
|
|
513
|
+
|
|
514
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
515
|
+
|
|
516
|
+
query.queryKey = queryOptions.queryKey ;
|
|
517
|
+
|
|
518
|
+
return query;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
415
523
|
/**
|
|
416
524
|
* Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
|
|
417
525
|
|
|
@@ -425,7 +533,7 @@ export const createDefaultUnit = (
|
|
|
425
533
|
|
|
426
534
|
|
|
427
535
|
return customInstance<PersonalUnitPutResponse>(
|
|
428
|
-
{url: `/unit`, method: '
|
|
536
|
+
{url: `/unit`, method: 'PUT',
|
|
429
537
|
headers: {'Content-Type': 'application/json', },
|
|
430
538
|
data: personalUnitPutBodyBody
|
|
431
539
|
},
|
|
@@ -435,7 +543,6 @@ export const createDefaultUnit = (
|
|
|
435
543
|
|
|
436
544
|
|
|
437
545
|
export const getCreateDefaultUnitMutationOptions = <TError = ErrorType<AsError | void>,
|
|
438
|
-
|
|
439
546
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
440
547
|
): UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext> => {
|
|
441
548
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
@@ -462,7 +569,6 @@ export const getCreateDefaultUnitMutationOptions = <TError = ErrorType<AsError |
|
|
|
462
569
|
* @summary Create a new Personal Unit
|
|
463
570
|
*/
|
|
464
571
|
export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>,
|
|
465
|
-
|
|
466
572
|
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
467
573
|
) => {
|
|
468
574
|
|
|
@@ -481,7 +587,7 @@ export const deleteDefaultUnit = (
|
|
|
481
587
|
|
|
482
588
|
|
|
483
589
|
return customInstance<void>(
|
|
484
|
-
{url: `/unit`, method: '
|
|
590
|
+
{url: `/unit`, method: 'DELETE'
|
|
485
591
|
},
|
|
486
592
|
options);
|
|
487
593
|
}
|
|
@@ -489,15 +595,14 @@ export const deleteDefaultUnit = (
|
|
|
489
595
|
|
|
490
596
|
|
|
491
597
|
export const getDeleteDefaultUnitMutationOptions = <TError = ErrorType<AsError>,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
): UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext> => {
|
|
598
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
599
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext> => {
|
|
495
600
|
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
496
601
|
|
|
497
602
|
|
|
498
603
|
|
|
499
604
|
|
|
500
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>,
|
|
605
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, void> = () => {
|
|
501
606
|
|
|
502
607
|
|
|
503
608
|
return deleteDefaultUnit(requestOptions)
|
|
@@ -516,8 +621,7 @@ export const getDeleteDefaultUnitMutationOptions = <TError = ErrorType<AsError>,
|
|
|
516
621
|
* @summary Deletes a Personal Unit
|
|
517
622
|
*/
|
|
518
623
|
export const useDeleteDefaultUnit = <TError = ErrorType<AsError>,
|
|
519
|
-
|
|
520
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
624
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
521
625
|
) => {
|
|
522
626
|
|
|
523
627
|
const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
|
|
@@ -541,7 +645,7 @@ export const getUnitCharges = (
|
|
|
541
645
|
|
|
542
646
|
|
|
543
647
|
return customInstance<UnitChargesGetResponse>(
|
|
544
|
-
{url: `/unit/${unitId}/charges`, method: '
|
|
648
|
+
{url: `/unit/${unitId}/charges`, method: 'GET',
|
|
545
649
|
params, signal
|
|
546
650
|
},
|
|
547
651
|
options);
|
|
@@ -550,13 +654,12 @@ export const getUnitCharges = (
|
|
|
550
654
|
|
|
551
655
|
export const getGetUnitChargesQueryKey = (unitId: string,
|
|
552
656
|
params?: GetUnitChargesParams,) => {
|
|
553
|
-
|
|
554
657
|
return ["account-server-api", `/unit/${unitId}/charges`, ...(params ? [params]: [])] as const;
|
|
555
658
|
}
|
|
556
659
|
|
|
557
660
|
|
|
558
661
|
export const getGetUnitChargesQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,
|
|
559
|
-
params?: GetUnitChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData
|
|
662
|
+
params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
560
663
|
) => {
|
|
561
664
|
|
|
562
665
|
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
@@ -582,7 +685,7 @@ export type GetUnitChargesQueryError = ErrorType<AsError | void>
|
|
|
582
685
|
*/
|
|
583
686
|
export const useGetUnitCharges = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(
|
|
584
687
|
unitId: string,
|
|
585
|
-
params?: GetUnitChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData
|
|
688
|
+
params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
586
689
|
|
|
587
690
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
588
691
|
|
|
@@ -597,3 +700,45 @@ export const useGetUnitCharges = <TData = Awaited<ReturnType<typeof getUnitCharg
|
|
|
597
700
|
|
|
598
701
|
|
|
599
702
|
|
|
703
|
+
export const getGetUnitChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,
|
|
704
|
+
params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
705
|
+
) => {
|
|
706
|
+
|
|
707
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
708
|
+
|
|
709
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: QueryKey }
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export type GetUnitChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>
|
|
723
|
+
export type GetUnitChargesSuspenseQueryError = ErrorType<AsError | void>
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* @summary Get charges made against a Unit
|
|
727
|
+
*/
|
|
728
|
+
export const useGetUnitChargesSuspense = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(
|
|
729
|
+
unitId: string,
|
|
730
|
+
params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
731
|
+
|
|
732
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
733
|
+
|
|
734
|
+
const queryOptions = getGetUnitChargesSuspenseQueryOptions(unitId,params,options)
|
|
735
|
+
|
|
736
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
737
|
+
|
|
738
|
+
query.queryKey = queryOptions.queryKey ;
|
|
739
|
+
|
|
740
|
+
return query;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|