@squonk/account-server-client 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/admin/admin.cjs +14 -7
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.cts +33 -0
  4. package/admin/admin.d.ts +4 -1
  5. package/admin/admin.js +14 -7
  6. package/admin/admin.js.map +1 -1
  7. package/asset/asset.cjs +44 -19
  8. package/asset/asset.cjs.map +1 -1
  9. package/asset/asset.d.cts +241 -0
  10. package/asset/asset.d.ts +43 -19
  11. package/asset/asset.js +37 -12
  12. package/asset/asset.js.map +1 -1
  13. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  14. package/chunk-J22A7LHX.cjs.map +1 -0
  15. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  16. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  17. package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
  18. package/index.cjs +10 -10
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +2 -0
  21. package/index.d.ts +1 -1
  22. package/index.js +9 -9
  23. package/index.js.map +1 -1
  24. package/merchant/merchant.cjs +23 -13
  25. package/merchant/merchant.cjs.map +1 -1
  26. package/merchant/merchant.d.cts +57 -0
  27. package/merchant/merchant.d.ts +7 -1
  28. package/merchant/merchant.js +22 -12
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +50 -25
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.cts +203 -0
  33. package/organisation/organisation.d.ts +31 -10
  34. package/organisation/organisation.js +44 -19
  35. package/organisation/organisation.js.map +1 -1
  36. package/package.json +12 -12
  37. package/product/product.cjs +80 -44
  38. package/product/product.cjs.map +1 -1
  39. package/product/product.d.cts +280 -0
  40. package/product/product.d.ts +40 -10
  41. package/product/product.js +71 -35
  42. package/product/product.js.map +1 -1
  43. package/src/account-server-api.schemas.ts +268 -276
  44. package/src/admin/admin.ts +72 -78
  45. package/src/asset/asset.ts +447 -556
  46. package/src/merchant/merchant.ts +125 -136
  47. package/src/organisation/organisation.ts +394 -484
  48. package/src/product/product.ts +557 -682
  49. package/src/state/state.ts +70 -69
  50. package/src/unit/unit.ts +494 -593
  51. package/src/user/user.ts +377 -463
  52. package/state/state.cjs +13 -7
  53. package/state/state.cjs.map +1 -1
  54. package/state/state.d.cts +29 -0
  55. package/state/state.d.ts +4 -1
  56. package/state/state.js +13 -7
  57. package/state/state.js.map +1 -1
  58. package/unit/unit.cjs +59 -28
  59. package/unit/unit.cjs.map +1 -1
  60. package/unit/unit.d.cts +254 -0
  61. package/unit/unit.d.ts +43 -16
  62. package/unit/unit.js +52 -21
  63. package/unit/unit.js.map +1 -1
  64. package/user/user.cjs +52 -21
  65. package/user/user.cjs.map +1 -1
  66. package/user/user.d.cts +220 -0
  67. package/user/user.d.ts +31 -10
  68. package/user/user.js +46 -15
  69. package/user/user.js.map +1 -1
  70. package/chunk-UZTHSGDT.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
2
+ * Generated by orval v6.20.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,107 +8,106 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 2.0
10
10
  */
11
- import { useQuery, useMutation } from "@tanstack/react-query";
11
+ import {
12
+ useMutation,
13
+ useQuery
14
+ } from '@tanstack/react-query'
12
15
  import type {
13
- UseQueryOptions,
14
- UseMutationOptions,
15
- QueryFunction,
16
16
  MutationFunction,
17
- UseQueryResult,
17
+ QueryFunction,
18
18
  QueryKey,
19
- } from "@tanstack/react-query";
19
+ UseMutationOptions,
20
+ UseQueryOptions,
21
+ UseQueryResult
22
+ } from '@tanstack/react-query'
20
23
  import type {
21
- ProductsGetTypesResponse,
22
24
  AsError,
25
+ GetProductChargesParams,
26
+ ProductChargesGetResponse,
27
+ ProductPatchBodyBody,
28
+ ProductUnitGetResponse,
23
29
  ProductsGetDefaultStorageCost,
24
30
  ProductsGetResponse,
25
- UnitProductPostResponse,
31
+ ProductsGetTypesResponse,
26
32
  UnitProductPostBodyBody,
27
- ProductUnitGetResponse,
28
- ProductPatchBodyBody,
29
- ProductChargesGetResponse,
30
- GetProductChargesParams,
31
- } from "../account-server-api.schemas";
32
- import { customInstance } from ".././custom-instance";
33
- import type { ErrorType } from ".././custom-instance";
33
+ UnitProductPostResponse
34
+ } from '../account-server-api.schemas'
35
+ import { customInstance } from '.././custom-instance';
36
+ import type { ErrorType } from '.././custom-instance';
37
+
34
38
 
35
39
  // eslint-disable-next-line
