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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/admin/admin.cjs +30 -8
  3. package/admin/admin.cjs.map +1 -1
  4. package/admin/admin.d.cts +50 -0
  5. package/admin/admin.d.ts +26 -6
  6. package/admin/admin.js +30 -8
  7. package/admin/admin.js.map +1 -1
  8. package/asset/asset.cjs +62 -22
  9. package/asset/asset.cjs.map +1 -1
  10. package/asset/asset.d.cts +260 -0
  11. package/asset/asset.d.ts +79 -36
  12. package/asset/asset.js +54 -14
  13. package/asset/asset.js.map +1 -1
  14. package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
  15. package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
  16. package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
  17. package/chunk-TKLTUR4R.cjs.map +1 -0
  18. package/event-stream/event-stream.cjs +64 -19
  19. package/event-stream/event-stream.cjs.map +1 -1
  20. package/event-stream/event-stream.d.cts +142 -0
  21. package/event-stream/event-stream.d.ts +66 -20
  22. package/event-stream/event-stream.js +61 -16
  23. package/event-stream/event-stream.js.map +1 -1
  24. package/index.cjs +10 -10
  25. package/index.cjs.map +1 -1
  26. package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
  27. package/index.d.ts +700 -2
  28. package/index.js +9 -9
  29. package/index.js.map +1 -1
  30. package/merchant/merchant.cjs +53 -14
  31. package/merchant/merchant.cjs.map +1 -1
  32. package/merchant/merchant.d.cts +91 -0
  33. package/merchant/merchant.d.ts +48 -8
  34. package/merchant/merchant.js +52 -13
  35. package/merchant/merchant.js.map +1 -1
  36. package/organisation/organisation.cjs +110 -28
  37. package/organisation/organisation.cjs.map +1 -1
  38. package/organisation/organisation.d.cts +271 -0
  39. package/organisation/organisation.d.ts +114 -25
  40. package/organisation/organisation.js +103 -21
  41. package/organisation/organisation.js.map +1 -1
  42. package/package.json +12 -12
  43. package/product/product.cjs +182 -47
  44. package/product/product.cjs.map +1 -1
  45. package/product/product.d.cts +399 -0
  46. package/product/product.d.ts +180 -31
  47. package/product/product.js +172 -37
  48. package/product/product.js.map +1 -1
  49. package/src/account-server-api.schemas.ts +272 -280
  50. package/src/admin/admin.ts +114 -84
  51. package/src/asset/asset.ts +480 -565
  52. package/src/custom-instance.ts +3 -4
  53. package/src/event-stream/event-stream.ts +300 -275
  54. package/src/merchant/merchant.ts +206 -142
  55. package/src/organisation/organisation.ts +549 -490
  56. package/src/product/product.ts +829 -688
  57. package/src/state/state.ts +112 -75
  58. package/src/unit/unit.ts +645 -599
  59. package/src/user/user.ts +489 -469
  60. package/state/state.cjs +29 -8
  61. package/state/state.cjs.map +1 -1
  62. package/state/state.d.cts +46 -0
  63. package/state/state.d.ts +26 -6
  64. package/state/state.js +29 -8
  65. package/state/state.js.map +1 -1
  66. package/unit/unit.cjs +120 -32
  67. package/unit/unit.cjs.map +1 -1
  68. package/unit/unit.d.cts +322 -0
  69. package/unit/unit.d.ts +133 -38
  70. package/unit/unit.js +112 -24
  71. package/unit/unit.js.map +1 -1
  72. package/user/user.cjs +96 -22
  73. package/user/user.cjs.map +1 -1
  74. package/user/user.d.cts +271 -0
  75. package/user/user.d.ts +96 -24
  76. package/user/user.js +90 -16
  77. package/user/user.js.map +1 -1
  78. package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/unit/unit.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
2
+ * Generated by orval v6.25.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,38 +8,40 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 2.1
10
10
  */
11
- import { useQuery, useMutation } from "@tanstack/react-query";
11
+ import {
12
+ useMutation,
13
+ useQuery,
14
+ useSuspenseQuery
15
+ } from '@tanstack/react-query'
12
16
  import type {
13
- UseQueryOptions,
14
- UseMutationOptions,
15
- QueryFunction,
16
17
  MutationFunction,
17
- UseQueryResult,
18
+ QueryFunction,
18
19
  QueryKey,
19
- } from "@tanstack/react-query";
20
+ UseMutationOptions,
21
+ UseQueryOptions,
22
+ UseQueryResult,
23
+ UseSuspenseQueryOptions,
24
+ UseSuspenseQueryResult
25
+ } from '@tanstack/react-query'
20
26
  import type {
21
- OrganisationUnitsGetResponse,
22
27
  AsError,
23
- OrganisationUnitPostResponse,
28
+ GetUnitChargesParams,
24
29
  OrganisationUnitPostBodyBody,
25
- UnitGetResponse,
26
- UnitPatchBodyBody,
27
- UnitsGetResponse,
28
- PersonalUnitPutResponse,
30
+ OrganisationUnitPostResponse,
31
+ OrganisationUnitsGetResponse,
29
32
  PersonalUnitPutBodyBody,
33
+ PersonalUnitPutResponse,
30
34
  UnitChargesGetResponse,
31
- GetUnitChargesParams,
32
- } from "../account-server-api.schemas";
33
- import { customInstance } from ".././custom-instance";
34
- import type { ErrorType } from ".././custom-instance";
35
-
36
- // eslint-disable-next-line
37
- type SecondParameter<T extends (...args: any) => any> = T extends (
38
- config: any,
39
- args: infer P
40
- ) => any
41
- ? P
42
- : never;
35
+ UnitDetail,
36
+ UnitPatchBodyBody,
37
+ UnitsGetResponse
38
+ } from '../account-server-api.schemas'
39
+ import { customInstance } from '.././custom-instance';
40
+ import type { ErrorType } from '.././custom-instance';
41
+
42
+
43
+ type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
44
+
43
45
 
