@squonk/account-server-client 2.1.0-rc.2 → 2.1.0-rc.4

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 (77) 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 +243 -0
  10. package/asset/asset.d.ts +49 -23
  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-35e5d4fd.d.ts → custom-instance-37bb38c1.d.ts} +159 -159
  18. package/event-stream/event-stream.cjs +34 -18
  19. package/event-stream/event-stream.cjs.map +1 -1
  20. package/event-stream/event-stream.d.cts +108 -0
  21. package/event-stream/event-stream.d.ts +16 -4
  22. package/event-stream/event-stream.js +31 -15
  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/index.d.cts +2 -0
  27. package/index.d.ts +1 -1
  28. package/index.js +9 -9
  29. package/index.js.map +1 -1
  30. package/merchant/merchant.cjs +23 -13
  31. package/merchant/merchant.cjs.map +1 -1
  32. package/merchant/merchant.d.cts +57 -0
  33. package/merchant/merchant.d.ts +7 -1
  34. package/merchant/merchant.js +22 -12
  35. package/merchant/merchant.js.map +1 -1
  36. package/organisation/organisation.cjs +50 -25
  37. package/organisation/organisation.cjs.map +1 -1
  38. package/organisation/organisation.d.cts +203 -0
  39. package/organisation/organisation.d.ts +31 -10
  40. package/organisation/organisation.js +44 -19
  41. package/organisation/organisation.js.map +1 -1
  42. package/package.json +12 -12
  43. package/product/product.cjs +80 -44
  44. package/product/product.cjs.map +1 -1
  45. package/product/product.d.cts +280 -0
  46. package/product/product.d.ts +40 -10
  47. package/product/product.js +71 -35
  48. package/product/product.js.map +1 -1
  49. package/src/account-server-api.schemas.ts +268 -276
  50. package/src/admin/admin.ts +72 -78
  51. package/src/asset/asset.ts +453 -560
  52. package/src/event-stream/event-stream.ts +222 -268
  53. package/src/merchant/merchant.ts +125 -136
  54. package/src/organisation/organisation.ts +394 -484
  55. package/src/product/product.ts +557 -682
  56. package/src/state/state.ts +70 -69
  57. package/src/unit/unit.ts +494 -593
  58. package/src/user/user.ts +377 -463
  59. package/state/state.cjs +13 -7
  60. package/state/state.cjs.map +1 -1
  61. package/state/state.d.cts +29 -0
  62. package/state/state.d.ts +4 -1
  63. package/state/state.js +13 -7
  64. package/state/state.js.map +1 -1
  65. package/unit/unit.cjs +59 -28
  66. package/unit/unit.cjs.map +1 -1
  67. package/unit/unit.d.cts +254 -0
  68. package/unit/unit.d.ts +43 -16
  69. package/unit/unit.js +52 -21
  70. package/unit/unit.js.map +1 -1
  71. package/user/user.cjs +52 -21
  72. package/user/user.cjs.map +1 -1
  73. package/user/user.d.cts +220 -0
  74. package/user/user.d.ts +31 -10
  75. package/user/user.js +46 -15
  76. package/user/user.js.map +1 -1
  77. 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.20.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,117 +8,107 @@ 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
+ } 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
- OrganisationUnitsGetResponse,
22
24
  AsError,
23
- OrganisationUnitPostResponse,
25
+ GetUnitChargesParams,
24
26
  OrganisationUnitPostBodyBody,
25
- UnitGetResponse,
26
- UnitPatchBodyBody,
27
- UnitsGetResponse,
28
- PersonalUnitPutResponse,
27
+ OrganisationUnitPostResponse,
28
+ OrganisationUnitsGetResponse,
29
29
  PersonalUnitPutBodyBody,
30
+ PersonalUnitPutResponse,
30
31
  UnitChargesGetResponse,
31
- GetUnitChargesParams,
32
- } from "../account-server-api.schemas";
33
- import { customInstance } from ".././custom-instance";
34
- import type { ErrorType } from ".././custom-instance";
32
+ UnitDetail,
33
+ UnitPatchBodyBody,
34
+ UnitsGetResponse
35
+ } from '../account-server-api.schemas'
36
+ import { customInstance } from '.././custom-instance';
37
+ import type { ErrorType } from '.././custom-instance';
38
+
35
39
 
