@squonk/account-server-client 2.0.6 → 2.0.7

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.
Files changed (70) hide show
  1. package/admin/admin.cjs +14 -7
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.cts +33 -0
  4. package/admin/admin.d.ts +4 -1
  5. package/admin/admin.js +14 -7
  6. package/admin/admin.js.map +1 -1
  7. package/asset/asset.cjs +44 -19
  8. package/asset/asset.cjs.map +1 -1
  9. package/asset/asset.d.cts +241 -0
  10. package/asset/asset.d.ts +43 -19
  11. package/asset/asset.js +37 -12
  12. package/asset/asset.js.map +1 -1
  13. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  14. package/chunk-J22A7LHX.cjs.map +1 -0
  15. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  16. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  17. package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
  18. package/index.cjs +10 -10
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +2 -0
  21. package/index.d.ts +1 -1
  22. package/index.js +9 -9
  23. package/index.js.map +1 -1
  24. package/merchant/merchant.cjs +23 -13
  25. package/merchant/merchant.cjs.map +1 -1
  26. package/merchant/merchant.d.cts +57 -0
  27. package/merchant/merchant.d.ts +7 -1
  28. package/merchant/merchant.js +22 -12
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +50 -25
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.cts +203 -0
  33. package/organisation/organisation.d.ts +31 -10
  34. package/organisation/organisation.js +44 -19
  35. package/organisation/organisation.js.map +1 -1
  36. package/package.json +12 -12
  37. package/product/product.cjs +80 -44
  38. package/product/product.cjs.map +1 -1
  39. package/product/product.d.cts +280 -0
  40. package/product/product.d.ts +40 -10
  41. package/product/product.js +71 -35
  42. package/product/product.js.map +1 -1
  43. package/src/account-server-api.schemas.ts +268 -276
  44. package/src/admin/admin.ts +72 -78
  45. package/src/asset/asset.ts +447 -556
  46. package/src/merchant/merchant.ts +125 -136
  47. package/src/organisation/organisation.ts +394 -484
  48. package/src/product/product.ts +557 -682
  49. package/src/state/state.ts +70 -69
  50. package/src/unit/unit.ts +494 -593
  51. package/src/user/user.ts +377 -463
  52. package/state/state.cjs +13 -7
  53. package/state/state.cjs.map +1 -1
  54. package/state/state.d.cts +29 -0
  55. package/state/state.d.ts +4 -1
  56. package/state/state.js +13 -7
  57. package/state/state.js.map +1 -1
  58. package/unit/unit.cjs +59 -28
  59. package/unit/unit.cjs.map +1 -1
  60. package/unit/unit.d.cts +254 -0
  61. package/unit/unit.d.ts +43 -16
  62. package/unit/unit.js +52 -21
  63. package/unit/unit.js.map +1 -1
  64. package/user/user.cjs +52 -21
  65. package/user/user.cjs.map +1 -1
  66. package/user/user.d.cts +220 -0
  67. package/user/user.d.ts +31 -10
  68. package/user/user.js +46 -15
  69. package/user/user.js.map +1 -1
  70. package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/user/user.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
2
+ * Generated by orval v6.20.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,100 +8,99 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
11
- import { useQuery, useMutation } from "@tanstack/react-query";
11
+ import {
12
+ useMutation,
13
+ useQuery
14
+ } from '@tanstack/react-query'
12
15
  import type {
13
- UseQueryOptions,
14
- UseMutationOptions,
15
- QueryFunction,
16
16
  MutationFunction,
17
- UseQueryResult,
17
+ QueryFunction,
18
18
  QueryKey,
19
- } from "@tanstack/react-query";
19
+ UseMutationOptions,
20
+ UseQueryOptions,
21
+ UseQueryResult
22
+ } from '@tanstack/react-query'
20
23
  import type {
21
- UserAccountGetResponse,
22
24
  AsError,
23
- UsersGetResponse,
24
- } from "../account-server-api.schemas";
25
- import { customInstance } from ".././custom-instance";
26
- import type { ErrorType } from ".././custom-instance";
25
+ UserAccountDetail,
26
+ UsersGetResponse
27
+ } from '../account-server-api.schemas'
28
+ import { customInstance } from '.././custom-instance';
29
+ import type { ErrorType } from '.././custom-instance';
30
+
27
31
 
