@squonk/account-server-client 2.0.3 → 2.0.4-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/admin/admin.cjs +8 -6
  2. package/admin/admin.cjs.map +1 -1
  3. package/admin/admin.d.ts +4 -4
  4. package/admin/admin.js +7 -5
  5. package/admin/admin.js.map +1 -1
  6. package/asset/asset.cjs +15 -13
  7. package/asset/asset.cjs.map +1 -1
  8. package/asset/asset.d.ts +20 -20
  9. package/asset/asset.js +7 -5
  10. package/asset/asset.js.map +1 -1
  11. package/{chunk-3O5KIRV4.js → chunk-3RNIDX7T.js} +1 -1
  12. package/{chunk-3O5KIRV4.js.map → chunk-3RNIDX7T.js.map} +1 -1
  13. package/chunk-7XN3IQYV.cjs +13 -0
  14. package/chunk-7XN3IQYV.cjs.map +1 -0
  15. package/{chunk-IUEU2LYC.cjs → chunk-UZTHSGDT.cjs} +1 -1
  16. package/chunk-UZTHSGDT.cjs.map +1 -0
  17. package/chunk-YEX2SGER.js +13 -0
  18. package/chunk-YEX2SGER.js.map +1 -0
  19. package/{custom-instance-dad9d28e.d.ts → custom-instance-85497958.d.ts} +110 -48
  20. package/index.cjs +2 -2
  21. package/index.cjs.map +1 -1
  22. package/index.d.ts +1 -1
  23. package/index.js +1 -1
  24. package/index.js.map +1 -1
  25. package/merchant/merchant.cjs +12 -9
  26. package/merchant/merchant.cjs.map +1 -1
  27. package/merchant/merchant.d.ts +6 -6
  28. package/merchant/merchant.js +10 -7
  29. package/merchant/merchant.js.map +1 -1
  30. package/organisation/organisation.cjs +44 -16
  31. package/organisation/organisation.cjs.map +1 -1
  32. package/organisation/organisation.d.ts +37 -16
  33. package/organisation/organisation.js +38 -10
  34. package/organisation/organisation.js.map +1 -1
  35. package/package.json +12 -12
  36. package/product/product.cjs +35 -33
  37. package/product/product.cjs.map +1 -1
  38. package/product/product.d.ts +24 -24
  39. package/product/product.js +25 -23
  40. package/product/product.js.map +1 -1
  41. package/src/account-server-api.schemas.ts +85 -17
  42. package/src/admin/admin.ts +6 -5
  43. package/src/asset/asset.ts +6 -5
  44. package/src/merchant/merchant.ts +10 -9
  45. package/src/organisation/organisation.ts +78 -19
  46. package/src/product/product.ts +30 -32
  47. package/src/queryMutator.ts +12 -0
  48. package/src/state/state.ts +6 -5
  49. package/src/unit/unit.ts +78 -19
  50. package/src/user/user.ts +14 -15
  51. package/state/state.cjs +8 -6
  52. package/state/state.cjs.map +1 -1
  53. package/state/state.d.ts +4 -4
  54. package/state/state.js +7 -5
  55. package/state/state.js.map +1 -1
  56. package/unit/unit.cjs +46 -25
  57. package/unit/unit.cjs.map +1 -1
  58. package/unit/unit.d.ts +42 -21
  59. package/unit/unit.js +38 -17
  60. package/unit/unit.js.map +1 -1
  61. package/user/user.cjs +20 -17
  62. package/user/user.cjs.map +1 -1
  63. package/user/user.d.ts +16 -16
  64. package/user/user.js +13 -10
  65. package/user/user.js.map +1 -1
  66. package/chunk-IUEU2LYC.cjs.map +0 -1
@@ -1,9 +1,9 @@
1
- import { aC as customInstance, ak as OrganisationsGetResponse, aD as ErrorType, ay as AsError, o as OrganisationPostBodyBody, at as OrganisationPostResponse, y as OrganisationDetail, k as GetOrganisationChargesParams, am as OrganisationChargesGetResponse, ar as OrganisationGetDefaultResponse } from '../custom-instance-dad9d28e.js';
1
+ import { aE as customInstance, am as OrganisationsGetResponse, aF as ErrorType, aA as AsError, q as OrganisationPostBodyBody, av as OrganisationPostResponse, B as OrganisationDetail, O as OrganisationPatchBodyBody, G as GetOrganisationChargesParams, ao as OrganisationChargesGetResponse, at as OrganisationGetDefaultResponse } from '../custom-instance-85497958.js';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
4
4
  import 'axios';
