@squonk/account-server-client 2.1.0-rc.1 → 2.1.0-rc.11

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