44
46
  /**
45
47
  * Gets Organisational Units you have access to or that are public
@@ -47,78 +49,102 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
47
49
  * @summary Gets Organisational Units
48
50
  */
49
51
  export const getOrganisationUnits = (
50
- orgId: string,
51
- options?: SecondParameter<typeof customInstance>,
52
- signal?: AbortSignal
52
+ orgId: string,
53
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
53
54
  ) => {
54
- return customInstance<OrganisationUnitsGetResponse>(
55
- { url: `/organisation/${orgId}/unit`, method: "get", signal },
56
- options
57
- );
58
- };
59
-
60
- export const getGetOrganisationUnitsQueryKey = (orgId: string) =>
61
- ["account-server-api", `/organisation/${orgId}/unit`] as const;
62
-
63
- export const getGetOrganisationUnitsQueryOptions = <
64
- TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
65
- TError = ErrorType<void | AsError>
66
- >(
67
- orgId: string,
68
- options?: {
69
- query?: UseQueryOptions<
70
- Awaited<ReturnType<typeof getOrganisationUnits>>,
71
- TError,
72
- TData
73
- >;
74
- request?: SecondParameter<typeof customInstance>;
75
- }
76
- ): UseQueryOptions<
77
- Awaited<ReturnType<typeof getOrganisationUnits>>,
78
- TError,
79
- TData
80
- > & { queryKey: QueryKey } => {
81
- const { query: queryOptions, request: requestOptions } = options ?? {};
82
-
83
- const queryKey =
84
- queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
85
-
86
- const queryFn: QueryFunction<
87
- Awaited<ReturnType<typeof getOrganisationUnits>>
88
- > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
89
-
90
- return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
91
- };
92
-
93
- export type GetOrganisationUnitsQueryResult = NonNullable<
94
- Awaited<ReturnType<typeof getOrganisationUnits>>
95
- >;
96
- export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
97
-
98
- export const useGetOrganisationUnits = <
99
- TData = Awaited<ReturnType<typeof getOrganisationUnits>>,
100
- TError = ErrorType<void | AsError>
101
- >(
102
- orgId: string,
103
- options?: {
104
- query?: UseQueryOptions<
105
- Awaited<ReturnType<typeof getOrganisationUnits>>,
106
- TError,
107
- TData
108
- >;
109
- request?: SecondParameter<typeof customInstance>;
110
- }
111
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
112
- const queryOptions = getGetOrganisationUnitsQueryOptions(orgId, options);
113
-
114
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
115
- queryKey: QueryKey;
116
- };
117
-
118
- query.queryKey = queryOptions.queryKey;
55
+
56
+
57
+ return customInstance<OrganisationUnitsGetResponse>(
58
+ {url: `/organisation/${orgId}/unit`, method: 'GET', signal
59
+ },
60
+ options);
61
+ }
62
+
63
+
64
+ export const getGetOrganisationUnitsQueryKey = (orgId: string,) => {
65
+ return ["account-server-api", `/organisation/${orgId}/unit`] as const;
66
+ }
67
+
68
+
69
+ export const getGetOrganisationUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
70
+ ) => {
71
+
72
+ const {query: queryOptions, request: requestOptions} = options ?? {};
73
+
74
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
75
+
76
+
77
+
78
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
79
+
80
+
81
+
82
+
83
+
84
+ return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: QueryKey }
85
+ }
86
+
87
+ export type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
88
+ export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>
89
+
90
+ /**
91
+ * @summary Gets Organisational Units
92
+ */
93
+ export const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
94
+ orgId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
95
+
96
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
97
+
98
+ const queryOptions = getGetOrganisationUnitsQueryOptions(orgId,options)
99
+
100
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
101
+
102
+ query.queryKey = queryOptions.queryKey ;
119
103
 
120
104
  return query;
121
- };
105
+ }
106
+
107
+
108
+
109
+ export const getGetOrganisationUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
110
+ ) => {
111
+
112
+ const {query: queryOptions, request: requestOptions} = options ?? {};
113
+
114
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
115
+
116
+
117
+
118
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
119
+
120
+
121
+
122
+
123
+
124
+ return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: QueryKey }
125
+ }
126
+
127
+ export type GetOrganisationUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
128
+ export type GetOrganisationUnitsSuspenseQueryError = ErrorType<void | AsError>
129
+
130
+ /**
131
+ * @summary Gets Organisational Units
132
+ */
133
+ export const useGetOrganisationUnitsSuspense = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
134
+ orgId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
135
+
136
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
137
+
138
+ const queryOptions = getGetOrganisationUnitsSuspenseQueryOptions(orgId,options)
139
+
140
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
141
+
142
+ query.queryKey = queryOptions.queryKey ;
143
+
144
+ return query;
145
+ }
146
+
147
+
122
148
 
123
149
  /**
124
150
  * Creates a new Organisation Unit. You need to be a member of the **Organisation** or have administration rights to use this endpoint
@@ -126,141 +152,157 @@ export const useGetOrganisationUnits = <
126
152
  * @summary Create a new Organisational Unit
127
153
  */