5
5
 
6
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
6
+ type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
7
  /**
8
8
  * Gets all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations
9
9
 
@@ -11,8 +11,8 @@ declare type SecondParameter<T extends (...args: any) => any> = T extends (confi
11
11
  */
12
12
  declare const getOrganisations: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationsGetResponse>;
13
13
  declare const getGetOrganisationsQueryKey: () => string[];
14
- declare type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>;
15
- declare type GetOrganisationsQueryError = ErrorType<void | AsError>;
14
+ type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>;
15
+ type GetOrganisationsQueryError = ErrorType<void | AsError>;
16
16
  declare const useGetOrganisations: <TData = OrganisationsGetResponse, TError = ErrorType<void | AsError>>(options?: {
17
17
  query?: UseQueryOptions<OrganisationsGetResponse, TError, TData, QueryKey> | undefined;
18
18
  request?: SecondParameter<typeof customInstance>;
@@ -27,9 +27,9 @@ You need **admin** rights to use this method
27
27
  * @summary Create a new organisation
28
28
  */
29
29
  declare const createOrganisation: (organisationPostBodyBody: OrganisationPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationPostResponse>;
30
- declare type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>;
31
- declare type CreateOrganisationMutationBody = OrganisationPostBodyBody;
32
- declare type CreateOrganisationMutationError = ErrorType<AsError | void>;
30
+ type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>;
31
+ type CreateOrganisationMutationBody = OrganisationPostBodyBody;
32
+ type CreateOrganisationMutationError = ErrorType<AsError | void>;
33
33
  declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
34
34
  mutation?: UseMutationOptions<OrganisationPostResponse, TError, {
35
35
  data: OrganisationPostBodyBody;
@@ -45,14 +45,35 @@ declare const useCreateOrganisation: <TError = ErrorType<void | AsError>, TConte
45
45
  */
46
46
  declare const getOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationDetail>;
47
47
  declare const getGetOrganisationQueryKey: (orgId: string) => string[];
48
- declare type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>;
49
- declare type GetOrganisationQueryError = ErrorType<void | AsError>;
48
+ type GetOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisation>>>;
49
+ type GetOrganisationQueryError = ErrorType<void | AsError>;
50
50
  declare const useGetOrganisation: <TData = OrganisationDetail, TError = ErrorType<void | AsError>>(orgId: string, options?: {
51
51
  query?: UseQueryOptions<OrganisationDetail, TError, TData, QueryKey> | undefined;
52
52
  request?: SecondParameter<typeof customInstance>;
53
53
  } | undefined) => UseQueryResult<TData, TError> & {
54
54
  queryKey: QueryKey;
55
55
  };
56
+ /**
57
+ * Used to update existing **Organisation**.
58
+
59
+ You have to be the Organisation owner (or an administrator) to patch an Organisation.
60
+
61
+ * @summary Adjust an existing Organisation
62
+ */
63
+ declare const patchOrganisation: (orgId: string, organisationPatchBodyBody: OrganisationPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
64
+ type PatchOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof patchOrganisation>>>;
65
+ type PatchOrganisationMutationBody = OrganisationPatchBodyBody;
66
+ type PatchOrganisationMutationError = ErrorType<AsError>;
67
+ declare const usePatchOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
68
+ mutation?: UseMutationOptions<void, TError, {
69
+ orgId: string;
70
+ data: OrganisationPatchBodyBody;
71
+ }, TContext> | undefined;
72
+ request?: SecondParameter<typeof customInstance>;
73
+ } | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
74
+ orgId: string;
75
+ data: OrganisationPatchBodyBody;
76
+ }, TContext>;
56
77
  /**
57
78
  * Units must first be deleted before an Organisation can be deleted
58
79
 
@@ -61,8 +82,8 @@ You need **admin** rights to use this method
61
82
  * @summary Deletes an Organisation
62
83
  */
63
84
  declare const deleteOrganisation: (orgId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
64
- declare type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>;
65
- declare type DeleteOrganisationMutationError = ErrorType<AsError>;
85
+ type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>;
86
+ type DeleteOrganisationMutationError = ErrorType<AsError>;
66
87
  declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
67
88
  mutation?: UseMutationOptions<void, TError, {
68
89
  orgId: string;
@@ -78,8 +99,8 @@ declare const useDeleteOrganisation: <TError = ErrorType<AsError>, TContext = un
78
99
  */
79
100
  declare const getOrganisationCharges: (orgId: string, params?: GetOrganisationChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationChargesGetResponse>;
80
101
  declare const getGetOrganisationChargesQueryKey: (orgId: string, params?: GetOrganisationChargesParams) => (string | GetOrganisationChargesParams)[];
81
- declare type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>;
82
- declare type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
102
+ type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>;
103
+ type GetOrganisationChargesQueryError = ErrorType<void | AsError>;
83
104
  declare const useGetOrganisationCharges: <TData = OrganisationChargesGetResponse, TError = ErrorType<void | AsError>>(orgId: string, params?: GetOrganisationChargesParams, options?: {
84
105
  query?: UseQueryOptions<OrganisationChargesGetResponse, TError, TData, QueryKey> | undefined;
85
106
  request?: SecondParameter<typeof customInstance>;
@@ -93,8 +114,8 @@ declare const useGetOrganisationCharges: <TData = OrganisationChargesGetResponse
93
114
  */
94
115
  declare const getDefaultOrganisation: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationGetDefaultResponse>;
95
116
  declare const getGetDefaultOrganisationQueryKey: () => string[];
96
- declare type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>;
97
- declare type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
117
+ type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>;
118
+ type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;
98
119
  declare const useGetDefaultOrganisation: <TData = OrganisationGetDefaultResponse, TError = ErrorType<void | AsError>>(options?: {
99
120
  query?: UseQueryOptions<OrganisationGetDefaultResponse, TError, TData, QueryKey> | undefined;
100
121
  request?: SecondParameter<typeof customInstance>;
@@ -102,4 +123,4 @@ declare const useGetDefaultOrganisation: <TData = OrganisationGetDefaultResponse
102
123
  queryKey: QueryKey;
103
124
  };
104
125
 
105
- export { CreateOrganisationMutationBody, CreateOrganisationMutationError, CreateOrganisationMutationResult, DeleteOrganisationMutationError, DeleteOrganisationMutationResult, GetDefaultOrganisationQueryError, GetDefaultOrganisationQueryResult, GetOrganisationChargesQueryError, GetOrganisationChargesQueryResult, GetOrganisationQueryError, GetOrganisationQueryResult, GetOrganisationsQueryError, GetOrganisationsQueryResult, createOrganisation, deleteOrganisation, getDefaultOrganisation, getGetDefaultOrganisationQueryKey, getGetOrganisationChargesQueryKey, getGetOrganisationQueryKey, getGetOrganisationsQueryKey, getOrganisation, getOrganisationCharges, getOrganisations, useCreateOrganisation, useDeleteOrganisation, useGetDefaultOrganisation, useGetOrganisation, useGetOrganisationCharges, useGetOrganisations };
126
+ export { CreateOrganisationMutationBody, CreateOrganisationMutationError, CreateOrganisationMutationResult, DeleteOrganisationMutationError, DeleteOrganisationMutationResult, GetDefaultOrganisationQueryError, GetDefaultOrganisationQueryResult, GetOrganisationChargesQueryError, GetOrganisationChargesQueryResult, GetOrganisationQueryError, GetOrganisationQueryResult, GetOrganisationsQueryError, GetOrganisationsQueryResult, PatchOrganisationMutationBody, PatchOrganisationMutationError, PatchOrganisationMutationResult, createOrganisation, deleteOrganisation, getDefaultOrganisation, getGetDefaultOrganisationQueryKey, getGetOrganisationChargesQueryKey, getGetOrganisationQueryKey, getGetOrganisationsQueryKey, getOrganisation, getOrganisationCharges, getOrganisations, patchOrganisation, useCreateOrganisation, useDeleteOrganisation, useGetDefaultOrganisation, useGetOrganisation, useGetOrganisationCharges, useGetOrganisations, usePatchOrganisation };
@@ -1,6 +1,9 @@
1
+ import {
2
+ queryMutator
3
+ } from "../chunk-YEX2SGER.js";
1
4
  import {
2
5
  customInstance
3
- } from "../chunk-3O5KIRV4.js";
6
+ } from "../chunk-3RNIDX7T.js";
4
7
 
5
8
  // src/organisation/organisation.ts
6
9
  import { useQuery, useMutation } from "@tanstack/react-query";
@@ -15,8 +18,9 @@ var useGetOrganisations = (options) => {
15
18
  const { query: queryOptions, request: requestOptions } = options ?? {};
16
19
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationsQueryKey();
17
20
  const queryFn = ({ signal }) => getOrganisations(requestOptions, signal);
18
- const query = useQuery(queryKey, queryFn, queryOptions);
19
- query.queryKey = queryKey;
21
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
22
+ const query = useQuery(customOptions);
23
+ query.queryKey = customOptions.queryKey;
20
24
  return query;
21
25
  };
22
26
  var createOrganisation = (organisationPostBodyBody, options) => {
@@ -53,10 +57,30 @@ var useGetOrganisation = (orgId, options) => {
53
57
  const queryFn = ({
54
58
  signal
55
59
  }) => getOrganisation(orgId, requestOptions, signal);
56
- const query = useQuery(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
57
- query.queryKey = queryKey;
60
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
61
+ const query = useQuery(customOptions);
62
+ query.queryKey = customOptions.queryKey;
58
63
  return query;
59
64
  };
65
+ var patchOrganisation = (orgId, organisationPatchBodyBody, options) => {
66
+ return customInstance(
67
+ {
68
+ url: `/organisation/${orgId}`,
69
+ method: "patch",
70
+ headers: { "Content-Type": "application/json" },
71
+ data: organisationPatchBodyBody
72
+ },
73
+ options
74
+ );
75
+ };
76
+ var usePatchOrganisation = (options) => {
77
+ const { mutation: mutationOptions, request: requestOptions } = options ?? {};
78
+ const mutationFn = (props) => {
79
+ const { orgId, data } = props ?? {};
80
+ return patchOrganisation(orgId, data, requestOptions);
81
+ };
82
+ return useMutation(mutationFn, mutationOptions);
83
+ };
60
84
  var deleteOrganisation = (orgId, options) => {
61
85
  return customInstance(
62
86
  { url: `/organisation/${orgId}`, method: "delete" },
@@ -82,8 +106,9 @@ var useGetOrganisationCharges = (orgId, params, options) => {
82
106
  const { query: queryOptions, request: requestOptions } = options ?? {};
83
107
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationChargesQueryKey(orgId, params);
84
108
  const queryFn = ({ signal }) => getOrganisationCharges(orgId, params, requestOptions, signal);
85
- const query = useQuery(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
86
- query.queryKey = queryKey;
109
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
110
+ const query = useQuery(customOptions);
111
+ query.queryKey = customOptions.queryKey;
87
112
  return query;
88
113
  };
89
114
  var getDefaultOrganisation = (options, signal) => {
@@ -99,8 +124,9 @@ var useGetDefaultOrganisation = (options) => {
99
124
  const { query: queryOptions, request: requestOptions } = options ?? {};
100
125
  const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetDefaultOrganisationQueryKey();
101
126
  const queryFn = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
102
- const query = useQuery(queryKey, queryFn, queryOptions);
103
- query.queryKey = queryKey;
127
+ const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
128
+ const query = useQuery(customOptions);
129
+ query.queryKey = customOptions.queryKey;
104
130
  return query;
105
131
  };
106
132
  export {
@@ -114,11 +140,13 @@ export {
114
140
  getOrganisation,
115
141
  getOrganisationCharges,
116
142
  getOrganisations,
143
+ patchOrganisation,
117
144
  useCreateOrganisation,
118
145
  useDeleteOrganisation,
119
146
  useGetDefaultOrganisation,
120
147
  useGetOrganisation,
121
148
  useGetOrganisationCharges,
122
- useGetOrganisations
149
+ useGetOrganisations,
150
+ usePatchOrganisation
123
151
  };
124
152
  //# sourceMappingURL=organisation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.10.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetResponse,\n OrganisationChargesGetResponse,\n GetOrganisationChargesParams,\n OrganisationGetDefaultResponse,\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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport type GetOrganisationsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisations>>\n>;\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisations = <\n TData = Awaited<ReturnType<typeof getOrganisations>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisations>>,\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 ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisations>>\n > = ({ signal }) => getOrganisations(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisations>>,\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 * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n {\n url: `/organisation`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisation>>\n>;\nexport type CreateOrganisationMutationBody = OrganisationPostBodyBody;\nexport type CreateOrganisationMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisation = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\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 createOrganisation>>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets a specific Organisation\n\n * @summary Gets an Organisation\n */\nexport const getOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetResponse>(\n { url: `/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationQueryKey = (orgId: string) => [\n `/organisation/${orgId}`,\n];\n\nexport type GetOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisation>>\n>;\nexport type GetOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisation = <\n TData = Awaited<ReturnType<typeof getOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisation>>,\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 ?? getGetOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({\n signal,\n }) => getOrganisation(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisation>>,\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 * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisation>>\n>;\n\nexport type DeleteOrganisationMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: 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 deleteOrganisation>>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props ?? {};\n\n return deleteOrganisation(orgId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets a Organisation charges. The organisation cannot be the **Default** organisation and you need to be a member of the Organisation\n\n * @summary Gets charges for all Units in an Organisation\n */\nexport const getOrganisationCharges = (\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationChargesGetResponse>(\n { url: `/organisation/${orgId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetOrganisationChargesQueryKey = (\n orgId: string,\n params?: GetOrganisationChargesParams\n) => [`/organisation/${orgId}/charges`, ...(params ? [params] : [])];\n\nexport type GetOrganisationChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n>;\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationCharges = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\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 ?? getGetOrganisationChargesQueryKey(orgId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n > = ({ signal }) =>\n getOrganisationCharges(orgId, params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\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 * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const getDefaultOrganisation = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n { url: `/organisation/default`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetDefaultOrganisationQueryKey = () => [\n `/organisation/default`,\n];\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n>;\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetDefaultOrganisation = <\n TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\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 =\n queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n > = ({ signal }) => getDefaultOrganisation(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\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"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAmC/B,IAAM,mBAAmB,CAC9B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,8BAA8B,MAAM,CAAC,eAAe;AAO1D,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,iBAAiB,gBAAgB,MAAM;AAE3D,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;AASO,IAAM,qBAAqB,CAChC,0BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,KAAK,IAAI,SAAS,CAAC;AAE3B,WAAO,mBAAmB,MAAM,cAAc;AAAA,EAChD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,kBAAkB,CAC7B,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,SAAS,QAAQ,OAAO,OAAO;AAAA,IACvD;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,CAAC,UAAkB;AAAA,EAC3D,iBAAiB;AACnB;AAO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AM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,yBAAyB,QAAQ,OAAO,OAAO;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,oCAAoC,MAAM;AAAA,EACrD;AACF;AAOO,IAAM,4BAA4B,CAGvC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,kCAAkC;AAE9D,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,uBAAuB,gBAAgB,MAAM;AAEjE,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAIjC,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/organisation/organisation.ts"],"sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n OrganisationsGetResponse,\n AsError,\n OrganisationPostResponse,\n OrganisationPostBodyBody,\n OrganisationGetResponse,\n OrganisationPatchBodyBody,\n OrganisationChargesGetResponse,\n GetOrganisationChargesParams,\n OrganisationGetDefaultResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\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 all the Organisations that you are a member of or are public. Admin users are members of all organisation and can see all Organisations\n\n * @summary Gets Organisations\n */\nexport const getOrganisations = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationsGetResponse>(\n { url: `/organisation`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationsQueryKey = () => [`/organisation`];\n\nexport type GetOrganisationsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisations>>\n>;\nexport type GetOrganisationsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisations = <\n TData = Awaited<ReturnType<typeof getOrganisations>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisations>>,\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 ?? getGetOrganisationsQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisations>>\n > = ({ signal }) => getOrganisations(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisations>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new Organisation\n\nYou need **admin** rights to use this method\n\n * @summary Create a new organisation\n */\nexport const createOrganisation = (\n organisationPostBodyBody: OrganisationPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationPostResponse>(\n {\n url: `/organisation`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisation>>\n>;\nexport type CreateOrganisationMutationBody = OrganisationPostBodyBody;\nexport type CreateOrganisationMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisation = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\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 createOrganisation>>,\n { data: OrganisationPostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createOrganisation(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisation>>,\n TError,\n { data: OrganisationPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets a specific Organisation\n\n * @summary Gets an Organisation\n */\nexport const getOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetResponse>(\n { url: `/organisation/${orgId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationQueryKey = (orgId: string) => [\n `/organisation/${orgId}`,\n];\n\nexport type GetOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisation>>\n>;\nexport type GetOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisation = <\n TData = Awaited<ReturnType<typeof getOrganisation>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisation>>,\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 ?? getGetOrganisationQueryKey(orgId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisation>>> = ({\n signal,\n }) => getOrganisation(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisation>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Used to update existing **Organisation**.\n\nYou have to be the Organisation owner (or an administrator) to patch an Organisation.\n\n * @summary Adjust an existing Organisation\n */\nexport const patchOrganisation = (\n orgId: string,\n organisationPatchBodyBody: OrganisationPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/organisation/${orgId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationPatchBodyBody,\n },\n options\n );\n};\n\nexport type PatchOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchOrganisation>>\n>;\nexport type PatchOrganisationMutationBody = OrganisationPatchBodyBody;\nexport type PatchOrganisationMutationError = ErrorType<AsError>;\n\nexport const usePatchOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchOrganisation>>,\n TError,\n { orgId: string; data: OrganisationPatchBodyBody },\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 patchOrganisation>>,\n { orgId: string; data: OrganisationPatchBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return patchOrganisation(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchOrganisation>>,\n TError,\n { orgId: string; data: OrganisationPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Units must first be deleted before an Organisation can be deleted\n\nYou need **admin** rights to use this method\n\n * @summary Deletes an Organisation\n */\nexport const deleteOrganisation = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisation>>\n>;\n\nexport type DeleteOrganisationMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisation = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: 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 deleteOrganisation>>,\n { orgId: string }\n > = (props) => {\n const { orgId } = props ?? {};\n\n return deleteOrganisation(orgId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisation>>,\n TError,\n { orgId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets a Organisation charges. The organisation cannot be the **Default** organisation and you need to be a member of the Organisation\n\n * @summary Gets charges for all Units in an Organisation\n */\nexport const getOrganisationCharges = (\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationChargesGetResponse>(\n { url: `/organisation/${orgId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetOrganisationChargesQueryKey = (\n orgId: string,\n params?: GetOrganisationChargesParams\n) => [`/organisation/${orgId}/charges`, ...(params ? [params] : [])];\n\nexport type GetOrganisationChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n>;\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationCharges = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\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 ?? getGetOrganisationChargesQueryKey(orgId, params);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n > = ({ signal }) =>\n getOrganisationCharges(orgId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets the built-in Default Organisation, used exclusively for Personal Units\n\n * @summary Gets the (built-in) Default Organisation\n */\nexport const getDefaultOrganisation = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationGetDefaultResponse>(\n { url: `/organisation/default`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetDefaultOrganisationQueryKey = () => [\n `/organisation/default`,\n];\n\nexport type GetDefaultOrganisationQueryResult = NonNullable<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n>;\nexport type GetDefaultOrganisationQueryError = ErrorType<void | AsError>;\n\nexport const useGetDefaultOrganisation = <\n TData = Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\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 =\n queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getDefaultOrganisation>>\n > = ({ signal }) => getDefaultOrganisation(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getDefaultOrganisation>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,mBAAmB,CAC9B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,8BAA8B,MAAM,CAAC,eAAe;AAO1D,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,iBAAiB,gBAAgB,MAAM;AAE3D,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT;AASO,IAAM,qBAAqB,CAChC,0BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,wBAAwB,CAGnC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,KAAK,IAAI,SAAS,CAAC;AAE3B,WAAO,mBAAmB,MAAM,cAAc;AAAA,EAChD;AAEA,SAAO,YAKL,YAAY,eAA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AAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.3",
2
+ "version": "2.0.4-rc.2",
3
3
  "author": "Oliver Dudgeon",
4
4
  "name": "@squonk/account-server-client",
5
5
  "private": false,
@@ -15,21 +15,21 @@
15
15
  "build": "tsup && node setup-entrypoints.js"
16
16
  },
17
17
  "devDependencies": {
18
- "@tanstack/react-query": "4.12.0",
19
- "@typescript-eslint/eslint-plugin": "5.37.0",
20
- "axios": "0.27.2",
21
- "eslint": "8.23.1",
18
+ "@tanstack/react-query": "4.26.1",
19
+ "@typescript-eslint/eslint-plugin": "5.54.1",
20
+ "axios": "1.3.4",
21
+ "eslint": "8.35.0",
22
22
  "eslint-plugin-prettier": "4.2.1",
23
23
  "js-yaml": "4.1.0",
24
- "orval": "6.10.0",
25
- "prettier": "2.7.1",
26
- "tslib": "2.4.0",
27
- "tsup": "6.2.3",
28
- "typescript": "4.8.3"
24
+ "orval": "6.12.1",
25
+ "prettier": "2.8.4",
26
+ "tslib": "2.5.0",
27
+ "tsup": "6.6.3",
28
+ "typescript": "4.9.5"
29
29
  },
30
30
  "peerDependencies": {
31
- "axios": ">=0.23",
32
- "@tanstack/react-query": ">=4"
31
+ "@tanstack/react-query": ">=4",
32
+ "axios": ">=0.23"
33
33
  },
34
34
  "module": "./index.js",
35
35
  "main": "./index.cjs",
@@ -1,11 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
3
+ var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
4
+
5
+
6
+ var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
4
7
 
5
8
  // src/product/product.ts
6
9
  var _reactquery = require('@tanstack/react-query');
7
10
  var getProductTypes = (options, signal) => {
8
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
11
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
9
12
  { url: `/product-type`, method: "get", signal },
10
13
  options
11
14
  );
@@ -17,12 +20,13 @@ var useGetProductTypes = (options) => {
17
20
  const queryFn = ({
18
21
  signal
19
22
  }) => getProductTypes(requestOptions, signal);
20
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
21
- query.queryKey = queryKey;
23
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
24
+ const query = _reactquery.useQuery.call(void 0, customOptions);
25
+ query.queryKey = customOptions.queryKey;
22
26
  return query;
23
27
  };
24
28
  var getProductDefaultStorageCost = (options, signal) => {
25
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
29
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
26
30
  { url: `/product-default-storage-cost`, method: "get", signal },
27
31
  options
28
32
  );
@@ -34,12 +38,13 @@ var useGetProductDefaultStorageCost = (options) => {
34
38
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
35
39
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductDefaultStorageCostQueryKey()));
36
40
  const queryFn = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);
37
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
38
- query.queryKey = queryKey;
41
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
42
+ const query = _reactquery.useQuery.call(void 0, customOptions);
43
+ query.queryKey = customOptions.queryKey;
39
44
  return query;
40
45
  };
41
46
  var getProducts = (options, signal) => {
42
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
47
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
43
48
  { url: `/product`, method: "get", signal },
44
49
  options
45
50
  );
@@ -51,12 +56,13 @@ var useGetProducts = (options) => {
51
56
  const queryFn = ({
52
57
  signal
53
58
  }) => getProducts(requestOptions, signal);
54
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
55
- query.queryKey = queryKey;
59
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
60
+ const query = _reactquery.useQuery.call(void 0, customOptions);
61
+ query.queryKey = customOptions.queryKey;
56
62
  return query;
57
63
  };
58
64
  var getProductsForOrganisation = (orgId, options, signal) => {
59
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
65
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
60
66
  { url: `/product/organisation/${orgId}`, method: "get", signal },
61
67
  options
62
68
  );
@@ -68,12 +74,13 @@ var useGetProductsForOrganisation = (orgId, options) => {
68
74
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
69
75
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForOrganisationQueryKey(orgId)));
70
76
  const queryFn = ({ signal }) => getProductsForOrganisation(orgId, requestOptions, signal);
71
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
72
- query.queryKey = queryKey;
77
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
78
+ const query = _reactquery.useQuery.call(void 0, customOptions);
79
+ query.queryKey = customOptions.queryKey;
73
80
  return query;
74
81
  };
75
82
  var createUnitProduct = (unitId, unitProductPostBodyBody, options) => {
76
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
83
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
77
84
  {
78
85
  url: `/product/unit/${unitId}`,
79
86
  method: "post",
@@ -92,7 +99,7 @@ var useCreateUnitProduct = (options) => {
92
99
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
93
100
  };
94
101
  var getProductsForUnit = (unitId, options, signal) => {
95
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
102
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
96
103
  { url: `/product/unit/${unitId}`, method: "get", signal },
97
104
  options
98
105
  );
@@ -104,15 +111,13 @@ var useGetProductsForUnit = (unitId, options) => {
104
111
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
105
112
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductsForUnitQueryKey(unitId)));
106
113
  const queryFn = ({ signal }) => getProductsForUnit(unitId, requestOptions, signal);
107
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, {
108
- enabled: !!unitId,
109
- ...queryOptions
110
- });
111
- query.queryKey = queryKey;
114
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
115
+ const query = _reactquery.useQuery.call(void 0, customOptions);
116
+ query.queryKey = customOptions.queryKey;
112
117
  return query;
113
118
  };
114
119
  var getProduct = (productId, options, signal) => {
115
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
120
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
116
121
  { url: `/product/${productId}`, method: "get", signal },
117
122
  options
118
123
  );
@@ -126,16 +131,15 @@ var useGetProduct = (productId, options) => {
126
131
  const queryFn = ({
127
132
  signal
128
133
  }) => getProduct(productId, requestOptions, signal);
134
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
129
135
  const query = _reactquery.useQuery.call(void 0,
130
- queryKey,
131
- queryFn,
132
- { enabled: !!productId, ...queryOptions }
136
+ customOptions
133
137
  );
134
- query.queryKey = queryKey;
138
+ query.queryKey = customOptions.queryKey;
135
139
  return query;
136
140
  };
137
141
  var deleteProduct = (productId, options) => {
138
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
142
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
139
143
  { url: `/product/${productId}`, method: "delete" },
140
144
  options
141
145
  );
@@ -149,7 +153,7 @@ var useDeleteProduct = (options) => {
149
153
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
150
154
  };
151
155
  var patchProduct = (productId, productPatchBodyBody, options) => {
152
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
156
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
153
157
  {
154
158
  url: `/product/${productId}`,
155
159
  method: "patch",
@@ -168,7 +172,7 @@ var usePatchProduct = (options) => {
168
172
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
169
173
  };
170
174
  var getProductCharges = (productId, params, options, signal) => {
171
- return _chunkIUEU2LYCcjs.customInstance.call(void 0,
175
+ return _chunkUZTHSGDTcjs.customInstance.call(void 0,
172
176
  { url: `/product/${productId}/charges`, method: "get", params, signal },
173
177
  options
174
178
  );
@@ -178,11 +182,9 @@ var useGetProductCharges = (productId, params, options) => {
178
182
  const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
179
183
  const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetProductChargesQueryKey(productId, params)));
180
184
  const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
181
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, {
182
- enabled: !!productId,
183
- ...queryOptions
184
- });
185
- query.queryKey = queryKey;
185
+ const customOptions = _chunk7XN3IQYVcjs.queryMutator.call(void 0, { ...queryOptions, queryKey, queryFn });
186
+ const query = _reactquery.useQuery.call(void 0, customOptions);
187
+ query.queryKey = customOptions.queryKey;
186
188
  return query;
187
189
  };
188
190
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAqC/B,IAAM,kBAAkB,CAC7B,SACA,WACG;AACH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","sourcesContent":["/**\n * Generated by orval v6.10.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\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 * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () => [\n `/product-default-storage-cost`,\n];\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\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 =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\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`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** 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"]}
1
+ {"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;;;;;;AAUA,SAAS,UAAU,mBAAmB;AAsC/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,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT;AAKO,IAAM,+BAA+B,CAC1C,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iCAAiC,QAAQ,OAAO,OAAO;AAAA,IAC9D;AAAA,EACF;AACF;AAEO,IAAM,0CAA0C,MAAM;AAAA,EAC3D;AACF;AAOO,IAAM,kCAAkC,CAG7C,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,wCAAwC;AAEpE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,6BAA6B,gBAAgB,MAAM;AAEvE,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cA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1C,WACA,WACG,CAAC,YAAY,qBAAqB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAO3D,IAAM,uBAAuB,CAIlC,WACA,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,6BAA6B,WAAW,MAAM;AAE1E,QAAM,UAEF,CAAC,EAAE,OAAO,MACZ,kBAAkB,WAAW,QAAQ,gBAAgB,MAAM;AAE7D,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.12.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: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetDefaultStorageCost,\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\";\nimport { queryMutator } from \".././queryMutator\";\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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductTypes>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * @summary Gets the default cross-product storage cost\n */\nexport const getProductDefaultStorageCost = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<ProductsGetDefaultStorageCost>(\n { url: `/product-default-storage-cost`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetProductDefaultStorageCostQueryKey = () => [\n `/product-default-storage-cost`,\n];\n\nexport type GetProductDefaultStorageCostQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n>;\nexport type GetProductDefaultStorageCostQueryError = ErrorType<AsError | void>;\n\nexport const useGetProductDefaultStorageCost = <\n TData = Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\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 =\n queryOptions?.queryKey ?? getGetProductDefaultStorageCostQueryKey();\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>\n > = ({ signal }) => getProductDefaultStorageCost(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductDefaultStorageCost>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProducts>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForOrganisation>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductsForUnit>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getProduct>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.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`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** 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 customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"]}