@squonk/account-server-client 0.1.31-rc.1 → 0.1.32-rc.2

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 (59) hide show
  1. package/asset/asset.cjs +133 -0
  2. package/asset/asset.cjs.map +1 -0
  3. package/asset/asset.d.ts +126 -0
  4. package/asset/asset.js +133 -0
  5. package/asset/asset.js.map +1 -0
  6. package/asset/package.json +7 -0
  7. package/{custom-instance-13412a15.d.ts → custom-instance-b985e1be.d.ts} +127 -40
  8. package/index.cjs +20 -2
  9. package/index.cjs.map +1 -1
  10. package/index.d.ts +1 -1
  11. package/index.js +20 -2
  12. package/index.js.map +1 -1
  13. package/merchant/merchant.cjs +48 -0
  14. package/merchant/merchant.cjs.map +1 -0
  15. package/merchant/merchant.d.ts +39 -0
  16. package/merchant/merchant.js +48 -0
  17. package/merchant/merchant.js.map +1 -0
  18. package/merchant/package.json +7 -0
  19. package/organisation/organisation.cjs +12 -12
  20. package/organisation/organisation.cjs.map +1 -1
  21. package/organisation/organisation.d.ts +10 -9
  22. package/organisation/organisation.js +12 -12
  23. package/organisation/organisation.js.map +1 -1
  24. package/package.json +9 -9
  25. package/product/product.cjs +36 -26
  26. package/product/product.cjs.map +1 -1
  27. package/product/product.d.ts +23 -16
  28. package/product/product.js +36 -26
  29. package/product/product.js.map +1 -1
  30. package/src/account-server-api.schemas.ts +155 -52
  31. package/src/asset/asset.ts +433 -0
  32. package/src/merchant/merchant.ts +145 -0
  33. package/src/organisation/organisation.ts +37 -37
  34. package/src/product/product.ts +97 -74
  35. package/src/state/state.ts +19 -16
  36. package/src/unit/unit.ts +64 -56
  37. package/src/user/user.ts +63 -62
  38. package/state/state.cjs +6 -4
  39. package/state/state.cjs.map +1 -1
  40. package/state/state.d.ts +7 -6
  41. package/state/state.js +6 -4
  42. package/state/state.js.map +1 -1
  43. package/unit/unit.cjs +22 -18
  44. package/unit/unit.cjs.map +1 -1
  45. package/unit/unit.d.ts +16 -15
  46. package/unit/unit.js +22 -18
  47. package/unit/unit.js.map +1 -1
  48. package/user/user.cjs +22 -20
  49. package/user/user.cjs.map +1 -1
  50. package/user/user.d.ts +14 -13
  51. package/user/user.js +22 -20
  52. package/user/user.js.map +1 -1
  53. package/service/package.json +0 -7
  54. package/service/service.cjs +0 -44
  55. package/service/service.cjs.map +0 -1
  56. package/service/service.d.ts +0 -49
  57. package/service/service.js +0 -44
  58. package/service/service.js.map +0 -1
  59. package/src/service/service.ts +0 -136
@@ -1,18 +1,19 @@
1
1
  import * as react_query from 'react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