36
- type SecondParameter<T extends (...args: any) => any> = T extends (
40
+ type SecondParameter<T extends (...args: any) => any> = T extends (
37
41
  config: any,
38
- args: infer P
42
+ args: infer P,
39
43
  ) => any
40
44
  ? P
41
45
  : never;
42
46
 
47
+
43
48
  /**
44
49
  * Gets Product Types you can purchase (subscribe to)
45
50
 
46
51
  * @summary Gets all Product Types
47
52
  */
48
53
  export const getProductTypes = (
49
- options?: SecondParameter<typeof customInstance>,
50
- signal?: AbortSignal
54
+
55
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
56
+ ) => {
57
+
58
+
59
+ return customInstance<ProductsGetTypesResponse>(
60
+ {url: `/product-type`, method: 'get', signal
61
+ },
62
+ options);
63
+ }
64
+
65
+
66
+ export const getGetProductTypesQueryKey = () => {
67
+
68
+ return ["account-server-api", `/product-type`] as const;
69
+ }
70
+
71
+
72
+ export const getGetProductTypesQueryOptions = <TData = Awaited<ReturnType<typeof getProductTypes>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
51
73
  ) => {
52
- return customInstance<ProductsGetTypesResponse>(
53
- { url: `/product-type`, method: "get", signal },
54
- options
55
- );
56
- };
57
-
58
- export const getGetProductTypesQueryKey = () => ["account-server-api", `/product-type`] as const;
59
-
60
- export const getGetProductTypesQueryOptions = <
61
- TData = Awaited<ReturnType<typeof getProductTypes>>,
62
- TError = ErrorType<AsError | void>
63
- >(options?: {
64
- query?: UseQueryOptions<
65
- Awaited<ReturnType<typeof getProductTypes>>,
66
- TError,
67
- TData
68
- >;
69
- request?: SecondParameter<typeof customInstance>;
70
- }): UseQueryOptions<
71
- Awaited<ReturnType<typeof getProductTypes>>,
72
- TError,
73
- TData
74
- > & { queryKey: QueryKey } => {
75
- const { query: queryOptions, request: requestOptions } = options ?? {};
76
-
77
- const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();
78
-
79
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({
80
- signal,
81
- }) => getProductTypes(requestOptions, signal);
82
-
83
- return { queryKey, queryFn, ...queryOptions };
84
- };
85
-
86
- export type GetProductTypesQueryResult = NonNullable<
87
- Awaited<ReturnType<typeof getProductTypes>>
88
- >;
89
- export type GetProductTypesQueryError = ErrorType<AsError | void>;
90
-
91
- export const useGetProductTypes = <
92
- TData = Awaited<ReturnType<typeof getProductTypes>>,
93
- TError = ErrorType<AsError | void>
94
- >(options?: {
95
- query?: UseQueryOptions<
96
- Awaited<ReturnType<typeof getProductTypes>>,
97
- TError,
98
- TData
99
- >;
100
- request?: SecondParameter<typeof customInstance>;
101
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
102
- const queryOptions = getGetProductTypesQueryOptions(options);
103
-
104
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
105
- queryKey: QueryKey;
106
- };
107
-
108
- query.queryKey = queryOptions.queryKey;
74
+
75
+ const {query: queryOptions, request: requestOptions} = options ?? {};
76
+
77
+ const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();
78
+
79
+
80
+
81
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({ signal }) => getProductTypes(requestOptions, signal);
82
+
83
+
84
+
85
+
86
+
87
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData> & { queryKey: QueryKey }
88
+ }
89
+
90
+ export type GetProductTypesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductTypes>>>
91
+ export type GetProductTypesQueryError = ErrorType<AsError | void>
92
+
93
+ /**
94
+ * @summary Gets all Product Types
95
+ */
96
+ export const useGetProductTypes = <TData = Awaited<ReturnType<typeof getProductTypes>>, TError = ErrorType<AsError | void>>(
97
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductTypes>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
98
+
99
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
100
+
101
+ const queryOptions = getGetProductTypesQueryOptions(options)
102
+
103
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
104
+
105
+ query.queryKey = queryOptions.queryKey ;
109
106
 
110
107
  return query;
111
- };
108
+ }
109
+
110
+
112
111
 
113
112
  /**
114
113
  * The storage cost is returned along with its measurement units, typically a Coin value based on the the peak storage that was measured on each billable day.
@@ -116,71 +115,63 @@ export const useGetProductTypes = <
116
115
  * @summary Gets the default cross-product storage cost
117
116
  */
118
117
  export const getProductDefaultStorageCost = (
119
- options?: SecondParameter<typeof customInstance>,
120
- signal?: AbortSignal
118
+
119
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
120
+ ) => {
121
+
122
+
123
+ return customInstance<ProductsGetDefaultStorageCost>(
124
+ {url: `/product-default-storage-cost`, method: 'get', signal
125
+ },
126
+ options);
127
+ }
128
+
129
+
130
+ export const getGetProductDefaultStorageCostQueryKey = () => {
131
+
132
+ return ["account-server-api", `/product-default-storage-cost`] as const;
133
+ }
134
+
135
+
136
+ export const getGetProductDefaultStorageCostQueryOptions = <TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
121
137
  ) => {
122
- return customInstance<ProductsGetDefaultStorageCost>(
123
- { url: `/product-default-storage-cost`, method: "get", signal },
124
- options
125
- );
126
- };
127
-
128
- export const getGetProductDefaultStorageCostQueryKey = () =>
129
- ["account-server-api", `/product-default-storage-cost`] as const;
130
-
131
- export const getGetProductDefaultStorageCostQueryOptions = <
132
- TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
133
- TError = ErrorType<AsError | void>
134
- >(options?: {
135
- query?: UseQueryOptions<
136
- Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
137
- TError,
138
- TData
139
- >;
140
- request?: SecondParameter<typeof customInstance>;
141
- }): UseQueryOptions<
142
- Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
143
- TError,
144
- TData
145
- > & { queryKey: QueryKey } => {
146
- const { query: queryOptions, request: requestOptions } = options ?? {};
147
-
148
- const queryKey =
149
- queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();
150
-
151
- const queryFn: QueryFunction<
152
- Awaited<ReturnType<typeof getProductDefaultStorageCost>>
153
- > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);
154
-
155
- return { queryKey, queryFn, ...queryOptions };
156
- };
157
-
158
- export type GetProductDefaultStorageCostQueryResult = NonNullable<
159
- Awaited<ReturnType<typeof getProductDefaultStorageCost>>
160
- >;
161
- export type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;
162
-
163
- export const useGetProductDefaultStorageCost = <
164
- TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
165
- TError = ErrorType<AsError | void>
166
- >(options?: {
167
- query?: UseQueryOptions<
168
- Awaited<ReturnType<typeof getProductDefaultStorageCost>>,
169
- TError,
170
- TData
171
- >;
172
- request?: SecondParameter<typeof customInstance>;
173
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
174
- const queryOptions = getGetProductDefaultStorageCostQueryOptions(options);
175
-
176
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
177
- queryKey: QueryKey;
178
- };
179
-
180
- query.queryKey = queryOptions.queryKey;
138
+
139
+ const {query: queryOptions, request: requestOptions} = options ?? {};
140
+
141
+ const queryKey = queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();
142
+
143
+
144
+
145
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductDefaultStorageCost>>> = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);
146
+
147
+
148
+
149
+
150
+
151
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData> & { queryKey: QueryKey }
152
+ }
153
+
154
+ export type GetProductDefaultStorageCostQueryResult = NonNullable<Awaited<ReturnType<typeof getProductDefaultStorageCost>>>
155
+ export type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>
156
+
157
+ /**
158
+ * @summary Gets the default cross-product storage cost
159
+ */
160
+ export const useGetProductDefaultStorageCost = <TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError = ErrorType<AsError | void>>(
161
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductDefaultStorageCost>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
162
+
163
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
164
+
165
+ const queryOptions = getGetProductDefaultStorageCostQueryOptions(options)
166
+
167
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
168
+
169
+ query.queryKey = queryOptions.queryKey ;
181
170
 
182
171
  return query;
183
- };
172
+ }
173
+
174
+
184
175
 
