@squonk/account-server-client 0.1.38-rc.1 → 1.0.0-rc.1

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 (57) hide show
  1. package/asset/asset.cjs +39 -14
  2. package/asset/asset.cjs.map +1 -1
  3. package/asset/asset.d.ts +1 -3
  4. package/asset/asset.js +39 -14
  5. package/asset/asset.js.map +1 -1
  6. package/chunk-3O5KIRV4.js +27 -0
  7. package/{chunk-3TENYKS7.js.map → chunk-3O5KIRV4.js.map} +1 -1
  8. package/chunk-IUEU2LYC.cjs +27 -0
  9. package/chunk-IUEU2LYC.cjs.map +1 -0
  10. package/{custom-instance-00382740.d.ts → custom-instance-b8075093.d.ts} +92 -15
  11. package/index.cjs +11 -2
  12. package/index.cjs.map +1 -1
  13. package/index.d.ts +1 -1
  14. package/index.js +10 -1
  15. package/index.js.map +1 -1
  16. package/merchant/merchant.cjs +14 -5
  17. package/merchant/merchant.cjs.map +1 -1
  18. package/merchant/merchant.d.ts +1 -3
  19. package/merchant/merchant.js +14 -5
  20. package/merchant/merchant.js.map +1 -1
  21. package/organisation/organisation.cjs +22 -10
  22. package/organisation/organisation.cjs.map +1 -1
  23. package/organisation/organisation.d.ts +1 -3
  24. package/organisation/organisation.js +22 -10
  25. package/organisation/organisation.js.map +1 -1
  26. package/package.json +3 -4
  27. package/product/product.cjs +75 -26
  28. package/product/product.cjs.map +1 -1
  29. package/product/product.d.ts +22 -4
  30. package/product/product.js +74 -25
  31. package/product/product.js.map +1 -1
  32. package/src/account-server-api.schemas.ts +109 -14
  33. package/src/asset/asset.ts +2 -6
  34. package/src/merchant/merchant.ts +2 -6
  35. package/src/organisation/organisation.ts +2 -6
  36. package/src/product/product.ts +74 -6
  37. package/src/state/state.ts +2 -6
  38. package/src/unit/unit.ts +4 -8
  39. package/src/user/user.ts +4 -8
  40. package/state/state.cjs +10 -3
  41. package/state/state.cjs.map +1 -1
  42. package/state/state.d.ts +1 -3
  43. package/state/state.js +10 -3
  44. package/state/state.js.map +1 -1
  45. package/unit/unit.cjs +42 -17
  46. package/unit/unit.cjs.map +1 -1
  47. package/unit/unit.d.ts +3 -5
  48. package/unit/unit.js +41 -16
  49. package/unit/unit.js.map +1 -1
  50. package/user/user.cjs +34 -13
  51. package/user/user.cjs.map +1 -1
  52. package/user/user.d.ts +3 -5
  53. package/user/user.js +34 -13
  54. package/user/user.js.map +1 -1
  55. package/chunk-3TENYKS7.js +0 -46
  56. package/chunk-RHHRF25R.cjs +0 -46
  57. package/chunk-RHHRF25R.cjs.map +0 -1
@@ -1,12 +1,14 @@
1
1
  import {
2
- __spreadValues,
3
2
  customInstance
4
- } from "../chunk-3TENYKS7.js";
3
+ } from "../chunk-3O5KIRV4.js";
5
4
 
6
5
  // src/product/product.ts
7
6
  import { useQuery, useMutation } from "react-query";
8
7
  var getProductTypes = (options, signal) => {
9
- return customInstance({ url: `/product-type`, method: "get", signal }, options);
8
+ return customInstance(
9
+ { url: `/product-type`, method: "get", signal },
10
+ options
11
+ );
10
12
  };
11
13
  var getGetProductTypesQueryKey = () => [`/product-type`];