28
32
  // eslint-disable-next-line
29
- type SecondParameter<T extends (...args: any) => any> = T extends (
33
+ type SecondParameter<T extends (...args: any) => any> = T extends (
30
34
  config: any,
31
- args: infer P
35
+ args: infer P,
32
36
  ) => any
33
37
  ? P
34
38
  : never;
35
39
 
40
+
36
41
  /**
37
42
  * Returns a summary of your account
38
43
 
39
44
  * @summary Get information about your account
40
45
  */
41
46
  export const getUserAccount = (
42
- options?: SecondParameter<typeof customInstance>,
43
- signal?: AbortSignal
47
+
48
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
44
49
  ) => {
45
- return customInstance<UserAccountGetResponse>(
46
- { url: `/user/account`, method: "get", signal },
47
- options
48
- );
49
- };
50
-
51
- export const getGetUserAccountQueryKey = () => ["account-server-api", `/user/account`] as const;
52
-
53
- export const getGetUserAccountQueryOptions = <
54
- TData = Awaited<ReturnType<typeof getUserAccount>>,
55
- TError = ErrorType<void | AsError>
56
- >(options?: {
57
- query?: UseQueryOptions<
58
- Awaited<ReturnType<typeof getUserAccount>>,
59
- TError,
60
- TData
61
- >;
62
- request?: SecondParameter<typeof customInstance>;
63
- }): UseQueryOptions<
64
- Awaited<ReturnType<typeof getUserAccount>>,
65
- TError,
66
- TData
67
- > & { queryKey: QueryKey } => {
68
- const { query: queryOptions, request: requestOptions } = options ?? {};
69
-
70
- const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
71
-
72
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({
73
- signal,
74
- }) => getUserAccount(requestOptions, signal);
75
-
76
- return { queryKey, queryFn, ...queryOptions };
77
- };
78
-
79
- export type GetUserAccountQueryResult = NonNullable<
80
- Awaited<ReturnType<typeof getUserAccount>>
81
- >;
82
- export type GetUserAccountQueryError = ErrorType<void | AsError>;
83
-
84
- export const useGetUserAccount = <
85
- TData = Awaited<ReturnType<typeof getUserAccount>>,
86
- TError = ErrorType<void | AsError>
87
- >(options?: {
88
- query?: UseQueryOptions<
89
- Awaited<ReturnType<typeof getUserAccount>>,
90
- TError,
91
- TData
92
- >;
93
- request?: SecondParameter<typeof customInstance>;
94
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
95
- const queryOptions = getGetUserAccountQueryOptions(options);
96
-
97
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
98
- queryKey: QueryKey;
99
- };
100
-
101
- query.queryKey = queryOptions.queryKey;
50
+
51
+
52
+ return customInstance<UserAccountDetail>(
53
+ {url: `/user/account`, method: 'get', signal
54
+ },
55
+ options);
56
+ }
57
+
58
+
59
+ export const getGetUserAccountQueryKey = () => {
60
+
61
+ return ["account-server-api", `/user/account`] as const;
62
+ }
63
+
64
+
65
+ export const getGetUserAccountQueryOptions = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
66
+ ) => {
67
+
68
+ const {query: queryOptions, request: requestOptions} = options ?? {};
69
+
70
+ const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
71
+
72
+
73
+
74
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) => getUserAccount(requestOptions, signal);
75
+
76
+
77
+
78
+
79
+
80
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData> & { queryKey: QueryKey }
81
+ }
82
+
83
+ export type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>
84
+ export type GetUserAccountQueryError = ErrorType<void | AsError>
85
+
86
+ /**
87
+ * @summary Get information about your account
88
+ */
89
+ export const useGetUserAccount = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>(
90
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
91
+
92
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
93
+
94
+ const queryOptions = getGetUserAccountQueryOptions(options)
95
+
96
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
97
+
98
+ query.queryKey = queryOptions.queryKey ;
102
99
 
103
100
  return query;
104
- };
101
+ }
102
+
103
+
105
104
 
106
105
  /**
107
106
  * Gets Users in an Organisation.
@@ -111,78 +110,63 @@ You have to be a member of the Organisation or an admin user to use this endpoin
111
110
  * @summary Gets users in an Organisation
112
111
  */