128
154
  export const createOrganisationUnit = (
129
- orgId: string,
130
- organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
131
- options?: SecondParameter<typeof customInstance>
132
- ) => {
133
- return customInstance<OrganisationUnitPostResponse>(
134
- {
135
- url: `/organisation/${orgId}/unit`,
136
- method: "post",
137
- headers: { "Content-Type": "application/json" },
138
- data: organisationUnitPostBodyBody,
155
+ orgId: string,
156
+ organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
157
+ options?: SecondParameter<typeof customInstance>,) => {
158
+
159
+
160
+ return customInstance<OrganisationUnitPostResponse>(
161
+ {url: `/organisation/${orgId}/unit`, method: 'POST',
162
+ headers: {'Content-Type': 'application/json', },
163
+ data: organisationUnitPostBodyBody
139
164
  },
140
- options
141
- );
142
- };
143
-
144
- export const getCreateOrganisationUnitMutationOptions = <
145
- TError = ErrorType<AsError | void>,
146
- TContext = unknown
147
- >(options?: {
148
- mutation?: UseMutationOptions<
149
- Awaited<ReturnType<typeof createOrganisationUnit>>,
150
- TError,
151
- { orgId: string; data: OrganisationUnitPostBodyBody },
152
- TContext
153
- >;
154
- request?: SecondParameter<typeof customInstance>;
155
- }): UseMutationOptions<
156
- Awaited<ReturnType<typeof createOrganisationUnit>>,
157
- TError,
158
- { orgId: string; data: OrganisationUnitPostBodyBody },
159
- TContext
160
- > => {
161
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
162
-
163
- const mutationFn: MutationFunction<
164
- Awaited<ReturnType<typeof createOrganisationUnit>>,
165
- { orgId: string; data: OrganisationUnitPostBodyBody }
166
- > = (props) => {
167
- const { orgId, data } = props ?? {};
168
-
169
- return createOrganisationUnit(orgId, data, requestOptions);
170
- };
171
-
172
- return { mutationFn, ...mutationOptions };
173
- };
174
-
175
- export type CreateOrganisationUnitMutationResult = NonNullable<
176
- Awaited<ReturnType<typeof createOrganisationUnit>>
177
- >;
178
- export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
179
- export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
180
-
181
- export const useCreateOrganisationUnit = <
182
- TError = ErrorType<AsError | void>,
183
- TContext = unknown
184
- >(options?: {
185
- mutation?: UseMutationOptions<
186
- Awaited<ReturnType<typeof createOrganisationUnit>>,
187
- TError,
188
- { orgId: string; data: OrganisationUnitPostBodyBody },
189
- TContext
190
- >;
191
- request?: SecondParameter<typeof customInstance>;
192
- }) => {
193
- const mutationOptions = getCreateOrganisationUnitMutationOptions(options);
194
-
195
- return useMutation(mutationOptions);
196
- };
197
- /**
165
+ options);
166
+ }
167
+
168
+
169
+
170
+ export const getCreateOrganisationUnitMutationOptions = <TError = ErrorType<AsError | void>,
171
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
172
+ ): UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext> => {
173
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
174
+
175
+
176
+
177
+
178
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisationUnit>>, {orgId: string;data: OrganisationUnitPostBodyBody}> = (props) => {
179
+ const {orgId,data} = props ?? {};
180
+
181
+ return createOrganisationUnit(orgId,data,requestOptions)
182
+ }
183
+
184
+
185
+
186
+
187
+ return { mutationFn, ...mutationOptions }}
188
+
189
+ export type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>
190
+ export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody
191
+ export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>
192
+
193
+ /**
194
+ * @summary Create a new Organisational Unit
195
+ */
196
+ export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>,
197
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
198
+ ) => {
199
+
200
+ const mutationOptions = getCreateOrganisationUnitMutationOptions(options);
201
+
202
+ return useMutation(mutationOptions);
203
+ }
204
+ /**
198
205
  * Gets a Unit, assuming it is public, you are a member of it or its **Organisation**. Admin users have access to all Units
199
206
 
200
207
  * @summary Gets an Organisational Unit
201
208
  */
202
209
  export const getUnit = (
203
- unitId: string,
204
- options?: SecondParameter<typeof customInstance>,
205
- signal?: AbortSignal
210
+ unitId: string,
211
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
206
212
  ) => {
207
- return customInstance<UnitGetResponse>(
208
- { url: `/unit/${unitId}`, method: "get", signal },
209
- options
210
- );
211
- };
212
-
213
- export const getGetUnitQueryKey = (unitId: string) =>
214
- ["account-server-api", `/unit/${unitId}`] as const;
215
-
216
- export const getGetUnitQueryOptions = <
217
- TData = Awaited<ReturnType<typeof getUnit>>,
218
- TError = ErrorType<void | AsError>
219
- >(
220
- unitId: string,
221
- options?: {
222
- query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;
223
- request?: SecondParameter<typeof customInstance>;
224
- }
225
- ): UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & {
226
- queryKey: QueryKey;
227
- } => {
228
- const { query: queryOptions, request: requestOptions } = options ?? {};
229
-
230
- const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
231
-
232
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({
233
- signal,
234
- }) => getUnit(unitId, requestOptions, signal);
235
-
236
- return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
237
- };
238
-
239
- export type GetUnitQueryResult = NonNullable<
240
- Awaited<ReturnType<typeof getUnit>>
241
- >;
242
- export type GetUnitQueryError = ErrorType<void | AsError>;
243
-
244
- export const useGetUnit = <
245
- TData = Awaited<ReturnType<typeof getUnit>>,
246
- TError = ErrorType<void | AsError>
247
- >(
248
- unitId: string,
249
- options?: {
250
- query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;
251
- request?: SecondParameter<typeof customInstance>;
252
- }
253
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
254
- const queryOptions = getGetUnitQueryOptions(unitId, options);
255
-
256
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
257
- queryKey: QueryKey;
258
- };
259
-
260
- query.queryKey = queryOptions.queryKey;
213
+
214
+
215
+ return customInstance<UnitDetail>(
216
+ {url: `/unit/${unitId}`, method: 'GET', signal
217
+ },
218
+ options);
219
+ }
220
+
221
+
222
+ export const getGetUnitQueryKey = (unitId: string,) => {
223
+ return ["account-server-api", `/unit/${unitId}`] as const;
224
+ }
225
+
226
+
227
+ export const getGetUnitQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
228
+ ) => {
229
+
230
+ const {query: queryOptions, request: requestOptions} = options ?? {};
231
+
232
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
233
+
234
+
235
+
236
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
237
+
238
+
239
+
240
+
241
+
242
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: QueryKey }
243
+ }
244
+
245
+ export type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
246
+ export type GetUnitQueryError = ErrorType<void | AsError>
247
+
248
+ /**
249
+ * @summary Gets an Organisational Unit
250
+ */
251
+ export const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
252
+ unitId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
253
+
254
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
255
+
256
+ const queryOptions = getGetUnitQueryOptions(unitId,options)
257
+
258
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
259
+
260
+ query.queryKey = queryOptions.queryKey ;
261
261
 
