@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.
- package/README.md +1 -1
- package/admin/admin.cjs +30 -8
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +50 -0
- package/admin/admin.d.ts +26 -6
- package/admin/admin.js +30 -8
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +62 -22
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +260 -0
- package/asset/asset.d.ts +79 -36
- package/asset/asset.js +54 -14
- package/asset/asset.js.map +1 -1
- package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/event-stream/event-stream.cjs +64 -19
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +142 -0
- package/event-stream/event-stream.d.ts +66 -20
- package/event-stream/event-stream.js +61 -16
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
- package/index.d.ts +700 -2
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +53 -14
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +91 -0
- package/merchant/merchant.d.ts +48 -8
- package/merchant/merchant.js +52 -13
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +110 -28
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +271 -0
- package/organisation/organisation.d.ts +114 -25
- package/organisation/organisation.js +103 -21
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +182 -47
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +399 -0
- package/product/product.d.ts +180 -31
- package/product/product.js +172 -37
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +272 -280
- package/src/admin/admin.ts +114 -84
- package/src/asset/asset.ts +480 -565
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +300 -275
- package/src/merchant/merchant.ts +206 -142
- package/src/organisation/organisation.ts +549 -490
- package/src/product/product.ts +829 -688
- package/src/state/state.ts +112 -75
- package/src/unit/unit.ts +645 -599
- package/src/user/user.ts +489 -469
- package/state/state.cjs +29 -8
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +46 -0
- package/state/state.d.ts +26 -6
- package/state/state.js +29 -8
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +120 -32
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +322 -0
- package/unit/unit.d.ts +133 -38
- package/unit/unit.js +112 -24
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +96 -22
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +271 -0
- package/user/user.d.ts +96 -24
- package/user/user.js +90 -16
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,36 +8,38 @@ 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 {
|
|
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
|
-
|
|
18
|
+
QueryFunction,
|
|
18
19
|
QueryKey,
|
|
19
|
-
|
|
20
|
+
UseMutationOptions,
|
|
21
|
+
UseQueryOptions,
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
25
|
+
} from '@tanstack/react-query'
|
|
20
26
|
import type {
|
|
21
|
-
OrganisationsGetResponse,
|
|
22
27
|
AsError,
|
|
23
|
-
OrganisationPostResponse,
|
|
24
|
-
OrganisationPostBodyBody,
|
|
25
|
-
OrganisationGetResponse,
|
|
26
|
-
OrganisationPatchBodyBody,
|
|
27
|
-
OrganisationChargesGetResponse,
|
|
28
28
|
GetOrganisationChargesParams,
|
|
29
|
+
OrganisationChargesGetResponse,
|
|
30
|
+
OrganisationDetail,
|
|
29
31
|
OrganisationGetDefaultResponse,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
OrganisationPatchBodyBody,
|
|
33
|
+
OrganisationPostBodyBody,
|
|
34
|
+
OrganisationPostResponse,
|
|
35
|
+
OrganisationsGetResponse
|
|
36
|
+
} from '../account-server-api.schemas'
|
|
37
|
+
import { customInstance } from '.././custom-instance';
|
|
38
|
+
import type { ErrorType } from '.././custom-instance';
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
42
|
+
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Gets all the Organisations that you are a member of or are public. Admin users are members of all Organisations
|
|
@@ -45,69 +47,102 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
45
47
|
* @summary Gets Organisations
|
|
46
48
|
*/
|
|
47
49
|
export const getOrganisations = (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
|
|
51
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
52
|
+
) => {
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return customInstance<OrganisationsGetResponse>(
|
|
56
|
+
{url: `/organisation`, method: 'GET', signal
|
|
57
|
+
},
|
|
58
|
+
options);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const getGetOrganisationsQueryKey = () => {
|
|
63
|
+
return ["account-server-api", `/organisation`] as const;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export const getGetOrganisationsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
68
|
+
) => {
|
|
69
|
+
|
|
70
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
71
|
+
|
|
72
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisations>>> = ({ signal }) => getOrganisations(requestOptions, signal);
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData> & { queryKey: QueryKey }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>
|
|
86
|
+
export type GetOrganisationsQueryError = ErrorType<void | AsError>
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @summary Gets Organisations
|
|
90
|
+
*/
|
|
91
|
+
export const useGetOrganisations = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>(
|
|
92
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
93
|
+
|
|
94
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
95
|
+
|
|
96
|
+
const queryOptions = getGetOrganisationsQueryOptions(options)
|
|
97
|
+
|
|
98
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
99
|
+
|
|
100
|
+
query.queryKey = queryOptions.queryKey ;
|
|
101
|
+
|
|
102
|
+
return query;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export const getGetOrganisationsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
50
108
|
) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type GetOrganisationsQueryResult = NonNullable<
|
|
86
|
-
Awaited<ReturnType<typeof getOrganisations>>
|
|
87
|
-
>;
|
|
88
|
-
export type GetOrganisationsQueryError = ErrorType<void | AsError>;
|
|
89
|
-
|
|
90
|
-
export const useGetOrganisations = <
|
|
91
|
-
TData = Awaited<ReturnType<typeof getOrganisations>>,
|
|
92
|
-
TError = ErrorType<void | AsError>
|
|
93
|
-
>(options?: {
|
|
94
|
-
query?: UseQueryOptions<
|
|
95
|
-
Awaited<ReturnType<typeof getOrganisations>>,
|
|
96
|
-
TError,
|
|
97
|
-
TData
|
|
98
|
-
>;
|
|
99
|
-
request?: SecondParameter<typeof customInstance>;
|
|
100
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
101
|
-
const queryOptions = getGetOrganisationsQueryOptions(options);
|
|
102
|
-
|
|
103
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
104
|
-
queryKey: QueryKey;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
query.queryKey = queryOptions.queryKey;
|
|
109
|
+
|
|
110
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
111
|
+
|
|
112
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisations>>> = ({ signal }) => getOrganisations(requestOptions, signal);
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData> & { queryKey: QueryKey }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type GetOrganisationsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>
|
|
126
|
+
export type GetOrganisationsSuspenseQueryError = ErrorType<void | AsError>
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @summary Gets Organisations
|
|
130
|
+
*/
|
|
131
|
+
export const useGetOrganisationsSuspense = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>(
|
|
132
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
133
|
+
|
|
134
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
135
|
+
|
|
136
|
+
const queryOptions = getGetOrganisationsSuspenseQueryOptions(options)
|
|
137
|
+
|
|
138
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
139
|
+
|
|
140
|
+
query.queryKey = queryOptions.queryKey ;
|
|
108
141
|
|
|
109
142
|
return query;
|
|
110
|
-
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
111
146
|
|
|
112
147
|
/**
|
|
113
148
|
* Creates a new Organisation
|
|
@@ -117,74 +152,55 @@ You need admin rights to use this method
|
|
|
117
152
|
* @summary Create a new organisation
|
|
118
153
|
*/
|
|
119
154
|
export const createOrganisation = (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
url: `/organisation`,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
data: organisationPostBodyBody,
|
|
155
|
+
organisationPostBodyBody: OrganisationPostBodyBody,
|
|
156
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
return customInstance<OrganisationPostResponse>(
|
|
160
|
+
{url: `/organisation`, method: 'POST',
|
|
161
|
+
headers: {'Content-Type': 'application/json', },
|
|
162
|
+
data: organisationPostBodyBody
|
|
129
163
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Awaited<ReturnType<typeof createOrganisation
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
export const useCreateOrganisation = <
|
|
172
|
-
TError = ErrorType<AsError | void>,
|
|
173
|
-
TContext = unknown
|
|
174
|
-
>(options?: {
|
|
175
|
-
mutation?: UseMutationOptions<
|
|
176
|
-
Awaited<ReturnType<typeof createOrganisation>>,
|
|
177
|
-
TError,
|
|
178
|
-
{ data: OrganisationPostBodyBody },
|
|
179
|
-
TContext
|
|
180
|
-
>;
|
|
181
|
-
request?: SecondParameter<typeof customInstance>;
|
|
182
|
-
}) => {
|
|
183
|
-
const mutationOptions = getCreateOrganisationMutationOptions(options);
|
|
184
|
-
|
|
185
|
-
return useMutation(mutationOptions);
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
164
|
+
options);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
export const getCreateOrganisationMutationOptions = <TError = ErrorType<AsError | void>,
|
|
170
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
171
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext> => {
|
|
172
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisation>>, {data: OrganisationPostBodyBody}> = (props) => {
|
|
178
|
+
const {data} = props ?? {};
|
|
179
|
+
|
|
180
|
+
return createOrganisation(data,requestOptions)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
return { mutationFn, ...mutationOptions }}
|
|
187
|
+
|
|
188
|
+
export type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>
|
|
189
|
+
export type CreateOrganisationMutationBody = OrganisationPostBodyBody
|
|
190
|
+
export type CreateOrganisationMutationError = ErrorType<AsError | void>
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @summary Create a new organisation
|
|
194
|
+
*/
|
|
195
|
+
export const useCreateOrganisation = <TError = ErrorType<AsError | void>,
|
|
196
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
197
|
+
) => {
|
|
198
|
+
|
|
199
|
+
const mutationOptions = getCreateOrganisationMutationOptions(options);
|
|
200
|
+
|
|
201
|
+
return useMutation(mutationOptions);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
188
204
|
* Gets a specific Organisation. To see the Organisation you need admin rights or need to be a member of the Organisation.
|
|
189
205
|
|
|
190
206
|
Members of an Organisation's **Unit** do not necessarily have access to the Organisation.
|
|
@@ -192,77 +208,102 @@ Members of an Organisation's **Unit** do not necessarily have access to the Orga
|
|
|
192
208
|
* @summary Gets an Organisation
|
|
193
209
|
*/
|
|
194
210
|
export const getOrganisation = (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
orgId: string,
|
|
212
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
213
|
+
) => {
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
return customInstance<OrganisationDetail>(
|
|
217
|
+
{url: `/organisation/${orgId}`, method: 'GET', signal
|
|
218
|
+
},
|
|
219
|
+
options);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
export const getGetOrganisationQueryKey = (orgId: string,) => {
|
|
224
|
+
return ["account-server-api", `/organisation/${orgId}`] as const;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
export const getGetOrganisationQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
198
229
|
) => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
orgId:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
TData
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
signal,
|
|
232
|
-
}) => getOrganisation(orgId, requestOptions, signal);
|
|
233
|
-
|
|
234
|
-
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
export type GetOrganisationQueryResult = NonNullable<
|
|
238
|
-
Awaited<ReturnType<typeof getOrganisation>>
|
|
239
|
-
>;
|
|
240
|
-
export type GetOrganisationQueryError = ErrorType<void | AsError>;
|
|
241
|
-
|
|
242
|
-
export const useGetOrganisation = <
|
|
243
|
-
TData = Awaited<ReturnType<typeof getOrganisation>>,
|
|
244
|
-
TError = ErrorType<void | AsError>
|
|
245
|
-
>(
|
|
246
|
-
orgId: string,
|
|
247
|
-
options?: {
|
|
248
|
-
query?: UseQueryOptions<
|
|
249
|
-
Awaited<ReturnType<typeof getOrganisation>>,
|
|
250
|
-
TError,
|
|
251
|
-
TData
|
|
252
|
-
>;
|
|
253
|
-
request?: SecondParameter<typeof customInstance>;
|
|
254
|
-
}
|
|
255
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
256
|
-
const queryOptions = getGetOrganisationQueryOptions(orgId, options);
|
|
257
|
-
|
|
258
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
259
|
-
queryKey: QueryKey;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
query.queryKey = queryOptions.queryKey;
|
|
230
|
+
|
|
231
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
232
|
+
|
|
233
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({ signal }) => getOrganisation(orgId, requestOptions, signal);
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData> & { queryKey: QueryKey }
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>
|
|
247
|
+
export type GetOrganisationQueryError = ErrorType<void | AsError>
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @summary Gets an Organisation
|
|
251
|
+
*/
|
|
252
|
+
export const useGetOrganisation = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(
|
|
253
|
+
orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
254
|
+
|
|
255
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
256
|
+
|
|
257
|
+
const queryOptions = getGetOrganisationQueryOptions(orgId,options)
|
|
258
|
+
|
|
259
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
260
|
+
|
|
261
|
+
query.queryKey = queryOptions.queryKey ;
|
|
263
262
|
|
|
264
263
|
return query;
|
|
265
|
-
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
export const getGetOrganisationSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
269
|
+
) => {
|
|
270
|
+
|
|
271
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
272
|
+
|
|
273
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({ signal }) => getOrganisation(orgId, requestOptions, signal);
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData> & { queryKey: QueryKey }
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export type GetOrganisationSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>
|
|
287
|
+
export type GetOrganisationSuspenseQueryError = ErrorType<void | AsError>
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @summary Gets an Organisation
|
|
291
|
+
*/
|
|
292
|
+
export const useGetOrganisationSuspense = <TData = Awaited<ReturnType<typeof getOrganisation>>, TError = ErrorType<void | AsError>>(
|
|
293
|
+
orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
294
|
+
|
|
295
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
296
|
+
|
|
297
|
+
const queryOptions = getGetOrganisationSuspenseQueryOptions(orgId,options)
|
|
298
|
+
|
|
299
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
300
|
+
|
|
301
|
+
query.queryKey = queryOptions.queryKey ;
|
|
302
|
+
|
|
303
|
+
return query;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
|
|
266
307
|
|
|
267
308
|
/**
|
|
268
309
|
* Used to update existing Organisation.
|
|
@@ -272,75 +313,56 @@ You have to be the Organisation owner (or an administrator) to patch an Organisa
|
|
|
272
313
|
* @summary Adjust an existing Organisation
|
|
273
314
|
*/
|
|
274
315
|
export const patchOrganisation = (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
url: `/organisation/${orgId}`,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
data: organisationPatchBodyBody,
|
|
316
|
+
orgId: string,
|
|
317
|
+
organisationPatchBodyBody: OrganisationPatchBodyBody,
|
|
318
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
return customInstance<void>(
|
|
322
|
+
{url: `/organisation/${orgId}`, method: 'PATCH',
|
|
323
|
+
headers: {'Content-Type': 'application/json', },
|
|
324
|
+
data: organisationPatchBodyBody
|
|
285
325
|
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
>
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
Awaited<ReturnType<typeof patchOrganisation
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
export const usePatchOrganisation = <
|
|
328
|
-
TError = ErrorType<AsError>,
|
|
329
|
-
TContext = unknown
|
|
330
|
-
>(options?: {
|
|
331
|
-
mutation?: UseMutationOptions<
|
|
332
|
-
Awaited<ReturnType<typeof patchOrganisation>>,
|
|
333
|
-
TError,
|
|
334
|
-
{ orgId: string; data: OrganisationPatchBodyBody },
|
|
335
|
-
TContext
|
|
336
|
-
>;
|
|
337
|
-
request?: SecondParameter<typeof customInstance>;
|
|
338
|
-
}) => {
|
|
339
|
-
const mutationOptions = getPatchOrganisationMutationOptions(options);
|
|
340
|
-
|
|
341
|
-
return useMutation(mutationOptions);
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
326
|
+
options);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
export const getPatchOrganisationMutationOptions = <TError = ErrorType<AsError>,
|
|
332
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
333
|
+
): UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext> => {
|
|
334
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchOrganisation>>, {orgId: string;data: OrganisationPatchBodyBody}> = (props) => {
|
|
340
|
+
const {orgId,data} = props ?? {};
|
|
341
|
+
|
|
342
|
+
return patchOrganisation(orgId,data,requestOptions)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
return { mutationFn, ...mutationOptions }}
|
|
349
|
+
|
|
350
|
+
export type PatchOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof patchOrganisation>>>
|
|
351
|
+
export type PatchOrganisationMutationBody = OrganisationPatchBodyBody
|
|
352
|
+
export type PatchOrganisationMutationError = ErrorType<AsError>
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @summary Adjust an existing Organisation
|
|
356
|
+
*/
|
|
357
|
+
export const usePatchOrganisation = <TError = ErrorType<AsError>,
|
|
358
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchOrganisation>>, TError,{orgId: string;data: OrganisationPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
359
|
+
) => {
|
|
360
|
+
|
|
361
|
+
const mutationOptions = getPatchOrganisationMutationOptions(options);
|
|
362
|
+
|
|
363
|
+
return useMutation(mutationOptions);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
344
366
|
* Before an Organisation can be deleted all its underlying **Units** must also be deleted, remembering that **Units** that have undeleted **Products** cannot be deleted.
|
|
345
367
|
|
|
346
368
|
You need admin rights to use this method
|
|
@@ -348,69 +370,53 @@ You need admin rights to use this method
|
|
|
348
370
|
* @summary Deletes an Organisation
|
|
349
371
|
*/
|
|
350
372
|
export const deleteOrganisation = (
|
|
351
|
-
|
|
352
|
-
|
|
373
|
+
orgId: string,
|
|
374
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
return customInstance<void>(
|
|
378
|
+
{url: `/organisation/${orgId}`, method: 'DELETE'
|
|
379
|
+
},
|
|
380
|
+
options);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
export const getDeleteOrganisationMutationOptions = <TError = ErrorType<AsError>,
|
|
386
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
387
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext> => {
|
|
388
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisation>>, {orgId: string}> = (props) => {
|
|
394
|
+
const {orgId} = props ?? {};
|
|
395
|
+
|
|
396
|
+
return deleteOrganisation(orgId,requestOptions)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
return { mutationFn, ...mutationOptions }}
|
|
403
|
+
|
|
404
|
+
export type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>
|
|
405
|
+
|
|
406
|
+
export type DeleteOrganisationMutationError = ErrorType<AsError>
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @summary Deletes an Organisation
|
|
410
|
+
*/
|
|
411
|
+
export const useDeleteOrganisation = <TError = ErrorType<AsError>,
|
|
412
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
353
413
|
) => {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export const getDeleteOrganisationMutationOptions = <
|
|
361
|
-
TError = ErrorType<AsError>,
|
|
362
|
-
TContext = unknown
|
|
363
|
-
>(options?: {
|
|
364
|
-
mutation?: UseMutationOptions<
|
|
365
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
366
|
-
TError,
|
|
367
|
-
{ orgId: string },
|
|
368
|
-
TContext
|
|
369
|
-
>;
|
|
370
|
-
request?: SecondParameter<typeof customInstance>;
|
|
371
|
-
}): UseMutationOptions<
|
|
372
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
373
|
-
TError,
|
|
374
|
-
{ orgId: string },
|
|
375
|
-
TContext
|
|
376
|
-
> => {
|
|
377
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
378
|
-
|
|
379
|
-
const mutationFn: MutationFunction<
|
|
380
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
381
|
-
{ orgId: string }
|
|
382
|
-
> = (props) => {
|
|
383
|
-
const { orgId } = props ?? {};
|
|
384
|
-
|
|
385
|
-
return deleteOrganisation(orgId, requestOptions);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
return { mutationFn, ...mutationOptions };
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
export type DeleteOrganisationMutationResult = NonNullable<
|
|
392
|
-
Awaited<ReturnType<typeof deleteOrganisation>>
|
|
393
|
-
>;
|
|
394
|
-
|
|
395
|
-
export type DeleteOrganisationMutationError = ErrorType<AsError>;
|
|
396
|
-
|
|
397
|
-
export const useDeleteOrganisation = <
|
|
398
|
-
TError = ErrorType<AsError>,
|
|
399
|
-
TContext = unknown
|
|
400
|
-
>(options?: {
|
|
401
|
-
mutation?: UseMutationOptions<
|
|
402
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
403
|
-
TError,
|
|
404
|
-
{ orgId: string },
|
|
405
|
-
TContext
|
|
406
|
-
>;
|
|
407
|
-
request?: SecondParameter<typeof customInstance>;
|
|
408
|
-
}) => {
|
|
409
|
-
const mutationOptions = getDeleteOrganisationMutationOptions(options);
|
|
410
|
-
|
|
411
|
-
return useMutation(mutationOptions);
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
+
|
|
415
|
+
const mutationOptions = getDeleteOrganisationMutationOptions(options);
|
|
416
|
+
|
|
417
|
+
return useMutation(mutationOptions);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
414
420
|
* Gets a Organisation charges.
|
|
415
421
|
|
|
416
422
|
The Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint
|
|
@@ -418,88 +424,109 @@ The Organisation cannot be the **Default Organisation** and you need to be a mem
|
|
|
418
424
|
* @summary Gets charges for all Units in an Organisation
|
|
419
425
|
*/
|
|
420
426
|
export const getOrganisationCharges = (
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
427
|
+
orgId: string,
|
|
428
|
+
params?: GetOrganisationChargesParams,
|
|
429
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
430
|
+
) => {
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
return customInstance<OrganisationChargesGetResponse>(
|
|
434
|
+
{url: `/organisation/${orgId}/charges`, method: 'GET',
|
|
435
|
+
params, signal
|
|
436
|
+
},
|
|
437
|
+
options);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
export const getGetOrganisationChargesQueryKey = (orgId: string,
|
|
442
|
+
params?: GetOrganisationChargesParams,) => {
|
|
443
|
+
return ["account-server-api", `/organisation/${orgId}/charges`, ...(params ? [params]: [])] as const;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
export const getGetOrganisationChargesQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(orgId: string,
|
|
448
|
+
params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
425
449
|
) => {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);
|
|
460
|
-
|
|
461
|
-
const queryFn: QueryFunction<
|
|
462
|
-
Awaited<ReturnType<typeof getOrganisationCharges>>
|
|
463
|
-
> = ({ signal }) =>
|
|
464
|
-
getOrganisationCharges(orgId, params, requestOptions, signal);
|
|
465
|
-
|
|
466
|
-
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
export type GetOrganisationChargesQueryResult = NonNullable<
|
|
470
|
-
Awaited<ReturnType<typeof getOrganisationCharges>>
|
|
471
|
-
>;
|
|
472
|
-
export type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
|
|
473
|
-
|
|
474
|
-
export const useGetOrganisationCharges = <
|
|
475
|
-
TData = Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
476
|
-
TError = ErrorType<void | AsError>
|
|
477
|
-
>(
|
|
478
|
-
orgId: string,
|
|
479
|
-
params?: GetOrganisationChargesParams,
|
|
480
|
-
options?: {
|
|
481
|
-
query?: UseQueryOptions<
|
|
482
|
-
Awaited<ReturnType<typeof getOrganisationCharges>>,
|
|
483
|
-
TError,
|
|
484
|
-
TData
|
|
485
|
-
>;
|
|
486
|
-
request?: SecondParameter<typeof customInstance>;
|
|
487
|
-
}
|
|
488
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
489
|
-
const queryOptions = getGetOrganisationChargesQueryOptions(
|
|
490
|
-
orgId,
|
|
491
|
-
params,
|
|
492
|
-
options
|
|
493
|
-
);
|
|
494
|
-
|
|
495
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
496
|
-
queryKey: QueryKey;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
query.queryKey = queryOptions.queryKey;
|
|
450
|
+
|
|
451
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
452
|
+
|
|
453
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId,params);
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) => getOrganisationCharges(orgId,params, requestOptions, signal);
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData> & { queryKey: QueryKey }
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>
|
|
467
|
+
export type GetOrganisationChargesQueryError = ErrorType<void | AsError>
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @summary Gets charges for all Units in an Organisation
|
|
471
|
+
*/
|
|
472
|
+
export const useGetOrganisationCharges = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(
|
|
473
|
+
orgId: string,
|
|
474
|
+
params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
475
|
+
|
|
476
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
477
|
+
|
|
478
|
+
const queryOptions = getGetOrganisationChargesQueryOptions(orgId,params,options)
|
|
479
|
+
|
|
480
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
481
|
+
|
|
482
|
+
query.queryKey = queryOptions.queryKey ;
|
|
500
483
|
|
|
501
484
|
return query;
|
|
502
|
-
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
export const getGetOrganisationChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(orgId: string,
|
|
490
|
+
params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
491
|
+
) => {
|
|
492
|
+
|
|
493
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
494
|
+
|
|
495
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId,params);
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) => getOrganisationCharges(orgId,params, requestOptions, signal);
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData> & { queryKey: QueryKey }
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export type GetOrganisationChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>
|
|
509
|
+
export type GetOrganisationChargesSuspenseQueryError = ErrorType<void | AsError>
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* @summary Gets charges for all Units in an Organisation
|
|
513
|
+
*/
|
|
514
|
+
export const useGetOrganisationChargesSuspense = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(
|
|
515
|
+
orgId: string,
|
|
516
|
+
params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
517
|
+
|
|
518
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
519
|
+
|
|
520
|
+
const queryOptions = getGetOrganisationChargesSuspenseQueryOptions(orgId,params,options)
|
|
521
|
+
|
|
522
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
523
|
+
|
|
524
|
+
query.queryKey = queryOptions.queryKey ;
|
|
525
|
+
|
|
526
|
+
return query;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
503
530
|
|
|
504
531
|
/**
|
|
505
532
|
* Gets the Default Organisation, a built-in Organisation used exclusively for **Personal Units**.
|
|
@@ -509,68 +536,100 @@ Any authorised user can see the Default Organisation.
|
|
|
509
536
|
* @summary Gets the Default Organisation
|
|
510
537
|
*/
|
|
511
538
|
export const getDefaultOrganisation = (
|
|
512
|
-
|
|
513
|
-
|
|
539
|
+
|
|
540
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
514
541
|
) => {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
export const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
query
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
return customInstance<OrganisationGetDefaultResponse>(
|
|
545
|
+
{url: `/organisation/default`, method: 'GET', signal
|
|
546
|
+
},
|
|
547
|
+
options);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
export const getGetDefaultOrganisationQueryKey = () => {
|
|
552
|
+
return ["account-server-api", `/organisation/default`] as const;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
export const getGetDefaultOrganisationQueryOptions = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
557
|
+
) => {
|
|
558
|
+
|
|
559
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
560
|
+
|
|
561
|
+
const queryKey = queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDefaultOrganisation>>> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData> & { queryKey: QueryKey }
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>
|
|
575
|
+
export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @summary Gets the Default Organisation
|
|
579
|
+
*/
|
|
580
|
+
export const useGetDefaultOrganisation = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>(
|
|
581
|
+
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
582
|
+
|
|
583
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
584
|
+
|
|
585
|
+
const queryOptions = getGetDefaultOrganisationQueryOptions(options)
|
|
586
|
+
|
|
587
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
588
|
+
|
|
589
|
+
query.queryKey = queryOptions.queryKey ;
|
|
590
|
+
|
|
591
|
+
return query;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
export const getGetDefaultOrganisationSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
597
|
+
) => {
|
|
598
|
+
|
|
599
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
600
|
+
|
|
601
|
+
const queryKey = queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDefaultOrganisation>>> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData> & { queryKey: QueryKey }
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type GetDefaultOrganisationSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>
|
|
615
|
+
export type GetDefaultOrganisationSuspenseQueryError = ErrorType<void | AsError>
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* @summary Gets the Default Organisation
|
|
619
|
+
*/
|
|
620
|
+
export const useGetDefaultOrganisationSuspense = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>(
|
|
621
|
+
options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
622
|
+
|
|
623
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
624
|
+
|
|
625
|
+
const queryOptions = getGetDefaultOrganisationSuspenseQueryOptions(options)
|
|
626
|
+
|
|
627
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
628
|
+
|
|
629
|
+
query.queryKey = queryOptions.queryKey ;
|
|
574
630
|
|
|
575
631
|
return query;
|
|
576
|
-
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|