@squonk/account-server-client 0.1.31 → 0.1.32-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 (59) hide show
  1. package/asset/asset.cjs +130 -0
  2. package/asset/asset.cjs.map +1 -0
  3. package/asset/asset.d.ts +126 -0
  4. package/asset/asset.js +130 -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-6b9df5d3.d.ts} +124 -34
  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 +17 -16
  28. package/product/product.js +36 -26
  29. package/product/product.js.map +1 -1
  30. package/src/account-server-api.schemas.ts +152 -46
  31. package/src/asset/asset.ts +430 -0
  32. package/src/merchant/merchant.ts +145 -0
  33. package/src/organisation/organisation.ts +37 -37
  34. package/src/product/product.ts +91 -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 +14 -13
  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-6b9df5d3.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;
@@ -54,7 +55,7 @@ declare const useGetProductsForOrganisation: <TData = ProductsGetResponse, TErro
54
55
  * @summary Creates a Product for an Organisational Unit
55
56
  */
56
57
  declare const createUnitProduct: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<UnitProductPostResponse>;
57
- declare type CreateUnitProductMutationResult = NonNullable<AsyncReturnType<typeof createUnitProduct>>;
58
+ declare type CreateUnitProductMutationResult = NonNullable<Awaited<ReturnType<typeof createUnitProduct>>>;
58
59
  declare type CreateUnitProductMutationBody = UnitProductPostBodyBody;
59
60
  declare type CreateUnitProductMutationError = ErrorType<AsError | void>;
60
61
  declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
@@ -72,9 +73,9 @@ declare const useCreateUnitProduct: <TError = ErrorType<void | AsError>, TContex
72
73
 
73
74
  * @summary Gets Products for an Organisational Unit
74
75
  */
75
- declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductsGetResponse>;
76
+ declare const getProductsForUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductsGetResponse>;
76
77
  declare const getGetProductsForUnitQueryKey: (unitId: string) => string[];
77
- declare type GetProductsForUnitQueryResult = NonNullable<AsyncReturnType<typeof getProductsForUnit>>;
78
+ declare type GetProductsForUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getProductsForUnit>>>;
78
79
  declare type GetProductsForUnitQueryError = ErrorType<void | AsError>;
79
80
  declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
80
81
  query?: UseQueryOptions<ProductsGetResponse, TError, TData, QueryKey> | undefined;
@@ -87,9 +88,9 @@ declare const useGetProductsForUnit: <TData = ProductsGetResponse, TError = Erro
87
88
 
88
89
  * @summary Gets a Unit's Product
89
90
  */
90
- declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<ProductUnitGetResponse>;
91
+ declare const getProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<ProductUnitGetResponse>;
91
92
  declare const getGetProductQueryKey: (unitId: string, productId: string) => string[];
92
- declare type GetProductQueryResult = NonNullable<AsyncReturnType<typeof getProduct>>;
93
+ declare type GetProductQueryResult = NonNullable<Awaited<ReturnType<typeof getProduct>>>;
93
94
  declare type GetProductQueryError = ErrorType<AsError | void>;