262
262
  return query;
263
- };
263
+ }
264
+
265
+
266
+
267
+ export const getGetUnitSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
268
+ ) => {
269
+
270
+ const {query: queryOptions, request: requestOptions} = options ?? {};
271
+
272
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
273
+
274
+
275
+
276
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
277
+
278
+
279
+
280
+
281
+
282
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: QueryKey }
283
+ }
284
+
285
+ export type GetUnitSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
286
+ export type GetUnitSuspenseQueryError = ErrorType<void | AsError>
287
+
288
+ /**
289
+ * @summary Gets an Organisational Unit
290
+ */
291
+ export const useGetUnitSuspense = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
292
+ unitId: string, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
293
+
294
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
295
+
296
+ const queryOptions = getGetUnitSuspenseQueryOptions(unitId,options)
297
+
298
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
299
+
300
+ query.queryKey = queryOptions.queryKey ;
301
+
302
+ return query;
303
+ }
304
+
305
+
264
306
 
265
307
  /**
266
308
  * Used to update existing Unit.
@@ -270,75 +312,56 @@ You have to be the Unit owner, a member of its **Organisation** or an administra
270
312
  * @summary Adjust an existing Unit
271
313
  */
272
314
  export const patchUnit = (
273
- unitId: string,
274
- unitPatchBodyBody: UnitPatchBodyBody,
275
- options?: SecondParameter<typeof customInstance>
276
- ) => {
277
- return customInstance<void>(
278
- {
279
- url: `/unit/${unitId}`,
280
- method: "patch",
281
- headers: { "Content-Type": "application/json" },
282
- data: unitPatchBodyBody,
315
+ unitId: string,
316
+ unitPatchBodyBody: UnitPatchBodyBody,
317
+ options?: SecondParameter<typeof customInstance>,) => {
318
+
319
+
320
+ return customInstance<void>(
321
+ {url: `/unit/${unitId}`, method: 'PATCH',
322
+ headers: {'Content-Type': 'application/json', },
323
+ data: unitPatchBodyBody
283
324
  },
284
- options
285
- );
286
- };
287
-
288
- export const getPatchUnitMutationOptions = <
289
- TError = ErrorType<AsError>,
290
- TContext = unknown
291
- >(options?: {
292
- mutation?: UseMutationOptions<
293
- Awaited<ReturnType<typeof patchUnit>>,
294
- TError,
295
- { unitId: string; data: UnitPatchBodyBody },
296
- TContext
297
- >;
298
- request?: SecondParameter<typeof customInstance>;
299
- }): UseMutationOptions<
300
- Awaited<ReturnType<typeof patchUnit>>,
301
- TError,
302
- { unitId: string; data: UnitPatchBodyBody },
303
- TContext
304
- > => {
305
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
306
-
307
- const mutationFn: MutationFunction<
308
- Awaited<ReturnType<typeof patchUnit>>,
309
- { unitId: string; data: UnitPatchBodyBody }
310
- > = (props) => {
311
- const { unitId, data } = props ?? {};
312
-
313
- return patchUnit(unitId, data, requestOptions);
314
- };
315
-
316
- return { mutationFn, ...mutationOptions };
317
- };
318
-
319
- export type PatchUnitMutationResult = NonNullable<
320
- Awaited<ReturnType<typeof patchUnit>>
321
- >;
322
- export type PatchUnitMutationBody = UnitPatchBodyBody;
323
- export type PatchUnitMutationError = ErrorType<AsError>;
324
-
325
- export const usePatchUnit = <
326
- TError = ErrorType<AsError>,
327
- TContext = unknown
328
- >(options?: {
329
- mutation?: UseMutationOptions<
330
- Awaited<ReturnType<typeof patchUnit>>,
331
- TError,
332
- { unitId: string; data: UnitPatchBodyBody },
333
- TContext
334
- >;
335
- request?: SecondParameter<typeof customInstance>;
336
- }) => {
337
- const mutationOptions = getPatchUnitMutationOptions(options);
338
-
339
- return useMutation(mutationOptions);
340
- };
341
- /**
325
+ options);
326
+ }
327
+
328
+
329
+
330
+ export const getPatchUnitMutationOptions = <TError = ErrorType<AsError>,
331
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
332
+ ): UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext> => {
333
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
334
+
335
+
336
+
337
+
338
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchUnit>>, {unitId: string;data: UnitPatchBodyBody}> = (props) => {
339
+ const {unitId,data} = props ?? {};
340
+
341
+ return patchUnit(unitId,data,requestOptions)
342
+ }
343
+
344
+
345
+
346
+
347
+ return { mutationFn, ...mutationOptions }}
348
+
349
+ export type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>
350
+ export type PatchUnitMutationBody = UnitPatchBodyBody
351
+ export type PatchUnitMutationError = ErrorType<AsError>
352
+
353
+ /**
354
+ * @summary Adjust an existing Unit
355
+ */
356
+ export const usePatchUnit = <TError = ErrorType<AsError>,
357
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
358
+ ) => {
359
+
360
+ const mutationOptions = getPatchUnitMutationOptions(options);
361
+
362
+ return useMutation(mutationOptions);
363
+ }
364
+ /**
342
365
  * Deletes an Organisational Unit you have access to. Units can only be deleted by members of the Unit, its Organisation users or admin users.
343
366
 
344
367
  You cannot delete Units in the **Default Organisation**. These Units are **Personal Units** and need to be deleted using the `DELETE /unit` endpoint.
@@ -348,127 +371,154 @@ You cannot delete a Unit that contains undeleted **Products**
348
371
  * @summary Deletes an Organisational Unit
349
372
  */
350
373
  export const deleteOrganisationUnit = (
351
- unitId: string,
352
- options?: SecondParameter<typeof customInstance>
374
+ unitId: string,
375
+ options?: SecondParameter<typeof customInstance>,) => {
376
+
377
+
378
+ return customInstance<void>(
379
+ {url: `/unit/${unitId}`, method: 'DELETE'
380
+ },
381
+ options);
382
+ }
383
+
384
+
385
+
386
+ export const getDeleteOrganisationUnitMutationOptions = <TError = ErrorType<AsError>,
387
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
388
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext> => {
389
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
390
+
391
+
392
+
393
+
394
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnit>>, {unitId: string}> = (props) => {
395
+ const {unitId} = props ?? {};
396
+
397
+ return deleteOrganisationUnit(unitId,requestOptions)
398
+ }
399
+
400
+
401
+
402
+
403
+ return { mutationFn, ...mutationOptions }}
404
+
405
+ export type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>
406
+
407
+ export type DeleteOrganisationUnitMutationError = ErrorType<AsError>
408
+
409
+ /**
410
+ * @summary Deletes an Organisational Unit
411
+ */
412
+ export const useDeleteOrganisationUnit = <TError = ErrorType<AsError>,
413
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
353
414
  ) => {
354
- return customInstance<void>(
355
- { url: `/unit/${unitId}`, method: "delete" },
356
- options
357
- );
358
- };
359
-
360
- export const getDeleteOrganisationUnitMutationOptions = <
361
- TError = ErrorType<AsError>,
362
- TContext = unknown
363
- >(options?: {
364
- mutation?: UseMutationOptions<
365
- Awaited<ReturnType<typeof deleteOrganisationUnit>>,
366
- TError,
367
- { unitId: string },
368
- TContext
369
- >;
370
- request?: SecondParameter<typeof customInstance>;
371
- }): UseMutationOptions<
372
- Awaited<ReturnType<typeof deleteOrganisationUnit>>,
373
- TError,
374
- { unitId: string },
375
- TContext
376
- > => {
377
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
378
-
379
- const mutationFn: MutationFunction<
380
- Awaited<ReturnType<typeof deleteOrganisationUnit>>,
381
- { unitId: string }
382
- > = (props) => {
383
- const { unitId } = props ?? {};
384
-
385
- return deleteOrganisationUnit(unitId, requestOptions);
386
- };
387
-
388
- return { mutationFn, ...mutationOptions };
389
- };
390
-
391
- export type DeleteOrganisationUnitMutationResult = NonNullable<
392
- Awaited<ReturnType<typeof deleteOrganisationUnit>>
393
- >;
394
-
395
- export type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
396
-
397
- export const useDeleteOrganisationUnit = <
398
- TError = ErrorType<AsError>,
399
- TContext = unknown
400
- >(options?: {
401
- mutation?: UseMutationOptions<
402
- Awaited<ReturnType<typeof deleteOrganisationUnit>>,
403
- TError,
404
- { unitId: string },
405
- TContext
406
- >;
407
- request?: SecondParameter<typeof customInstance>;
408
- }) => {
409
- const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);
410
-
411
- return useMutation(mutationOptions);
412
- };
413
- /**
415
+
416
+ const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);
417
+
418
+ return useMutation(mutationOptions);
419
+ }
420
+ /**
414
421
  * Gets all the Units that are public or you are a member of. Admin users can see all Units.
415
422
 
416
423
  * @summary Gets Units
417
424
  */