3
- import { V as customInstance, B as ProductsGetTypesResponse, W as ErrorType, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-13412a15.js';
3
+ import { a9 as customInstance, T as ProductsGetTypesResponse, aa as ErrorType, a5 as AsError, W as ProductsGetResponse, f as UnitProductPostBodyBody, N as UnitProductPostResponse, S as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../custom-instance-b985e1be.js';
4
4
  import 'axios';
5
5
 
6
- declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
6
+ declare type AwaitedInput<T> = PromiseLike<T> | T;
7
+ declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
7
8
  declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
8
9
  /**
9
10
  * Gets product types you can purchase
10
11
 
11
12
  * @summary Gets all Product Types
12
13
  */
13
- declare const getProductTypes: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetTypesResponse>;
14
+ declare const getProductTypes: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetTypesResponse>;
14
15
  declare const getGetProductTypesQueryKey: () => string[];
15
- declare type GetProductTypesQueryResult = NonNullable<AsyncReturnType<typeof getProductTypes>>;
16
+ declare type GetProductTypesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductTypes>>>;
16
17
  declare type GetProductTypesQueryError = ErrorType<AsError | void>;
17
18
  declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = ErrorType<void | AsError>>(options?: {
18
19
  query?: UseQueryOptions<ProductsGetTypesResponse, TError, TData, QueryKey> | undefined;
@@ -25,9 +26,9 @@ declare const useGetProductTypes: <TData = ProductsGetTypesResponse, TError = Er
25
26
 
26
27
  * @summary Gets all Products
27
28
  */
28
- declare const getProducts: (options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
29
+ declare const getProducts: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetResponse>;
29
30
  declare const getGetProductsQueryKey: () => string[];
30
- declare type GetProductsQueryResult = NonNullable<AsyncReturnType<typeof getProducts>>;
31
+ declare type GetProductsQueryResult = NonNullable<Awaited<ReturnType<typeof getProducts>>>;
31
32
  declare type GetProductsQueryError = ErrorType<AsError | void>;
32
33
  declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(options?: {
33
34
  query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
@@ -40,9 +41,9 @@ declare const useGetProducts: <TData = ProductsGetResponse, TError = ErrorType<v
40
41
 
41
42
  * @summary Gets Products for an Organisation
42
43
  */
43
- declare const getProductsForOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
44
+ declare const getProductsForOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetResponse>;
44
45
  declare const getGetProductsForOrganisationQueryKey: (orgId: string) => string[];
45
- declare type GetProductsForOrganisationQueryResult = NonNullable<AsyncReturnType<typeof getProductsForOrganisation>>;
46
+ declare type GetProductsForOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForOrganisation>>>;
46
47
  declare type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;
47
48
  declare const useGetProductsForOrganisation: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
48
49
  query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
@@ -51,10 +52,16 @@ declare const useGetProductsForOrganisation: <TData = ProductsGetResponse, TErro
51
52
  queryKey: QueryKey;
52
53
  };
53
54
  /**
55
+ * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.
56
+
57
+ Typical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.
58
+
59
+ Some subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`
60
+
54
61
  * @summary Creates a Product for an Organisational Unit
55
62
  */
56
63
  declare const createUnitProduct: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
57
- declare type CreateUnitProductMutationResult = NonNullable<AsyncReturnType<typeof createUnitProduct>>;
64
+ declare type CreateUnitProductMutationResult = NonNullable<Awaited<ReturnType<typeof createUnitProduct>>>;
58
65
  declare type CreateUnitProductMutationBody = UnitProductPostBodyBody;
59
66
  declare type CreateUnitProductMutationError = ErrorType<AsError | void>;
60
67
  declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
@@ -72,9 +79,9 @@ declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContex
72
79
 
73
80
  * @summary Gets Products for an Organisational Unit
74
81
  */
75
- declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
82
+ declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetResponse>;
76
83
  declare const getGetProductsForUnitQueryKey: (unitId: string) => string[];
77
- declare type GetProductsForUnitQueryResult = NonNullable<AsyncReturnType<typeof getProductsForUnit>>;
84
+ declare type GetProductsForUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForUnit>>>;
78
85
  declare type GetProductsForUnitQueryError = ErrorType<void | AsError>;
79
86
  declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
80
87
  query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
@@ -87,9 +94,9 @@ declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = Erro
87
94
 
88
95
  * @summary Gets a Unit's Product
89
96
  */
90
- declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
97
+ declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductUnitGetResponse>;
91
98
  declare const getGetProductQueryKey: (unitId: string, productId: string) => string[];
92
- declare type GetProductQueryResult = NonNullable<AsyncReturnType<typeof getProduct>>;
99
+ declare type GetProductQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>;
93
100
  declare type GetProductQueryError = ErrorType<AsError | void>;
94
101
  declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitId: string, productId: string, options?: {
95
102
  query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
@@ -101,7 +108,7 @@ declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType
101
108
  * @summary Deletes an existing Product
102
109
  */
103
110
  declare const deleteProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
104
- declare type DeleteProductMutationResult = NonNullable<AsyncReturnType<typeof deleteProduct>>;
111
+ declare type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>;
105
112
  declare type DeleteProductMutationError = ErrorType<AsError>;
106
113
  declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
107
114
  mutation?: UseMutationOptions<void, TError, {
@@ -119,7 +126,7 @@ declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown
119
126
  * @summary Adjust an existing Product
120
127
  */
121
128
  declare const patchProduct: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
122
- declare type PatchProductMutationResult = NonNullable<AsyncReturnType<typeof patchProduct>>;
129
+ declare type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>;
123
130
  declare type PatchProductMutationBody = ProductPatchBodyBody;
124
131
  declare type PatchProductMutationError = ErrorType<AsError>;
125
132
  declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -135,4 +142,4 @@ declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>
135
142
  data: ProductPatchBodyBody;
136
143
  }, TContext>;
137
144
 
138
- export { CreateUnitProductMutationBody, CreateUnitProductMutationError, CreateUnitProductMutationResult, DeleteProductMutationError, DeleteProductMutationResult, GetProductQueryError, GetProductQueryResult, GetProductTypesQueryError, GetProductTypesQueryResult, GetProductsForOrganisationQueryError, GetProductsForOrganisationQueryResult, GetProductsForUnitQueryError, GetProductsForUnitQueryResult, GetProductsQueryError, GetProductsQueryResult, PatchProductMutationBody, PatchProductMutationError, PatchProductMutationResult, createUnitProduct, deleteProduct, getGetProductQueryKey, getGetProductTypesQueryKey, getGetProductsForOrganisationQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProductTypes, getProducts, getProductsForOrganisation, getProductsForUnit, patchProduct, useCreateUnitProduct, useDeleteProduct, useGetProduct, useGetProductTypes, useGetProducts, useGetProductsForOrganisation, useGetProductsForUnit, usePatchProduct };
145
+ export { Awaited, AwaitedInput, CreateUnitProductMutationBody, CreateUnitProductMutationError, CreateUnitProductMutationResult, DeleteProductMutationError, DeleteProductMutationResult, GetProductQueryError, GetProductQueryResult, GetProductTypesQueryError, GetProductTypesQueryResult, GetProductsForOrganisationQueryError, GetProductsForOrganisationQueryResult, GetProductsForUnitQueryError, GetProductsForUnitQueryResult, GetProductsQueryError, GetProductsQueryResult, PatchProductMutationBody, PatchProductMutationError, PatchProductMutationResult, createUnitProduct, deleteProduct, getGetProductQueryKey, getGetProductTypesQueryKey, getGetProductsForOrganisationQueryKey, getGetProductsForUnitQueryKey, getGetProductsQueryKey, getProduct, getProductTypes, getProducts, getProductsForOrganisation, getProductsForUnit, patchProduct, useCreateUnitProduct, useDeleteProduct, useGetProduct, useGetProductTypes, useGetProducts, useGetProductsForOrganisation, useGetProductsForUnit, usePatchProduct };
@@ -8,42 +8,46 @@ import {
8
8
  useQuery,
9
9
  useMutation
10
10
  } from "react-query";
11
- var getProductTypes = (options) => {
12
- return customInstance({ url: `/product-type`, method: "get" }, options);
11
+ var getProductTypes = (options, signal) => {
12
+ return customInstance({ url: `/product-type`, method: "get", signal }, options);
13
13
  };
14
14
  var getGetProductTypesQueryKey = () => [`/product-type`];
15
15
  var useGetProductTypes = (options) => {
16
- const { query: queryOptions, request: requestOptions } = options || {};
16
+ const { query: queryOptions, request: requestOptions } = options ?? {};
17
17
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductTypesQueryKey();
18
- const queryFn = () => getProductTypes(requestOptions);
18
+ const queryFn = ({
19
+ signal
20
+ }) => getProductTypes(requestOptions, signal);
19
21
  const query = useQuery(queryKey, queryFn, queryOptions);
20
22
  return __spreadValues({
21
23
  queryKey
22
24
  }, query);
23
25
  };
24
- var getProducts = (options) => {
25
- return customInstance({ url: `/product`, method: "get" }, options);
26
+ var getProducts = (options, signal) => {
27
+ return customInstance({ url: `/product`, method: "get", signal }, options);
26
28
  };
27
29
  var getGetProductsQueryKey = () => [`/product`];
28
30
  var useGetProducts = (options) => {
29
- const { query: queryOptions, request: requestOptions } = options || {};
31
+ const { query: queryOptions, request: requestOptions } = options ?? {};
30
32
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsQueryKey();
31
- const queryFn = () => getProducts(requestOptions);
33
+ const queryFn = ({
34
+ signal
35
+ }) => getProducts(requestOptions, signal);
32
36
  const query = useQuery(queryKey, queryFn, queryOptions);
33
37
  return __spreadValues({
34
38
  queryKey
35
39
  }, query);
36
40
  };
37
- var getProductsForOrganisation = (orgId, options) => {
38
- return customInstance({ url: `/product/organisation/${orgId}`, method: "get" }, options);
41
+ var getProductsForOrganisation = (orgId, options, signal) => {
42
+ return customInstance({ url: `/product/organisation/${orgId}`, method: "get", signal }, options);
39
43
  };
40
44
  var getGetProductsForOrganisationQueryKey = (orgId) => [
41
45
  `/product/organisation/${orgId}`
42
46
  ];
43
47
  var useGetProductsForOrganisation = (orgId, options) => {
44
- const { query: queryOptions, request: requestOptions } = options || {};
48
+ const { query: queryOptions, request: requestOptions } = options ?? {};
45
49
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForOrganisationQueryKey(orgId);
46
- const queryFn = () => getProductsForOrganisation(orgId, requestOptions);
50
+ const queryFn = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
47
51
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
48
52
  return __spreadValues({
49
53
  queryKey
@@ -58,38 +62,44 @@ var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
58
62
  }, options);
59
63
  };
60
64
  var useCreateUnitProduct = (options) => {
61
- const { mutation: mutationOptions, request: requestOptions } = options || {};
65
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
62
66
  const mutationFn = (props) => {
63
- const { unitId, data } = props || {};
67
+ const { unitId, data } = props ?? {};
64
68
  return createUnitProduct(unitId, data, requestOptions);
65
69
  };
66
70
  return useMutation(mutationFn, mutationOptions);
67
71
  };
68
- var getProductsForUnit = (unitId, options) => {
69
- return customInstance({ url: `/product/unit/${unitId}`, method: "get" }, options);
72
+ var getProductsForUnit = (unitId, options, signal) => {
73
+ return customInstance({ url: `/product/unit/${unitId}`, method: "get", signal }, options);
70
74
  };
71
75
  var getGetProductsForUnitQueryKey = (unitId) => [
72
76
  `/product/unit/${unitId}`
73
77
  ];
74
78
  var useGetProductsForUnit = (unitId, options) => {
75
- const { query: queryOptions, request: requestOptions } = options || {};
79
+ const { query: queryOptions, request: requestOptions } = options ?? {};
76
80
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
77
- const queryFn = () => getProductsForUnit(unitId, requestOptions);
81
+ const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
78
82
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
79
83
  return __spreadValues({
80
84
  queryKey
81
85
  }, query);
82
86
  };
83
- var getProduct = (unitId, productId, options) => {
84
- return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "get" }, options);
87
+ var getProduct = (unitId, productId, options, signal) => {
88
+ return customInstance({
89
+ url: `/product/unit/${unitId}/product/${productId}`,
90
+ method: "get",
91
+ signal
92
+ }, options);
85
93
  };
86
94
  var getGetProductQueryKey = (unitId, productId) => [
87
95
  `/product/unit/${unitId}/product/${productId}`
88
96
  ];
89
97
  var useGetProduct = (unitId, productId, options) => {
90
- const { query: queryOptions, request: requestOptions } = options || {};
98
+ const { query: queryOptions, request: requestOptions } = options ?? {};
91
99
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductQueryKey(unitId, productId);
92
- const queryFn = () => getProduct(unitId, productId, requestOptions);
100
+ const queryFn = ({
101
+ signal
102
+ }) => getProduct(unitId, productId, requestOptions, signal);
93
103
  const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitId && productId) }, queryOptions));
94
104
  return __spreadValues({
95
105
  queryKey
@@ -99,9 +109,9 @@ var deleteProduct = (unitId, productId, options) => {
99
109
  return customInstance({ url: `/product/unit/${unitId}/product/${productId}`, method: "delete" }, options);
100
110
  };
101
111
  var useDeleteProduct = (options) => {
102
- const { mutation: mutationOptions, request: requestOptions } = options || {};
112
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
103
113
  const mutationFn = (props) => {
104
- const { unitId, productId } = props || {};
114
+ const { unitId, productId } = props ?? {};
105
115
  return deleteProduct(unitId, productId, requestOptions);
106
116
  };
107
117
  return useMutation(mutationFn, mutationOptions);
@@ -115,9 +125,9 @@ var patchProduct = (unitId, productId, productPatchBodyBody, options) => {
115
125
  }, options);
116
126
  };
117
127
  var usePatchProduct = (options) => {
118
- const { mutation: mutationOptions, request: requestOptions } = options || {};
128
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
119
129
  const mutationFn = (props) => {
120
- const { unitId, productId, data } = props || {};
130
+ const { unitId, productId, data } = props ?? {};
121
131
  return patchProduct(unitId, productId, data, requestOptions);
122
132
  };
123
133
  return useMutation(mutationFn, mutationOptions);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n AsyncReturnType<typeof getProductTypes>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = AsyncReturnType<typeof getProductTypes>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>\n getProductTypes(requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n AsyncReturnType<typeof getProducts>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = AsyncReturnType<typeof getProducts>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>\n getProducts(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) => [\n `/product/organisation/${orgId}`,\n];\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n AsyncReturnType<typeof getProductsForOrganisation>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = AsyncReturnType<typeof getProductsForOrganisation>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForOrganisation>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForOrganisation>\n > = () => getProductsForOrganisation(orgId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForOrganisation>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n AsyncReturnType<typeof createUnitProduct>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createUnitProduct>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props || {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createUnitProduct>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof getProductsForUnit>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = AsyncReturnType<typeof getProductsForUnit>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getProductsForUnit>\n > = () => getProductsForUnit(unitId, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getProductsForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitId: string, productId: string) => [\n `/product/unit/${unitId}/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n AsyncReturnType<typeof getProduct>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = AsyncReturnType<typeof getProduct>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>\n getProduct(unitId, productId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitId && productId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n AsyncReturnType<typeof deleteProduct>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteProduct>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return deleteProduct(unitId, productId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteProduct>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/unit/${unitId}/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n AsyncReturnType<typeof patchProduct>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchProduct>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props || {};\n\n return patchProduct(unitId, productId, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchProduct>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAyCO,IAAM,kBAAkB,CAC7B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,MAAM,GACtC,OACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,eAAe;AAOzD,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAkE,MACtE,gBAAgB,cAAc;AAEhC,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO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A,EACR,GACA,OACF;AACF;AAQO,IAAM,kBAAkB,CAG7B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,SAAS,CAAC;AAE9C,WAAO,aAAa,QAAQ,WAAW,MAAM,cAAc;AAAA,EAC7D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const getProductTypes = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetTypesResponse>(\n { url: `/product-type`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductTypesQueryKey = () => [`/product-type`];\n\nexport type GetProductTypesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductTypes>>\n>;\nexport type GetProductTypesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductTypes = <\n TData = Awaited<ReturnType<typeof getProductTypes>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductTypes>>> = ({\n signal,\n }) => getProductTypes(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const getProducts = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsQueryKey = () => [`/product`];\n\nexport type GetProductsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProducts>>\n>;\nexport type GetProductsQueryError = ErrorType<AsError | void>;\n\nexport const useGetProducts = <\n TData = Awaited<ReturnType<typeof getProducts>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProducts>>> = ({\n signal,\n }) => getProducts(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to based on an Organisation\n\n * @summary Gets Products for an Organisation\n */\nexport const getProductsForOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForOrganisationQueryKey = (orgId: string) => [\n `/product/organisation/${orgId}`,\n];\n\nexport type GetProductsForOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n>;\nexport type GetProductsForOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForOrganisation = <\n TData = Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForOrganisation>>\n > = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Products are **Subscriptions** that you create in a Unit and use **Merchant** services like the `DATA_MANAGER`.\n\nTypical subscriptions include `DATA_MANAGER_STORAGE_SUBSCRIPTION` and `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION`.\n\nSome subscriptions, like the `DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION` are available i various **flavours** that influence their capabilities. Flavours are typically referred to using the names `BRONZE`, `SILVER` and `GOLD`\n\n * @summary Creates a Product for an Organisational Unit\n */\nexport const createUnitProduct = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitProductPostResponse>(\n {\n url: `/product/unit/${unitId}`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitProductPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateUnitProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof createUnitProduct>>\n>;\nexport type CreateUnitProductMutationBody = UnitProductPostBodyBody;\nexport type CreateUnitProductMutationError = ErrorType<AsError | void>;\n\nexport const useCreateUnitProduct = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createUnitProduct>>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return createUnitProduct(unitId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createUnitProduct>>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const getProductsForUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetResponse>(\n { url: `/product/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductsForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type GetProductsForUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductsForUnit>>\n>;\nexport type GetProductsForUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetProductsForUnit = <\n TData = Awaited<ReturnType<typeof getProductsForUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductsForUnit>>\n > = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const getProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n {\n url: `/product/unit/${unitId}/product/${productId}`,\n method: \"get\",\n signal,\n },\n options\n );\n};\n\nexport const getGetProductQueryKey = (unitId: string, productId: string) => [\n `/product/unit/${unitId}/product/${productId}`,\n];\n\nexport type GetProductQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProduct>>\n>;\nexport type GetProductQueryError = ErrorType<AsError | void>;\n\nexport const useGetProduct = <\n TData = Awaited<ReturnType<typeof getProduct>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProduct>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(unitId, productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(unitId && productId), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n unitId: string,\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/product/unit/${unitId}/product/${productId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteProduct>>\n>;\n\nexport type DeleteProductMutationError = ErrorType<AsError>;\n\nexport const useDeleteProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteProduct>>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props ?? {};\n\n return deleteProduct(unitId, productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`\n\n * @summary Adjust an existing Product\n */\nexport const patchProduct = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/product/unit/${unitId}/product/${productId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: productPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchProductMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchProduct>>\n>;\nexport type PatchProductMutationBody = ProductPatchBodyBody;\nexport type PatchProductMutationError = ErrorType<AsError>;\n\nexport const usePatchProduct = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchProduct>>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props ?? {};\n\n return patchProduct(unitId, productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAsCO,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO,GAC9C,OACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,eAAe;AAOzD,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,QACI,gBAAgB,gBAAgB,MAAM;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,cAAc,CACzB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACz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