@squonk/account-server-client 1.0.2 → 1.0.3-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/asset/asset.cjs +34 -18
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.ts +16 -16
  4. package/asset/asset.js +35 -19
  5. package/asset/asset.js.map +1 -1
  6. package/{custom-instance-e2d92e5c.d.ts → custom-instance-93fb01eb.d.ts} +17 -17
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +1 -1
  9. package/index.js.map +1 -1
  10. package/merchant/merchant.cjs +15 -13
  11. package/merchant/merchant.cjs.map +1 -1
  12. package/merchant/merchant.d.ts +1 -1
  13. package/merchant/merchant.js +16 -14
  14. package/merchant/merchant.js.map +1 -1
  15. package/organisation/organisation.cjs +18 -6
  16. package/organisation/organisation.cjs.map +1 -1
  17. package/organisation/organisation.d.ts +7 -7
  18. package/organisation/organisation.js +19 -7
  19. package/organisation/organisation.js.map +1 -1
  20. package/package.json +1 -1
  21. package/product/product.cjs +47 -38
  22. package/product/product.cjs.map +1 -1
  23. package/product/product.d.ts +10 -10
  24. package/product/product.js +48 -39
  25. package/product/product.js.map +1 -1
  26. package/src/account-server-api.schemas.ts +68 -84
  27. package/src/asset/asset.ts +248 -345
  28. package/src/merchant/merchant.ts +62 -84
  29. package/src/organisation/organisation.ts +131 -184
  30. package/src/product/product.ts +279 -422
  31. package/src/state/state.ts +36 -42
  32. package/src/unit/unit.ts +218 -301
  33. package/src/user/user.ts +224 -327
  34. package/state/state.cjs +9 -9
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +1 -1
  37. package/state/state.js +10 -10
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +40 -25
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +10 -10
  42. package/unit/unit.js +41 -26
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +38 -20
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +10 -10
  47. package/user/user.js +39 -21
  48. package/user/user.js.map +1 -1
package/src/user/user.ts CHANGED
@@ -8,27 +8,31 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 1.0
10
10
  */
11
- import { useQuery, useMutation } from "react-query";
11
+ import {
12
+ useQuery,
13
+ useMutation
14
+ } from 'react-query'
12
15
  import type {
13
16
  UseQueryOptions,
14
17
  UseMutationOptions,
15
18
  QueryFunction,
16
19
  MutationFunction,
17
20
  UseQueryResult,
18
- QueryKey,
19
- } from "react-query";
21
+ QueryKey
22
+ } from 'react-query'
20
23
  import type {
21
24
  UserAccountGetResponse,
22
25
  AsError,
23
- UsersGetResponse,
24
- } from "../account-server-api.schemas";
25
- import { customInstance } from ".././custom-instance";
26
- import type { ErrorType } from ".././custom-instance";
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;
@@ -39,53 +43,41 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
39
43
  * @summary Get information about your account
40
44
  */
41
45
  export const getUserAccount = (
42
- options?: SecondParameter<typeof customInstance>,
43
- signal?: AbortSignal
46
+
47
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
44
48
  ) => {
45
- return customInstance<UserAccountGetResponse>(
46
- { url: `/user/account`, method: "get", signal },
47
- options
48
- );
49
- };
49
+ return customInstance<UserAccountGetResponse>(
50
+ {url: `/user/account`, method: 'get', signal
51
+ },
52
+ options);
53
+ }
54
+
50
55
 
51
56
  export const getGetUserAccountQueryKey = () => [`/user/account`];
52
57
 
53
- export type GetUserAccountQueryResult = NonNullable<
54
- Awaited<ReturnType<typeof getUserAccount>>
55
- >;
56
- export type GetUserAccountQueryError = ErrorType<void | AsError>;
57
-
58
- export const useGetUserAccount = <
59
- TData = Awaited<ReturnType<typeof getUserAccount>>,
60
- TError = ErrorType<void | AsError>
61
- >(options?: {
62
- query?: UseQueryOptions<
63
- Awaited<ReturnType<typeof getUserAccount>>,
64
- TError,
65
- TData
66
- >;
67
- request?: SecondParameter<typeof customInstance>;
68
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
69
- const { query: queryOptions, request: requestOptions } = options ?? {};
58
+
59
+ export type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>
60
+ export type GetUserAccountQueryError = ErrorType<void | AsError>
61
+
62
+ export const useGetUserAccount = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>(
63
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
64
+
65
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
66
+
67
+ const {query: queryOptions, request: requestOptions} = options ?? {}
70
68
 
71
69
  const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
72
70
 
73
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({
74
- signal,
75
- }) => getUserAccount(requestOptions, signal);
71
+
72
+
73
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) => getUserAccount(requestOptions, signal);
76
74
 
77
- const query = useQuery<
78
- Awaited<ReturnType<typeof getUserAccount>>,
79
- TError,
80
- TData
81
- >(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
82
- queryKey: QueryKey;
83
- };
75
+ const query = useQuery<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
84
76
 
85
77
  query.queryKey = queryKey;
86
78
 
87
79
  return query;
88
- };
80
+ }
89
81
 