36
40
  // eslint-disable-next-line
37
- type SecondParameter<T extends (...args: any) => any> = T extends (
41
+ type SecondParameter<T extends (...args: any) => any> = T extends (
38
42
  config: any,
39
- args: infer P
43
+ args: infer P,
40
44
  ) => any
41
45
  ? P
42
46
  : never;
43
47
 
48
+
44
49
  /**
45
50
  * Gets Organisational Units you have access to or that are public
46
51
 
47
52
  * @summary Gets Organisational Units
48
53
  */
49
54
  export const getOrganisationUnits = (
50
- orgId: string,
51
- options?: SecondParameter<typeof customInstance>,
52
- signal?: AbortSignal
55
+ orgId: string,
56
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
57
+ ) => {
58
+
59
+
60
+ return customInstance<OrganisationUnitsGetResponse>(
61
+ {url: `/organisation/${orgId}/unit`, method: 'get', signal
62
+ },
63
+ options);
64
+ }
65
+
66
+
67
+ export const getGetOrganisationUnitsQueryKey = (orgId: string,) => {
68
+
69
+ return ["account-server-api", `/organisation/${orgId}/unit`] as const;
70
+ }
71
+
72
+
73
+ export const getGetOrganisationUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
53
74
  ) => {
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;
75
+
76
+ const {query: queryOptions, request: requestOptions} = options ?? {};
77
+
78
+ const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);
79
+
80
+
81
+
82
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnits>>> = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
83
+
84
+
85
+
86
+
87
+
88
+ return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData> & { queryKey: QueryKey }
89
+ }
90
+
91
+ export type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>
92
+ export type GetOrganisationUnitsQueryError = ErrorType<void | AsError>
93
+
94
+ /**
95
+ * @summary Gets Organisational Units
96
+ */
97
+ export const useGetOrganisationUnits = <TData = Awaited<ReturnType<typeof getOrganisationUnits>>, TError = ErrorType<void | AsError>>(
98
+ orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
99
+
100
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
101
+
102
+ const queryOptions = getGetOrganisationUnitsQueryOptions(orgId,options)
103
+
104
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
105
+
106
+ query.queryKey = queryOptions.queryKey ;
119
107
 
120
108
  return query;
121
- };
109
+ }
110
+
111
+
122
112
 
123
113
  /**
124
114
  * Creates a new Organisation Unit. You need to be a member of the **Organisation** or have administration rights to use this endpoint
@@ -126,141 +116,120 @@ export const useGetOrganisationUnits = <
126
116
  * @summary Create a new Organisational Unit
127
117
  */
128
118
  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,