418
425
  export const getUnits = (
419
- options?: SecondParameter<typeof customInstance>,
420
- signal?: AbortSignal
426
+
427
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
421
428
  ) => {
422
- return customInstance<UnitsGetResponse>(
423
- { url: `/unit`, method: "get", signal },
424
- options
425
- );
426
- };
427
-
428
- export const getGetUnitsQueryKey = () => ["account-server-api", `/unit`] as const;
429
-
430
- export const getGetUnitsQueryOptions = <
431
- TData = Awaited<ReturnType<typeof getUnits>>,
432
- TError = ErrorType<void | AsError>
433
- >(options?: {
434
- query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;
435
- request?: SecondParameter<typeof customInstance>;
436
- }): UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & {
437
- queryKey: QueryKey;
438
- } => {
439
- const { query: queryOptions, request: requestOptions } = options ?? {};
440
-
441
- const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
442
-
443
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({
444
- signal,
445
- }) => getUnits(requestOptions, signal);
446
-
447
- return { queryKey, queryFn, ...queryOptions };
448
- };
449
-
450
- export type GetUnitsQueryResult = NonNullable<
451
- Awaited<ReturnType<typeof getUnits>>
452
- >;
453
- export type GetUnitsQueryError = ErrorType<void | AsError>;
454
-
455
- export const useGetUnits = <
456
- TData = Awaited<ReturnType<typeof getUnits>>,
457
- TError = ErrorType<void | AsError>
458
- >(options?: {
459
- query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;
460
- request?: SecondParameter<typeof customInstance>;
461
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
462
- const queryOptions = getGetUnitsQueryOptions(options);
463
-
464
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
465
- queryKey: QueryKey;
466
- };
467
-
468
- query.queryKey = queryOptions.queryKey;
429
+
430
+
431
+ return customInstance<UnitsGetResponse>(
432
+ {url: `/unit`, method: 'GET', signal
433
+ },
434
+ options);
435
+ }
436
+
437
+
438
+ export const getGetUnitsQueryKey = () => {
439
+ return ["account-server-api", `/unit`] as const;
440
+ }
441
+
442
+
443
+ export const getGetUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
444
+ ) => {
445
+
446
+ const {query: queryOptions, request: requestOptions} = options ?? {};
447
+
448
+ const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
449
+
450
+
451
+
452
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);
453
+
454
+
455
+
456
+
457
+
458
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: QueryKey }
459
+ }
460
+
461
+ export type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
462
+ export type GetUnitsQueryError = ErrorType<void | AsError>
463
+
464
+ /**
465
+ * @summary Gets Units
466
+ */
467
+ export const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
468
+ options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
469
+
470
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
471
+
472
+ const queryOptions = getGetUnitsQueryOptions(options)
473
+
474
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
475
+
476
+ query.queryKey = queryOptions.queryKey ;
469
477
 