113
112
  export const getOrganisationUsers = (
114
- orgId: string,
115
- options?: SecondParameter<typeof customInstance>,
116
- signal?: AbortSignal
113
+ orgId: string,
114
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
115
+ ) => {
116
+
117
+
118
+ return customInstance<UsersGetResponse>(
119
+ {url: `/organisation/${orgId}/user`, method: 'get', signal
120
+ },
121
+ options);
122
+ }
123
+
124
+
125
+ export const getGetOrganisationUsersQueryKey = (orgId: string,) => {
126
+
127
+ return ["account-server-api", `/organisation/${orgId}/user`] as const;
128
+ }
129
+
130
+
131
+ export const getGetOrganisationUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
117
132
  ) => {
118
- return customInstance<UsersGetResponse>(
119
- { url: `/organisation/${orgId}/user`, method: "get", signal },
120
- options
121
- );
122
- };
123
-
124
- export const getGetOrganisationUsersQueryKey = (orgId: string) =>
125
- ["account-server-api", `/organisation/${orgId}/user`] as const;
126
-
127
- export const getGetOrganisationUsersQueryOptions = <
128
- TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
129
- TError = ErrorType<AsError | void>
130
- >(
131
- orgId: string,
132
- options?: {
133
- query?: UseQueryOptions<
134
- Awaited<ReturnType<typeof getOrganisationUsers>>,
135
- TError,
136
- TData
137
- >;
138
- request?: SecondParameter<typeof customInstance>;
139
- }
140
- ): UseQueryOptions<
141
- Awaited<ReturnType<typeof getOrganisationUsers>>,
142
- TError,
143
- TData
144
- > & { queryKey: QueryKey } => {
145
- const { query: queryOptions, request: requestOptions } = options ?? {};
146
-
147
- const queryKey =
148
- queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
149
-
150
- const queryFn: QueryFunction<
151
- Awaited<ReturnType<typeof getOrganisationUsers>>
152
- > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
153
-
154
- return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
155
- };
156
-
157
- export type GetOrganisationUsersQueryResult = NonNullable<
158
- Awaited<ReturnType<typeof getOrganisationUsers>>
159
- >;
160
- export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
161
-
162
- export const useGetOrganisationUsers = <
163
- TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
164
- TError = ErrorType<AsError | void>
165
- >(
166
- orgId: string,
167
- options?: {
168
- query?: UseQueryOptions<
169
- Awaited<ReturnType<typeof getOrganisationUsers>>,
170
- TError,
171
- TData
172
- >;
173
- request?: SecondParameter<typeof customInstance>;
174
- }
175
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
176
- const queryOptions = getGetOrganisationUsersQueryOptions(orgId, options);
177
-
178
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
179
- queryKey: QueryKey;
180
- };
181
-
182
- query.queryKey = queryOptions.queryKey;
133
+
134
+ const {query: queryOptions, request: requestOptions} = options ?? {};
135
+
136
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
137
+
138
+
139
+
140
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
141
+
142
+
143
+
144
+
145
+
146
+ return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData> & { queryKey: QueryKey }
147
+ }
148
+
149
+ export type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>
150
+ export type GetOrganisationUsersQueryError = ErrorType<AsError | void>
151
+
152
+ /**
153
+ * @summary Gets users in an Organisation
154
+ */
155
+ export const useGetOrganisationUsers = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(
156
+ orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
157
+
158
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
159
+
160
+ const queryOptions = getGetOrganisationUsersQueryOptions(orgId,options)
161
+
162
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
163
+
164
+ query.queryKey = queryOptions.queryKey ;
183
165
 
184
166
  return query;
185
- };
167
+ }
168
+
169
+
186
170
 
187
171
  /**
188
172
  * Adds a User to an **Organisation**.
@@ -192,70 +176,56 @@ You have to be in the Organisation or an admin user to use this endpoint
192
176
  * @summary Adds a User to an Organisation
193
177
  */