119
+ orgId: string,
120
+ organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,
121
+ options?: SecondParameter<typeof customInstance>,) => {
122
+
123
+
124
+ return customInstance<OrganisationUnitPostResponse>(
125
+ {url: `/organisation/${orgId}/unit`, method: 'post',
126
+ headers: {'Content-Type': 'application/json', },
127
+ data: organisationUnitPostBodyBody
139
128
  },
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
- /**
129
+ options);
130
+ }
131
+
132
+
133
+
134
+ export const getCreateOrganisationUnitMutationOptions = <TError = ErrorType<AsError | void>,
135
+
136
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
137
+ ): UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext> => {
138
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
139
+
140
+
141
+
142
+
143
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisationUnit>>, {orgId: string;data: OrganisationUnitPostBodyBody}> = (props) => {
144
+ const {orgId,data} = props ?? {};
145
+
146
+ return createOrganisationUnit(orgId,data,requestOptions)
147
+ }
148
+
149
+
150
+
151
+
152
+ return { mutationFn, ...mutationOptions }}
153
+
154
+ export type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>
155
+ export type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody
156
+ export type CreateOrganisationUnitMutationError = ErrorType<AsError | void>
157
+
158
+ /**
159
+ * @summary Create a new Organisational Unit
160
+ */
161
+ export const useCreateOrganisationUnit = <TError = ErrorType<AsError | void>,
162
+
163
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisationUnit>>, TError,{orgId: string;data: OrganisationUnitPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
164
+ ) => {
165
+
166
+ const mutationOptions = getCreateOrganisationUnitMutationOptions(options);
167
+
168
+ return useMutation(mutationOptions);
169
+ }
170
+ /**
198
171
  * Gets a Unit, assuming it is public, you are a member of it or its **Organisation**. Admin users have access to all Units
199
172
 
200
173
  * @summary Gets an Organisational Unit
201
174
  */
202
175
  export const getUnit = (
203
- unitId: string,
204
- options?: SecondParameter<typeof customInstance>,
205
- signal?: AbortSignal
176
+ unitId: string,
177
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
178
+ ) => {
179
+
180
+
181
+ return customInstance<UnitDetail>(
182
+ {url: `/unit/${unitId}`, method: 'get', signal
183
+ },
184
+ options);
185
+ }
186
+
187
+
188
+ export const getGetUnitQueryKey = (unitId: string,) => {
189
+
190
+ return ["account-server-api", `/unit/${unitId}`] as const;
191
+ }
192
+
193
+
194
+ export const getGetUnitQueryOptions = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
206
195
  ) => {
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;
196
+
197
+ const {query: queryOptions, request: requestOptions} = options ?? {};
198
+
199
+ const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);
200
+
201
+
202
+
203
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({ signal }) => getUnit(unitId, requestOptions, signal);
204
+
205
+
206
+
207
+
208
+
209
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & { queryKey: QueryKey }
210
+ }
211
+
212
+ export type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>
213
+ export type GetUnitQueryError = ErrorType<void | AsError>
214
+
215
+ /**
216
+ * @summary Gets an Organisational Unit
217
+ */
218
+ export const useGetUnit = <TData = Awaited<ReturnType<typeof getUnit>>, TError = ErrorType<void | AsError>>(
219
+ unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
220
+
221
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
222
+
223
+ const queryOptions = getGetUnitQueryOptions(unitId,options)
224
+
225
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
226
+
227
+ query.queryKey = queryOptions.queryKey ;
261
228
 
262
229
  return query;
263
- };
230
+ }
231
+
232
+
264
233
 
265
234
  /**
266
235
  * Used to update existing Unit.
@@ -270,75 +239,58 @@ You have to be the Unit owner, a member of its **Organisation** or an administra
270
239
  * @summary Adjust an existing Unit
271
240
  */
272
241
  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,