94
95
  declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType<void | AsError>>(unitId: string, productId: string, options?: {
95
96
  query?: UseQueryOptions<ProductUnitGetResponse, TError, TData, QueryKey> | undefined;
@@ -101,7 +102,7 @@ declare const useGetProduct: <TData = ProductUnitGetResponse, TError = ErrorType
101
102
  * @summary Deletes an existing Product
102
103
  */
103
104
  declare const deleteProduct: (unitId: string, productId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
104
- declare type DeleteProductMutationResult = NonNullable<AsyncReturnType<typeof deleteProduct>>;
105
+ declare type DeleteProductMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProduct>>>;
105
106
  declare type DeleteProductMutationError = ErrorType<AsError>;
106
107
  declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
107
108
  mutation?: UseMutationOptions<void, TError, {
@@ -119,7 +120,7 @@ declare const useDeleteProduct: <TError = ErrorType<AsError>, TContext = unknown
119
120
  * @summary Adjust an existing Product
120
121
  */
121
122
  declare const patchProduct: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
122
- declare type PatchProductMutationResult = NonNullable<AsyncReturnType<typeof patchProduct>>;
123
+ declare type PatchProductMutationResult = NonNullable<Awaited<ReturnType<typeof patchProduct>>>;
123
124
  declare type PatchProductMutationBody = ProductPatchBodyBody;
124
125
  declare type PatchProductMutationError = ErrorType<AsError>;
125
126
  declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
@@ -135,4 +136,4 @@ declare const usePatchProduct: <TError = ErrorType<AsError>, TContext = unknown>
135
136
  data: ProductPatchBodyBody;
136
137
  }, TContext>;
137
138
 
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 };
139
+ 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,IAAM,6BAA6B,CACxC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,yBAAyB,SAAS,QAAQ,MAAM,GACvD,OACF;AACF;AAEO,IAAM,wCAAwC,CAAC,UAAkB;AAAA,EACtE,yBAAyB;AAC3B;AAOO,IAAM,gCAAgC,CAI3C,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,sCAAsC,KAAK;AAEvE,QAAM,U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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 * @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,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;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;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,cA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E,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,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.7.1 🍺
2
+ * Generated by orval v6.8.0 🍺
3
3
  * Do not edit manually.
4
4
  * Account Server API
5
5
  * The Informatics Matters Account Server API.
@@ -8,6 +8,42 @@ A service that provides access to the Account Server, which gives *registered* u
8
8
 
9
9
  * OpenAPI spec version: 0.1
10
10
  */
11
+ export type DetachAssetParams = { m_id?: QMIdParameter };
12
+
13
+ export type AttachAssetParams = { m_id?: QMIdParameter };
14
+
15
+ /**
16
+ * A User Identity
17
+ */
18
+ export type QUserIdParameter = string;
19
+
20
+ /**
21
+ * A Product Identity
22
+ */
23
+ export type QProductIdParameter = string;
24
+
25
+ /**
26
+ * A Unit Identity
27
+ */
28
+ export type QUnitIdParameter = string;
29
+
30
+ export type GetAssetParams = {
31
+ user_id?: QUserIdParameter;
32
+ product_id?: QProductIdParameter;
33
+ unit_id?: QUnitIdParameter;
34
+ org_id?: QOrgIdParameter;
35
+ };
36
+
37
+ /**
38
+ * A Merchant Identity
39
+ */
40
+ export type QMIdParameter = number;
41
+
42
+ /**
43
+ * An Organisation Identity
44
+ */
45
+ export type QOrgIdParameter = string;
46
+
11
47
  export type ProductPatchBodyBody = {
12
48
  /** The name you want to give the Product */
13
49
  name?: string;
@@ -21,18 +57,15 @@ export type ProductPatchBodyBody = {
21
57
  * The Flavour of the Product. Used only for Project Tier Products. Do not set this for Storage products
22
58
  */
23
59
  export type UnitProductPostBodyBodyFlavour =
24
- | "EVALUATION"
25
- | "BRONZE"
26
- | "SILVER"
27
- | "GOLD";
60
+ typeof UnitProductPostBodyBodyFlavour[keyof typeof UnitProductPostBodyBodyFlavour];
28
61
 
29
62
  // eslint-disable-next-line @typescript-eslint/no-redeclare
30
63
  export const UnitProductPostBodyBodyFlavour = {
31
- EVALUATION: "EVALUATION" as UnitProductPostBodyBodyFlavour,
32
- BRONZE: "BRONZE" as UnitProductPostBodyBodyFlavour,
33
- SILVER: "SILVER" as UnitProductPostBodyBodyFlavour,
34
- GOLD: "GOLD" as UnitProductPostBodyBodyFlavour,
35
- };
64
+ EVALUATION: "EVALUATION",
65
+ BRONZE: "BRONZE",
66
+ SILVER: "SILVER",
67
+ GOLD: "GOLD",
68
+ } as const;
36
69
 
37
70
  /**
38
71
  * The Type of Product. Storage subscriptions require an **Allowance** to be defined and the **Flavour** must not be provided.
@@ -40,16 +73,14 @@ export const UnitProductPostBodyBodyFlavour = {
40
73
  Project Tier subscriptions have built-in allowances and Limits so you must not provide values for these for these products
41
74
  */
42
75
  export type UnitProductPostBodyBodyType =
43
- | "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION"
44
- | "DATA_MANAGER_STORAGE_SUBSCRIPTION";
76
+ typeof UnitProductPostBodyBodyType[keyof typeof UnitProductPostBodyBodyType];
45
77
 
46
78
  // eslint-disable-next-line @typescript-eslint/no-redeclare
47
79
  export const UnitProductPostBodyBodyType = {
48
80
  DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:
49
- "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION" as UnitProductPostBodyBodyType,
50
- DATA_MANAGER_STORAGE_SUBSCRIPTION:
51
- "DATA_MANAGER_STORAGE_SUBSCRIPTION" as UnitProductPostBodyBodyType,
52
- };
81
+ "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
82
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION",
83
+ } as const;
53
84
 
54
85
  export type UnitProductPostBodyBody = {
55
86
  /** The name you want to give the Product */
@@ -82,6 +113,31 @@ export type OrganisationPostBodyBody = {
82
113
  owner: string;
83
114
  };
84
115
 
116
+ export type AssetPostBodyBodyScope =
117
+ typeof AssetPostBodyBodyScope[keyof typeof AssetPostBodyBodyScope];
118
+
119
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
120
+ export const AssetPostBodyBodyScope = {
121
+ USER: "USER",
122
+ PRODUCT: "PRODUCT",
123
+ UNIT: "UNIT",
124
+ ORGANISATION: "ORGANISATION",
125
+ } as const;
126
+
127
+ export type AssetPostBodyBody = {
128
+ /** The name of the asset. This must be unique within its scope. For example, only one asset can be called "asset-1" within a given Unit. Asset names must be valid RFC 1123 Label Names */
129
+ name: string;
130
+ /** A file containing the content for the asset. You must provide a value here or in content_string */
131
+ content_file?: Blob;
132
+ /** The textual content of the asset. You must provide a value here or in content_file */
133
+ content_string?: string;
134
+ scope: AssetPostBodyBodyScope;
135
+ /** 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 */
136
+ scope_id?: string;
137
+ /** Is this a secret asset? */
138
+ secret: boolean;
139
+ };
140
+
85
141
  export interface UserDetail {
86
142
  /** The user identity (username) */
87
143
  id: string;
@@ -109,26 +165,31 @@ export interface UnitDetail {
109
165
  /**
110
166
  * The kind of Service
111
167
  */
112
- export type ServiceGetResponseKind = "DATA_MANAGER";
168
+ export type MerchantDetailKind =
169
+ typeof MerchantDetailKind[keyof typeof MerchantDetailKind];
113
170
 
114
171
  // eslint-disable-next-line @typescript-eslint/no-redeclare
115
- export const ServiceGetResponseKind = {
116
- DATA_MANAGER: "DATA_MANAGER" as ServiceGetResponseKind,
117
- };
172
+ export const MerchantDetailKind = {
173
+ DATA_MANAGER: "DATA_MANAGER",
174
+ } as const;
118
175
 
119
- export interface ServiceGetResponse {
176
+ export interface MerchantDetail {
120
177
  /** The unique ID of the Service */
121
178
  id: number;
122
179
  /** The kind of Service */
123
- kind: ServiceGetResponseKind;
180
+ kind: MerchantDetailKind;
124
181
  /** The name assigned to the Service */
125
- name?: string;
182
+ name: string;
183
+ /** The hostname used by the Service */
184
+ api_hostname: string;
126
185
  }
127
186
 
128
- export interface ServicesGetResponse {
129
- /** The list of known Services
187
+ export type MerchantGetResponse = MerchantDetail;
188
+
189
+ export interface MerchantsGetResponse {
190
+ /** The list of known Merchants
130
191
  */
131
- services: ServiceGetResponse[];
192
+ merchants: MerchantDetail[];
132
193
  }
133
194
 
134
195
  export interface OrganisationDetail {
@@ -144,13 +205,24 @@ export interface OrganisationDetail {
144
205
  private: boolean;
145
206
  }
146
207
 
208
+ /**
209
+ * The kind of service that can use the Product
210
+ */
211
+ export type ProductTypeServiceKind =
212
+ typeof ProductTypeServiceKind[keyof typeof ProductTypeServiceKind];
213
+
214
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
215
+ export const ProductTypeServiceKind = {
216
+ DATA_MANAGER: "DATA_MANAGER",
217
+ } as const;
218
+
147
219
  export interface ProductType {
148
220
  /** A product type, this is a unique string amongst all types known to the Account Server */
149
221
  type: string;
150
222
  /** A product flavour. Not all types have a flavour, those that do have a type-specific flavour string */
151
223
  flavour?: string;
152
- /** For a product that belongs to a specific service, the service that owns it is provided */
153
- service?: ServiceGetResponse;
224
+ /** The kind of service that can use the Product */
225
+ service_kind?: ProductTypeServiceKind;
154
226
  }
155
227
 
156
228
  export type ProductInstanceDetailCoins = {
@@ -167,31 +239,30 @@ export interface ProductInstanceDetail {
167
239
  * The Product Type falvour. Not all products have flavours
168
240
 
169
241
  */
170
- export type ProductDetailFlavour = "EVALUATION" | "BRONZE" | "SILVER" | "GOLD";
242
+ export type ProductDetailFlavour =
243
+ typeof ProductDetailFlavour[keyof typeof ProductDetailFlavour];
171
244
 
172
245
  // eslint-disable-next-line @typescript-eslint/no-redeclare
173
246
  export const ProductDetailFlavour = {
174
- EVALUATION: "EVALUATION" as ProductDetailFlavour,
175
- BRONZE: "BRONZE" as ProductDetailFlavour,
176
- SILVER: "SILVER" as ProductDetailFlavour,
177
- GOLD: "GOLD" as ProductDetailFlavour,
178
- };
247
+ EVALUATION: "EVALUATION",
248
+ BRONZE: "BRONZE",
249
+ SILVER: "SILVER",
250
+ GOLD: "GOLD",
251
+ } as const;
179
252
 
180
253
  /**
181
254
  * The Product Type
182
255
 
183
256
  */
184
257
  export type ProductDetailType =
185
- | "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION"
186
- | "DATA_MANAGER_STORAGE_SUBSCRIPTION";
258
+ typeof ProductDetailType[keyof typeof ProductDetailType];
187
259
 
188
260
  // eslint-disable-next-line @typescript-eslint/no-redeclare
189
261
  export const ProductDetailType = {
190
262
  DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION:
191
- "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION" as ProductDetailType,
192
- DATA_MANAGER_STORAGE_SUBSCRIPTION:
193
- "DATA_MANAGER_STORAGE_SUBSCRIPTION" as ProductDetailType,
194
- };
263
+ "DATA_MANAGER_PROJECT_TIER_SUBSCRIPTION",
264
+ DATA_MANAGER_STORAGE_SUBSCRIPTION: "DATA_MANAGER_STORAGE_SUBSCRIPTION",
265
+ } as const;
195
266
 
196
267
  export interface ProductDetail {
197
268
  /** The Product ID
@@ -284,8 +355,37 @@ export interface ProductDmStorage {
284
355
  coins: ProductCoinsDetail;
285
356
  }
286
357
 
358
+ export type AssetDetailScope =
359
+ typeof AssetDetailScope[keyof typeof AssetDetailScope];
360
+
361
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
362
+ export const AssetDetailScope = {
363
+ USER: "USER",
364
+ PRODUCT: "PRODUCT",
365
+ UNIT: "UNIT",
366
+ ORGANISATION: "ORGANISATION",
367
+ } as const;
368
+
369
+ export interface AssetDetail {
370
+ creator: string;
371
+ id: string;
372
+ name: string;
373
+ scope: AssetDetailScope;
374
+ scope_id: string;
375
+ secret: boolean;
376
+ disabled: boolean;
377
+ content: string;
378
+ merchants: MerchantDetail[];
379
+ }
380
+
287
381
  export type UserAccountGetResponse = UserAccountDetail;
288
382
 
383
+ export interface UnitsGetResponse {
384
+ /** A list of Units
385
+ */
386
+ units: OrganisationUnitsGetResponse[];
387
+ }
388
+
289
389
  export interface UnitGetResponse {
290
390
  /** The Unit's unique ID */
291
391
  id: string;
@@ -338,12 +438,6 @@ export interface OrganisationUnitsGetResponse {
338
438
  units: UnitDetail[];
339
439
  }
340
440
 
341
- export interface UnitsGetResponse {
342
- /** A list of Units
343
- */
344
- units: OrganisationUnitsGetResponse[];
345
- }
346
-
347
441
  export interface PersonalUnitPutResponse {
348
442
  /** The unit's Organisation. Used to identify the Default organisation */
349
443
  organisation_id: string;
@@ -389,6 +483,18 @@ export interface StateGetVersionResponse {
389
483
  version: string;
390
484
  }
391
485
 
486
+ export interface AssetPostResponse {
487
+ /** The Asset ID
488
+ */
489
+ id: string;
490
+ }
491
+
492
+ export interface AssetGetResponse {
493
+ /** A list of Assets
494
+ */
495
+ assets: AssetDetail[];
496
+ }
497
+
392
498
  export interface AsError {
393
499
  /** Brief error text that can be presented to the user */
394
500
  error: string;