194
178
  export const addOrganisationUser = (
195
- orgId: string,
196
- userId: string,
197
- options?: SecondParameter<typeof customInstance>
179
+ orgId: string,
180
+ userId: string,
181
+ options?: SecondParameter<typeof customInstance>,) => {
182
+
183
+
184
+ return customInstance<void>(
185
+ {url: `/organisation/${orgId}/user/${userId}`, method: 'put'
186
+ },
187
+ options);
188
+ }
189
+
190
+
191
+
192
+ export const getAddOrganisationUserMutationOptions = <TError = ErrorType<AsError>,
193
+
194
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
195
+ ): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {
196
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
197
+
198
+
199
+
200
+
201
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUser>>, {orgId: string;userId: string}> = (props) => {
202
+ const {orgId,userId} = props ?? {};
203
+
204
+ return addOrganisationUser(orgId,userId,requestOptions)
205
+ }
206
+
207
+
208
+
209
+
210
+ return { mutationFn, ...mutationOptions }}
211
+
212
+ export type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>
213
+
214
+ export type AddOrganisationUserMutationError = ErrorType<AsError>
215
+
216
+ /**
217
+ * @summary Adds a User to an Organisation
218
+ */
219
+ export const useAddOrganisationUser = <TError = ErrorType<AsError>,
220
+
221
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
198
222
  ) => {
199
- return customInstance<void>(
200
- { url: `/organisation/${orgId}/user/${userId}`, method: "put" },
201
- options
202
- );
203
- };
204
-
205
- export const getAddOrganisationUserMutationOptions = <
206
- TError = ErrorType<AsError>,
207
- TContext = unknown
208
- >(options?: {
209
- mutation?: UseMutationOptions<
210
- Awaited<ReturnType<typeof addOrganisationUser>>,
211
- TError,
212
- { orgId: string; userId: string },
213
- TContext
214
- >;
215
- request?: SecondParameter<typeof customInstance>;
216
- }): UseMutationOptions<
217
- Awaited<ReturnType<typeof addOrganisationUser>>,
218
- TError,
219
- { orgId: string; userId: string },
220
- TContext
221
- > => {
222
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
223
-
224
- const mutationFn: MutationFunction<
225
- Awaited<ReturnType<typeof addOrganisationUser>>,
226
- { orgId: string; userId: string }
227
- > = (props) => {
228
- const { orgId, userId } = props ?? {};
229
-
230
- return addOrganisationUser(orgId, userId, requestOptions);
231
- };
232
-
233
- return { mutationFn, ...mutationOptions };
234
- };
235
-
236
- export type AddOrganisationUserMutationResult = NonNullable<
237
- Awaited<ReturnType<typeof addOrganisationUser>>
238
- >;
239
-
240
- export type AddOrganisationUserMutationError = ErrorType<AsError>;
241
-
242
- export const useAddOrganisationUser = <
243
- TError = ErrorType<AsError>,
244
- TContext = unknown
245
- >(options?: {
246
- mutation?: UseMutationOptions<
247
- Awaited<ReturnType<typeof addOrganisationUser>>,
248
- TError,
249
- { orgId: string; userId: string },
250
- TContext
251
- >;
252
- request?: SecondParameter<typeof customInstance>;
253
- }) => {
254
- const mutationOptions = getAddOrganisationUserMutationOptions(options);
255
-
256
- return useMutation(mutationOptions);
257
- };
258
- /**
223
+
224
+ const mutationOptions = getAddOrganisationUserMutationOptions(options);
225
+
226
+ return useMutation(mutationOptions);
227
+ }
228
+ /**
259
229
  * Removes a User from an **Organisation**.
260
230
 
261
231
  You have to be in the Organisation or an admin user to use this endpoint
@@ -263,70 +233,56 @@ You have to be in the Organisation or an admin user to use this endpoint
263
233
  * @summary Deletes a User from an Organisation
264
234
  */