12
14
  var useGetProductTypes = (options) => {
@@ -20,7 +22,10 @@ var useGetProductTypes = (options) => {
20
22
  return query;
21
23
  };
22
24
  var getProducts = (options, signal) => {
23
- return customInstance({ url: `/product`, method: "get", signal }, options);
25
+ return customInstance(
26
+ { url: `/product`, method: "get", signal },
27
+ options
28
+ );
24
29
  };
25
30
  var getGetProductsQueryKey = () => [`/product`];
26
31
  var useGetProducts = (options) => {
@@ -34,7 +39,10 @@ var useGetProducts = (options) => {
34
39
  return query;
35
40
  };
36
41
  var getProductsForOrganisation = (orgId, options, signal) => {
37
- return customInstance({ url: `/product/organisation/${orgId}`, method: "get", signal }, options);
42
+ return customInstance(
43
+ { url: `/product/organisation/${orgId}`, method: "get", signal },
44
+ options
45
+ );
38
46
  };
39
47
  var getGetProductsForOrganisationQueryKey = (orgId) => [
40
48
  `/product/organisation/${orgId}`
@@ -43,17 +51,20 @@ var useGetProductsForOrganisation = (orgId, options) => {
43
51
  const { query: queryOptions, request: requestOptions } = options ?? {};
44
52
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForOrganisationQueryKey(orgId);
45
53
  const queryFn = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
46
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
54
+ const query = useQuery(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
47
55
  query.queryKey = queryKey;
48
56
  return query;
49
57
  };
50
58
  var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
51
- return customInstance({
52
- url: `/product/unit/${unitId}`,
53
- method: "post",
54
- headers: { "Content-Type": "application/json" },
55
- data: unitProductPostBodyBody
56
- }, options);
59
+ return customInstance(
60
+ {
61
+ url: `/product/unit/${unitId}`,
62
+ method: "post",
63
+ headers: { "Content-Type": "application/json" },
64
+ data: unitProductPostBodyBody
65
+ },
66
+ options
67
+ );
57
68
  };
58
69
  var useCreateUnitProduct = (options) => {
59
70
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
@@ -64,7 +75,10 @@ var useCreateUnitProduct = (options) => {
64
75
  return useMutation(mutationFn, mutationOptions);
65
76
  };
66
77
  var getProductsForUnit = (unitId, options, signal) => {
67
- return customInstance({ url: `/product/unit/${unitId}`, method: "get", signal }, options);
78
+ return customInstance(
79
+ { url: `/product/unit/${unitId}`, method: "get", signal },
80
+ options
81
+ );
68
82
  };
69
83
  var getGetProductsForUnitQueryKey = (unitId) => [
70
84
  `/product/unit/${unitId}`
@@ -73,14 +87,18 @@ var useGetProductsForUnit = (unitId, options) => {
73
87
  const { query: queryOptions, request: requestOptions } = options ?? {};
74
88
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductsForUnitQueryKey(unitId);
75
89
  const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
76
- const query = useQuery(queryKey, queryFn, __spreadValues({
77
- enabled: !!unitId
78
- }, queryOptions));
90
+ const query = useQuery(queryKey, queryFn, {
91
+ enabled: !!unitId,
92
+ ...queryOptions
93
+ });
79
94
  query.queryKey = queryKey;
80
95
  return query;
81
96
  };
82
97
  var getProduct = (productId, options, signal) => {
83
- return customInstance({ url: `/product/${productId}`, method: "get", signal }, options);
98
+ return customInstance(
99
+ { url: `/product/${productId}`, method: "get", signal },
100
+ options
101
+ );
84
102
  };
85
103
  var getGetProductQueryKey = (productId) => [
86
104
  `/product/${productId}`
@@ -91,12 +109,19 @@ var useGetProduct = (productId, options) => {
91
109
  const queryFn = ({
92
110
  signal
93
111
  }) => getProduct(productId, requestOptions, signal);
94
- const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!productId }, queryOptions));
112
+ const query = useQuery(
113
+ queryKey,
114
+ queryFn,
115
+ { enabled: !!productId, ...queryOptions }
116
+ );
95
117
  query.queryKey = queryKey;
96
118
  return query;
97
119
  };
98
120
  var deleteProduct = (productId, options) => {
99
- return customInstance({ url: `/product/${productId}`, method: "delete" }, options);
121
+ return customInstance(
122
+ { url: `/product/${productId}`, method: "delete" },
123
+ options
124
+ );
100
125
  };
101
126
  var useDeleteProduct = (options) => {
102
127
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
@@ -107,12 +132,15 @@ var useDeleteProduct = (options) => {
107
132
  return useMutation(mutationFn, mutationOptions);
108
133
  };
109
134
  var patchProduct = (productId, productPatchBodyBody, options) => {
110
- return customInstance({
111
- url: `/product/${productId}`,
112
- method: "patch",
113
- headers: { "Content-Type": "application/json" },
114
- data: productPatchBodyBody
115
- }, options);
135
+ return customInstance(
136
+ {
137
+ url: `/product/${productId}`,
138
+ method: "patch",
139
+ headers: { "Content-Type": "application/json" },
140
+ data: productPatchBodyBody
141
+ },
142
+ options
143
+ );
116
144
  };
117
145
  var usePatchProduct = (options) => {
118
146
  const { mutation: mutationOptions, request: requestOptions } = options ?? {};
@@ -122,15 +150,35 @@ var usePatchProduct = (options) => {
122
150
  };
123
151
  return useMutation(mutationFn, mutationOptions);
124
152
  };
153
+ var getProductCharges = (productId, params, options, signal) => {
154
+ return customInstance(
155
+ { url: `/product/${productId}/charges`, method: "get", params, signal },
156
+ options
157
+ );
158
+ };
159
+ var getGetProductChargesQueryKey = (productId, params) => [`/product/${productId}/charges`, ...params ? [params] : []];
160
+ var useGetProductCharges = (productId, params, options) => {
161
+ const { query: queryOptions, request: requestOptions } = options ?? {};
162
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetProductChargesQueryKey(productId, params);
163
+ const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
164
+ const query = useQuery(queryKey, queryFn, {
165
+ enabled: !!productId,
166
+ ...queryOptions
167
+ });
168
+ query.queryKey = queryKey;
169
+ return query;
170
+ };
125
171
  export {
126
172
  createUnitProduct,
127
173
  deleteProduct,
174
+ getGetProductChargesQueryKey,
128
175
  getGetProductQueryKey,
129
176
  getGetProductTypesQueryKey,
130
177
  getGetProductsForOrganisationQueryKey,
131
178
  getGetProductsForUnitQueryKey,
132
179
  getGetProductsQueryKey,
133
180
  getProduct,
181
+ getProductCharges,
134
182
  getProductTypes,
135
183
  getProducts,
136
184
  getProductsForOrganisation,
@@ -139,6 +187,7 @@ export {
139
187
  useCreateUnitProduct,
140
188
  useDeleteProduct,
141
189
  useGetProduct,
190
+ useGetProductCharges,
142
191
  useGetProductTypes,
143
192
  useGetProducts,
144
193
  useGetProductsForOrganisation,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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 { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\ntype AwaitedInput<T> = PromiseLike<T> | T;\n\ntype Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line\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) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\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) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\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 }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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, {\n enabled: !!unitId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) => [\n `/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 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 = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!productId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/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 { 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 { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { 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 productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/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 { 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 { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;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;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAAkE,CAAC;AAAA,IACvE;AAAA,QACI,YAAY,gBAAgB,MAAM;AAExC,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,6BAA6B,CACxC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,yBAAyB,SAAS,QAAQ,OAAO,OAAO,GAC/D,OACF;AACF;AAEO,IAAM,wCAAwC,CAAC,UAAkB;AAAA,EACtE,yBAAyB;AAC3B;AAOO,IAAM,gCAAgC,CAI3C,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,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;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\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 ProductChargesGetResponse,\n GetProductChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\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) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryKey;\n\n return query;\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 }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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, {\n enabled: !!unitId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * Gets a Product\n\n * @summary Gets a Product\n */\nexport const getProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductUnitGetResponse>(\n { url: `/product/${productId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductQueryKey = (productId: string) => [\n `/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 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 = queryOptions?.queryKey ?? getGetProductQueryKey(productId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProduct>>> = ({\n signal,\n }) => getProduct(productId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!productId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const deleteProduct = (\n productId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/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 { 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 { productId: string }\n > = (props) => {\n const { productId } = props ?? {};\n\n return deleteProduct(productId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteProduct>>,\n TError,\n { 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 productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/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 { 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 { productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { productId, data } = props ?? {};\n\n return patchProduct(productId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchProduct>>,\n TError,\n { productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * 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.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`.\n\nYou need **admin** rights to use this method\n * @summary Get charges made against a Product\n */\nexport const getProductCharges = (\n productId: string,\n params?: GetProductChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductChargesGetResponse>(\n { url: `/product/${productId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams\n) => [`/product/${productId}/charges`, ...(params ? [params] : [])];\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductCharges = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\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 ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductCharges>>\n > = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!productId,\n ...queryOptions,\n }) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAoC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,MAAM,CAAC,eAAe;AAOzD,IAAM,qBAAqB,CAGhC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,2BAA2B;AAEtE,QAAM,UAAsE,CAAC;AAAA,IAC3E;AAAA,EACF,MAAM,gBAAgB,gBAAgB,MAAM;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,cAAc,CACzB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,uBAAuB;AAElE,QAAM,UAAkE,CAAC;AAAA,IACvE;AAAA,EACF,MAAM,YAAY,gBAAgB,MAAM;AAExC,QAAM,QAAQ,SAIZ,UAAU,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.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
8
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
- export type DetachAssetParams = { m_id?: QMIdParameter };
12
-
13
11
  export type AttachAssetParams = { m_id?: QMIdParameter };
14
12
 
13
+ /**
14
+ * A date where assets prior to this will be returned. This can be a date-time string but it is interpreted as a date, i.e. `2020-01-01T00:00:00Z` is interpreted as `2020-01-01`. Any asset that occurs prior this date will be returned. UTC is assumed if no timezone is provided
15
+ */
16
+ export type QUntilParameter = string;
17
+
18
+ /**
19
+ * A date from which to retrieve assets. This can be a date-time string but it is interpreted as a date, i.e. `2020-01-01T00:00:00Z` is interpreted as `2020-01-01`. Any asset that occurs on ar after this date will be returned. UTC is assumed if no timezone is provided
20
+ */
21
+ export type QFromParameter = string;
22
+
23
+ export type GetProductChargesParams = {
24
+ from?: QFromParameter;
25
+ until?: QUntilParameter;
26
+ };
27
+
15
28
  /**
16
29
  * A User Identity
17
30
  */
@@ -39,6 +52,8 @@ export type GetAssetParams = {
39
52
  */
40
53
  export type QMIdParameter = number;
41
54
 
55
+ export type DetachAssetParams = { m_id?: QMIdParameter };
56
+
42
57
  /**
43
58
  * An Organisation Identity
44
59
  */
@@ -130,7 +145,7 @@ export type AssetPostBodyBody = {
130
145
  /** The textual content of the asset. You must provide a value here or in content_file */
131
146
  content_string?: string;
132
147
  scope: AssetPostBodyBodyScope;
133
- /** The unique identity based on the Scope of the asset. For example, this wil be the Unit ID if it's a UNIT. A scope_id is required if the scope is USER as it wil be automatically set to your username */
148
+ /** The unique identity based on the Scope of the asset. For example, this will be the Unit ID if it's a UNIT. A scope_id is required if the scope is USER as it will be automatically set to your username */
134
149
  scope_id?: string;
135
150
  /** Is this a secret asset? */
136
151
  secret: boolean;
@@ -160,6 +175,7 @@ export interface UnitDetail {
160
175
  owner_id: string;
161
176
  /** True if the Unit is private */
162
177
  private: boolean;
178
+ created: string;
163
179
  }
164
180
 
165
181
  /**
@@ -176,6 +192,7 @@ export const MerchantDetailKind = {
176
192
  export interface MerchantDetail {
177
193
  /** The unique ID of the Service */
178
194
  id: number;
195
+ created: string;
179
196
  /** The kind of Service */
180
197
  kind: MerchantDetailKind;
181
198
  /** The name assigned to the Service */
@@ -203,6 +220,7 @@ export interface OrganisationDetail {
203
220
  owner_id?: string;
204
221
  /** True if the Unit is private */
205
222
  private: boolean;
223
+ created: string;
206
224
  }
207
225
 
208
226
  /**
@@ -236,7 +254,7 @@ export interface ProductInstanceDetail {
236
254
  }
237
255
 
238
256
  /**
239
- * The Product Type falvour. Not all products have flavours
257
+ * The Product Type flavour. Not all products have flavours
240
258
 
241
259
  */
242
260
  export type ProductDetailFlavour =
@@ -268,10 +286,11 @@ export interface ProductDetail {
268
286
  /** The Product ID
269
287
  */
270
288
  id: string;
289
+ created: string;
271
290
  /** The Product Type
272
291
  */
273
292
  type: ProductDetailType;
274
- /** The Product Type falvour. Not all products have flavours
293
+ /** The Product Type flavour. Not all products have flavours
275
294
  */
276
295
  flavour?: ProductDetailFlavour;
277
296
  /** The name of the Product
@@ -352,6 +371,53 @@ export interface ProductDmStorage {
352
371
  coins: ProductCoinsDetail;
353
372
  }
354
373
 
374
+ export interface ChargeAdditionalData {
375
+ [key: string]: any;
376
+ }
377
+
378
+ export interface StorageChargeItem {
379
+ item_number: number;
380
+ /** The date and time of the processing charge */
381
+ date: string;
382
+ /** The coin-cost of the storage */
383
+ coins: string;
384
+ additional_data?: ChargeAdditionalData;
385
+ }
386
+
387
+ export interface StorageCharges {
388
+ num_items: number;
389
+ items: StorageChargeItem[];
390
+ }
391
+
392
+ export interface ProcessingChargeItem {
393
+ item_number: number;
394
+ /** The most recent sequence number for this charge */
395
+ sqn: number;
396
+ name?: string;
397
+ username: string;
398
+ /** The date and time of the processing charge */
399
+ timestamp: string;
400
+ /** The coin-cost of the storage */
401
+ coins: string;
402
+ additional_data?: ChargeAdditionalData;
403
+ }
404
+
405
+ export type ProcessingChargesMerchantKind =
406
+ typeof ProcessingChargesMerchantKind[keyof typeof ProcessingChargesMerchantKind];
407
+
408
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
409
+ export const ProcessingChargesMerchantKind = {
410
+ DATA_MANAGER: "DATA_MANAGER",
411
+ } as const;
412
+
413
+ export interface ProcessingCharges {
414
+ merchant_name: string;
415
+ merchant_kind: ProcessingChargesMerchantKind;
416
+ merchant_api_hostname: string;
417
+ num_items: number;
418
+ items: ProcessingChargeItem[];
419
+ }
420
+
355
421
  export type AssetDetailScope =
356
422
  typeof AssetDetailScope[keyof typeof AssetDetailScope];
357
423
 
@@ -379,16 +445,10 @@ export interface AssetDetail {
379
445
 
380
446
  export type UserAccountGetResponse = UserAccountDetail;
381
447
 
382
- export interface UnitsGetResponse {
383
- /** A list of Units
384
- */
385
- units: OrganisationUnitsGetResponse[];
386
- }
387
-
388
448
  export type UnitGetResponse = UnitDetail;
389
449
 
390
450
  export interface UnitProductPostResponse {
391
- /** The Products's unique ID */
451
+ /** The Product's unique ID */
392
452
  id: string;
393
453
  }
394
454
 
@@ -418,6 +478,34 @@ export interface ProductsGetResponse {
418
478
  products: ProductsGetResponseProductsItem[];
419
479
  }
420
480
 
481
+ export type ProductChargesGetResponseProductType =
482
+ typeof ProductChargesGetResponseProductType[keyof typeof ProductChargesGetResponseProductType];
483
+
484
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
485
+ export const ProductChargesGetResponseProductType = {
486
+ DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:
487
+ "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
488
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION",
489
+ } as const;
490
+
491
+ export interface ProductChargesGetResponse {
492
+ product_id: string;
493
+ product_type: ProductChargesGetResponseProductType;
494
+ billing_day: number;
495
+ /** The claim, if present, for claimable products */
496
+ claim_id?: string;
497
+ /** The claim name, if present, for claimable products */
498
+ claim_name?: string;
499
+ /** The start of the charge period */
500
+ from: string;
501
+ /** The date where of first day after the charge period */
502
+ until: string;
503
+ /** The total number of cons consumed by this product for the invoice period */
504
+ coins: string;
505
+ processing_charges: ProcessingCharges[];
506
+ storage_charges: StorageCharges;
507
+ }
508
+
421
509
  export interface OrganisationsGetResponse {
422
510
  /** A list of Organisations */
423
511
  organisations: OrganisationDetail[];
@@ -430,6 +518,12 @@ export interface OrganisationUnitsGetResponse {
430
518
  units: UnitDetail[];
431
519
  }
432
520
 
521
+ export interface UnitsGetResponse {
522
+ /** A list of Units
523
+ */
524
+ units: OrganisationUnitsGetResponse[];
525
+ }
526
+
433
527
  export interface PersonalUnitPutResponse {
434
528
  /** The unit's Organisation. Used to identify the Default organisation */
435
529
  organisation_id: string;
@@ -454,6 +548,7 @@ export interface OrganisationGetDefaultResponse {
454
548
  /** True if the Organisation is private. The Default organisation is always public, although it does not contain a membership (unless you're admin) and only houses Personal Units
455
549
  */
456
550
  private: boolean;
551
+ created: string;
457
552
  }
458
553
 
459
554
  export interface UsersGetResponse {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
8
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery, useMutation } from "react-query";
12
12
  import type {
@@ -29,10 +29,6 @@ import type {
29
29
  import { customInstance } from ".././custom-instance";
30
30
  import type { ErrorType } from ".././custom-instance";
31
31
 
32
- type AwaitedInput<T> = PromiseLike<T> | T;
33
-
34
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
32
  // eslint-disable-next-line
37
33
  type SecondParameter<T extends (...args: any) => any> = T extends (
38
34
  config: any,
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
8
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery } from "react-query";
12
12
  import type {
@@ -23,10 +23,6 @@ import type {
23
23
  import { customInstance } from ".././custom-instance";
24
24
  import type { ErrorType } from ".././custom-instance";
25
25
 
26
- type AwaitedInput<T> = PromiseLike<T> | T;
27
-
28
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
29
-
30
26
  // eslint-disable-next-line
31
27
  type SecondParameter<T extends (...args: any) => any> = T extends (
32
28
  config: any,
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Generated by orval v6.9.0 🍺
2
+ * Generated by orval v6.9.1 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
6
6
 
7
7
  A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
8
8
 
9
- * OpenAPI spec version: 0.1
9
+ * OpenAPI spec version: 1.0
10
10
  */
11
11
  import { useQuery, useMutation } from "react-query";
12
12
  import type {
@@ -27,10 +27,6 @@ import type {
27
27
  import { customInstance } from ".././custom-instance";
28
28
  import type { ErrorType } from ".././custom-instance";
29
29
 
30
- type AwaitedInput<T> = PromiseLike<T> | T;
31
-
32
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
33
-
34
30
  // eslint-disable-next-line
35
31
  type SecondParameter<T extends (...args: any) => any> = T extends (
36
32
  config: any,