@squonk/account-server-client 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/admin/admin.cjs +14 -7
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.cts +33 -0
  4. package/admin/admin.d.ts +4 -1
  5. package/admin/admin.js +14 -7
  6. package/admin/admin.js.map +1 -1
  7. package/asset/asset.cjs +44 -19
  8. package/asset/asset.cjs.map +1 -1
  9. package/asset/asset.d.cts +241 -0
  10. package/asset/asset.d.ts +43 -19
  11. package/asset/asset.js +37 -12
  12. package/asset/asset.js.map +1 -1
  13. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  14. package/chunk-J22A7LHX.cjs.map +1 -0
  15. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  16. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  17. package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
  18. package/index.cjs +10 -10
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +2 -0
  21. package/index.d.ts +1 -1
  22. package/index.js +9 -9
  23. package/index.js.map +1 -1
  24. package/merchant/merchant.cjs +23 -13
  25. package/merchant/merchant.cjs.map +1 -1
  26. package/merchant/merchant.d.cts +57 -0
  27. package/merchant/merchant.d.ts +7 -1
  28. package/merchant/merchant.js +22 -12
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +50 -25
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.cts +203 -0
  33. package/organisation/organisation.d.ts +31 -10
  34. package/organisation/organisation.js +44 -19
  35. package/organisation/organisation.js.map +1 -1
  36. package/package.json +12 -12
  37. package/product/product.cjs +80 -44
  38. package/product/product.cjs.map +1 -1
  39. package/product/product.d.cts +280 -0
  40. package/product/product.d.ts +40 -10
  41. package/product/product.js +71 -35
  42. package/product/product.js.map +1 -1
  43. package/src/account-server-api.schemas.ts +268 -276
  44. package/src/admin/admin.ts +72 -78
  45. package/src/asset/asset.ts +447 -556
  46. package/src/merchant/merchant.ts +125 -136
  47. package/src/organisation/organisation.ts +394 -484
  48. package/src/product/product.ts +557 -682
  49. package/src/state/state.ts +70 -69
  50. package/src/unit/unit.ts +494 -593
  51. package/src/user/user.ts +377 -463
  52. package/state/state.cjs +13 -7
  53. package/state/state.cjs.map +1 -1
  54. package/state/state.d.cts +29 -0
  55. package/state/state.d.ts +4 -1
  56. package/state/state.js +13 -7
  57. package/state/state.js.map +1 -1
  58. package/unit/unit.cjs +59 -28
  59. package/unit/unit.cjs.map +1 -1
  60. package/unit/unit.d.cts +254 -0
  61. package/unit/unit.d.ts +43 -16
  62. package/unit/unit.js +52 -21
  63. package/unit/unit.js.map +1 -1
  64. package/user/user.cjs +52 -21
  65. package/user/user.cjs.map +1 -1
  66. package/user/user.d.cts +220 -0
  67. package/user/user.d.ts +31 -10
  68. package/user/user.js +46 -15
  69. package/user/user.js.map +1 -1
  70. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
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 { useQuery, useMutation } from "@tanstack/react-query";
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
- UseQueryResult,
17
+ QueryFunction,
18
18
  QueryKey,