265
235
  export const deleteOrganisationUser = (
266
- orgId: string,
267
- userId: string,
268
- options?: SecondParameter<typeof customInstance>
236
+ orgId: string,
237
+ userId: string,
238
+ options?: SecondParameter<typeof customInstance>,) => {
239
+
240
+
241
+ return customInstance<void>(
242
+ {url: `/organisation/${orgId}/user/${userId}`, method: 'delete'
243
+ },
244
+ options);
245
+ }
246
+
247
+
248
+
249
+ export const getDeleteOrganisationUserMutationOptions = <TError = ErrorType<AsError>,
250
+
251
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
252
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {
253
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
254
+
255
+
256
+
257
+
258
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUser>>, {orgId: string;userId: string}> = (props) => {
259
+ const {orgId,userId} = props ?? {};
260
+
261
+ return deleteOrganisationUser(orgId,userId,requestOptions)
262
+ }
263
+
264
+
265
+
266
+
267
+ return { mutationFn, ...mutationOptions }}
268
+
269
+ export type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>
270
+
271
+ export type DeleteOrganisationUserMutationError = ErrorType<AsError>
272
+
273
+ /**
274
+ * @summary Deletes a User from an Organisation
275
+ */
276
+ export const useDeleteOrganisationUser = <TError = ErrorType<AsError>,
277
+
278
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
269
279
  ) => {
270
- return customInstance<void>(
271
- { url: `/organisation/${orgId}/user/${userId}`, method: "delete" },
272
- options
273
- );
274
- };
275
-
276
- export const getDeleteOrganisationUserMutationOptions = <
277
- TError = ErrorType<AsError>,
278
- TContext = unknown
279
- >(options?: {
280
- mutation?: UseMutationOptions<
281
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
282
- TError,
283
- { orgId: string; userId: string },
284
- TContext
285
- >;
286
- request?: SecondParameter<typeof customInstance>;
287
- }): UseMutationOptions<
288
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
289
- TError,
290
- { orgId: string; userId: string },
291
- TContext
292
- > => {
293
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
294
-
295
- const mutationFn: MutationFunction<
296
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
297
- { orgId: string; userId: string }
298
- > = (props) => {
299
- const { orgId, userId } = props ?? {};
300
-
301
- return deleteOrganisationUser(orgId, userId, requestOptions);
302
- };
303
-
304
- return { mutationFn, ...mutationOptions };
305
- };
306
-
307
- export type DeleteOrganisationUserMutationResult = NonNullable<
308
- Awaited<ReturnType<typeof deleteOrganisationUser>>
309
- >;
310
-
311
- export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
312
-
313
- export const useDeleteOrganisationUser = <
314
- TError = ErrorType<AsError>,
315
- TContext = unknown
316
- >(options?: {
317
- mutation?: UseMutationOptions<
318
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
319
- TError,
320
- { orgId: string; userId: string },
321
- TContext
322
- >;
323
- request?: SecondParameter<typeof customInstance>;
324
- }) => {
325
- const mutationOptions = getDeleteOrganisationUserMutationOptions(options);
326
-
327
- return useMutation(mutationOptions);
328
- };
329
- /**
280
+
281
+ const mutationOptions = getDeleteOrganisationUserMutationOptions(options);
282
+
283
+ return useMutation(mutationOptions);
284
+ }
285
+ /**
330
286
  * Gets users in an Organisational Unit.
331
287
 
332
288
  You have to be in the Organisation or Unit or an Admin user to use this endpoint
@@ -334,78 +290,63 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
334
290
  * @summary Gets users in an Organisational Unit
335
291
  */