185
176
  /**
186
177
  * Gets Products you have access to, across all **Units** and **Organisations**
@@ -188,67 +179,63 @@ export const useGetProductDefaultStorageCost = <
188
179
  * @summary Gets all Products
189
180
  */
190
181
  export const getProducts = (
191
- options?: SecondParameter<typeof customInstance>,
192
- signal?: AbortSignal
182
+
183
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
184
+ ) => {
185
+
186
+
187
+ return customInstance<ProductsGetResponse>(
188
+ {url: `/product`, method: 'get', signal
189
+ },
190
+ options);
191
+ }
192
+
193
+
194
+ export const getGetProductsQueryKey = () => {
195
+
196
+ return ["account-server-api", `/product`] as const;
197
+ }
198
+
199
+
200
+ export const getGetProductsQueryOptions = <TData = Awaited<ReturnType<typeof getProducts>>, TError = ErrorType<AsError | void>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
193
201
  ) => {
194
- return customInstance<ProductsGetResponse>(
195
- { url: `/product`, method: "get", signal },
196
- options
197
- );
198
- };
199
-
200
- export const getGetProductsQueryKey = () => ["account-server-api", `/product`] as const;
201
-
202
- export const getGetProductsQueryOptions = <
203
- TData = Awaited<ReturnType<typeof getProducts>>,
204
- TError = ErrorType<AsError | void>
205
- >(options?: {
206
- query?: UseQueryOptions<
207
- Awaited<ReturnType<typeof getProducts>>,
208
- TError,
209
- TData
210
- >;
211
- request?: SecondParameter<typeof customInstance>;
212
- }): UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & {
213
- queryKey: QueryKey;
214
- } => {
215
- const { query: queryOptions, request: requestOptions } = options ?? {};
216
-
217
- const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();
218
-
219
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({
220
- signal,
221
- }) => getProducts(requestOptions, signal);
222
-
223
- return { queryKey, queryFn, ...queryOptions };
224
- };
225
-
226
- export type GetProductsQueryResult = NonNullable<
227
- Awaited<ReturnType<typeof getProducts>>
228
- >;
229
- export type GetProductsQueryError = ErrorType<AsError | void>;
230
-
231
- export const useGetProducts = <
232
- TData = Awaited<ReturnType<typeof getProducts>>,
233
- TError = ErrorType<AsError | void>
234
- >(options?: {
235
- query?: UseQueryOptions<
236
- Awaited<ReturnType<typeof getProducts>>,
237
- TError,
238
- TData
239
- >;
240
- request?: SecondParameter<typeof customInstance>;
241
- }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
242
- const queryOptions = getGetProductsQueryOptions(options);
243
-
244
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
245
- queryKey: QueryKey;
246
- };
247
-
248
- query.queryKey = queryOptions.queryKey;
202
+
203
+ const {query: queryOptions, request: requestOptions} = options ?? {};
204
+
205
+ const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();
206
+
207
+
208
+
209
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({ signal }) => getProducts(requestOptions, signal);
210
+
211
+
212
+
213
+
214
+
215
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData> & { queryKey: QueryKey }
216
+ }
217
+
218
+ export type GetProductsQueryResult = NonNullable<Awaited<ReturnType<typeof getProducts>>>
219
+ export type GetProductsQueryError = ErrorType<AsError | void>
220
+
221
+ /**
222
+ * @summary Gets all Products
223
+ */
224
+ export const useGetProducts = <TData = Awaited<ReturnType<typeof getProducts>>, TError = ErrorType<AsError | void>>(
225
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProducts>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
226
+
227
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
228
+
229
+ const queryOptions = getGetProductsQueryOptions(options)
230
+
231
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
232
+
233
+ query.queryKey = queryOptions.queryKey ;
249
234
 
250
235
  return query;
251
- };
236
+ }
237
+
238
+
252
239
 
253
240
  /**
254
241
  * Gets Products you have access to based on an **Organisation**
@@ -256,81 +243,63 @@ export const useGetProducts = <
256
243
  * @summary Gets Products for an Organisation
257
244
  */