470
478
  return query;
471
- };
479
+ }
480
+
481
+
482
+
483
+ export const getGetUnitsSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
484
+ ) => {
485
+
486
+ const {query: queryOptions, request: requestOptions} = options ?? {};
487
+
488
+ const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
489
+
490
+
491
+
492
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);
493
+
494
+
495
+
496
+
497
+
498
+ return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: QueryKey }
499
+ }
500
+
501
+ export type GetUnitsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
502
+ export type GetUnitsSuspenseQueryError = ErrorType<void | AsError>
503
+
504
+ /**
505
+ * @summary Gets Units
506
+ */
507
+ export const useGetUnitsSuspense = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
508
+ options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
509
+
510
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
511
+
512
+ const queryOptions = getGetUnitsSuspenseQueryOptions(options)
513
+
514
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
515
+
516
+ query.queryKey = queryOptions.queryKey ;
517
+
518
+ return query;
519
+ }
520
+
521
+
472
522
 
473
523
  /**
474
524
  * Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
@@ -478,138 +528,107 @@ Users can only create one Personal unit and you cannot add other Users to a Pers
478
528
  * @summary Create a new Personal Unit
479
529
  */
480
530
  export const createDefaultUnit = (
481
- personalUnitPutBodyBody: PersonalUnitPutBodyBody,
482
- options?: SecondParameter<typeof customInstance>
483
- ) => {
484
- return customInstance<PersonalUnitPutResponse>(
485
- {
486
- url: `/unit`,
487
- method: "put",
488
- headers: { "Content-Type": "application/json" },
489
- data: personalUnitPutBodyBody,
531
+ personalUnitPutBodyBody: PersonalUnitPutBodyBody,
532
+ options?: SecondParameter<typeof customInstance>,) => {
533
+
534
+
535
+ return customInstance<PersonalUnitPutResponse>(
536
+ {url: `/unit`, method: 'PUT',
537
+ headers: {'Content-Type': 'application/json', },
538
+ data: personalUnitPutBodyBody
490
539
  },
491
- options
492
- );
493
- };
494
-
495
- export const getCreateDefaultUnitMutationOptions = <
496
- TError = ErrorType<AsError | void>,
497
- TContext = unknown
498
- >(options?: {
499
- mutation?: UseMutationOptions<
500
- Awaited<ReturnType<typeof createDefaultUnit>>,
501
- TError,
502
- { data: PersonalUnitPutBodyBody },
503
- TContext
504
- >;
505
- request?: SecondParameter<typeof customInstance>;
506
- }): UseMutationOptions<
507
- Awaited<ReturnType<typeof createDefaultUnit>>,
508
- TError,
509
- { data: PersonalUnitPutBodyBody },
510
- TContext
511
- > => {
512
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
513
-
514
- const mutationFn: MutationFunction<
515
- Awaited<ReturnType<typeof createDefaultUnit>>,
516
- { data: PersonalUnitPutBodyBody }
517
- > = (props) => {
518
- const { data } = props ?? {};
519
-
520
- return createDefaultUnit(data, requestOptions);
521
- };
522
-
523
- return { mutationFn, ...mutationOptions };
524
- };
525
-
526
- export type CreateDefaultUnitMutationResult = NonNullable<
527
- Awaited<ReturnType<typeof createDefaultUnit>>
528
- >;
529
- export type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
530
- export type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
531
-
532
- export const useCreateDefaultUnit = <
533
- TError = ErrorType<AsError | void>,
534
- TContext = unknown
535
- >(options?: {
536
- mutation?: UseMutationOptions<
537
- Awaited<ReturnType<typeof createDefaultUnit>>,
538
- TError,
539
- { data: PersonalUnitPutBodyBody },
540
- TContext
541
- >;
542
- request?: SecondParameter<typeof customInstance>;
543
- }) => {
544
- const mutationOptions = getCreateDefaultUnitMutationOptions(options);
545
-
546
- return useMutation(mutationOptions);
547
- };
548
- /**
540
+ options);
541
+ }
542
+
543
+
544
+
545
+ export const getCreateDefaultUnitMutationOptions = <TError = ErrorType<AsError | void>,
546
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
547
+ ): UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext> => {
548
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
549
+
550
+
551
+
552
+
553
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDefaultUnit>>, {data: PersonalUnitPutBodyBody}> = (props) => {
554
+ const {data} = props ?? {};
555
+
556
+ return createDefaultUnit(data,requestOptions)
557
+ }
558
+
559
+
560
+
561
+
562
+ return { mutationFn, ...mutationOptions }}
563
+
564
+ export type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>
565
+ export type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody
566
+ export type CreateDefaultUnitMutationError = ErrorType<AsError | void>
567
+
568
+ /**
569
+ * @summary Create a new Personal Unit
570
+ */
571
+ export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>,
572
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
573
+ ) => {
574
+
575
+ const mutationOptions = getCreateDefaultUnitMutationOptions(options);
576
+
577
+ return useMutation(mutationOptions);
578
+ }
579
+ /**
549
580
  * Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
550
581
 
551
582
  * @summary Deletes a Personal Unit
552
583
  */
553
584
  export const deleteDefaultUnit = (
554
- options?: SecondParameter<typeof customInstance>
585
+
586
+ options?: SecondParameter<typeof customInstance>,) => {
587
+
588
+
589
+ return customInstance<void>(
590
+ {url: `/unit`, method: 'DELETE'
591
+ },
592
+ options);
593
+ }
594
+
595
+
596
+
597
+ export const getDeleteDefaultUnitMutationOptions = <TError = ErrorType<AsError>,
598
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
599
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext> => {
600
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
601
+
602
+
603
+
604
+
605
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, void> = () => {
606
+
607
+
608
+ return deleteDefaultUnit(requestOptions)
609
+ }
610
+
611
+
612
+
613
+
614
+ return { mutationFn, ...mutationOptions }}
615
+
616
+ export type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>
617
+
618
+ export type DeleteDefaultUnitMutationError = ErrorType<AsError>
619
+
620
+ /**
621
+ * @summary Deletes a Personal Unit
622
+ */
623
+ export const useDeleteDefaultUnit = <TError = ErrorType<AsError>,
624
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,void, TContext>, request?: SecondParameter<typeof customInstance>}
555
625
  ) => {
556
- return customInstance<void>({ url: `/unit`, method: "delete" }, options);
557
- };
558
-
559
- export const getDeleteDefaultUnitMutationOptions = <
560
- TError = ErrorType<AsError>,
561
- TVariables = void,
562
- TContext = unknown
563
- >(options?: {
564
- mutation?: UseMutationOptions<
565
- Awaited<ReturnType<typeof deleteDefaultUnit>>,
566
- TError,
567
- TVariables,
568
- TContext
569
- >;
570
- request?: SecondParameter<typeof customInstance>;
571
- }): UseMutationOptions<
572
- Awaited<ReturnType<typeof deleteDefaultUnit>>,
573
- TError,
574
- TVariables,
575
- TContext
576
- > => {
577
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
578
-
579
- const mutationFn: MutationFunction<
580
- Awaited<ReturnType<typeof deleteDefaultUnit>>,
581
- TVariables
582
- > = () => {
583
- return deleteDefaultUnit(requestOptions);
584
- };
585
-
586
- return { mutationFn, ...mutationOptions };
587
- };
588
-
589
- export type DeleteDefaultUnitMutationResult = NonNullable<
590
- Awaited<ReturnType<typeof deleteDefaultUnit>>
591
- >;
592
-
593
- export type DeleteDefaultUnitMutationError = ErrorType<AsError>;
594
-
595
- export const useDeleteDefaultUnit = <
596
- TError = ErrorType<AsError>,
597
- TVariables = void,
598
- TContext = unknown
599
- >(options?: {
600
- mutation?: UseMutationOptions<
601
- Awaited<ReturnType<typeof deleteDefaultUnit>>,
602
- TError,
603
- TVariables,
604
- TContext
605
- >;
606
- request?: SecondParameter<typeof customInstance>;
607
- }) => {
608
- const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
609
-
610
- return useMutation(mutationOptions);
611
- };
612
- /**
626
+
627
+ const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
628
+
629
+ return useMutation(mutationOptions);
630
+ }
631
+ /**
613
632
  * Get the charges made against a Unit with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
614
633
  Dates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.
615
634
 
@@ -619,80 +638,107 @@ You need to be part of the **Unit** or **Organisation** to use this method
619
638
  * @summary Get charges made against a Unit
620
639
  */