242
+ unitId: string,
243
+ unitPatchBodyBody: UnitPatchBodyBody,
244
+ options?: SecondParameter<typeof customInstance>,) => {
245
+
246
+
247
+ return customInstance<void>(
248
+ {url: `/unit/${unitId}`, method: 'patch',
249
+ headers: {'Content-Type': 'application/json', },
250
+ data: unitPatchBodyBody
283
251
  },
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
- /**
252
+ options);
253
+ }
254
+
255
+
256
+
257
+ export const getPatchUnitMutationOptions = <TError = ErrorType<AsError>,
258
+
259
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
260
+ ): UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext> => {
261
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
262
+
263
+
264
+
265
+
266
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchUnit>>, {unitId: string;data: UnitPatchBodyBody}> = (props) => {
267
+ const {unitId,data} = props ?? {};
268
+
269
+ return patchUnit(unitId,data,requestOptions)
270
+ }
271
+
272
+
273
+
274
+
275
+ return { mutationFn, ...mutationOptions }}
276
+
277
+ export type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>
278
+ export type PatchUnitMutationBody = UnitPatchBodyBody
279
+ export type PatchUnitMutationError = ErrorType<AsError>
280
+
281
+ /**
282
+ * @summary Adjust an existing Unit
283
+ */
284
+ export const usePatchUnit = <TError = ErrorType<AsError>,
285
+
286
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchUnit>>, TError,{unitId: string;data: UnitPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
287
+ ) => {
288
+
289
+ const mutationOptions = getPatchUnitMutationOptions(options);
290
+
291
+ return useMutation(mutationOptions);
292
+ }
293
+ /**
342
294
  * 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
295
 
344
296
  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 +300,117 @@ You cannot delete a Unit that contains undeleted **Products**
348
300
  * @summary Deletes an Organisational Unit
349
301
  */
350
302
  export const deleteOrganisationUnit = (
351
- unitId: string,
352
- options?: SecondParameter<typeof customInstance>
303
+ unitId: string,
304
+ options?: SecondParameter<typeof customInstance>,) => {
305
+
306
+
307
+ return customInstance<void>(
308
+ {url: `/unit/${unitId}`, method: 'delete'
309
+ },
310
+ options);
311
+ }
312
+
313
+
314
+
315
+ export const getDeleteOrganisationUnitMutationOptions = <TError = ErrorType<AsError>,
316
+
317
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
318
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext> => {
319
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
320
+
321
+
322
+
323
+
324
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnit>>, {unitId: string}> = (props) => {
325
+ const {unitId} = props ?? {};
326
+
327
+ return deleteOrganisationUnit(unitId,requestOptions)
328
+ }
329
+
330
+
331
+
332
+
333
+ return { mutationFn, ...mutationOptions }}
334
+
335
+ export type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>
336
+
337
+ export type DeleteOrganisationUnitMutationError = ErrorType<AsError>
338
+
339
+ /**
340
+ * @summary Deletes an Organisational Unit
341
+ */
342
+ export const useDeleteOrganisationUnit = <TError = ErrorType<AsError>,
343
+
344
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnit>>, TError,{unitId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
353
345
  ) => {
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
- /**
346
+
347
+ const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);
348
+
349
+ return useMutation(mutationOptions);
350
+ }
351
+ /**
414
352
  * Gets all the Units that are public or you are a member of. Admin users can see all Units.
415
353
 
416
354
  * @summary Gets Units
417
355
  */
418
356
  export const getUnits = (
419
- options?: SecondParameter<typeof customInstance>,
420
- signal?: AbortSignal
357
+
358
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
421
359
  ) => {
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;
360
+
361
+
362
+ return customInstance<UnitsGetResponse>(
363
+ {url: `/unit`, method: 'get', signal
364
+ },
365
+ options);
366
+ }
367
+
368
+
369
+ export const getGetUnitsQueryKey = () => {
370
+
371
+ return ["account-server-api", `/unit`] as const;
372
+ }
373
+
374
+
375
+ export const getGetUnitsQueryOptions = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
376
+ ) => {
377
+
378
+ const {query: queryOptions, request: requestOptions} = options ?? {};
379
+
380
+ const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();
381
+
382
+
383
+
384
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({ signal }) => getUnits(requestOptions, signal);
385
+
386
+
387
+
388
+
389
+
390
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & { queryKey: QueryKey }
391
+ }
392
+
393
+ export type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>
394
+ export type GetUnitsQueryError = ErrorType<void | AsError>
395
+
396
+ /**
397
+ * @summary Gets Units
398
+ */
399
+ export const useGetUnits = <TData = Awaited<ReturnType<typeof getUnits>>, TError = ErrorType<void | AsError>>(
400
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
401
+
402
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
403
+
404
+ const queryOptions = getGetUnitsQueryOptions(options)
405
+
406
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
407
+
408
+ query.queryKey = queryOptions.queryKey ;
469
409
 
470
410
  return query;
471
- };
411
+ }
412
+
413
+
472
414
 
473
415
  /**
474
416
  * Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
@@ -478,138 +420,111 @@ Users can only create one Personal unit and you cannot add other Users to a Pers
478
420
  * @summary Create a new Personal Unit
479
421
  */
480
422
  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,
423
+ personalUnitPutBodyBody: PersonalUnitPutBodyBody,
424
+ options?: SecondParameter<typeof customInstance>,) => {
425
+
426
+
427
+ return customInstance<PersonalUnitPutResponse>(
428
+ {url: `/unit`, method: 'put',
429
+ headers: {'Content-Type': 'application/json', },
430
+ data: personalUnitPutBodyBody
490
431
  },
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
- /**
432
+ options);
433
+ }
434
+
435
+
436
+
437
+ export const getCreateDefaultUnitMutationOptions = <TError = ErrorType<AsError | void>,
438
+
439
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
440
+ ): UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext> => {
441
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
442
+
443
+
444
+
445
+
446
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDefaultUnit>>, {data: PersonalUnitPutBodyBody}> = (props) => {
447
+ const {data} = props ?? {};
448
+
449
+ return createDefaultUnit(data,requestOptions)
450
+ }
451
+
452
+
453
+
454
+
455
+ return { mutationFn, ...mutationOptions }}
456
+
457
+ export type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>
458
+ export type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody
459
+ export type CreateDefaultUnitMutationError = ErrorType<AsError | void>
460
+
461
+ /**
462
+ * @summary Create a new Personal Unit
463
+ */
464
+ export const useCreateDefaultUnit = <TError = ErrorType<AsError | void>,
465
+
466
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDefaultUnit>>, TError,{data: PersonalUnitPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
467
+ ) => {
468
+
469
+ const mutationOptions = getCreateDefaultUnitMutationOptions(options);
470
+
471
+ return useMutation(mutationOptions);
472
+ }
473
+ /**
549
474
  * Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
550
475
 
551
476
  * @summary Deletes a Personal Unit
552
477
  */
553
478
  export const deleteDefaultUnit = (
554
- options?: SecondParameter<typeof customInstance>
479
+
480
+ options?: SecondParameter<typeof customInstance>,) => {
481
+
482
+
483
+ return customInstance<void>(
484
+ {url: `/unit`, method: 'delete'
485
+ },
486
+ options);
487
+ }
488
+
489
+
490
+
491
+ export const getDeleteDefaultUnitMutationOptions = <TError = ErrorType<AsError>,
492
+ TVariables = void,
493
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}
494
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext> => {
495
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
496
+
497
+
498
+
499
+
500
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDefaultUnit>>, TVariables> = () => {
501
+
502
+
503
+ return deleteDefaultUnit(requestOptions)
504
+ }
505
+
506
+
507
+
508
+
509
+ return { mutationFn, ...mutationOptions }}
510
+
511
+ export type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>
512
+
513
+ export type DeleteDefaultUnitMutationError = ErrorType<AsError>
514
+
515
+ /**
516
+ * @summary Deletes a Personal Unit
517
+ */
518
+ export const useDeleteDefaultUnit = <TError = ErrorType<AsError>,
519
+ TVariables = void,
520
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDefaultUnit>>, TError,TVariables, TContext>, request?: SecondParameter<typeof customInstance>}
555
521
  ) => {
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
- /**
522
+
523
+ const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
524
+
525
+ return useMutation(mutationOptions);
526
+ }
527
+ /**
613
528
  * 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
529
  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
530
 
@@ -619,80 +534,66 @@ You need to be part of the **Unit** or **Organisation** to use this method
619
534
  * @summary Get charges made against a Unit
620
535
  */
621
536
  export const getUnitCharges = (
622
- unitId: string,
623
- params?: GetUnitChargesParams,
624
- options?: SecondParameter<typeof customInstance>,
625
- signal?: AbortSignal
537
+ unitId: string,
538
+ params?: GetUnitChargesParams,
539
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
626
540
  ) => {
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;
541
+
542
+
543
+ return customInstance<UnitChargesGetResponse>(
544
+ {url: `/unit/${unitId}/charges`, method: 'get',
545
+ params, signal
546
+ },
547
+ options);
548
+ }
549
+
550
+
551
+ export const getGetUnitChargesQueryKey = (unitId: string,
552
+ params?: GetUnitChargesParams,) => {
553
+
554
+ return ["account-server-api", `/unit/${unitId}/charges`, ...(params ? [params]: [])] as const;
555
+ }
556
+
557
+
558
+ export const getGetUnitChargesQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,
559
+ params?: GetUnitChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
560
+ ) => {
561
+
562
+ const {query: queryOptions, request: requestOptions} = options ?? {};
563
+
564
+ const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);
565
+
566
+
567
+
568
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);
569
+
570
+
571
+
572
+
573
+
574
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: QueryKey }
575
+ }
576
+
577
+ export type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>
578
+ export type GetUnitChargesQueryError = ErrorType<AsError | void>
579
+
580
+ /**
581
+ * @summary Get charges made against a Unit
582
+ */
583
+ export const useGetUnitCharges = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(
584
+ unitId: string,
585
+ params?: GetUnitChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
586
+
587
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
588
+
589
+ const queryOptions = getGetUnitChargesQueryOptions(unitId,params,options)
590
+
591
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
592
+
593
+ query.queryKey = queryOptions.queryKey ;
696
594
 
697
595
  return query;
698
- };
596
+ }
597
+
598
+
599
+