336
292
  export const getOrganisationUnitUsers = (
337
- unitId: string,
338
- options?: SecondParameter<typeof customInstance>,
339
- signal?: AbortSignal
293
+ unitId: string,
294
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
340
295
  ) => {
341
- return customInstance<UsersGetResponse>(
342
- { url: `/unit/${unitId}/user`, method: "get", signal },
343
- options
344
- );
345
- };
346
-
347
- export const getGetOrganisationUnitUsersQueryKey = (unitId: string) =>
348
- ["account-server-api", `/unit/${unitId}/user`] as const;
349
-
350
- export const getGetOrganisationUnitUsersQueryOptions = <
351
- TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
352
- TError = ErrorType<AsError | void>
353
- >(
354
- unitId: string,
355
- options?: {
356
- query?: UseQueryOptions<
357
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
358
- TError,
359
- TData
360
- >;
361
- request?: SecondParameter<typeof customInstance>;
362
- }
363
- ): UseQueryOptions<
364
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
365
- TError,
366
- TData
367
- > & { queryKey: QueryKey } => {
368
- const { query: queryOptions, request: requestOptions } = options ?? {};
369
-
370
- const queryKey =
371
- queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
372
-
373
- const queryFn: QueryFunction<
374
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>
375
- > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
376
-
377
- return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
378
- };
379
-
380
- export type GetOrganisationUnitUsersQueryResult = NonNullable<
381
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>
382
- >;
383
- export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
384
-
385
- export const useGetOrganisationUnitUsers = <
386
- TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
387
- TError = ErrorType<AsError | void>
388
- >(
389
- unitId: string,
390
- options?: {
391
- query?: UseQueryOptions<
392
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
393
- TError,
394
- TData
395
- >;
396
- request?: SecondParameter<typeof customInstance>;
397
- }
398
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
399
- const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, options);
400
-
401
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
402
- queryKey: QueryKey;
403
- };
404
-
405
- query.queryKey = queryOptions.queryKey;
296
+
297
+
298
+ return customInstance<UsersGetResponse>(
299
+ {url: `/unit/${unitId}/user`, method: 'get', signal
300
+ },
301
+ options);
302
+ }
303
+
304
+
305
+ export const getGetOrganisationUnitUsersQueryKey = (unitId: string,) => {
306
+
307
+ return ["account-server-api", `/unit/${unitId}/user`] as const;
308
+ }
309
+
310
+
311
+ export const getGetOrganisationUnitUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
312
+ ) => {
313
+
314
+ const {query: queryOptions, request: requestOptions} = options ?? {};
315
+
316
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
317
+
318
+
319
+
320
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
321
+
322
+
323
+
324
+
325
+
326
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData> & { queryKey: QueryKey }
327
+ }
328
+
329
+ export type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>
330
+ export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>
331
+
332
+ /**
333
+ * @summary Gets users in an Organisational Unit
334
+ */
335
+ export const useGetOrganisationUnitUsers = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(
336
+ unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
337
+
338
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
339
+
340
+ const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId,options)
341
+
342
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
343
+
344
+ query.queryKey = queryOptions.queryKey ;
406
345
 
407
346
  return query;
408
- };
347
+ }
348
+
349
+
409
350
 
410
351
  /**
411
352
  * Adds a user to an Organisational Unit.
@@ -417,70 +358,56 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
417
358
  * @summary Adds a user to an Organisational Unit
418
359
  */
419
360
  export const addOrganisationUnitUser = (
420
- unitId: string,
421
- userId: string,
422
- options?: SecondParameter<typeof customInstance>
361
+ unitId: string,
362
+ userId: string,
363
+ options?: SecondParameter<typeof customInstance>,) => {
364
+
365
+
366
+ return customInstance<void>(
367
+ {url: `/unit/${unitId}/user/${userId}`, method: 'put'
368
+ },
369
+ options);
370
+ }
371
+
372
+
373
+
374
+ export const getAddOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,
375
+
376
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
377
+ ): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {
378
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
379
+
380
+
381
+
382
+
383
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {
384
+ const {unitId,userId} = props ?? {};
385
+
386
+ return addOrganisationUnitUser(unitId,userId,requestOptions)
387
+ }
388
+
389
+
390
+
391
+
392
+ return { mutationFn, ...mutationOptions }}
393
+
394
+ export type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>
395
+
396
+ export type AddOrganisationUnitUserMutationError = ErrorType<AsError>
397
+
398
+ /**
399
+ * @summary Adds a user to an Organisational Unit
400
+ */
401
+ export const useAddOrganisationUnitUser = <TError = ErrorType<AsError>,
402
+
403
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
423
404
  ) => {
424
- return customInstance<void>(
425
- { url: `/unit/${unitId}/user/${userId}`, method: "put" },
426
- options
427
- );
428
- };
429
-
430
- export const getAddOrganisationUnitUserMutationOptions = <
431
- TError = ErrorType<AsError>,
432
- TContext = unknown
433
- >(options?: {
434
- mutation?: UseMutationOptions<
435
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
436
- TError,
437
- { unitId: string; userId: string },
438
- TContext
439
- >;
440
- request?: SecondParameter<typeof customInstance>;
441
- }): UseMutationOptions<
442
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
443
- TError,
444
- { unitId: string; userId: string },
445
- TContext
446
- > => {
447
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
448
-
449
- const mutationFn: MutationFunction<
450
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
451
- { unitId: string; userId: string }
452
- > = (props) => {
453
- const { unitId, userId } = props ?? {};
454
-
455
- return addOrganisationUnitUser(unitId, userId, requestOptions);
456
- };
457
-
458
- return { mutationFn, ...mutationOptions };
459
- };
460
-
461
- export type AddOrganisationUnitUserMutationResult = NonNullable<
462
- Awaited<ReturnType<typeof addOrganisationUnitUser>>
463
- >;
464
-
465
- export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
466
-
467
- export const useAddOrganisationUnitUser = <
468
- TError = ErrorType<AsError>,
469
- TContext = unknown
470
- >(options?: {
471
- mutation?: UseMutationOptions<
472
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
473
- TError,
474
- { unitId: string; userId: string },
475
- TContext
476
- >;
477
- request?: SecondParameter<typeof customInstance>;
478
- }) => {
479
- const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);
480
-
481
- return useMutation(mutationOptions);
482
- };
483
- /**
405
+
406
+ const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);
407
+
408
+ return useMutation(mutationOptions);
409
+ }
410
+ /**
484
411
  * Removes a User from an Organisational Unit.
485
412
 
486
413
  Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
@@ -490,66 +417,53 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
490
417
  * @summary Deletes a User from an Organisational Unit
491
418
  */