258
245
  export const getProductsForOrganisation = (
259
- orgId: string,
260
- options?: SecondParameter<typeof customInstance>,
261
- signal?: AbortSignal
246
+ orgId: string,
247
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
262
248
  ) => {
263
- return customInstance<ProductsGetResponse>(
264
- { url: `/product/organisation/${orgId}`, method: "get", signal },
265
- options
266
- );
267
- };
268
-
269
- export const getGetProductsForOrganisationQueryKey = (orgId: string) =>
270
- ["account-server-api", `/product/organisation/${orgId}`] as const;
271
-
272
- export const getGetProductsForOrganisationQueryOptions = <
273
- TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
274
- TError = ErrorType<void | AsError>
275
- >(
276
- orgId: string,
277
- options?: {
278
- query?: UseQueryOptions<
279
- Awaited<ReturnType<typeof getProductsForOrganisation>>,
280
- TError,
281
- TData
282
- >;
283
- request?: SecondParameter<typeof customInstance>;
284
- }
285
- ): UseQueryOptions<
286
- Awaited<ReturnType<typeof getProductsForOrganisation>>,
287
- TError,
288
- TData
289
- > & { queryKey: QueryKey } => {
290
- const { query: queryOptions, request: requestOptions } = options ?? {};
291
-
292
- const queryKey =
293
- queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);
294
-
295
- const queryFn: QueryFunction<
296
- Awaited<ReturnType<typeof getProductsForOrganisation>>
297
- > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
298
-
299
- return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
300
- };
301
-
302
- export type GetProductsForOrganisationQueryResult = NonNullable<
303
- Awaited<ReturnType<typeof getProductsForOrganisation>>
304
- >;
305
- export type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;
306
-
307
- export const useGetProductsForOrganisation = <
308
- TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,
309
- TError = ErrorType<void | AsError>
310
- >(
311
- orgId: string,
312
- options?: {
313
- query?: UseQueryOptions<
314
- Awaited<ReturnType<typeof getProductsForOrganisation>>,
315
- TError,
316
- TData
317
- >;
318
- request?: SecondParameter<typeof customInstance>;
319
- }
320
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
321
- const queryOptions = getGetProductsForOrganisationQueryOptions(
322
- orgId,
323
- options
324
- );
325
-
326
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
327
- queryKey: QueryKey;
328
- };
329
-
330
- query.queryKey = queryOptions.queryKey;
249
+
250
+
251
+ return customInstance<ProductsGetResponse>(
252
+ {url: `/product/organisation/${orgId}`, method: 'get', signal
253
+ },
254
+ options);
255
+ }
256
+
257
+
258
+ export const getGetProductsForOrganisationQueryKey = (orgId: string,) => {
259
+
260
+ return ["account-server-api", `/product/organisation/${orgId}`] as const;
261
+ }
262
+
263
+
264
+ export const getGetProductsForOrganisationQueryOptions = <TData = Awaited<ReturnType<typeof getProductsForOrganisation>>, TError = ErrorType<void | AsError>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
265
+ ) => {
266
+
267
+ const {query: queryOptions, request: requestOptions} = options ?? {};
268
+
269
+ const queryKey = queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);
270
+
271
+
272
+
273
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForOrganisation>>> = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
274
+
275
+
276
+
277
+
278
+
279
+ return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData> & { queryKey: QueryKey }
280
+ }
281
+
282
+ export type GetProductsForOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForOrganisation>>>
283
+ export type GetProductsForOrganisationQueryError = ErrorType<void | AsError>
284
+
285
+ /**
286
+ * @summary Gets Products for an Organisation
287
+ */
288
+ export const useGetProductsForOrganisation = <TData = Awaited<ReturnType<typeof getProductsForOrganisation>>, TError = ErrorType<void | AsError>>(
289
+ orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
290
+
291
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
292
+
293
+ const queryOptions = getGetProductsForOrganisationQueryOptions(orgId,options)
294
+
295
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
296
+
297
+ query.queryKey = queryOptions.queryKey ;
331
298
 
332
299
  return query;
333
- };
300
+ }
301
+
302
+
334
303
 
335
304
  /**
336
305
  * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.
@@ -344,152 +313,120 @@ To do this you need to be a member of the **Unit** or the **Organisation**.
344
313
  * @summary Creates a Product for an Organisational Unit
345
314
  */
