@squonk/account-server-client 4.2.1 → 4.3.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.
- package/asset/asset.cjs +99 -126
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +99 -99
- package/asset/asset.d.ts +99 -99
- package/asset/asset.js +107 -134
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs +73 -85
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.d.cts +47 -47
- package/charges/charges.d.ts +47 -47
- package/charges/charges.js +78 -90
- package/charges/charges.js.map +1 -1
- package/chunk-3WKSNKHE.js +25 -0
- package/chunk-3WKSNKHE.js.map +1 -0
- package/chunk-NY2VJJG7.cjs +25 -0
- package/chunk-NY2VJJG7.cjs.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/event-stream/event-stream.cjs +53 -61
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +45 -45
- package/event-stream/event-stream.d.ts +45 -45
- package/event-stream/event-stream.js +58 -66
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +49 -57
- package/index.cjs.map +1 -1
- package/index.d.cts +796 -773
- package/index.d.ts +796 -773
- package/index.js +48 -56
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +38 -45
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +25 -25
- package/merchant/merchant.d.ts +25 -25
- package/merchant/merchant.js +42 -49
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +77 -87
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +72 -70
- package/organisation/organisation.d.ts +72 -70
- package/organisation/organisation.js +83 -93
- package/organisation/organisation.js.map +1 -1
- package/package.json +13 -16
- package/product/product.cjs +143 -153
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +100 -100
- package/product/product.d.ts +100 -100
- package/product/product.js +153 -163
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +863 -856
- package/src/asset/asset.ts +899 -634
- package/src/charges/charges.ts +822 -498
- package/src/custom-instance.ts +3 -3
- package/src/event-stream/event-stream.ts +531 -345
- package/src/index.ts +2 -2
- package/src/merchant/merchant.ts +355 -234
- package/src/options-mutator.ts +27 -0
- package/src/organisation/organisation.ts +812 -504
- package/src/product/product.ts +1373 -841
- package/src/state/state.ts +174 -127
- package/src/unit/unit.ts +1273 -603
- package/src/user/user.ts +895 -564
- package/state/state.cjs +22 -24
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +14 -14
- package/state/state.d.ts +14 -14
- package/state/state.js +24 -26
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +171 -106
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +200 -90
- package/unit/unit.d.ts +200 -90
- package/unit/unit.js +179 -114
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +94 -110
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +77 -77
- package/user/user.d.ts +77 -77
- package/user/user.js +101 -117
- package/user/user.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
package/src/user/user.ts
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.10.0 🍺
|
|
4
3
|
* Do not edit manually.
|
|
5
4
|
* Account Server API
|
|
6
5
|
* The Informatics Matters Account Server API.
|
|
7
6
|
|
|
8
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
9
8
|
|
|
10
|
-
* OpenAPI spec version: 4.
|
|
9
|
+
* OpenAPI spec version: 4.3
|
|
11
10
|
*/
|
|
12
|
-
import {
|
|
13
|
-
useMutation,
|
|
14
|
-
useQuery,
|
|
15
|
-
useSuspenseQuery
|
|
16
|
-
} from '@tanstack/react-query'
|
|
11
|
+
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
17
12
|
import type {
|
|
18
13
|
DataTag,
|
|
19
14
|
DefinedInitialDataOptions,
|
|
20
15
|
DefinedUseQueryResult,
|
|
21
16
|
MutationFunction,
|
|
17
|
+
QueryClient,
|
|
22
18
|
QueryFunction,
|
|
23
19
|
QueryKey,
|
|
24
20
|
UndefinedInitialDataOptions,
|
|
@@ -27,19 +23,17 @@ import type {
|
|
|
27
23
|
UseQueryOptions,
|
|
28
24
|
UseQueryResult,
|
|
29
25
|
UseSuspenseQueryOptions,
|
|
30
|
-
UseSuspenseQueryResult
|
|
31
|
-
} from
|
|
32
|
-
import type {
|
|
33
|
-
AsError,
|
|
34
|
-
UserAccountDetail,
|
|
35
|
-
UsersGetResponse
|
|
36
|
-
} from '../account-server-api.schemas'
|
|
37
|
-
import { customInstance } from '.././custom-instance';
|
|
38
|
-
import type { ErrorType } from '.././custom-instance';
|
|
26
|
+
UseSuspenseQueryResult,
|
|
27
|
+
} from "@tanstack/react-query";
|
|
39
28
|
|
|
29
|
+
import type { AsError, UserAccountDetail, UsersGetResponse } from "../account-server-api.schemas";
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
import { customInstance } from ".././custom-instance";
|
|
32
|
+
import type { ErrorType } from ".././custom-instance";
|
|
33
|
+
import { queryMutator } from ".././options-mutator";
|
|
34
|
+
import { mutationMutator } from ".././options-mutator";
|
|
42
35
|
|
|
36
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
43
37
|
|
|
44
38
|
/**
|
|
45
39
|
* Returns a summary of your account
|
|
@@ -47,143 +41,210 @@ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
|
47
41
|
* @summary Get information about your account
|
|
48
42
|
*/
|
|
49
43
|
export const getUserAccount = (
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
options?: SecondParameter<typeof customInstance>,
|
|
45
|
+
signal?: AbortSignal,
|
|
52
46
|
) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
options);
|
|
59
|
-
}
|
|
60
|
-
|
|
47
|
+
return customInstance<UserAccountDetail>(
|
|
48
|
+
{ url: `/user/account`, method: "GET", signal },
|
|
49
|
+
options,
|
|
50
|
+
);
|
|
51
|
+
};
|
|
61
52
|
|
|
62
53
|
export const getGetUserAccountQueryKey = () => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export
|
|
90
|
-
|
|
54
|
+
return [`/user/account`] as const;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const useGetUserAccountQueryOptions = <
|
|
58
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
59
|
+
TError = ErrorType<void | AsError>,
|
|
60
|
+
>(options?: {
|
|
61
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;
|
|
62
|
+
request?: SecondParameter<typeof customInstance>;
|
|
63
|
+
}) => {
|
|
64
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
65
|
+
|
|
66
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
|
|
67
|
+
|
|
68
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) =>
|
|
69
|
+
getUserAccount(requestOptions, signal);
|
|
70
|
+
|
|
71
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
72
|
+
|
|
73
|
+
return customOptions as UseQueryOptions<
|
|
74
|
+
Awaited<ReturnType<typeof getUserAccount>>,
|
|
75
|
+
TError,
|
|
76
|
+
TData
|
|
77
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>;
|
|
81
|
+
export type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
82
|
+
|
|
83
|
+
export function useGetUserAccount<
|
|
84
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
85
|
+
TError = ErrorType<void | AsError>,
|
|
86
|
+
>(
|
|
87
|
+
options: {
|
|
88
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>> &
|
|
89
|
+
Pick<
|
|
91
90
|
DefinedInitialDataOptions<
|
|
92
91
|
Awaited<ReturnType<typeof getUserAccount>>,
|
|
93
92
|
TError,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
Awaited<ReturnType<typeof getUserAccount>>
|
|
94
|
+
>,
|
|
95
|
+
"initialData"
|
|
96
|
+
>;
|
|
97
|
+
request?: SecondParameter<typeof customInstance>;
|
|
98
|
+
},
|
|
99
|
+
queryClient?: QueryClient,
|
|
100
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
101
|
+
export function useGetUserAccount<
|
|
102
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
103
|
+
TError = ErrorType<void | AsError>,
|
|
104
|
+
>(
|
|
105
|
+
options?: {
|
|
106
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>> &
|
|
107
|
+
Pick<
|
|
101
108
|
UndefinedInitialDataOptions<
|
|
102
109
|
Awaited<ReturnType<typeof getUserAccount>>,
|
|
103
110
|
TError,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
Awaited<ReturnType<typeof getUserAccount>>
|
|
112
|
+
>,
|
|
113
|
+
"initialData"
|
|
114
|
+
>;
|
|
115
|
+
request?: SecondParameter<typeof customInstance>;
|
|
116
|
+
},
|
|
117
|
+
queryClient?: QueryClient,
|
|
118
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
119
|
+
export function useGetUserAccount<
|
|
120
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
121
|
+
TError = ErrorType<void | AsError>,
|
|
122
|
+
>(
|
|
123
|
+
options?: {
|
|
124
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;
|
|
125
|
+
request?: SecondParameter<typeof customInstance>;
|
|
126
|
+
},
|
|
127
|
+
queryClient?: QueryClient,
|
|
128
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
113
129
|
/**
|
|
114
130
|
* @summary Get information about your account
|
|
115
131
|
*/
|
|
116
132
|
|
|
117
|
-
export function useGetUserAccount<
|
|
118
|
-
|
|
133
|
+
export function useGetUserAccount<
|
|
134
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
135
|
+
TError = ErrorType<void | AsError>,
|
|
136
|
+
>(
|
|
137
|
+
options?: {
|
|
138
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>>;
|
|
139
|
+
request?: SecondParameter<typeof customInstance>;
|
|
140
|
+
},
|
|
141
|
+
queryClient?: QueryClient,
|
|
142
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
143
|
+
const queryOptions = useGetUserAccountQueryOptions(options);
|
|
119
144
|
|
|
120
|
-
|
|
145
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
146
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
147
|
+
};
|
|
121
148
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
125
|
-
|
|
126
|
-
query.queryKey = queryOptions.queryKey ;
|
|
149
|
+
query.queryKey = queryOptions.queryKey;
|
|
127
150
|
|
|
128
151
|
return query;
|
|
129
152
|
}
|
|
130
153
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
export
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
export const useGetUserAccountSuspenseQueryOptions = <
|
|
155
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
156
|
+
TError = ErrorType<void | AsError>,
|
|
157
|
+
>(options?: {
|
|
158
|
+
query?: Partial<
|
|
159
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>
|
|
160
|
+
>;
|
|
161
|
+
request?: SecondParameter<typeof customInstance>;
|
|
162
|
+
}) => {
|
|
163
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
164
|
+
|
|
165
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();
|
|
166
|
+
|
|
167
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) =>
|
|
168
|
+
getUserAccount(requestOptions, signal);
|
|
169
|
+
|
|
170
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
171
|
+
|
|
172
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
173
|
+
Awaited<ReturnType<typeof getUserAccount>>,
|
|
174
|
+
TError,
|
|
175
|
+
TData
|
|
176
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export type GetUserAccountSuspenseQueryResult = NonNullable<
|
|
180
|
+
Awaited<ReturnType<typeof getUserAccount>>
|
|
181
|
+
>;
|
|
182
|
+
export type GetUserAccountSuspenseQueryError = ErrorType<void | AsError>;
|
|
183
|
+
|
|
184
|
+
export function useGetUserAccountSuspense<
|
|
185
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
186
|
+
TError = ErrorType<void | AsError>,
|
|
187
|
+
>(
|
|
188
|
+
options: {
|
|
189
|
+
query: Partial<
|
|
190
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>
|
|
191
|
+
>;
|
|
192
|
+
request?: SecondParameter<typeof customInstance>;
|
|
193
|
+
},
|
|
194
|
+
queryClient?: QueryClient,
|
|
195
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
196
|
+
export function useGetUserAccountSuspense<
|
|
197
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
198
|
+
TError = ErrorType<void | AsError>,
|
|
199
|
+
>(
|
|
200
|
+
options?: {
|
|
201
|
+
query?: Partial<
|
|
202
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>
|
|
203
|
+
>;
|
|
204
|
+
request?: SecondParameter<typeof customInstance>;
|
|
205
|
+
},
|
|
206
|
+
queryClient?: QueryClient,
|
|
207
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
208
|
+
export function useGetUserAccountSuspense<
|
|
209
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
210
|
+
TError = ErrorType<void | AsError>,
|
|
211
|
+
>(
|
|
212
|
+
options?: {
|
|
213
|
+
query?: Partial<
|
|
214
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>
|
|
215
|
+
>;
|
|
216
|
+
request?: SecondParameter<typeof customInstance>;
|
|
217
|
+
},
|
|
218
|
+
queryClient?: QueryClient,
|
|
219
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
167
220
|
/**
|
|
168
221
|
* @summary Get information about your account
|
|
169
222
|
*/
|
|
170
223
|
|
|
171
|
-
export function useGetUserAccountSuspense<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
224
|
+
export function useGetUserAccountSuspense<
|
|
225
|
+
TData = Awaited<ReturnType<typeof getUserAccount>>,
|
|
226
|
+
TError = ErrorType<void | AsError>,
|
|
227
|
+
>(
|
|
228
|
+
options?: {
|
|
229
|
+
query?: Partial<
|
|
230
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>
|
|
231
|
+
>;
|
|
232
|
+
request?: SecondParameter<typeof customInstance>;
|
|
233
|
+
},
|
|
234
|
+
queryClient?: QueryClient,
|
|
235
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
236
|
+
const queryOptions = useGetUserAccountSuspenseQueryOptions(options);
|
|
237
|
+
|
|
238
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
239
|
+
TData,
|
|
240
|
+
TError
|
|
241
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
242
|
+
|
|
243
|
+
query.queryKey = queryOptions.queryKey;
|
|
181
244
|
|
|
182
245
|
return query;
|
|
183
246
|
}
|
|
184
247
|
|
|
185
|
-
|
|
186
|
-
|
|
187
248
|
/**
|
|
188
249
|
* Gets Users in an Organisation.
|
|
189
250
|
|
|
@@ -194,143 +255,237 @@ You have to be a member of the Organisation or an admin user to use this endpoin
|
|
|
194
255
|
* @summary Gets users in an Organisation
|
|
195
256
|
*/
|
|
196
257
|
export const getOrganisationUsers = (
|
|
197
|
-
|
|
198
|
-
|
|
258
|
+
orgId: string,
|
|
259
|
+
options?: SecondParameter<typeof customInstance>,
|
|
260
|
+
signal?: AbortSignal,
|
|
199
261
|
) => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
262
|
+
return customInstance<UsersGetResponse>(
|
|
263
|
+
{ url: `/organisation/${orgId}/user`, method: "GET", signal },
|
|
264
|
+
options,
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const getGetOrganisationUsersQueryKey = (orgId: string) => {
|
|
269
|
+
return [`/organisation/${orgId}/user`] as const;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const useGetOrganisationUsersQueryOptions = <
|
|
273
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
274
|
+
TError = ErrorType<AsError | void>,
|
|
275
|
+
>(
|
|
276
|
+
orgId: string,
|
|
277
|
+
options?: {
|
|
278
|
+
query?: Partial<
|
|
279
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
280
|
+
>;
|
|
281
|
+
request?: SecondParameter<typeof customInstance>;
|
|
282
|
+
},
|
|
215
283
|
) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export type GetOrganisationUsersQueryResult = NonNullable<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
284
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
285
|
+
|
|
286
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
|
|
287
|
+
|
|
288
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) =>
|
|
289
|
+
getOrganisationUsers(orgId, requestOptions, signal);
|
|
290
|
+
|
|
291
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
292
|
+
|
|
293
|
+
return customOptions as UseQueryOptions<
|
|
294
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
295
|
+
TError,
|
|
296
|
+
TData
|
|
297
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export type GetOrganisationUsersQueryResult = NonNullable<
|
|
301
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
302
|
+
>;
|
|
303
|
+
export type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
304
|
+
|
|
305
|
+
export function useGetOrganisationUsers<
|
|
306
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
307
|
+
TError = ErrorType<AsError | void>,
|
|
308
|
+
>(
|
|
309
|
+
orgId: string,
|
|
310
|
+
options: {
|
|
311
|
+
query: Partial<
|
|
312
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
313
|
+
> &
|
|
314
|
+
Pick<
|
|
238
315
|
DefinedInitialDataOptions<
|
|
239
316
|
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
240
317
|
TError,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
318
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
319
|
+
>,
|
|
320
|
+
"initialData"
|
|
321
|
+
>;
|
|
322
|
+
request?: SecondParameter<typeof customInstance>;
|
|
323
|
+
},
|
|
324
|
+
queryClient?: QueryClient,
|
|
325
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
326
|
+
export function useGetOrganisationUsers<
|
|
327
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
328
|
+
TError = ErrorType<AsError | void>,
|
|
329
|
+
>(
|
|
330
|
+
orgId: string,
|
|
331
|
+
options?: {
|
|
332
|
+
query?: Partial<
|
|
333
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
334
|
+
> &
|
|
335
|
+
Pick<
|
|
248
336
|
UndefinedInitialDataOptions<
|
|
249
337
|
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
250
338
|
TError,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
339
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
340
|
+
>,
|
|
341
|
+
"initialData"
|
|
342
|
+
>;
|
|
343
|
+
request?: SecondParameter<typeof customInstance>;
|
|
344
|
+
},
|
|
345
|
+
queryClient?: QueryClient,
|
|
346
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
347
|
+
export function useGetOrganisationUsers<
|
|
348
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
349
|
+
TError = ErrorType<AsError | void>,
|
|
350
|
+
>(
|
|
351
|
+
orgId: string,
|
|
352
|
+
options?: {
|
|
353
|
+
query?: Partial<
|
|
354
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
355
|
+
>;
|
|
356
|
+
request?: SecondParameter<typeof customInstance>;
|
|
357
|
+
},
|
|
358
|
+
queryClient?: QueryClient,
|
|
359
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
260
360
|
/**
|
|
261
361
|
* @summary Gets users in an Organisation
|
|
262
362
|
*/
|
|
263
363
|
|
|
264
|
-
export function useGetOrganisationUsers<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
364
|
+
export function useGetOrganisationUsers<
|
|
365
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
366
|
+
TError = ErrorType<AsError | void>,
|
|
367
|
+
>(
|
|
368
|
+
orgId: string,
|
|
369
|
+
options?: {
|
|
370
|
+
query?: Partial<
|
|
371
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
372
|
+
>;
|
|
373
|
+
request?: SecondParameter<typeof customInstance>;
|
|
374
|
+
},
|
|
375
|
+
queryClient?: QueryClient,
|
|
376
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
377
|
+
const queryOptions = useGetOrganisationUsersQueryOptions(orgId, options);
|
|
378
|
+
|
|
379
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
380
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
query.queryKey = queryOptions.queryKey;
|
|
274
384
|
|
|
275
385
|
return query;
|
|
276
386
|
}
|
|
277
387
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
388
|
+
export const useGetOrganisationUsersSuspenseQueryOptions = <
|
|
389
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
390
|
+
TError = ErrorType<AsError | void>,
|
|
391
|
+
>(
|
|
392
|
+
orgId: string,
|
|
393
|
+
options?: {
|
|
394
|
+
query?: Partial<
|
|
395
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
396
|
+
>;
|
|
397
|
+
request?: SecondParameter<typeof customInstance>;
|
|
398
|
+
},
|
|
281
399
|
) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export type GetOrganisationUsersSuspenseQueryResult = NonNullable<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
400
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
401
|
+
|
|
402
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);
|
|
403
|
+
|
|
404
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) =>
|
|
405
|
+
getOrganisationUsers(orgId, requestOptions, signal);
|
|
406
|
+
|
|
407
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
408
|
+
|
|
409
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
410
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
411
|
+
TError,
|
|
412
|
+
TData
|
|
413
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
export type GetOrganisationUsersSuspenseQueryResult = NonNullable<
|
|
417
|
+
Awaited<ReturnType<typeof getOrganisationUsers>>
|
|
418
|
+
>;
|
|
419
|
+
export type GetOrganisationUsersSuspenseQueryError = ErrorType<AsError | void>;
|
|
420
|
+
|
|
421
|
+
export function useGetOrganisationUsersSuspense<
|
|
422
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
423
|
+
TError = ErrorType<AsError | void>,
|
|
424
|
+
>(
|
|
425
|
+
orgId: string,
|
|
426
|
+
options: {
|
|
427
|
+
query: Partial<
|
|
428
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
429
|
+
>;
|
|
430
|
+
request?: SecondParameter<typeof customInstance>;
|
|
431
|
+
},
|
|
432
|
+
queryClient?: QueryClient,
|
|
433
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
434
|
+
export function useGetOrganisationUsersSuspense<
|
|
435
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
436
|
+
TError = ErrorType<AsError | void>,
|
|
437
|
+
>(
|
|
438
|
+
orgId: string,
|
|
439
|
+
options?: {
|
|
440
|
+
query?: Partial<
|
|
441
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
442
|
+
>;
|
|
443
|
+
request?: SecondParameter<typeof customInstance>;
|
|
444
|
+
},
|
|
445
|
+
queryClient?: QueryClient,
|
|
446
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
447
|
+
export function useGetOrganisationUsersSuspense<
|
|
448
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
449
|
+
TError = ErrorType<AsError | void>,
|
|
450
|
+
>(
|
|
451
|
+
orgId: string,
|
|
452
|
+
options?: {
|
|
453
|
+
query?: Partial<
|
|
454
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
455
|
+
>;
|
|
456
|
+
request?: SecondParameter<typeof customInstance>;
|
|
457
|
+
},
|
|
458
|
+
queryClient?: QueryClient,
|
|
459
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
314
460
|
/**
|
|
315
461
|
* @summary Gets users in an Organisation
|
|
316
462
|
*/
|
|
317
463
|
|
|
318
|
-
export function useGetOrganisationUsersSuspense<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
464
|
+
export function useGetOrganisationUsersSuspense<
|
|
465
|
+
TData = Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
466
|
+
TError = ErrorType<AsError | void>,
|
|
467
|
+
>(
|
|
468
|
+
orgId: string,
|
|
469
|
+
options?: {
|
|
470
|
+
query?: Partial<
|
|
471
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>
|
|
472
|
+
>;
|
|
473
|
+
request?: SecondParameter<typeof customInstance>;
|
|
474
|
+
},
|
|
475
|
+
queryClient?: QueryClient,
|
|
476
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
477
|
+
const queryOptions = useGetOrganisationUsersSuspenseQueryOptions(orgId, options);
|
|
478
|
+
|
|
479
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
480
|
+
TData,
|
|
481
|
+
TError
|
|
482
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
483
|
+
|
|
484
|
+
query.queryKey = queryOptions.queryKey;
|
|
328
485
|
|
|
329
486
|
return query;
|
|
330
487
|
}
|
|
331
488
|
|
|
332
|
-
|
|
333
|
-
|
|
334
489
|
/**
|
|
335
490
|
* Adds a User to an **Organisation**.
|
|
336
491
|
|
|
@@ -339,64 +494,85 @@ You have to be in the Organisation or an admin user to use this endpoint
|
|
|
339
494
|
* @summary Adds a User to an Organisation
|
|
340
495
|
*/
|
|
341
496
|
export const addOrganisationUser = (
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return customInstance<void>(
|
|
348
|
-
{url: `/organisation/${orgId}/user/${userId}`, method: 'PUT'
|
|
349
|
-
},
|
|
350
|
-
options);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
export const getAddOrganisationUserMutationOptions = <TData = Awaited<ReturnType<typeof addOrganisationUser>>, TError = ErrorType<AsError | void>,
|
|
356
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
497
|
+
orgId: string,
|
|
498
|
+
userId: string,
|
|
499
|
+
options?: SecondParameter<typeof customInstance>,
|
|
357
500
|
) => {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
501
|
+
return customInstance<void>(
|
|
502
|
+
{ url: `/organisation/${orgId}/user/${userId}`, method: "PUT" },
|
|
503
|
+
options,
|
|
504
|
+
);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export const useAddOrganisationUserMutationOptions = <
|
|
508
|
+
TError = ErrorType<AsError | void>,
|
|
509
|
+
TContext = unknown,
|
|
510
|
+
>(options?: {
|
|
511
|
+
mutation?: UseMutationOptions<
|
|
512
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
513
|
+
TError,
|
|
514
|
+
{ orgId: string; userId: string },
|
|
515
|
+
TContext
|
|
516
|
+
>;
|
|
517
|
+
request?: SecondParameter<typeof customInstance>;
|
|
518
|
+
}): UseMutationOptions<
|
|
519
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
520
|
+
TError,
|
|
521
|
+
{ orgId: string; userId: string },
|
|
522
|
+
TContext
|
|
523
|
+
> => {
|
|
524
|
+
const mutationKey = ["addOrganisationUser"];
|
|
525
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
526
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
527
|
+
? options
|
|
528
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
529
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
530
|
+
|
|
531
|
+
const mutationFn: MutationFunction<
|
|
532
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
533
|
+
{ orgId: string; userId: string }
|
|
534
|
+
> = (props) => {
|
|
535
|
+
const { orgId, userId } = props ?? {};
|
|
536
|
+
|
|
537
|
+
return addOrganisationUser(orgId, userId, requestOptions);
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
541
|
+
|
|
542
|
+
return customOptions;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
export type AddOrganisationUserMutationResult = NonNullable<
|
|
546
|
+
Awaited<ReturnType<typeof addOrganisationUser>>
|
|
547
|
+
>;
|
|
548
|
+
|
|
549
|
+
export type AddOrganisationUserMutationError = ErrorType<AsError | void>;
|
|
370
550
|
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{orgId: string;userId: string}, TContext>}
|
|
378
|
-
|
|
379
|
-
export type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>
|
|
380
|
-
|
|
381
|
-
export type AddOrganisationUserMutationError = ErrorType<AsError | void>
|
|
382
|
-
|
|
383
|
-
/**
|
|
551
|
+
/**
|
|
384
552
|
* @summary Adds a User to an Organisation
|
|
385
553
|
*/
|
|
386
|
-
export const useAddOrganisationUser = <
|
|
387
|
-
|
|
554
|
+
export const useAddOrganisationUser = <TError = ErrorType<AsError | void>, TContext = unknown>(
|
|
555
|
+
options?: {
|
|
556
|
+
mutation?: UseMutationOptions<
|
|
557
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
558
|
+
TError,
|
|
559
|
+
{ orgId: string; userId: string },
|
|
560
|
+
TContext
|
|
561
|
+
>;
|
|
562
|
+
request?: SecondParameter<typeof customInstance>;
|
|
563
|
+
},
|
|
564
|
+
queryClient?: QueryClient,
|
|
388
565
|
): UseMutationResult<
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
/**
|
|
566
|
+
Awaited<ReturnType<typeof addOrganisationUser>>,
|
|
567
|
+
TError,
|
|
568
|
+
{ orgId: string; userId: string },
|
|
569
|
+
TContext
|
|
570
|
+
> => {
|
|
571
|
+
const mutationOptions = useAddOrganisationUserMutationOptions(options);
|
|
572
|
+
|
|
573
|
+
return useMutation(mutationOptions, queryClient);
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
400
576
|
* Removes a User from an **Organisation**.
|
|
401
577
|
|
|
402
578
|
You have to be in the Organisation or an admin user to use this endpoint
|
|
@@ -404,64 +580,85 @@ You have to be in the Organisation or an admin user to use this endpoint
|
|
|
404
580
|
* @summary Deletes a User from an Organisation
|
|
405
581
|
*/
|
|
406
582
|
export const deleteOrganisationUser = (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return customInstance<void>(
|
|
413
|
-
{url: `/organisation/${orgId}/user/${userId}`, method: 'DELETE'
|
|
414
|
-
},
|
|
415
|
-
options);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
export const getDeleteOrganisationUserMutationOptions = <TData = Awaited<ReturnType<typeof deleteOrganisationUser>>, TError = ErrorType<AsError | void>,
|
|
421
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
583
|
+
orgId: string,
|
|
584
|
+
userId: string,
|
|
585
|
+
options?: SecondParameter<typeof customInstance>,
|
|
422
586
|
) => {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
587
|
+
return customInstance<void>(
|
|
588
|
+
{ url: `/organisation/${orgId}/user/${userId}`, method: "DELETE" },
|
|
589
|
+
options,
|
|
590
|
+
);
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
export const useDeleteOrganisationUserMutationOptions = <
|
|
594
|
+
TError = ErrorType<AsError | void>,
|
|
595
|
+
TContext = unknown,
|
|
596
|
+
>(options?: {
|
|
597
|
+
mutation?: UseMutationOptions<
|
|
598
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
599
|
+
TError,
|
|
600
|
+
{ orgId: string; userId: string },
|
|
601
|
+
TContext
|
|
602
|
+
>;
|
|
603
|
+
request?: SecondParameter<typeof customInstance>;
|
|
604
|
+
}): UseMutationOptions<
|
|
605
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
606
|
+
TError,
|
|
607
|
+
{ orgId: string; userId: string },
|
|
608
|
+
TContext
|
|
609
|
+
> => {
|
|
610
|
+
const mutationKey = ["deleteOrganisationUser"];
|
|
611
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
612
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
613
|
+
? options
|
|
614
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
615
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
616
|
+
|
|
617
|
+
const mutationFn: MutationFunction<
|
|
618
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
619
|
+
{ orgId: string; userId: string }
|
|
620
|
+
> = (props) => {
|
|
621
|
+
const { orgId, userId } = props ?? {};
|
|
622
|
+
|
|
623
|
+
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
627
|
+
|
|
628
|
+
return customOptions;
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
export type DeleteOrganisationUserMutationResult = NonNullable<
|
|
632
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>
|
|
633
|
+
>;
|
|
634
|
+
|
|
635
|
+
export type DeleteOrganisationUserMutationError = ErrorType<AsError | void>;
|
|
432
636
|
|
|
433
|
-
|
|
434
|
-
const {orgId,userId} = props ?? {};
|
|
435
|
-
|
|
436
|
-
return deleteOrganisationUser(orgId,userId,requestOptions)
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{orgId: string;userId: string}, TContext>}
|
|
443
|
-
|
|
444
|
-
export type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>
|
|
445
|
-
|
|
446
|
-
export type DeleteOrganisationUserMutationError = ErrorType<AsError | void>
|
|
447
|
-
|
|
448
|
-
/**
|
|
637
|
+
/**
|
|
449
638
|
* @summary Deletes a User from an Organisation
|
|
450
639
|
*/
|
|
451
|
-
export const useDeleteOrganisationUser = <
|
|
452
|
-
|
|
640
|
+
export const useDeleteOrganisationUser = <TError = ErrorType<AsError | void>, TContext = unknown>(
|
|
641
|
+
options?: {
|
|
642
|
+
mutation?: UseMutationOptions<
|
|
643
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
644
|
+
TError,
|
|
645
|
+
{ orgId: string; userId: string },
|
|
646
|
+
TContext
|
|
647
|
+
>;
|
|
648
|
+
request?: SecondParameter<typeof customInstance>;
|
|
649
|
+
},
|
|
650
|
+
queryClient?: QueryClient,
|
|
453
651
|
): UseMutationResult<
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
/**
|
|
652
|
+
Awaited<ReturnType<typeof deleteOrganisationUser>>,
|
|
653
|
+
TError,
|
|
654
|
+
{ orgId: string; userId: string },
|
|
655
|
+
TContext
|
|
656
|
+
> => {
|
|
657
|
+
const mutationOptions = useDeleteOrganisationUserMutationOptions(options);
|
|
658
|
+
|
|
659
|
+
return useMutation(mutationOptions, queryClient);
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
465
662
|
* Gets users in an Organisational Unit.
|
|
466
663
|
|
|
467
664
|
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
@@ -471,143 +668,239 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
471
668
|
* @summary Gets users in an Organisational Unit
|
|
472
669
|
*/
|
|
473
670
|
export const getOrganisationUnitUsers = (
|
|
474
|
-
|
|
475
|
-
|
|
671
|
+
unitId: string,
|
|
672
|
+
options?: SecondParameter<typeof customInstance>,
|
|
673
|
+
signal?: AbortSignal,
|
|
476
674
|
) => {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
675
|
+
return customInstance<UsersGetResponse>(
|
|
676
|
+
{ url: `/unit/${unitId}/user`, method: "GET", signal },
|
|
677
|
+
options,
|
|
678
|
+
);
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
export const getGetOrganisationUnitUsersQueryKey = (unitId: string) => {
|
|
682
|
+
return [`/unit/${unitId}/user`] as const;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
export const useGetOrganisationUnitUsersQueryOptions = <
|
|
686
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
687
|
+
TError = ErrorType<AsError | void>,
|
|
688
|
+
>(
|
|
689
|
+
unitId: string,
|
|
690
|
+
options?: {
|
|
691
|
+
query?: Partial<
|
|
692
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
693
|
+
>;
|
|
694
|
+
request?: SecondParameter<typeof customInstance>;
|
|
695
|
+
},
|
|
492
696
|
) => {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
export type
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
export
|
|
514
|
-
|
|
697
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
698
|
+
|
|
699
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
700
|
+
|
|
701
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({
|
|
702
|
+
signal,
|
|
703
|
+
}) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
704
|
+
|
|
705
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
706
|
+
|
|
707
|
+
return customOptions as UseQueryOptions<
|
|
708
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
709
|
+
TError,
|
|
710
|
+
TData
|
|
711
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
export type GetOrganisationUnitUsersQueryResult = NonNullable<
|
|
715
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
716
|
+
>;
|
|
717
|
+
export type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
718
|
+
|
|
719
|
+
export function useGetOrganisationUnitUsers<
|
|
720
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
721
|
+
TError = ErrorType<AsError | void>,
|
|
722
|
+
>(
|
|
723
|
+
unitId: string,
|
|
724
|
+
options: {
|
|
725
|
+
query: Partial<
|
|
726
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
727
|
+
> &
|
|
728
|
+
Pick<
|
|
515
729
|
DefinedInitialDataOptions<
|
|
516
730
|
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
517
731
|
TError,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
732
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
733
|
+
>,
|
|
734
|
+
"initialData"
|
|
735
|
+
>;
|
|
736
|
+
request?: SecondParameter<typeof customInstance>;
|
|
737
|
+
},
|
|
738
|
+
queryClient?: QueryClient,
|
|
739
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
740
|
+
export function useGetOrganisationUnitUsers<
|
|
741
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
742
|
+
TError = ErrorType<AsError | void>,
|
|
743
|
+
>(
|
|
744
|
+
unitId: string,
|
|
745
|
+
options?: {
|
|
746
|
+
query?: Partial<
|
|
747
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
748
|
+
> &
|
|
749
|
+
Pick<
|
|
525
750
|
UndefinedInitialDataOptions<
|
|
526
751
|
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
527
752
|
TError,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
753
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
754
|
+
>,
|
|
755
|
+
"initialData"
|
|
756
|
+
>;
|
|
757
|
+
request?: SecondParameter<typeof customInstance>;
|
|
758
|
+
},
|
|
759
|
+
queryClient?: QueryClient,
|
|
760
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
761
|
+
export function useGetOrganisationUnitUsers<
|
|
762
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
763
|
+
TError = ErrorType<AsError | void>,
|
|
764
|
+
>(
|
|
765
|
+
unitId: string,
|
|
766
|
+
options?: {
|
|
767
|
+
query?: Partial<
|
|
768
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
769
|
+
>;
|
|
770
|
+
request?: SecondParameter<typeof customInstance>;
|
|
771
|
+
},
|
|
772
|
+
queryClient?: QueryClient,
|
|
773
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
537
774
|
/**
|
|
538
775
|
* @summary Gets users in an Organisational Unit
|
|
539
776
|
*/
|
|
540
777
|
|
|
541
|
-
export function useGetOrganisationUnitUsers<
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
778
|
+
export function useGetOrganisationUnitUsers<
|
|
779
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
780
|
+
TError = ErrorType<AsError | void>,
|
|
781
|
+
>(
|
|
782
|
+
unitId: string,
|
|
783
|
+
options?: {
|
|
784
|
+
query?: Partial<
|
|
785
|
+
UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
786
|
+
>;
|
|
787
|
+
request?: SecondParameter<typeof customInstance>;
|
|
788
|
+
},
|
|
789
|
+
queryClient?: QueryClient,
|
|
790
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
791
|
+
const queryOptions = useGetOrganisationUnitUsersQueryOptions(unitId, options);
|
|
792
|
+
|
|
793
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
794
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
query.queryKey = queryOptions.queryKey;
|
|
551
798
|
|
|
552
799
|
return query;
|
|
553
800
|
}
|
|
554
801
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
802
|
+
export const useGetOrganisationUnitUsersSuspenseQueryOptions = <
|
|
803
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
804
|
+
TError = ErrorType<AsError | void>,
|
|
805
|
+
>(
|
|
806
|
+
unitId: string,
|
|
807
|
+
options?: {
|
|
808
|
+
query?: Partial<
|
|
809
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
810
|
+
>;
|
|
811
|
+
request?: SecondParameter<typeof customInstance>;
|
|
812
|
+
},
|
|
558
813
|
) => {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
export type
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
export
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
814
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
815
|
+
|
|
816
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
817
|
+
|
|
818
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({
|
|
819
|
+
signal,
|
|
820
|
+
}) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
821
|
+
|
|
822
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
823
|
+
|
|
824
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
825
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
826
|
+
TError,
|
|
827
|
+
TData
|
|
828
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
export type GetOrganisationUnitUsersSuspenseQueryResult = NonNullable<
|
|
832
|
+
Awaited<ReturnType<typeof getOrganisationUnitUsers>>
|
|
833
|
+
>;
|
|
834
|
+
export type GetOrganisationUnitUsersSuspenseQueryError = ErrorType<AsError | void>;
|
|
835
|
+
|
|
836
|
+
export function useGetOrganisationUnitUsersSuspense<
|
|
837
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
838
|
+
TError = ErrorType<AsError | void>,
|
|
839
|
+
>(
|
|
840
|
+
unitId: string,
|
|
841
|
+
options: {
|
|
842
|
+
query: Partial<
|
|
843
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
844
|
+
>;
|
|
845
|
+
request?: SecondParameter<typeof customInstance>;
|
|
846
|
+
},
|
|
847
|
+
queryClient?: QueryClient,
|
|
848
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
849
|
+
export function useGetOrganisationUnitUsersSuspense<
|
|
850
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
851
|
+
TError = ErrorType<AsError | void>,
|
|
852
|
+
>(
|
|
853
|
+
unitId: string,
|
|
854
|
+
options?: {
|
|
855
|
+
query?: Partial<
|
|
856
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
857
|
+
>;
|
|
858
|
+
request?: SecondParameter<typeof customInstance>;
|
|
859
|
+
},
|
|
860
|
+
queryClient?: QueryClient,
|
|
861
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
862
|
+
export function useGetOrganisationUnitUsersSuspense<
|
|
863
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
864
|
+
TError = ErrorType<AsError | void>,
|
|
865
|
+
>(
|
|
866
|
+
unitId: string,
|
|
867
|
+
options?: {
|
|
868
|
+
query?: Partial<
|
|
869
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
870
|
+
>;
|
|
871
|
+
request?: SecondParameter<typeof customInstance>;
|
|
872
|
+
},
|
|
873
|
+
queryClient?: QueryClient,
|
|
874
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
591
875
|
/**
|
|
592
876
|
* @summary Gets users in an Organisational Unit
|
|
593
877
|
*/
|
|
594
878
|
|
|
595
|
-
export function useGetOrganisationUnitUsersSuspense<
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
879
|
+
export function useGetOrganisationUnitUsersSuspense<
|
|
880
|
+
TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
881
|
+
TError = ErrorType<AsError | void>,
|
|
882
|
+
>(
|
|
883
|
+
unitId: string,
|
|
884
|
+
options?: {
|
|
885
|
+
query?: Partial<
|
|
886
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>
|
|
887
|
+
>;
|
|
888
|
+
request?: SecondParameter<typeof customInstance>;
|
|
889
|
+
},
|
|
890
|
+
queryClient?: QueryClient,
|
|
891
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
892
|
+
const queryOptions = useGetOrganisationUnitUsersSuspenseQueryOptions(unitId, options);
|
|
893
|
+
|
|
894
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
895
|
+
TData,
|
|
896
|
+
TError
|
|
897
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
898
|
+
|
|
899
|
+
query.queryKey = queryOptions.queryKey;
|
|
605
900
|
|
|
606
901
|
return query;
|
|
607
902
|
}
|
|
608
903
|
|
|
609
|
-
|
|
610
|
-
|
|
611
904
|
/**
|
|
612
905
|
* Adds a user to an Organisational Unit.
|
|
613
906
|
|
|
@@ -618,64 +911,82 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
618
911
|
* @summary Adds a user to an Organisational Unit
|
|
619
912
|
*/
|
|
620
913
|
export const addOrganisationUnitUser = (
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
return customInstance<void>(
|
|
627
|
-
{url: `/unit/${unitId}/user/${userId}`, method: 'PUT'
|
|
628
|
-
},
|
|
629
|
-
options);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
export const getAddOrganisationUnitUserMutationOptions = <TData = Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError = ErrorType<AsError | void>,
|
|
635
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
914
|
+
unitId: string,
|
|
915
|
+
userId: string,
|
|
916
|
+
options?: SecondParameter<typeof customInstance>,
|
|
636
917
|
) => {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
918
|
+
return customInstance<void>({ url: `/unit/${unitId}/user/${userId}`, method: "PUT" }, options);
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
export const useAddOrganisationUnitUserMutationOptions = <
|
|
922
|
+
TError = ErrorType<AsError | void>,
|
|
923
|
+
TContext = unknown,
|
|
924
|
+
>(options?: {
|
|
925
|
+
mutation?: UseMutationOptions<
|
|
926
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
927
|
+
TError,
|
|
928
|
+
{ unitId: string; userId: string },
|
|
929
|
+
TContext
|
|
930
|
+
>;
|
|
931
|
+
request?: SecondParameter<typeof customInstance>;
|
|
932
|
+
}): UseMutationOptions<
|
|
933
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
934
|
+
TError,
|
|
935
|
+
{ unitId: string; userId: string },
|
|
936
|
+
TContext
|
|
937
|
+
> => {
|
|
938
|
+
const mutationKey = ["addOrganisationUnitUser"];
|
|
939
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
940
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
941
|
+
? options
|
|
942
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
943
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
944
|
+
|
|
945
|
+
const mutationFn: MutationFunction<
|
|
946
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
947
|
+
{ unitId: string; userId: string }
|
|
948
|
+
> = (props) => {
|
|
949
|
+
const { unitId, userId } = props ?? {};
|
|
950
|
+
|
|
951
|
+
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
955
|
+
|
|
956
|
+
return customOptions;
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
export type AddOrganisationUnitUserMutationResult = NonNullable<
|
|
960
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>
|
|
961
|
+
>;
|
|
962
|
+
|
|
963
|
+
export type AddOrganisationUnitUserMutationError = ErrorType<AsError | void>;
|
|
646
964
|
|
|
647
|
-
|
|
648
|
-
const {unitId,userId} = props ?? {};
|
|
649
|
-
|
|
650
|
-
return addOrganisationUnitUser(unitId,userId,requestOptions)
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{unitId: string;userId: string}, TContext>}
|
|
657
|
-
|
|
658
|
-
export type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>
|
|
659
|
-
|
|
660
|
-
export type AddOrganisationUnitUserMutationError = ErrorType<AsError | void>
|
|
661
|
-
|
|
662
|
-
/**
|
|
965
|
+
/**
|
|
663
966
|
* @summary Adds a user to an Organisational Unit
|
|
664
967
|
*/
|
|
665
|
-
export const useAddOrganisationUnitUser = <
|
|
666
|
-
|
|
968
|
+
export const useAddOrganisationUnitUser = <TError = ErrorType<AsError | void>, TContext = unknown>(
|
|
969
|
+
options?: {
|
|
970
|
+
mutation?: UseMutationOptions<
|
|
971
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
972
|
+
TError,
|
|
973
|
+
{ unitId: string; userId: string },
|
|
974
|
+
TContext
|
|
975
|
+
>;
|
|
976
|
+
request?: SecondParameter<typeof customInstance>;
|
|
977
|
+
},
|
|
978
|
+
queryClient?: QueryClient,
|
|
667
979
|
): UseMutationResult<
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
/**
|
|
980
|
+
Awaited<ReturnType<typeof addOrganisationUnitUser>>,
|
|
981
|
+
TError,
|
|
982
|
+
{ unitId: string; userId: string },
|
|
983
|
+
TContext
|
|
984
|
+
> => {
|
|
985
|
+
const mutationOptions = useAddOrganisationUnitUserMutationOptions(options);
|
|
986
|
+
|
|
987
|
+
return useMutation(mutationOptions, queryClient);
|
|
988
|
+
};
|
|
989
|
+
/**
|
|
679
990
|
* Removes a User from an Organisational Unit.
|
|
680
991
|
|
|
681
992
|
Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
|
|
@@ -685,61 +996,81 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
685
996
|
* @summary Deletes a User from an Organisational Unit
|
|
686
997
|
*/
|
|
687
998
|
export const deleteOrganisationUnitUser = (
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return customInstance<void>(
|
|
694
|
-
{url: `/unit/${unitId}/user/${userId}`, method: 'DELETE'
|
|
695
|
-
},
|
|
696
|
-
options);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
export const getDeleteOrganisationUnitUserMutationOptions = <TData = Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError = ErrorType<AsError | void>,
|
|
702
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
999
|
+
unitId: string,
|
|
1000
|
+
userId: string,
|
|
1001
|
+
options?: SecondParameter<typeof customInstance>,
|
|
703
1002
|
) => {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1003
|
+
return customInstance<void>({ url: `/unit/${unitId}/user/${userId}`, method: "DELETE" }, options);
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
export const useDeleteOrganisationUnitUserMutationOptions = <
|
|
1007
|
+
TError = ErrorType<AsError | void>,
|
|
1008
|
+
TContext = unknown,
|
|
1009
|
+
>(options?: {
|
|
1010
|
+
mutation?: UseMutationOptions<
|
|
1011
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
1012
|
+
TError,
|
|
1013
|
+
{ unitId: string; userId: string },
|
|
1014
|
+
TContext
|
|
1015
|
+
>;
|
|
1016
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1017
|
+
}): UseMutationOptions<
|
|
1018
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
1019
|
+
TError,
|
|
1020
|
+
{ unitId: string; userId: string },
|
|
1021
|
+
TContext
|
|
1022
|
+
> => {
|
|
1023
|
+
const mutationKey = ["deleteOrganisationUnitUser"];
|
|
1024
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
1025
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
1026
|
+
? options
|
|
1027
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
1028
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
1029
|
+
|
|
1030
|
+
const mutationFn: MutationFunction<
|
|
1031
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
1032
|
+
{ unitId: string; userId: string }
|
|
1033
|
+
> = (props) => {
|
|
1034
|
+
const { unitId, userId } = props ?? {};
|
|
1035
|
+
|
|
1036
|
+
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
1040
|
+
|
|
1041
|
+
return customOptions;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
export type DeleteOrganisationUnitUserMutationResult = NonNullable<
|
|
1045
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>
|
|
1046
|
+
>;
|
|
1047
|
+
|
|
1048
|
+
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError | void>;
|
|
712
1049
|
|
|
713
|
-
|
|
714
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {
|
|
715
|
-
const {unitId,userId} = props ?? {};
|
|
716
|
-
|
|
717
|
-
return deleteOrganisationUnitUser(unitId,userId,requestOptions)
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{unitId: string;userId: string}, TContext>}
|
|
724
|
-
|
|
725
|
-
export type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>
|
|
726
|
-
|
|
727
|
-
export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError | void>
|
|
728
|
-
|
|
729
|
-
/**
|
|
1050
|
+
/**
|
|
730
1051
|
* @summary Deletes a User from an Organisational Unit
|
|
731
1052
|
*/
|
|
732
|
-
export const useDeleteOrganisationUnitUser = <
|
|
733
|
-
|
|
1053
|
+
export const useDeleteOrganisationUnitUser = <
|
|
1054
|
+
TError = ErrorType<AsError | void>,
|
|
1055
|
+
TContext = unknown,
|
|
1056
|
+
>(
|
|
1057
|
+
options?: {
|
|
1058
|
+
mutation?: UseMutationOptions<
|
|
1059
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
1060
|
+
TError,
|
|
1061
|
+
{ unitId: string; userId: string },
|
|
1062
|
+
TContext
|
|
1063
|
+
>;
|
|
1064
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1065
|
+
},
|
|
1066
|
+
queryClient?: QueryClient,
|
|
734
1067
|
): UseMutationResult<
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
745
|
-
|
|
1068
|
+
Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,
|
|
1069
|
+
TError,
|
|
1070
|
+
{ unitId: string; userId: string },
|
|
1071
|
+
TContext
|
|
1072
|
+
> => {
|
|
1073
|
+
const mutationOptions = useDeleteOrganisationUnitUserMutationOptions(options);
|
|
1074
|
+
|
|
1075
|
+
return useMutation(mutationOptions, queryClient);
|
|
1076
|
+
};
|