492
419
  export const deleteOrganisationUnitUser = (
493
- unitId: string,
494
- userId: string,
495
- options?: SecondParameter<typeof customInstance>
420
+ unitId: string,
421
+ userId: string,
422
+ options?: SecondParameter<typeof customInstance>,) => {
423
+
424
+
425
+ return customInstance<void>(
426
+ {url: `/unit/${unitId}/user/${userId}`, method: 'delete'
427
+ },
428
+ options);
429
+ }
430
+
431
+
432
+
433
+ export const getDeleteOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,
434
+
435
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
436
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {
437
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
438
+
439
+
440
+
441
+
442
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {
443
+ const {unitId,userId} = props ?? {};
444
+
445
+ return deleteOrganisationUnitUser(unitId,userId,requestOptions)
446
+ }
447
+
448
+
449
+
450
+
451
+ return { mutationFn, ...mutationOptions }}
452
+
453
+ export type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>
454
+
455
+ export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>
456
+
457
+ /**
458
+ * @summary Deletes a User from an Organisational Unit
459
+ */
460
+ export const useDeleteOrganisationUnitUser = <TError = ErrorType<AsError>,
461
+
462
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
496
463
  ) => {
497
- return customInstance<void>(
498
- { url: `/unit/${unitId}/user/${userId}`, method: "delete" },
499
- options
500
- );
501
- };
502
-
503
- export const getDeleteOrganisationUnitUserMutationOptions = <
504
- TError = ErrorType<AsError>,
505
- TContext = unknown
506
- >(options?: {
507
- mutation?: UseMutationOptions<
508
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
509
- TError,
510
- { unitId: string; userId: string },
511
- TContext
512
- >;
513
- request?: SecondParameter<typeof customInstance>;
514
- }): UseMutationOptions<
515
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
516
- TError,
517
- { unitId: string; userId: string },
518
- TContext
519
- > => {
520
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
521
-
522
- const mutationFn: MutationFunction<
523
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
524
- { unitId: string; userId: string }
525
- > = (props) => {
526
- const { unitId, userId } = props ?? {};
527
-
528
- return deleteOrganisationUnitUser(unitId, userId, requestOptions);
529
- };
530
-
531
- return { mutationFn, ...mutationOptions };
532
- };
533
-
534
- export type DeleteOrganisationUnitUserMutationResult = NonNullable<
535
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
536
- >;
537
-
538
- export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
539
-
540
- export const useDeleteOrganisationUnitUser = <
541
- TError = ErrorType<AsError>,
542
- TContext = unknown
543
- >(options?: {
544
- mutation?: UseMutationOptions<
545
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
546
- TError,
547
- { unitId: string; userId: string },
548
- TContext
549
- >;
550
- request?: SecondParameter<typeof customInstance>;
551
- }) => {
552
- const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);
553
-
554
- return useMutation(mutationOptions);
555
- };
464
+
465
+ const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);
466
+
467
+ return useMutation(mutationOptions);
468
+ }
469
+