346
315
  export const createUnitProduct = (
347
- unitId: string,
348
- unitProductPostBodyBody: UnitProductPostBodyBody,
349
- options?: SecondParameter<typeof customInstance>
350
- ) => {
351
- return customInstance<UnitProductPostResponse>(
352
- {
353
- url: `/product/unit/${unitId}`,
354
- method: "post",
355
- headers: { "Content-Type": "application/json" },
356
- data: unitProductPostBodyBody,
316
+ unitId: string,
317
+ unitProductPostBodyBody: UnitProductPostBodyBody,
318
+ options?: SecondParameter<typeof customInstance>,) => {
319
+
320
+
321
+ return customInstance<UnitProductPostResponse>(
322
+ {url: `/product/unit/${unitId}`, method: 'post',
323
+ headers: {'Content-Type': 'application/json', },
324
+ data: unitProductPostBodyBody
357
325
  },
358
- options
359
- );
360
- };
361
-
362
- export const getCreateUnitProductMutationOptions = <
363
- TError = ErrorType<AsError | void>,
364
- TContext = unknown
365
- >(options?: {
366
- mutation?: UseMutationOptions<
367
- Awaited<ReturnType<typeof createUnitProduct>>,
368
- TError,
369
- { unitId: string; data: UnitProductPostBodyBody },
370
- TContext
371
- >;
372
- request?: SecondParameter<typeof customInstance>;
373
- }): UseMutationOptions<
374
- Awaited<ReturnType<typeof createUnitProduct>>,
375
- TError,
376
- { unitId: string; data: UnitProductPostBodyBody },
377
- TContext
378
- > => {
379
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
380
-
381
- const mutationFn: MutationFunction<
382
- Awaited<ReturnType<typeof createUnitProduct>>,
383
- { unitId: string; data: UnitProductPostBodyBody }
384
- > = (props) => {
385
- const { unitId, data } = props ?? {};
386
-
387
- return createUnitProduct(unitId, data, requestOptions);
388
- };
389
-
390
- return { mutationFn, ...mutationOptions };
391
- };
392
-
393
- export type CreateUnitProductMutationResult = NonNullable<
394
- Awaited<ReturnType<typeof createUnitProduct>>
395
- >;
396
- export type CreateUnitProductMutationBody = UnitProductPostBodyBody;
397
- export type CreateUnitProductMutationError = ErrorType<AsError | void>;
398
-
399
- export const useCreateUnitProduct = <
400
- TError = ErrorType<AsError | void>,
401
- TContext = unknown
402
- >(options?: {
403
- mutation?: UseMutationOptions<
404
- Awaited<ReturnType<typeof createUnitProduct>>,
405
- TError,
406
- { unitId: string; data: UnitProductPostBodyBody },
407
- TContext
408
- >;
409
- request?: SecondParameter<typeof customInstance>;
410
- }) => {
411
- const mutationOptions = getCreateUnitProductMutationOptions(options);
412
-
413
- return useMutation(mutationOptions);
414
- };
415
- /**
326
+ options);
327
+ }
328
+
329
+
330
+
331
+ export const getCreateUnitProductMutationOptions = <TError = ErrorType<AsError | void>,
332
+
333
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createUnitProduct>>, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
334
+ ): UseMutationOptions<Awaited<ReturnType<typeof createUnitProduct>>, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext> => {
335
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
336
+
337
+
338
+
339
+
340
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof createUnitProduct>>, {unitId: string;data: UnitProductPostBodyBody}> = (props) => {
341
+ const {unitId,data} = props ?? {};
342
+
343
+ return createUnitProduct(unitId,data,requestOptions)
344
+ }
345
+
346
+
347
+
348
+
349
+ return { mutationFn, ...mutationOptions }}
350
+
351
+ export type CreateUnitProductMutationResult = NonNullable<Awaited<ReturnType<typeof createUnitProduct>>>
352
+ export type CreateUnitProductMutationBody = UnitProductPostBodyBody
353
+ export type CreateUnitProductMutationError = ErrorType<AsError | void>
354
+
355
+ /**
356
+ * @summary Creates a Product for an Organisational Unit
357
+ */
358
+ export const useCreateUnitProduct = <TError = ErrorType<AsError | void>,
359
+
360
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createUnitProduct>>, TError,{unitId: string;data: UnitProductPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
361
+ ) => {
362
+
363
+ const mutationOptions = getCreateUnitProductMutationOptions(options);
364
+
365
+ return useMutation(mutationOptions);
366
+ }
367
+ /**
416
368
  * Gets products you have access to based on an Organisational **Unit**
417
369
 
418
370
  * @summary Gets Products for an Organisational Unit
419
371
  */
420
372
  export const getProductsForUnit = (
421
- unitId: string,
422
- options?: SecondParameter<typeof customInstance>,
423
- signal?: AbortSignal
373
+ unitId: string,
374
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
375
+ ) => {
376
+
377
+
378
+ return customInstance<ProductsGetResponse>(
379
+ {url: `/product/unit/${unitId}`, method: 'get', signal
380
+ },
381
+ options);
382
+ }
383
+
384
+
385
+ export const getGetProductsForUnitQueryKey = (unitId: string,) => {
386
+
387
+ return ["account-server-api", `/product/unit/${unitId}`] as const;
388
+ }
389
+
390
+
391
+ export const getGetProductsForUnitQueryOptions = <TData = Awaited<ReturnType<typeof getProductsForUnit>>, TError = ErrorType<void | AsError>>(unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
424
392
  ) => {
425
- return customInstance<ProductsGetResponse>(
426
- { url: `/product/unit/${unitId}`, method: "get", signal },
427
- options
428
- );
429
- };
430
-
431
- export const getGetProductsForUnitQueryKey = (unitId: string) =>
432
- ["account-server-api", `/product/unit/${unitId}`] as const;
433
-
434
- export const getGetProductsForUnitQueryOptions = <
435
- TData = Awaited<ReturnType<typeof getProductsForUnit>>,
436
- TError = ErrorType<void | AsError>
437
- >(
438
- unitId: string,
439
- options?: {
440
- query?: UseQueryOptions<
441
- Awaited<ReturnType<typeof getProductsForUnit>>,
442
- TError,
443
- TData
444
- >;
445
- request?: SecondParameter<typeof customInstance>;
446
- }
447
- ): UseQueryOptions<
448
- Awaited<ReturnType<typeof getProductsForUnit>>,
449
- TError,
450
- TData
451
- > & { queryKey: QueryKey } => {
452
- const { query: queryOptions, request: requestOptions } = options ?? {};
453
-
454
- const queryKey =
455
- queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);
456
-
457
- const queryFn: QueryFunction<
458
- Awaited<ReturnType<typeof getProductsForUnit>>
459
- > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
460
-
461
- return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
462
- };
463
-
464
- export type GetProductsForUnitQueryResult = NonNullable<
465
- Awaited<ReturnType<typeof getProductsForUnit>>
466
- >;
467
- export type GetProductsForUnitQueryError = ErrorType<void | AsError>;
468
-
469
- export const useGetProductsForUnit = <
470
- TData = Awaited<ReturnType<typeof getProductsForUnit>>,
471
- TError = ErrorType<void | AsError>
472
- >(
473
- unitId: string,
474
- options?: {
475
- query?: UseQueryOptions<
476
- Awaited<ReturnType<typeof getProductsForUnit>>,
477
- TError,
478
- TData
479
- >;
480
- request?: SecondParameter<typeof customInstance>;
481
- }
482
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
483
- const queryOptions = getGetProductsForUnitQueryOptions(unitId, options);
484
-
485
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
486
- queryKey: QueryKey;
487
- };
488
-
489
- query.queryKey = queryOptions.queryKey;
393
+
394
+ const {query: queryOptions, request: requestOptions} = options ?? {};
395
+
396
+ const queryKey = queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);
397
+
398
+
399
+
400
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductsForUnit>>> = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
401
+
402
+
403
+
404
+
405
+
406
+ return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData> & { queryKey: QueryKey }
407
+ }
408
+
409
+ export type GetProductsForUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForUnit>>>
410
+ export type GetProductsForUnitQueryError = ErrorType<void | AsError>
411
+
412
+ /**
413
+ * @summary Gets Products for an Organisational Unit
414
+ */
415
+ export const useGetProductsForUnit = <TData = Awaited<ReturnType<typeof getProductsForUnit>>, TError = ErrorType<void | AsError>>(
416
+ unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductsForUnit>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
417
+
418
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
419
+
420
+ const queryOptions = getGetProductsForUnitQueryOptions(unitId,options)
421
+
422
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
423
+
424
+ query.queryKey = queryOptions.queryKey ;
490
425
 
491
426
  return query;
492
- };
427
+ }
428
+
429
+
493
430
 