90
82
  /**
91
83
  * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint
@@ -93,61 +85,41 @@ export const useGetUserAccount = <
93
85
  * @summary Gets users in an organisation
94
86
  */
95
87
  export const getOrganisationUsers = (
96
- orgId: string,
97
- options?: SecondParameter<typeof customInstance>,
98
- signal?: AbortSignal
88
+ orgId: string,
89
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
99
90
  ) => {
100
- return customInstance<UsersGetResponse>(
101
- { url: `/organisation/${orgId}/user`, method: "get", signal },
102
- options
103
- );
104
- };
105
-
106
- export const getGetOrganisationUsersQueryKey = (orgId: string) => [
107
- `/organisation/${orgId}/user`,
108
- ];
109
-
110
- export type GetOrganisationUsersQueryResult = NonNullable<
111
- Awaited<ReturnType<typeof getOrganisationUsers>>
112
- >;
113
- export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
114
-
115
- export const useGetOrganisationUsers = <
116
- TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
117
- TError = ErrorType<AsError | void>
118
- >(
119
- orgId: string,
120
- options?: {
121
- query?: UseQueryOptions<
122
- Awaited<ReturnType<typeof getOrganisationUsers>>,
123
- TError,
124
- TData
125
- >;
126
- request?: SecondParameter<typeof customInstance>;
127
- }
128
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
129
- const { query: queryOptions, request: requestOptions } = options ?? {};
130
-
131
- const queryKey =
132
- queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
133
-
134
- const queryFn: QueryFunction<
135
- Awaited<ReturnType<typeof getOrganisationUsers>>
136
- > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
137
-
138
- const query = useQuery<
139
- Awaited<ReturnType<typeof getOrganisationUsers>>,
140
- TError,
141
- TData
142
- >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<
143
- TData,
144
- TError
145
- > & { queryKey: QueryKey };
91
+ return customInstance<UsersGetResponse>(
92
+ {url: `/organisation/${orgId}/user`, method: 'get', signal
93
+ },
94
+ options);
95
+ }
96
+
97
+
98
+ export const getGetOrganisationUsersQueryKey = (orgId: string,) => [`/organisation/${orgId}/user`];
99
+
100
+
101
+ export type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>
102
+ export type GetOrganisationUsersQueryError = ErrorType<AsError | void>
103
+
104
+ export const useGetOrganisationUsers = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(
105
+ orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
106
+
107
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
108
+
109
+ const {query: queryOptions, request: requestOptions} = options ?? {}
110
+
111
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
112
+
113
+
114
+
115
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
116
+
117
+ const query = useQuery<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>(queryKey, queryFn, {enabled: !!(orgId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
146
118
 
147
119
  query.queryKey = queryKey;
148
120
 
149
121
  return query;
150
- };
122
+ }
151
123
 
152
124
  /**
153
125
  * Adds a user to an organisation. You have to be in the Organisation or an Admin user to use this endpoint
@@ -155,165 +127,117 @@ export const useGetOrganisationUsers = <
155
127
  * @summary Adds a user to an organisation
156
128
  */
157
129
  export const addOrganisationUser = (
158
- orgId: string,
159
- userId: string,
160
- options?: SecondParameter<typeof customInstance>
130
+ orgId: string,
131
+ userId: string,
132
+ options?: SecondParameter<typeof customInstance>,) => {
133
+ return customInstance<void>(
134
+ {url: `/organisation/${orgId}/user/${userId}`, method: 'put'
135
+ },
136
+ options);
137
+ }
138
+
139
+
140
+
141
+ export type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>
142
+
143
+ export type AddOrganisationUserMutationError = ErrorType<AsError>
144
+
145
+ export const useAddOrganisationUser = <TError = ErrorType<AsError>,
146
+
147
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
161
148
  ) => {
162
- return customInstance<void>(
163
- { url: `/organisation/${orgId}/user/${userId}`, method: "put" },
164
- options
165
- );
166
- };
167
-
168
- export type AddOrganisationUserMutationResult = NonNullable<
169
- Awaited<ReturnType<typeof addOrganisationUser>>
170
- >;
171
-
172
- export type AddOrganisationUserMutationError = ErrorType<AsError>;
173
-
174
- export const useAddOrganisationUser = <
175
- TError = ErrorType<AsError>,
176
- TContext = unknown
177
- >(options?: {
178
- mutation?: UseMutationOptions<
179
- Awaited<ReturnType<typeof addOrganisationUser>>,
180
- TError,
181
- { orgId: string; userId: string },
182
- TContext
183
- >;
184
- request?: SecondParameter<typeof customInstance>;
185
- }) => {
186
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
187
-
188
- const mutationFn: MutationFunction<
189
- Awaited<ReturnType<typeof addOrganisationUser>>,
190
- { orgId: string; userId: string }
191
- > = (props) => {
192
- const { orgId, userId } = props ?? {};
193
-
194
- return addOrganisationUser(orgId, userId, requestOptions);
195
- };
196
-
197
- return useMutation<
198
- Awaited<ReturnType<typeof addOrganisationUser>>,
199
- TError,
200
- { orgId: string; userId: string },
201
- TContext
202
- >(mutationFn, mutationOptions);
203
- };
204
- /**
149
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {}
150
+
151
+
152
+
153
+
154
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUser>>, {orgId: string;userId: string}> = (props) => {
155
+ const {orgId,userId} = props ?? {};
156
+
157
+ return addOrganisationUser(orgId,userId,requestOptions)
158
+ }
159
+
160
+ return useMutation<Awaited<ReturnType<typeof addOrganisationUser>>, TError, {orgId: string;userId: string}, TContext>(mutationFn, mutationOptions)
161
+ }
162
+ /**
205
163
  * Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint
206
164
 
207
165
  * @summary Deletes a user from an organisation
208
166
  */
209
167
  export const deleteOrganisationUser = (
210
- orgId: string,
211
- userId: string,
212
- options?: SecondParameter<typeof customInstance>
168
+ orgId: string,
169
+ userId: string,
170
+ options?: SecondParameter<typeof customInstance>,) => {
171
+ return customInstance<void>(
172
+ {url: `/organisation/${orgId}/user/${userId}`, method: 'delete'
173
+ },
174
+ options);
175
+ }
176
+
177
+
178
+
179
+ export type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>
180
+
181
+ export type DeleteOrganisationUserMutationError = ErrorType<AsError>
182
+
183
+ export const useDeleteOrganisationUser = <TError = ErrorType<AsError>,
184
+
185
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
213
186
  ) => {
214
- return customInstance<void>(
215
- { url: `/organisation/${orgId}/user/${userId}`, method: "delete" },
216
- options
217
- );
218
- };
219
-
220
- export type DeleteOrganisationUserMutationResult = NonNullable<
221
- Awaited<ReturnType<typeof deleteOrganisationUser>>
222
- >;
223
-
224
- export type DeleteOrganisationUserMutationError = ErrorType<AsError>;
225
-
226
- export const useDeleteOrganisationUser = <
227
- TError = ErrorType<AsError>,
228
- TContext = unknown
229
- >(options?: {
230
- mutation?: UseMutationOptions<
231
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
232
- TError,
233
- { orgId: string; userId: string },
234
- TContext
235
- >;
236
- request?: SecondParameter<typeof customInstance>;
237
- }) => {
238
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
239
-
240
- const mutationFn: MutationFunction<
241
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
242
- { orgId: string; userId: string }
243
- > = (props) => {
244
- const { orgId, userId } = props ?? {};
245
-
246
- return deleteOrganisationUser(orgId, userId, requestOptions);
247
- };
248
-
249
- return useMutation<
250
- Awaited<ReturnType<typeof deleteOrganisationUser>>,
251
- TError,
252
- { orgId: string; userId: string },
253
- TContext
254
- >(mutationFn, mutationOptions);
255
- };
256
- /**
187
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {}
188
+
189
+
190
+
191
+
192
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUser>>, {orgId: string;userId: string}> = (props) => {
193
+ const {orgId,userId} = props ?? {};
194
+
195
+ return deleteOrganisationUser(orgId,userId,requestOptions)
196
+ }
197
+
198
+ return useMutation<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError, {orgId: string;userId: string}, TContext>(mutationFn, mutationOptions)
199
+ }
200
+ /**
257
201
  * Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
258
202
 
259
203
  * @summary Gets users in an Organisational Unit
260
204
  */