19
- } from "@tanstack/react-query";
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
- } from "../account-server-api.schemas";
31
- import { customInstance } from ".././custom-instance";
32
- import type { ErrorType } from ".././custom-instance";
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
- options?: SecondParameter<typeof customInstance>,
49
- signal?: AbortSignal
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
- return customInstance<OrganisationsGetResponse>(
52
- { url: `/organisation`, method: "get", signal },
53
- options
54
- );
55
- };
56
-
57
- export const getGetOrganisationsQueryKey = () => ["account-server-api", `/organisation`] as const;
58
-
59
- export const getGetOrganisationsQueryOptions = <
60
- TData = Awaited<ReturnType<typeof getOrganisations>>,
61
- TError = ErrorType<void | AsError>
62
- >(options?: {
63
- query?: UseQueryOptions<
64
- Awaited<ReturnType<typeof getOrganisations>>,
65
- TError,
66
- TData
67
- >;
68
- request?: SecondParameter<typeof customInstance>;
69
- }): UseQueryOptions<
70
- Awaited<ReturnType<typeof getOrganisations>>,
71
- TError,
72
- TData
73
- > & { queryKey: QueryKey } => {
74
- const { query: queryOptions, request: requestOptions } = options ?? {};
75
-
76
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
77
-
78
- const queryFn: QueryFunction<
79
- Awaited<ReturnType<typeof getOrganisations>>
80
- > = ({ signal }) => getOrganisations(requestOptions, signal);
81
-
82
- return { queryKey, queryFn, ...queryOptions };
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
- organisationPostBodyBody: OrganisationPostBodyBody,
121
- options?: SecondParameter<typeof customInstance>
122
- ) => {
123
- return customInstance<OrganisationPostResponse>(
124
- {
125
- url: `/organisation`,
126
- method: "post",
127
- headers: { "Content-Type": "application/json" },
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
- options
131
- );
132
- };
133
-
134
- export const getCreateOrganisationMutationOptions = <
135
- TError = ErrorType<AsError | void>,
136
- TContext = unknown
137
- >(options?: {
138
- mutation?: UseMutationOptions<
139
- Awaited<ReturnType<typeof createOrganisation>>,
140
- TError,
141
- { data: OrganisationPostBodyBody },
142
- TContext
143
- >;
144
- request?: SecondParameter<typeof customInstance>;
145
- }): UseMutationOptions<
146
- Awaited<ReturnType<typeof createOrganisation>>,
147
- TError,
148
- { data: OrganisationPostBodyBody },
149
- TContext
150
- > => {
151
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
152
-
153
- const mutationFn: MutationFunction<
154
- Awaited<ReturnType<typeof createOrganisation>>,
155
- { data: OrganisationPostBodyBody }
156
- > = (props) => {
157
- const { data } = props ?? {};
158
-
159
- return createOrganisation(data, requestOptions);
160
- };
161
-
162
- return { mutationFn, ...mutationOptions };
163
- };
164
-
165
- export type CreateOrganisationMutationResult = NonNullable<
166
- Awaited<ReturnType<typeof createOrganisation>>
167
- >;
168
- export type CreateOrganisationMutationBody = OrganisationPostBodyBody;
169
- export type CreateOrganisationMutationError = ErrorType<AsError | void>;
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
- /**
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
- orgId: string,
196
- options?: SecondParameter<typeof customInstance>,
197
- signal?: AbortSignal
177
+ orgId: string,
178
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
198
179
  ) => {
199
- return customInstance<OrganisationGetResponse>(
200
- { url: `/organisation/${orgId}`, method: "get", signal },
201
- options
202
- );
203
- };
204
-
205
- export const getGetOrganisationQueryKey = (orgId: string) =>
206
- ["account-server-api", `/organisation/${orgId}`] as const;
207
-
208
- export const getGetOrganisationQueryOptions = <
209
- TData = Awaited<ReturnType<typeof getOrganisation>>,
210
- TError = ErrorType<void | AsError>
211
- >(
212
- orgId: string,
213
- options?: {
214
- query?: UseQueryOptions<
215
- Awaited<ReturnType<typeof getOrganisation>>,
216
- TError,
217
- TData
218
- >;
219
- request?: SecondParameter<typeof customInstance>;
220
- }
221
- ): UseQueryOptions<
222
- Awaited<ReturnType<typeof getOrganisation>>,
223
- TError,
224
- TData
225
- > & { queryKey: QueryKey } => {
226
- const { query: queryOptions, request: requestOptions } = options ?? {};
227
-
228
- const queryKey = queryOptions?.queryKey ?? getGetOrganisationQueryKey(orgId);
229
-
230
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({
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;
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
- orgId: string,
276
- organisationPatchBodyBody: OrganisationPatchBodyBody,
277
- options?: SecondParameter<typeof customInstance>
278
- ) => {
279
- return customInstance<void>(
280
- {
281
- url: `/organisation/${orgId}`,
282
- method: "patch",
283
- headers: { "Content-Type": "application/json" },
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
- options
287
- );
288
- };
289
-
290
- export const getPatchOrganisationMutationOptions = <
291
- TError = ErrorType<AsError>,
292
- TContext = unknown
293
- >(options?: {
294
- mutation?: UseMutationOptions<
295
- Awaited<ReturnType<typeof patchOrganisation>>,
296
- TError,
297
- { orgId: string; data: OrganisationPatchBodyBody },
298
- TContext
299
- >;
300
- request?: SecondParameter<typeof customInstance>;
301
- }): UseMutationOptions<
302
- Awaited<ReturnType<typeof patchOrganisation>>,
303
- TError,
304
- { orgId: string; data: OrganisationPatchBodyBody },
305
- TContext
306
- > => {
307
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
308
-
309
- const mutationFn: MutationFunction<
310
- Awaited<ReturnType<typeof patchOrganisation>>,
311
- { orgId: string; data: OrganisationPatchBodyBody }
312
- > = (props) => {
313
- const { orgId, data } = props ?? {};
314
-
315
- return patchOrganisation(orgId, data, requestOptions);
316
- };
317
-
318
- return { mutationFn, ...mutationOptions };
319
- };
320
-
321
- export type PatchOrganisationMutationResult = NonNullable<
322
- Awaited<ReturnType<typeof patchOrganisation>>
323
- >;
324
- export type PatchOrganisationMutationBody = OrganisationPatchBodyBody;
325
- export type PatchOrganisationMutationError = ErrorType<AsError>;
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
- /**
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
- orgId: string,
352
- options?: SecondParameter<typeof customInstance>
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
- return customInstance<void>(
355
- { url: `/organisation/${orgId}`, method: "delete" },
356
- options
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
- orgId: string,
422
- params?: GetOrganisationChargesParams,
423
- options?: SecondParameter<typeof customInstance>,
424
- signal?: AbortSignal
358
+ orgId: string,
359
+ params?: GetOrganisationChargesParams,
360
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
425
361
  ) => {
426
- return customInstance<OrganisationChargesGetResponse>(
427
- { url: `/organisation/${orgId}/charges`, method: "get", params, signal },
428
- options
429
- );
430
- };
431
-
432
- export const getGetOrganisationChargesQueryKey = (
433
- orgId: string,
434
- params?: GetOrganisationChargesParams
435
- ) => ["account-server-api", `/organisation/${orgId}/charges`, ...(params ? [params] : [])] as const;
436
-
437
- export const getGetOrganisationChargesQueryOptions = <
438
- TData = Awaited<ReturnType<typeof getOrganisationCharges>>,
439
- TError = ErrorType<void | AsError>
440
- >(
441
- orgId: string,
442
- params?: GetOrganisationChargesParams,
443
- options?: {
444
- query?: UseQueryOptions<
445
- Awaited<ReturnType<typeof getOrganisationCharges>>,
446
- TError,
447
- TData
448
- >;
449
- request?: SecondParameter<typeof customInstance>;
450
- }
451
- ): UseQueryOptions<
452
- Awaited<ReturnType<typeof getOrganisationCharges>>,
453
- TError,
454
- TData
455
- > & { queryKey: QueryKey } => {
456
- const { query: queryOptions, request: requestOptions } = options ?? {};
457
-
458
- const queryKey =
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;
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
- options?: SecondParameter<typeof customInstance>,
513
- signal?: AbortSignal
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
- return customInstance<OrganisationGetDefaultResponse>(
516
- { url: `/organisation/default`, method: "get", signal },
517
- options
518
- );
519
- };
520
-
521
- export const getGetDefaultOrganisationQueryKey = () =>
522
- ["account-server-api", `/organisation/default`] as const;
523
-
524
- export const getGetDefaultOrganisationQueryOptions = <
525
- TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,
526
- TError = ErrorType<void | AsError>
527
- >(options?: {
528
- query?: UseQueryOptions<
529
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
530
- TError,
531
- TData
532
- >;
533
- request?: SecondParameter<typeof customInstance>;
534
- }): UseQueryOptions<
535
- Awaited<ReturnType<typeof getDefaultOrganisation>>,
536
- TError,
537
- TData
538
- > & { queryKey: QueryKey } => {
539
- const { query: queryOptions, request: requestOptions } = options ?? {};
540
-
541
- const queryKey =
542
- queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
543
-
544
- const queryFn: QueryFunction<
545
- Awaited<ReturnType<typeof getDefaultOrganisation>>
546
- > = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
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
+