494
431
  /**
495
432
  * Gets details of a specific Product that you have access to.
@@ -497,75 +434,63 @@ export const useGetProductsForUnit = <
497
434
  * @summary Gets a Product
498
435
  */
499
436
  export const getProduct = (
500
- productId: string,
501
- options?: SecondParameter<typeof customInstance>,
502
- signal?: AbortSignal
437
+ productId: string,
438
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
439
+ ) => {
440
+
441
+
442
+ return customInstance<ProductUnitGetResponse>(
443
+ {url: `/product/${productId}`, method: 'get', signal
444
+ },
445
+ options);
446
+ }
447
+
448
+
449
+ export const getGetProductQueryKey = (productId: string,) => {
450
+
451
+ return ["account-server-api", `/product/${productId}`] as const;
452
+ }
453
+
454
+
455
+ export const getGetProductQueryOptions = <TData = Awaited<ReturnType<typeof getProduct>>, TError = ErrorType<AsError | void>>(productId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
503
456
  ) => {
504
- return customInstance<ProductUnitGetResponse>(
505
- { url: `/product/${productId}`, method: "get", signal },
506
- options
507
- );
508
- };
509
-
510
- export const getGetProductQueryKey = (productId: string) =>
511
- ["account-server-api", `/product/${productId}`] as const;
512
-
513
- export const getGetProductQueryOptions = <
514
- TData = Awaited<ReturnType<typeof getProduct>>,
515
- TError = ErrorType<AsError | void>
516
- >(
517
- productId: string,
518
- options?: {
519
- query?: UseQueryOptions<
520
- Awaited<ReturnType<typeof getProduct>>,
521
- TError,
522
- TData
523
- >;
524
- request?: SecondParameter<typeof customInstance>;
525
- }
526
- ): UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & {
527
- queryKey: QueryKey;
528
- } => {
529
- const { query: queryOptions, request: requestOptions } = options ?? {};
530
-
531
- const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);
532
-
533
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({
534
- signal,
535
- }) => getProduct(productId, requestOptions, signal);
536
-
537
- return { queryKey, queryFn, enabled: !!productId, ...queryOptions };
538
- };
539
-
540
- export type GetProductQueryResult = NonNullable<
541
- Awaited<ReturnType<typeof getProduct>>
542
- >;
543
- export type GetProductQueryError = ErrorType<AsError | void>;
544
-
545
- export const useGetProduct = <
546
- TData = Awaited<ReturnType<typeof getProduct>>,
547
- TError = ErrorType<AsError | void>
548
- >(
549
- productId: string,
550
- options?: {
551
- query?: UseQueryOptions<
552
- Awaited<ReturnType<typeof getProduct>>,
553
- TError,
554
- TData
555
- >;
556
- request?: SecondParameter<typeof customInstance>;
557
- }
558
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
559
- const queryOptions = getGetProductQueryOptions(productId, options);
560
-
561
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
562
- queryKey: QueryKey;
563
- };
564
-
565
- query.queryKey = queryOptions.queryKey;
457
+
458
+ const {query: queryOptions, request: requestOptions} = options ?? {};
459
+
460
+ const queryKey = queryOptions?.queryKey ?? getGetProductQueryKey(productId);
461
+
462
+
463
+
464
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({ signal }) => getProduct(productId, requestOptions, signal);
465
+
466
+
467
+
468
+
469
+
470
+ return { queryKey, queryFn, enabled: !!(productId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData> & { queryKey: QueryKey }
471
+ }
472
+
473
+ export type GetProductQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>
474
+ export type GetProductQueryError = ErrorType<AsError | void>
475
+
476
+ /**
477
+ * @summary Gets a Product
478
+ */
479
+ export const useGetProduct = <TData = Awaited<ReturnType<typeof getProduct>>, TError = ErrorType<AsError | void>>(
480
+ productId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProduct>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
481
+
482
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
483
+
484
+ const queryOptions = getGetProductQueryOptions(productId,options)
485
+
486
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
487
+
488
+ query.queryKey = queryOptions.queryKey ;
566
489
 
567
490
  return query;
568
- };
491
+ }
492
+
493
+
569
494
 
570
495
  /**
571
496
  * You need access to the Product and, if the Product is *claimable* the claim must be removed before the Product can be removed. An example claimable Product is a `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` where the *claimable* commodity is a Data Manager **Project**. In this case you will need to delete the Data Manager **Project** before you can delete the Account Server **Product**.
@@ -573,69 +498,55 @@ export const useGetProduct = <
573
498
  * @summary Deletes an existing Product
574
499
  */