261
205
  export const getOrganisationUnitUsers = (
262
- unitId: string,
263
- options?: SecondParameter<typeof customInstance>,
264
- signal?: AbortSignal
206
+ unitId: string,
207
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
265
208
  ) => {
266
- return customInstance<UsersGetResponse>(
267
- { url: `/unit/${unitId}/user`, method: "get", signal },
268
- options
269
- );
270
- };
271
-
272
- export const getGetOrganisationUnitUsersQueryKey = (unitId: string) => [
273
- `/unit/${unitId}/user`,
274
- ];
275
-
276
- export type GetOrganisationUnitUsersQueryResult = NonNullable<
277
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>
278
- >;
279
- export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
280
-
281
- export const useGetOrganisationUnitUsers = <
282
- TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
283
- TError = ErrorType<AsError | void>
284
- >(
285
- unitId: string,
286
- options?: {
287
- query?: UseQueryOptions<
288
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
289
- TError,
290
- TData
291
- >;
292
- request?: SecondParameter<typeof customInstance>;
293
- }
294
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
295
- const { query: queryOptions, request: requestOptions } = options ?? {};
296
-
297
- const queryKey =
298
- queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
299
-
300
- const queryFn: QueryFunction<
301
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>
302
- > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
303
-
304
- const query = useQuery<
305
- Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
306
- TError,
307
- TData
308
- >(queryKey, queryFn, {
309
- enabled: !!unitId,
310
- ...queryOptions,
311
- }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
209
+ return customInstance<UsersGetResponse>(
210
+ {url: `/unit/${unitId}/user`, method: 'get', signal
211
+ },
212
+ options);
213
+ }
214
+
215
+
216
+ export const getGetOrganisationUnitUsersQueryKey = (unitId: string,) => [`/unit/${unitId}/user`];
217
+
218
+
219
+ export type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>
220
+ export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>
221
+
222
+ export const useGetOrganisationUnitUsers = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(
223
+ unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
224
+
225
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
226
+
227
+ const {query: queryOptions, request: requestOptions} = options ?? {}
228
+
229
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
230
+
231
+
232
+
233
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
234
+
235
+ const query = useQuery<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>(queryKey, queryFn, {enabled: !!(unitId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
312
236
 
313
237
  query.queryKey = queryKey;
314
238
 
315
239
  return query;
316
- };
240
+ }
317
241
 
318
242
  /**
319
243
  * Adds a user to an Organisational Unit.
@@ -325,53 +249,39 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
325
249
  * @summary Adds a user to an Organisational Unit
326
250
  */
327
251
  export const addOrganisationUnitUser = (
328
- unitId: string,
329
- userId: string,
330
- options?: SecondParameter<typeof customInstance>
252
+ unitId: string,
253
+ userId: string,
254
+ options?: SecondParameter<typeof customInstance>,) => {
255
+ return customInstance<void>(
256
+ {url: `/unit/${unitId}/user/${userId}`, method: 'put'
257
+ },
258
+ options);
259
+ }
260
+
261
+
262
+
263
+ export type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>
264
+
265
+ export type AddOrganisationUnitUserMutationError = ErrorType<AsError>
266
+
267
+ export const useAddOrganisationUnitUser = <TError = ErrorType<AsError>,
268
+
269
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
331
270
  ) => {
332
- return customInstance<void>(
333
- { url: `/unit/${unitId}/user/${userId}`, method: "put" },
334
- options
335
- );
336
- };
337
-
338
- export type AddOrganisationUnitUserMutationResult = NonNullable<
339
- Awaited<ReturnType<typeof addOrganisationUnitUser>>
340
- >;
341
-
342
- export type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
343
-
344
- export const useAddOrganisationUnitUser = <
345
- TError = ErrorType<AsError>,
346
- TContext = unknown
347
- >(options?: {
348
- mutation?: UseMutationOptions<
349
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
350
- TError,
351
- { unitId: string; userId: string },
352
- TContext
353
- >;
354
- request?: SecondParameter<typeof customInstance>;
355
- }) => {
356
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
357
-
358
- const mutationFn: MutationFunction<
359
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
360
- { unitId: string; userId: string }
361
- > = (props) => {
362
- const { unitId, userId } = props ?? {};
363
-
364
- return addOrganisationUnitUser(unitId, userId, requestOptions);
365
- };
366
-
367
- return useMutation<
368
- Awaited<ReturnType<typeof addOrganisationUnitUser>>,
369
- TError,
370
- { unitId: string; userId: string },
371
- TContext
372
- >(mutationFn, mutationOptions);
373
- };
374
- /**
271
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {}
272
+
273
+
274
+
275
+
276
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {
277
+ const {unitId,userId} = props ?? {};
278
+
279
+ return addOrganisationUnitUser(unitId,userId,requestOptions)
280
+ }
281
+
282
+ return useMutation<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError, {unitId: string;userId: string}, TContext>(mutationFn, mutationOptions)
283
+ }
284
+ /**
375
285
  * Removes a user from an Organisational Unit.
376
286
 
377
287
  Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
@@ -381,49 +291,36 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
381
291
  * @summary Deletes a user from an Organisational Unit
382
292
  */
383
293
  export const deleteOrganisationUnitUser = (
384
- unitId: string,
385
- userId: string,
386
- options?: SecondParameter<typeof customInstance>
294
+ unitId: string,
295
+ userId: string,
296
+ options?: SecondParameter<typeof customInstance>,) => {
297
+ return customInstance<void>(
298
+ {url: `/unit/${unitId}/user/${userId}`, method: 'delete'
299
+ },
300
+ options);
301
+ }
302
+
303
+
304
+
305
+ export type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>
306
+
307
+ export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>
308
+
309
+ export const useDeleteOrganisationUnitUser = <TError = ErrorType<AsError>,
310
+
311
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
387
312
  ) => {
388
- return customInstance<void>(
389
- { url: `/unit/${unitId}/user/${userId}`, method: "delete" },
390
- options
391
- );
392
- };
393
-
394
- export type DeleteOrganisationUnitUserMutationResult = NonNullable<
395
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
396
- >;
397
-
398
- export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
399
-
400
- export const useDeleteOrganisationUnitUser = <
401
- TError = ErrorType<AsError>,
402
- TContext = unknown
403
- >(options?: {
404
- mutation?: UseMutationOptions<
405
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
406
- TError,
407
- { unitId: string; userId: string },
408
- TContext
409
- >;
410
- request?: SecondParameter<typeof customInstance>;
411
- }) => {
412
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
413
-
414
- const mutationFn: MutationFunction<
415
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
416
- { unitId: string; userId: string }
417
- > = (props) => {
418
- const { unitId, userId } = props ?? {};
419
-
420
- return deleteOrganisationUnitUser(unitId, userId, requestOptions);
421
- };
422
-
423
- return useMutation<
424
- Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
425
- TError,
426
- { unitId: string; userId: string },
427
- TContext
428
- >(mutationFn, mutationOptions);
429
- };
313
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {}
314
+
315
+
316
+
317
+
318
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {
319
+ const {unitId,userId} = props ?? {};
320
+
321
+ return deleteOrganisationUnitUser(unitId,userId,requestOptions)
322
+ }
323
+
324
+ return useMutation<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError, {unitId: string;userId: string}, TContext>(mutationFn, mutationOptions)
325
+ }
326
+
package/state/state.cjs CHANGED
@@ -3,10 +3,16 @@
3
3
  var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
4
4
 
5
5
  // src/state/state.ts
6
+
7
+
6
8
  var _reactquery = require('react-query');
7
9
  var getVersion = (options, signal) => {
8
10
  return _chunkIUEU2LYCcjs.customInstance.call(void 0,
9
- { url: `/version`, method: "get", signal },
11
+ {
12
+ url: `/version`,
13
+ method: "get",
14
+ signal
15
+ },
10
16
  options
11
17
  );
12
18
  };
@@ -14,14 +20,8 @@ var getGetVersionQueryKey = () => [`/version`];
14
20
  var useGetVersion = (options) => {
15
21
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
16
22
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetVersionQueryKey()));
17
- const queryFn = ({
18
- signal
19
- }) => getVersion(requestOptions, signal);
20
- const query = _reactquery.useQuery.call(void 0,
21
- queryKey,
22
- queryFn,
23
- queryOptions
24
- );
23
+ const queryFn = ({ signal }) => getVersion(requestOptions, signal);
24
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
25
25
  query.queryKey = queryKey;
26
26
  return query;
27
27
  };