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