575
500
  export const deleteProduct = (
576
- productId: string,
577
- options?: SecondParameter<typeof customInstance>
501
+ productId: string,
502
+ options?: SecondParameter<typeof customInstance>,) => {
503
+
504
+
505
+ return customInstance<void>(
506
+ {url: `/product/${productId}`, method: 'delete'
507
+ },
508
+ options);
509
+ }
510
+
511
+
512
+
513
+ export const getDeleteProductMutationOptions = <TError = ErrorType<AsError>,
514
+
515
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProduct>>, TError,{productId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
516
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteProduct>>, TError,{productId: string}, TContext> => {
517
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
518
+
519
+
520
+
521
+
522
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteProduct>>, {productId: string}> = (props) => {
523
+ const {productId} = props ?? {};
524
+
525
+ return deleteProduct(productId,requestOptions)
526
+ }
527
+
528
+
529
+
530
+
531
+ return { mutationFn, ...mutationOptions }}
532
+
533
+ export type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>
534
+
535
+ export type DeleteProductMutationError = ErrorType<AsError>
536
+
537
+ /**
538
+ * @summary Deletes an existing Product
539
+ */
540
+ export const useDeleteProduct = <TError = ErrorType<AsError>,
541
+
542
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProduct>>, TError,{productId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
578
543
  ) => {
579
- return customInstance<void>(
580
- { url: `/product/${productId}`, method: "delete" },
581
- options
582
- );
583
- };
584
-
585
- export const getDeleteProductMutationOptions = <
586
- TError = ErrorType<AsError>,
587
- TContext = unknown
588
- >(options?: {
589
- mutation?: UseMutationOptions<
590
- Awaited<ReturnType<typeof deleteProduct>>,
591
- TError,
592
- { productId: string },
593
- TContext
594
- >;
595
- request?: SecondParameter<typeof customInstance>;
596
- }): UseMutationOptions<
597
- Awaited<ReturnType<typeof deleteProduct>>,
598
- TError,
599
- { productId: string },
600
- TContext
601
- > => {
602
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
603
-
604
- const mutationFn: MutationFunction<
605
- Awaited<ReturnType<typeof deleteProduct>>,
606
- { productId: string }
607
- > = (props) => {
608
- const { productId } = props ?? {};
609
-
610
- return deleteProduct(productId, requestOptions);
611
- };
612
-
613
- return { mutationFn, ...mutationOptions };
614
- };
615
-
616
- export type DeleteProductMutationResult = NonNullable<
617
- Awaited<ReturnType<typeof deleteProduct>>
618
- >;
619
-
620
- export type DeleteProductMutationError = ErrorType<AsError>;
621
-
622
- export const useDeleteProduct = <
623
- TError = ErrorType<AsError>,
624
- TContext = unknown
625
- >(options?: {
626
- mutation?: UseMutationOptions<
627
- Awaited<ReturnType<typeof deleteProduct>>,
628
- TError,
629
- { productId: string },
630
- TContext
631
- >;
632
- request?: SecondParameter<typeof customInstance>;
633
- }) => {
634
- const mutationOptions = getDeleteProductMutationOptions(options);
635
-
636
- return useMutation(mutationOptions);
637
- };
638
- /**
544
+
545
+ const mutationOptions = getDeleteProductMutationOptions(options);
546
+
547
+ return useMutation(mutationOptions);
548
+ }
549
+ /**
639
550
  * Used to update some adjustable parameters of a Product, i.e. to extend its **Allowance** or **Limit**.
640
551
 
641
552
  At the moment we only support Products associated with the Data Manager, and these can be patched by changing the `name`, its coin `allowance` or `limit`
@@ -643,75 +554,58 @@ At the moment we only support Products associated with the Data Manager, and the
643
554
  * @summary Adjust an existing Product
644
555
  */
645
556
  export const patchProduct = (
646
- productId: string,
647
- productPatchBodyBody: ProductPatchBodyBody,
648
- options?: SecondParameter<typeof customInstance>
649
- ) => {
650
- return customInstance<void>(
651
- {
652
- url: `/product/${productId}`,
653
- method: "patch",
654
- headers: { "Content-Type": "application/json" },
655
- data: productPatchBodyBody,
557
+ productId: string,
558
+ productPatchBodyBody: ProductPatchBodyBody,
559
+ options?: SecondParameter<typeof customInstance>,) => {
560
+
561
+
562
+ return customInstance<void>(
563
+ {url: `/product/${productId}`, method: 'patch',
564
+ headers: {'Content-Type': 'application/json', },
565
+ data: productPatchBodyBody
656
566
  },
657
- options
658
- );
659
- };
660
-
661
- export const getPatchProductMutationOptions = <
662
- TError = ErrorType<AsError>,
663
- TContext = unknown
664
- >(options?: {
665
- mutation?: UseMutationOptions<
666
- Awaited<ReturnType<typeof patchProduct>>,
667
- TError,
668
- { productId: string; data: ProductPatchBodyBody },
669
- TContext
670
- >;
671
- request?: SecondParameter<typeof customInstance>;
672
- }): UseMutationOptions<
673
- Awaited<ReturnType<typeof patchProduct>>,
674
- TError,
675
- { productId: string; data: ProductPatchBodyBody },
676
- TContext
677
- > => {
678
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
679
-
680
- const mutationFn: MutationFunction<
681
- Awaited<ReturnType<typeof patchProduct>>,
682
- { productId: string; data: ProductPatchBodyBody }
683
- > = (props) => {
684
- const { productId, data } = props ?? {};
685
-
686
- return patchProduct(productId, data, requestOptions);
687
- };
688
-
689
- return { mutationFn, ...mutationOptions };
690
- };
691
-
692
- export type PatchProductMutationResult = NonNullable<
693
- Awaited<ReturnType<typeof patchProduct>>
694
- >;
695
- export type PatchProductMutationBody = ProductPatchBodyBody;
696
- export type PatchProductMutationError = ErrorType<AsError>;
697
-
698
- export const usePatchProduct = <
699
- TError = ErrorType<AsError>,
700
- TContext = unknown
701
- >(options?: {
702
- mutation?: UseMutationOptions<
703
- Awaited<ReturnType<typeof patchProduct>>,
704
- TError,
705
- { productId: string; data: ProductPatchBodyBody },
706
- TContext
707
- >;
708
- request?: SecondParameter<typeof customInstance>;
709
- }) => {
710
- const mutationOptions = getPatchProductMutationOptions(options);
711
-
712
- return useMutation(mutationOptions);
713
- };
714
- /**
567
+ options);
568
+ }
569
+
570
+
571
+
572
+ export const getPatchProductMutationOptions = <TError = ErrorType<AsError>,
573
+
574
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchProduct>>, TError,{productId: string;data: ProductPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
575
+ ): UseMutationOptions<Awaited<ReturnType<typeof patchProduct>>, TError,{productId: string;data: ProductPatchBodyBody}, TContext> => {
576
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
577
+
578
+
579
+
580
+
581
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchProduct>>, {productId: string;data: ProductPatchBodyBody}> = (props) => {
582
+ const {productId,data} = props ?? {};
583
+
584
+ return patchProduct(productId,data,requestOptions)
585
+ }
586
+
587
+
588
+
589
+
590
+ return { mutationFn, ...mutationOptions }}
591
+
592
+ export type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>
593
+ export type PatchProductMutationBody = ProductPatchBodyBody
594
+ export type PatchProductMutationError = ErrorType<AsError>
595
+
596
+ /**
597
+ * @summary Adjust an existing Product
598
+ */
599
+ export const usePatchProduct = <TError = ErrorType<AsError>,
600
+
601
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchProduct>>, TError,{productId: string;data: ProductPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
602
+ ) => {
603
+
604
+ const mutationOptions = getPatchProductMutationOptions(options);
605
+
606
+ return useMutation(mutationOptions);
607
+ }
608
+ /**
715
609
  * Get the charges made against a Product with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.
716
610
 
717
611
  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.
@@ -722,85 +616,66 @@ You need to be part of the **Unit** or **Organisation** to use this method
722
616
  * @summary Get charges made against a Product
723
617
  */
724
618
  export const getProductCharges = (
725
- productId: string,
726
- params?: GetProductChargesParams,
727
- options?: SecondParameter<typeof customInstance>,
728
- signal?: AbortSignal
619
+ productId: string,
620
+ params?: GetProductChargesParams,
621
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
729
622
  ) => {
730
- return customInstance<ProductChargesGetResponse>(
731
- { url: `/product/${productId}/charges`, method: "get", params, signal },
732
- options
733
- );
734
- };
735
-
736
- export const getGetProductChargesQueryKey = (
737
- productId: string,
738
- params?: GetProductChargesParams
739
- ) => ["account-server-api", `/product/${productId}/charges`, ...(params ? [params] : [])] as const;
740
-
741
- export const getGetProductChargesQueryOptions = <
742
- TData = Awaited<ReturnType<typeof getProductCharges>>,
743
- TError = ErrorType<AsError | void>
744
- >(
745
- productId: string,
746
- params?: GetProductChargesParams,
747
- options?: {
748
- query?: UseQueryOptions<
749
- Awaited<ReturnType<typeof getProductCharges>>,
750
- TError,
751
- TData
752
- >;
753
- request?: SecondParameter<typeof customInstance>;
754
- }
755
- ): UseQueryOptions<
756
- Awaited<ReturnType<typeof getProductCharges>>,
757
- TError,
758
- TData
759
- > & { queryKey: QueryKey } => {
760
- const { query: queryOptions, request: requestOptions } = options ?? {};
761
-
762
- const queryKey =
763
- queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);
764
-
765
- const queryFn: QueryFunction<
766
- Awaited<ReturnType<typeof getProductCharges>>
767
- > = ({ signal }) =>
768
- getProductCharges(productId, params, requestOptions, signal);
769
-
770
- return { queryKey, queryFn, enabled: !!productId, ...queryOptions };
771
- };
772
-
773
- export type GetProductChargesQueryResult = NonNullable<
774
- Awaited<ReturnType<typeof getProductCharges>>
775
- >;
776
- export type GetProductChargesQueryError = ErrorType<AsError | void>;
777
-
778
- export const useGetProductCharges = <
779
- TData = Awaited<ReturnType<typeof getProductCharges>>,
780
- TError = ErrorType<AsError | void>
781
- >(
782
- productId: string,
783
- params?: GetProductChargesParams,
784
- options?: {
785
- query?: UseQueryOptions<
786
- Awaited<ReturnType<typeof getProductCharges>>,
787
- TError,
788
- TData
789
- >;
790
- request?: SecondParameter<typeof customInstance>;
791
- }
792
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
793
- const queryOptions = getGetProductChargesQueryOptions(
794
- productId,
795
- params,
796
- options
797
- );
798
-
799
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
800
- queryKey: QueryKey;
801
- };
802
-
803
- query.queryKey = queryOptions.queryKey;
623
+
624
+
625
+ return customInstance<ProductChargesGetResponse>(
626
+ {url: `/product/${productId}/charges`, method: 'get',
627
+ params, signal
628
+ },
629
+ options);
630
+ }
631
+
632
+
633
+ export const getGetProductChargesQueryKey = (productId: string,
634
+ params?: GetProductChargesParams,) => {
635
+
636
+ return ["account-server-api", `/product/${productId}/charges`, ...(params ? [params]: [])] as const;
637
+ }
638
+
639
+
640
+ export const getGetProductChargesQueryOptions = <TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(productId: string,
641
+ params?: GetProductChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
642
+ ) => {
643
+
644
+ const {query: queryOptions, request: requestOptions} = options ?? {};
645
+
646
+ const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId,params);
647
+
648
+
649
+
650
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) => getProductCharges(productId,params, requestOptions, signal);
651
+
652
+
653
+
654
+
655
+
656
+ return { queryKey, queryFn, enabled: !!(productId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData> & { queryKey: QueryKey }
657
+ }
658
+
659
+ export type GetProductChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductCharges>>>
660
+ export type GetProductChargesQueryError = ErrorType<AsError | void>
661
+
662
+ /**
663
+ * @summary Get charges made against a Product
664
+ */
665
+ export const useGetProductCharges = <TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(
666
+ productId: string,
667
+ params?: GetProductChargesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
668
+
669
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
670
+
671
+ const queryOptions = getGetProductChargesQueryOptions(productId,params,options)
672
+
673
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
674
+
675
+ query.queryKey = queryOptions.queryKey ;
804
676
 
805
677
  return query;
806
- };
678
+ }
679
+
680
+
681
+