621
640
  export const getUnitCharges = (
622
- unitId: string,
623
- params?: GetUnitChargesParams,
624
- options?: SecondParameter<typeof customInstance>,
625
- signal?: AbortSignal
641
+ unitId: string,
642
+ params?: GetUnitChargesParams,
643
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
644
+ ) => {
645
+
646
+
647
+ return customInstance<UnitChargesGetResponse>(
648
+ {url: `/unit/${unitId}/charges`, method: 'GET',
649
+ params, signal
650
+ },
651
+ options);
652
+ }
653
+
654
+
655
+ export const getGetUnitChargesQueryKey = (unitId: string,
656
+ params?: GetUnitChargesParams,) => {
657
+ return ["account-server-api", `/unit/${unitId}/charges`, ...(params ? [params]: [])] as const;
658
+ }
659
+
660
+
661
+ export const getGetUnitChargesQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,
662
+ params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
626
663
  ) => {
627
- return customInstance<UnitChargesGetResponse>(
628
- { url: `/unit/${unitId}/charges`, method: "get", params, signal },
629
- options
630
- );
631
- };
632
-
633
- export const getGetUnitChargesQueryKey = (
634
- unitId: string,
635
- params?: GetUnitChargesParams
636
- ) => ["account-server-api", `/unit/${unitId}/charges`, ...(params ? [params] : [])] as const;
637
-
638
- export const getGetUnitChargesQueryOptions = <
639
- TData = Awaited<ReturnType<typeof getUnitCharges>>,
640
- TError = ErrorType<AsError | void>
641
- >(
642
- unitId: string,
643
- params?: GetUnitChargesParams,
644
- options?: {
645
- query?: UseQueryOptions<
646
- Awaited<ReturnType<typeof getUnitCharges>>,
647
- TError,
648
- TData
649
- >;
650
- request?: SecondParameter<typeof customInstance>;
651
- }
652
- ): UseQueryOptions<
653
- Awaited<ReturnType<typeof getUnitCharges>>,
654
- TError,
655
- TData
656
- > & { queryKey: QueryKey } => {
657
- const { query: queryOptions, request: requestOptions } = options ?? {};
658
-
659
- const queryKey =
660
- queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);
661
-
662
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({
663
- signal,
664
- }) => getUnitCharges(unitId, params, requestOptions, signal);
665
-
666
- return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
667
- };
668
-
669
- export type GetUnitChargesQueryResult = NonNullable<
670
- Awaited<ReturnType<typeof getUnitCharges>>
671
- >;
672
- export type GetUnitChargesQueryError = ErrorType<AsError | void>;
673
-
674
- export const useGetUnitCharges = <
675
- TData = Awaited<ReturnType<typeof getUnitCharges>>,
676
- TError = ErrorType<AsError | void>
677
- >(
678
- unitId: string,
679
- params?: GetUnitChargesParams,
680
- options?: {
681
- query?: UseQueryOptions<
682
- Awaited<ReturnType<typeof getUnitCharges>>,
683
- TError,
684
- TData
685
- >;
686
- request?: SecondParameter<typeof customInstance>;
687
- }
688
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
689
- const queryOptions = getGetUnitChargesQueryOptions(unitId, params, options);
690
-
691
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
692
- queryKey: QueryKey;
693
- };
694
-
695
- query.queryKey = queryOptions.queryKey;
664
+
665
+ const {query: queryOptions, request: requestOptions} = options ?? {};
666
+
667
+ const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);
668
+
669
+
670
+
671
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);
672
+
673
+
674
+
675
+
676
+
677
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: QueryKey }
678
+ }
679
+
680
+ export type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>
681
+ export type GetUnitChargesQueryError = ErrorType<AsError | void>
682
+
683
+ /**
684
+ * @summary Get charges made against a Unit
685
+ */
686
+ export const useGetUnitCharges = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(
687
+ unitId: string,
688
+ params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
689
+
690
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
691
+
692
+ const queryOptions = getGetUnitChargesQueryOptions(unitId,params,options)
693
+
694
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
695
+
696
+ query.queryKey = queryOptions.queryKey ;
696
697
 
697
698
  return query;
698
- };
699
+ }
700
+
701
+
702
+
703
+ export const getGetUnitChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,
704
+ params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
705
+ ) => {
706
+
707
+ const {query: queryOptions, request: requestOptions} = options ?? {};
708
+
709
+ const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);
710
+
711
+
712
+
713
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);
714
+
715
+
716
+
717
+
718
+
719
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: QueryKey }
720
+ }
721
+
722
+ export type GetUnitChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>
723
+ export type GetUnitChargesSuspenseQueryError = ErrorType<AsError | void>
724
+
725
+ /**
726
+ * @summary Get charges made against a Unit
727
+ */
728
+ export const useGetUnitChargesSuspense = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(
729
+ unitId: string,
730
+ params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
731
+
732
+ ): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
733
+
734
+ const queryOptions = getGetUnitChargesSuspenseQueryOptions(unitId,params,options)
735
+
736
+ const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
737
+
738
+ query.queryKey = queryOptions.queryKey ;
739
+
740
+ return query;
741
+ }
742
+
743
+
744
+