@squonk/account-server-client 4.2.1 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/asset/asset.cjs +99 -126
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +99 -99
- package/asset/asset.d.ts +99 -99
- package/asset/asset.js +107 -134
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs +73 -85
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.d.cts +47 -47
- package/charges/charges.d.ts +47 -47
- package/charges/charges.js +78 -90
- package/charges/charges.js.map +1 -1
- package/chunk-3WKSNKHE.js +25 -0
- package/chunk-3WKSNKHE.js.map +1 -0
- package/chunk-NY2VJJG7.cjs +25 -0
- package/chunk-NY2VJJG7.cjs.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/event-stream/event-stream.cjs +53 -61
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +45 -45
- package/event-stream/event-stream.d.ts +45 -45
- package/event-stream/event-stream.js +58 -66
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +49 -57
- package/index.cjs.map +1 -1
- package/index.d.cts +796 -773
- package/index.d.ts +796 -773
- package/index.js +48 -56
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +38 -45
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +25 -25
- package/merchant/merchant.d.ts +25 -25
- package/merchant/merchant.js +42 -49
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +77 -87
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +72 -70
- package/organisation/organisation.d.ts +72 -70
- package/organisation/organisation.js +83 -93
- package/organisation/organisation.js.map +1 -1
- package/package.json +13 -16
- package/product/product.cjs +143 -153
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +100 -100
- package/product/product.d.ts +100 -100
- package/product/product.js +153 -163
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +863 -856
- package/src/asset/asset.ts +899 -634
- package/src/charges/charges.ts +822 -498
- package/src/custom-instance.ts +3 -3
- package/src/event-stream/event-stream.ts +531 -345
- package/src/index.ts +2 -2
- package/src/merchant/merchant.ts +355 -234
- package/src/options-mutator.ts +27 -0
- package/src/organisation/organisation.ts +812 -504
- package/src/product/product.ts +1373 -841
- package/src/state/state.ts +174 -127
- package/src/unit/unit.ts +1273 -603
- package/src/user/user.ts +895 -564
- package/state/state.cjs +22 -24
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +14 -14
- package/state/state.d.ts +14 -14
- package/state/state.js +24 -26
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +171 -106
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +200 -90
- package/unit/unit.d.ts +200 -90
- package/unit/unit.js +179 -114
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +94 -110
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +77 -77
- package/user/user.d.ts +77 -77
- package/user/user.js +101 -117
- package/user/user.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
package/charges/charges.js
CHANGED
|
@@ -1,188 +1,176 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryMutator
|
|
3
|
+
} from "../chunk-3WKSNKHE.js";
|
|
1
4
|
import {
|
|
2
5
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-XYDLYMQ2.js";
|
|
4
7
|
|
|
5
8
|
// src/charges/charges.ts
|
|
6
|
-
import {
|
|
7
|
-
useQuery,
|
|
8
|
-
useSuspenseQuery
|
|
9
|
-
} from "@tanstack/react-query";
|
|
9
|
+
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
10
10
|
var getCharges = (params, options, signal) => {
|
|
11
11
|
return customInstance(
|
|
12
|
-
{
|
|
13
|
-
url: `/charges`,
|
|
14
|
-
method: "GET",
|
|
15
|
-
params,
|
|
16
|
-
signal
|
|
17
|
-
},
|
|
12
|
+
{ url: `/charges`, method: "GET", params, signal },
|
|
18
13
|
options
|
|
19
14
|
);
|
|
20
15
|
};
|
|
21
16
|
var getGetChargesQueryKey = (params) => {
|
|
22
|
-
return [
|
|
17
|
+
return [`/charges`, ...params ? [params] : []];
|
|
23
18
|
};
|
|
24
|
-
var
|
|
19
|
+
var useGetChargesQueryOptions = (params, options) => {
|
|
25
20
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
26
|
-
const queryKey =
|
|
21
|
+
const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);
|
|
27
22
|
const queryFn = ({ signal }) => getCharges(params, requestOptions, signal);
|
|
28
|
-
|
|
23
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
24
|
+
return customOptions;
|
|
29
25
|
};
|
|
30
|
-
function useGetCharges(params, options) {
|
|
31
|
-
const queryOptions =
|
|
32
|
-
const query = useQuery(queryOptions);
|
|
26
|
+
function useGetCharges(params, options, queryClient) {
|
|
27
|
+
const queryOptions = useGetChargesQueryOptions(params, options);
|
|
28
|
+
const query = useQuery(queryOptions, queryClient);
|
|
33
29
|
query.queryKey = queryOptions.queryKey;
|
|
34
30
|
return query;
|
|
35
31
|
}
|
|
36
|
-
var
|
|
32
|
+
var useGetChargesSuspenseQueryOptions = (params, options) => {
|
|
37
33
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
38
|
-
const queryKey =
|
|
34
|
+
const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);
|
|
39
35
|
const queryFn = ({ signal }) => getCharges(params, requestOptions, signal);
|
|
40
|
-
|
|
36
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
37
|
+
return customOptions;
|
|
41
38
|
};
|
|
42
|
-
function useGetChargesSuspense(params, options) {
|
|
43
|
-
const queryOptions =
|
|
44
|
-
const query = useSuspenseQuery(queryOptions);
|
|
39
|
+
function useGetChargesSuspense(params, options, queryClient) {
|
|
40
|
+
const queryOptions = useGetChargesSuspenseQueryOptions(params, options);
|
|
41
|
+
const query = useSuspenseQuery(queryOptions, queryClient);
|
|
45
42
|
query.queryKey = queryOptions.queryKey;
|
|
46
43
|
return query;
|
|
47
44
|
}
|
|
48
45
|
var getOrganisationCharges = (orgId, params, options, signal) => {
|
|
49
46
|
return customInstance(
|
|
50
|
-
{
|
|
51
|
-
url: `/charges/organisation/${orgId}`,
|
|
52
|
-
method: "GET",
|
|
53
|
-
params,
|
|
54
|
-
signal
|
|
55
|
-
},
|
|
47
|
+
{ url: `/charges/organisation/${orgId}`, method: "GET", params, signal },
|
|
56
48
|
options
|
|
57
49
|
);
|
|
58
50
|
};
|
|
59
51
|
var getGetOrganisationChargesQueryKey = (orgId, params) => {
|
|
60
|
-
return [
|
|
52
|
+
return [`/charges/organisation/${orgId}`, ...params ? [params] : []];
|
|
61
53
|
};
|
|
62
|
-
var
|
|
54
|
+
var useGetOrganisationChargesQueryOptions = (orgId, params, options) => {
|
|
63
55
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
64
|
-
const queryKey =
|
|
56
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);
|
|
65
57
|
const queryFn = ({ signal }) => getOrganisationCharges(orgId, params, requestOptions, signal);
|
|
66
|
-
|
|
58
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
59
|
+
return customOptions;
|
|
67
60
|
};
|
|
68
|
-
function useGetOrganisationCharges(orgId, params, options) {
|
|
69
|
-
const queryOptions =
|
|
70
|
-
const query = useQuery(queryOptions);
|
|
61
|
+
function useGetOrganisationCharges(orgId, params, options, queryClient) {
|
|
62
|
+
const queryOptions = useGetOrganisationChargesQueryOptions(orgId, params, options);
|
|
63
|
+
const query = useQuery(queryOptions, queryClient);
|
|
71
64
|
query.queryKey = queryOptions.queryKey;
|
|
72
65
|
return query;
|
|
73
66
|
}
|
|
74
|
-
var
|
|
67
|
+
var useGetOrganisationChargesSuspenseQueryOptions = (orgId, params, options) => {
|
|
75
68
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
76
|
-
const queryKey =
|
|
69
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);
|
|
77
70
|
const queryFn = ({ signal }) => getOrganisationCharges(orgId, params, requestOptions, signal);
|
|
78
|
-
|
|
71
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
72
|
+
return customOptions;
|
|
79
73
|
};
|
|
80
|
-
function useGetOrganisationChargesSuspense(orgId, params, options) {
|
|
81
|
-
const queryOptions =
|
|
82
|
-
const query = useSuspenseQuery(queryOptions);
|
|
74
|
+
function useGetOrganisationChargesSuspense(orgId, params, options, queryClient) {
|
|
75
|
+
const queryOptions = useGetOrganisationChargesSuspenseQueryOptions(orgId, params, options);
|
|
76
|
+
const query = useSuspenseQuery(queryOptions, queryClient);
|
|
83
77
|
query.queryKey = queryOptions.queryKey;
|
|
84
78
|
return query;
|
|
85
79
|
}
|
|
86
80
|
var getProductCharges = (productId, params, options, signal) => {
|
|
87
81
|
return customInstance(
|
|
88
|
-
{
|
|
89
|
-
url: `/charges/product/${productId}`,
|
|
90
|
-
method: "GET",
|
|
91
|
-
params,
|
|
92
|
-
signal
|
|
93
|
-
},
|
|
82
|
+
{ url: `/charges/product/${productId}`, method: "GET", params, signal },
|
|
94
83
|
options
|
|
95
84
|
);
|
|
96
85
|
};
|
|
97
86
|
var getGetProductChargesQueryKey = (productId, params) => {
|
|
98
|
-
return [
|
|
87
|
+
return [`/charges/product/${productId}`, ...params ? [params] : []];
|
|
99
88
|
};
|
|
100
|
-
var
|
|
89
|
+
var useGetProductChargesQueryOptions = (productId, params, options) => {
|
|
101
90
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
102
|
-
const queryKey =
|
|
91
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);
|
|
103
92
|
const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
|
|
104
|
-
|
|
93
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
94
|
+
return customOptions;
|
|
105
95
|
};
|
|
106
|
-
function useGetProductCharges(productId, params, options) {
|
|
107
|
-
const queryOptions =
|
|
108
|
-
const query = useQuery(queryOptions);
|
|
96
|
+
function useGetProductCharges(productId, params, options, queryClient) {
|
|
97
|
+
const queryOptions = useGetProductChargesQueryOptions(productId, params, options);
|
|
98
|
+
const query = useQuery(queryOptions, queryClient);
|
|
109
99
|
query.queryKey = queryOptions.queryKey;
|
|
110
100
|
return query;
|
|
111
101
|
}
|
|
112
|
-
var
|
|
102
|
+
var useGetProductChargesSuspenseQueryOptions = (productId, params, options) => {
|
|
113
103
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
114
|
-
const queryKey =
|
|
104
|
+
const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);
|
|
115
105
|
const queryFn = ({ signal }) => getProductCharges(productId, params, requestOptions, signal);
|
|
116
|
-
|
|
106
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
107
|
+
return customOptions;
|
|
117
108
|
};
|
|
118
|
-
function useGetProductChargesSuspense(productId, params, options) {
|
|
119
|
-
const queryOptions =
|
|
120
|
-
const query = useSuspenseQuery(queryOptions);
|
|
109
|
+
function useGetProductChargesSuspense(productId, params, options, queryClient) {
|
|
110
|
+
const queryOptions = useGetProductChargesSuspenseQueryOptions(productId, params, options);
|
|
111
|
+
const query = useSuspenseQuery(queryOptions, queryClient);
|
|
121
112
|
query.queryKey = queryOptions.queryKey;
|
|
122
113
|
return query;
|
|
123
114
|
}
|
|
124
115
|
var getUnitCharges = (unitId, params, options, signal) => {
|
|
125
116
|
return customInstance(
|
|
126
|
-
{
|
|
127
|
-
url: `/charges/unit/${unitId}`,
|
|
128
|
-
method: "GET",
|
|
129
|
-
params,
|
|
130
|
-
signal
|
|
131
|
-
},
|
|
117
|
+
{ url: `/charges/unit/${unitId}`, method: "GET", params, signal },
|
|
132
118
|
options
|
|
133
119
|
);
|
|
134
120
|
};
|
|
135
121
|
var getGetUnitChargesQueryKey = (unitId, params) => {
|
|
136
|
-
return [
|
|
122
|
+
return [`/charges/unit/${unitId}`, ...params ? [params] : []];
|
|
137
123
|
};
|
|
138
|
-
var
|
|
124
|
+
var useGetUnitChargesQueryOptions = (unitId, params, options) => {
|
|
139
125
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
140
|
-
const queryKey =
|
|
126
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);
|
|
141
127
|
const queryFn = ({ signal }) => getUnitCharges(unitId, params, requestOptions, signal);
|
|
142
|
-
|
|
128
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
129
|
+
return customOptions;
|
|
143
130
|
};
|
|
144
|
-
function useGetUnitCharges(unitId, params, options) {
|
|
145
|
-
const queryOptions =
|
|
146
|
-
const query = useQuery(queryOptions);
|
|
131
|
+
function useGetUnitCharges(unitId, params, options, queryClient) {
|
|
132
|
+
const queryOptions = useGetUnitChargesQueryOptions(unitId, params, options);
|
|
133
|
+
const query = useQuery(queryOptions, queryClient);
|
|
147
134
|
query.queryKey = queryOptions.queryKey;
|
|
148
135
|
return query;
|
|
149
136
|
}
|
|
150
|
-
var
|
|
137
|
+
var useGetUnitChargesSuspenseQueryOptions = (unitId, params, options) => {
|
|
151
138
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
152
|
-
const queryKey =
|
|
139
|
+
const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);
|
|
153
140
|
const queryFn = ({ signal }) => getUnitCharges(unitId, params, requestOptions, signal);
|
|
154
|
-
|
|
141
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
142
|
+
return customOptions;
|
|
155
143
|
};
|
|
156
|
-
function useGetUnitChargesSuspense(unitId, params, options) {
|
|
157
|
-
const queryOptions =
|
|
158
|
-
const query = useSuspenseQuery(queryOptions);
|
|
144
|
+
function useGetUnitChargesSuspense(unitId, params, options, queryClient) {
|
|
145
|
+
const queryOptions = useGetUnitChargesSuspenseQueryOptions(unitId, params, options);
|
|
146
|
+
const query = useSuspenseQuery(queryOptions, queryClient);
|
|
159
147
|
query.queryKey = queryOptions.queryKey;
|
|
160
148
|
return query;
|
|
161
149
|
}
|
|
162
150
|
export {
|
|
163
151
|
getCharges,
|
|
164
152
|
getGetChargesQueryKey,
|
|
165
|
-
getGetChargesQueryOptions,
|
|
166
|
-
getGetChargesSuspenseQueryOptions,
|
|
167
153
|
getGetOrganisationChargesQueryKey,
|
|
168
|
-
getGetOrganisationChargesQueryOptions,
|
|
169
|
-
getGetOrganisationChargesSuspenseQueryOptions,
|
|
170
154
|
getGetProductChargesQueryKey,
|
|
171
|
-
getGetProductChargesQueryOptions,
|
|
172
|
-
getGetProductChargesSuspenseQueryOptions,
|
|
173
155
|
getGetUnitChargesQueryKey,
|
|
174
|
-
getGetUnitChargesQueryOptions,
|
|
175
|
-
getGetUnitChargesSuspenseQueryOptions,
|
|
176
156
|
getOrganisationCharges,
|
|
177
157
|
getProductCharges,
|
|
178
158
|
getUnitCharges,
|
|
179
159
|
useGetCharges,
|
|
160
|
+
useGetChargesQueryOptions,
|
|
180
161
|
useGetChargesSuspense,
|
|
162
|
+
useGetChargesSuspenseQueryOptions,
|
|
181
163
|
useGetOrganisationCharges,
|
|
164
|
+
useGetOrganisationChargesQueryOptions,
|
|
182
165
|
useGetOrganisationChargesSuspense,
|
|
166
|
+
useGetOrganisationChargesSuspenseQueryOptions,
|
|
183
167
|
useGetProductCharges,
|
|
168
|
+
useGetProductChargesQueryOptions,
|
|
184
169
|
useGetProductChargesSuspense,
|
|
170
|
+
useGetProductChargesSuspenseQueryOptions,
|
|
185
171
|
useGetUnitCharges,
|
|
186
|
-
|
|
172
|
+
useGetUnitChargesQueryOptions,
|
|
173
|
+
useGetUnitChargesSuspense,
|
|
174
|
+
useGetUnitChargesSuspenseQueryOptions
|
|
187
175
|
};
|
|
188
176
|
//# sourceMappingURL=charges.js.map
|
package/charges/charges.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/charges/charges.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * Generated by orval v7.4.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 4.2\n */\nimport {\n useQuery,\n useSuspenseQuery\n} from '@tanstack/react-query'\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n ChargesGetResponse,\n GetChargesParams,\n GetOrganisationChargesParams,\n GetProductChargesParams,\n GetUnitChargesParams,\n OrganisationChargesGetResponse,\n ProductChargesGetResponse,\n UnitChargesGetResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\ntype SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];\n\n\n/**\n * Gets global Charges.\n\nYou need admin rights to use this path.\n\n * @summary Gets charges for all Organisations\n */\nexport const getCharges = (\n params?: GetChargesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<ChargesGetResponse>(\n {url: `/charges`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetChargesQueryKey = (params?: GetChargesParams,) => {\n return [\"account-server-api\", `/charges`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetChargesQueryOptions = <TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(params?: GetChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({ signal }) => getCharges(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getCharges>>>\nexport type GetChargesQueryError = ErrorType<void | AsError>\n\n\nexport function useGetCharges<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params: undefined | GetChargesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetCharges<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetCharges<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Gets charges for all Organisations\n */\n\nexport function useGetCharges<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetChargesQueryOptions(params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(params?: GetChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({ signal }) => getCharges(params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getCharges>>>\nexport type GetChargesSuspenseQueryError = ErrorType<void | AsError>\n\n\nexport function useGetChargesSuspense<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params: undefined | GetChargesParams, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetChargesSuspense<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetChargesSuspense<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Gets charges for all Organisations\n */\n\nexport function useGetChargesSuspense<TData = Awaited<ReturnType<typeof getCharges>>, TError = ErrorType<void | AsError>>(\n params?: GetChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetChargesSuspenseQueryOptions(params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Gets a Organisation charges.\n\nThe Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint\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>,signal?: AbortSignal\n) => {\n \n \n return customInstance<OrganisationChargesGetResponse>(\n {url: `/charges/organisation/${orgId}`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetOrganisationChargesQueryKey = (orgId: string,\n params?: GetOrganisationChargesParams,) => {\n return [\"account-server-api\", `/charges/organisation/${orgId}`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetOrganisationChargesQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) => getOrganisationCharges(orgId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetOrganisationChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>\n\n\nexport function useGetOrganisationCharges<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params: undefined | GetOrganisationChargesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetOrganisationCharges<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetOrganisationCharges<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Gets charges for all Units in an Organisation\n */\n\nexport function useGetOrganisationCharges<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetOrganisationChargesQueryOptions(orgId,params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetOrganisationChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) => getOrganisationCharges(orgId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetOrganisationChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationCharges>>>\nexport type GetOrganisationChargesSuspenseQueryError = ErrorType<void | AsError>\n\n\nexport function useGetOrganisationChargesSuspense<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params: undefined | GetOrganisationChargesParams, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetOrganisationChargesSuspense<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetOrganisationChargesSuspense<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Gets charges for all Units in an Organisation\n */\n\nexport function useGetOrganisationChargesSuspense<TData = Awaited<ReturnType<typeof getOrganisationCharges>>, TError = ErrorType<void | AsError>>(\n orgId: string,\n params?: GetOrganisationChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetOrganisationChargesSuspenseQueryOptions(orgId,params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\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 with, for example, `1 December 2021` as an acceptable input.\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` allowing you to obtain charges for up to 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>,signal?: AbortSignal\n) => {\n \n \n return customInstance<ProductChargesGetResponse>(\n {url: `/charges/product/${productId}`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetProductChargesQueryKey = (productId: string,\n params?: GetProductChargesParams,) => {\n return [\"account-server-api\", `/charges/product/${productId}`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetProductChargesQueryOptions = <TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) => getProductCharges(productId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(productId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetProductChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getProductCharges>>>\nexport type GetProductChargesQueryError = ErrorType<AsError | void>\n\n\nexport function useGetProductCharges<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params: undefined | GetProductChargesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetProductCharges<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetProductCharges<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get charges made against a Product\n */\n\nexport function useGetProductCharges<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetProductChargesQueryOptions(productId,params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetProductChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) => getProductCharges(productId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetProductChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getProductCharges>>>\nexport type GetProductChargesSuspenseQueryError = ErrorType<AsError | void>\n\n\nexport function useGetProductChargesSuspense<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params: undefined | GetProductChargesParams, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetProductChargesSuspense<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetProductChargesSuspense<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get charges made against a Product\n */\n\nexport function useGetProductChargesSuspense<TData = Awaited<ReturnType<typeof getProductCharges>>, TError = ErrorType<AsError | void>>(\n productId: string,\n params?: GetProductChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetProductChargesSuspenseQueryOptions(productId,params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Get the charges made against a Unit with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\nDates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.\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` allowing you to obtain charges for up to two years.\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Unit\n */\nexport const getUnitCharges = (\n unitId: string,\n params?: GetUnitChargesParams,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UnitChargesGetResponse>(\n {url: `/charges/unit/${unitId}`, method: 'GET',\n params, signal\n },\n options);\n }\n \n\nexport const getGetUnitChargesQueryKey = (unitId: string,\n params?: GetUnitChargesParams,) => {\n return [\"account-server-api\", `/charges/unit/${unitId}`, ...(params ? [params]: [])] as const;\n }\n\n \nexport const getGetUnitChargesQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>\n\n\nexport function useGetUnitCharges<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params: undefined | GetUnitChargesParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>> & Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetUnitCharges<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>> & Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n > , 'initialData'\n >, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetUnitCharges<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get charges made against a Unit\n */\n\nexport function useGetUnitCharges<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetUnitChargesQueryOptions(unitId,params,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\nexport const getGetUnitChargesSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId,params);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) => getUnitCharges(unitId,params, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }\n}\n\nexport type GetUnitChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>\nexport type GetUnitChargesSuspenseQueryError = ErrorType<AsError | void>\n\n\nexport function useGetUnitChargesSuspense<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params: undefined | GetUnitChargesParams, options: { query:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetUnitChargesSuspense<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\nexport function useGetUnitChargesSuspense<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }\n/**\n * @summary Get charges made against a Unit\n */\n\nexport function useGetUnitChargesSuspense<TData = Awaited<ReturnType<typeof getUnitCharges>>, TError = ErrorType<AsError | void>>(\n unitId: string,\n params?: GetUnitChargesParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}\n\n ): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n\n const queryOptions = getGetUnitChargesSuspenseQueryOptions(unitId,params,options)\n\n const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n"],"mappings":";;;;;AAWA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAsCA,IAAM,aAAa,CACtB,QACH,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAY,QAAQ;AAAA,MACxB;AAAA,MAAQ;AAAA,IACZ;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,wBAAwB,CAAC,WAA+B;AACjE,SAAO,CAAC,sBAAsB,YAAY,GAAI,SAAS,CAAC,MAAM,IAAG,CAAC,CAAE;AACpE;AAGG,IAAM,4BAA4B,CAAqF,QAA2B,YACpJ;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,sBAAsB,MAAM;AAItE,QAA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AIjF,QAAM,UAAqE,CAAC,EAAE,OAAO,MAAM,eAAe,QAAO,QAAQ,gBAAgB,MAAM;AAMhJ,SAAQ,EAAE,UAAU,SAAS,SAAS,CAAC,CAAE,QAAS,GAAG,aAAY;AACpE;AAqCO,SAAS,kBACf,QACG,QAA+B,SAEkD;AAEnF,QAAM,eAAe,8BAA8B,QAAO,QAAO,OAAO;AAExE,QAAM,QAAQ,SAAS,YAAY;AAEnC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAIO,IAAM,wCAAwC,CAAyF,QAC1I,QAA+B,YAC9B;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,0BAA0B,QAAO,MAAM;AAIjF,QAAM,UAAqE,CAAC,EAAE,OAAO,MAAM,eAAe,QAAO,QAAQ,gBAAgB,MAAM;AAMhJ,SAAQ,EAAE,UAAU,SAAS,GAAG,aAAY;AAC/C;AAyBO,SAAS,0BACf,QACG,QAA+B,SAE0D;AAE3F,QAAM,eAAe,sCAAsC,QAAO,QAAO,OAAO;AAEhF,QAAM,QAAQ,iBAAiB,YAAY;AAE3C,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/charges/charges.ts"],"sourcesContent":["/**\n * Generated by orval v7.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 4.3\n */\nimport { useQuery, useSuspenseQuery } from \"@tanstack/react-query\";\nimport type {\n DataTag,\n DefinedInitialDataOptions,\n DefinedUseQueryResult,\n QueryClient,\n QueryFunction,\n QueryKey,\n UndefinedInitialDataOptions,\n UseQueryOptions,\n UseQueryResult,\n UseSuspenseQueryOptions,\n UseSuspenseQueryResult,\n} from \"@tanstack/react-query\";\n\nimport type {\n AsError,\n ChargesGetResponse,\n GetChargesParams,\n GetOrganisationChargesParams,\n GetProductChargesParams,\n GetUnitChargesParams,\n OrganisationChargesGetResponse,\n ProductChargesGetResponse,\n UnitChargesGetResponse,\n} from \"../account-server-api.schemas\";\n\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././options-mutator\";\n\ntype SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];\n\n/**\n * Gets global Charges.\n\nYou need admin rights to use this path.\n\n * @summary Gets charges for all Organisations\n */\nexport const getCharges = (\n params?: GetChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal,\n) => {\n return customInstance<ChargesGetResponse>(\n { url: `/charges`, method: \"GET\", params, signal },\n options,\n );\n};\n\nexport const getGetChargesQueryKey = (params?: GetChargesParams) => {\n return [`/charges`, ...(params ? [params] : [])] as const;\n};\n\nexport const useGetChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({ signal }) =>\n getCharges(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n};\n\nexport type GetChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getCharges>>>;\nexport type GetChargesQueryError = ErrorType<void | AsError>;\n\nexport function useGetCharges<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params: undefined | GetChargesParams,\n options: {\n query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>> &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getCharges>>,\n TError,\n Awaited<ReturnType<typeof getCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetCharges<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>> &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getCharges>>,\n TError,\n Awaited<ReturnType<typeof getCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetCharges<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets charges for all Organisations\n */\n\nexport function useGetCharges<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetChargesQueryOptions(params, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetChargesSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetChargesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getCharges>>> = ({ signal }) =>\n getCharges(params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetChargesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getCharges>>>;\nexport type GetChargesSuspenseQueryError = ErrorType<void | AsError>;\n\nexport function useGetChargesSuspense<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params: undefined | GetChargesParams,\n options: {\n query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetChargesSuspense<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetChargesSuspense<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets charges for all Organisations\n */\n\nexport function useGetChargesSuspense<\n TData = Awaited<ReturnType<typeof getCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n params?: GetChargesParams,\n options?: {\n query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetChargesSuspenseQueryOptions(params, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\n/**\n * Gets a Organisation charges.\n\nThe Organisation cannot be the **Default Organisation** and you need to be a member of the Organisation to use this endpoint\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: `/charges/organisation/${orgId}`, method: \"GET\", params, signal },\n options,\n );\n};\n\nexport const getGetOrganisationChargesQueryKey = (\n orgId: string,\n params?: GetOrganisationChargesParams,\n) => {\n return [`/charges/organisation/${orgId}`, ...(params ? [params] : [])] as const;\n};\n\nexport const useGetOrganisationChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) =>\n getOrganisationCharges(orgId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n>;\nexport type GetOrganisationChargesQueryError = ErrorType<void | AsError>;\n\nexport function useGetOrganisationCharges<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params: undefined | GetOrganisationChargesParams,\n options: {\n query: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n > &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationCharges<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n > &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n Awaited<ReturnType<typeof getOrganisationCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationCharges<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets charges for all Units in an Organisation\n */\n\nexport function useGetOrganisationCharges<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationChargesQueryOptions(orgId, params, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetOrganisationChargesSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationChargesQueryKey(orgId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationCharges>>> = ({ signal }) =>\n getOrganisationCharges(orgId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetOrganisationChargesSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationCharges>>\n>;\nexport type GetOrganisationChargesSuspenseQueryError = ErrorType<void | AsError>;\n\nexport function useGetOrganisationChargesSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params: undefined | GetOrganisationChargesParams,\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationChargesSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetOrganisationChargesSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Gets charges for all Units in an Organisation\n */\n\nexport function useGetOrganisationChargesSuspense<\n TData = Awaited<ReturnType<typeof getOrganisationCharges>>,\n TError = ErrorType<void | AsError>,\n>(\n orgId: string,\n params?: GetOrganisationChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getOrganisationCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetOrganisationChargesSuspenseQueryOptions(orgId, params, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\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 with, for example, `1 December 2021` as an acceptable input.\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` allowing you to obtain charges for up to 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: `/charges/product/${productId}`, method: \"GET\", params, signal },\n options,\n );\n};\n\nexport const getGetProductChargesQueryKey = (\n productId: string,\n params?: GetProductChargesParams,\n) => {\n return [`/charges/product/${productId}`, ...(params ? [params] : [])] as const;\n};\n\nexport const useGetProductChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetProductChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesQueryError = ErrorType<AsError | void>;\n\nexport function useGetProductCharges<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params: undefined | GetProductChargesParams,\n options: {\n query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>> &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n Awaited<ReturnType<typeof getProductCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetProductCharges<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>> &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n Awaited<ReturnType<typeof getProductCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetProductCharges<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get charges made against a Product\n */\n\nexport function useGetProductCharges<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetProductChargesQueryOptions(productId, params, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetProductChargesSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetProductChargesQueryKey(productId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getProductCharges>>> = ({ signal }) =>\n getProductCharges(productId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getProductCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetProductChargesSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getProductCharges>>\n>;\nexport type GetProductChargesSuspenseQueryError = ErrorType<AsError | void>;\n\nexport function useGetProductChargesSuspense<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params: undefined | GetProductChargesParams,\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetProductChargesSuspense<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetProductChargesSuspense<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get charges made against a Product\n */\n\nexport function useGetProductChargesSuspense<\n TData = Awaited<ReturnType<typeof getProductCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n productId: string,\n params?: GetProductChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getProductCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetProductChargesSuspenseQueryOptions(productId, params, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\n/**\n * Get the charges made against a Unit with optional **from** (inclusive) and **until** (exclusive) dates. If no dates are provided, the charges for the current billing period are returned.\nDates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.\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` allowing you to obtain charges for up to two years.\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a Unit\n */\nexport const getUnitCharges = (\n unitId: string,\n params?: GetUnitChargesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal,\n) => {\n return customInstance<UnitChargesGetResponse>(\n { url: `/charges/unit/${unitId}`, method: \"GET\", params, signal },\n options,\n );\n};\n\nexport const getGetUnitChargesQueryKey = (unitId: string, params?: GetUnitChargesParams) => {\n return [`/charges/unit/${unitId}`, ...(params ? [params] : [])] as const;\n};\n\nexport const useGetUnitChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) =>\n getUnitCharges(unitId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>;\n\nexport function useGetUnitCharges<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params: undefined | GetUnitChargesParams,\n options: {\n query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>> &\n Pick<\n DefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n Awaited<ReturnType<typeof getUnitCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUnitCharges<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>> &\n Pick<\n UndefinedInitialDataOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n Awaited<ReturnType<typeof getUnitCharges>>\n >,\n \"initialData\"\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUnitCharges<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get charges made against a Unit\n */\n\nexport function useGetUnitCharges<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>>;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetUnitChargesQueryOptions(unitId, params, options);\n\n const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {\n queryKey: DataTag<QueryKey, TData, TError>;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n\nexport const useGetUnitChargesSuspenseQueryOptions = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n) => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({ signal }) =>\n getUnitCharges(unitId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n return customOptions as UseSuspenseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n};\n\nexport type GetUnitChargesSuspenseQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnitCharges>>\n>;\nexport type GetUnitChargesSuspenseQueryError = ErrorType<AsError | void>;\n\nexport function useGetUnitChargesSuspense<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params: undefined | GetUnitChargesParams,\n options: {\n query: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUnitChargesSuspense<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\nexport function useGetUnitChargesSuspense<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };\n/**\n * @summary Get charges made against a Unit\n */\n\nexport function useGetUnitChargesSuspense<\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>,\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: Partial<\n UseSuspenseQueryOptions<Awaited<ReturnType<typeof getUnitCharges>>, TError, TData>\n >;\n request?: SecondParameter<typeof customInstance>;\n },\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {\n const queryOptions = useGetUnitChargesSuspenseQueryOptions(unitId, params, options);\n\n const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<\n TData,\n TError\n > & { queryKey: DataTag<QueryKey, TData, TError> };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n}\n"],"mappings":";;;;;;;;AAUA,SAAS,UAAU,wBAAwB;AAwCpC,IAAM,aAAa,CACxB,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,QAAQ,OAAO;AAAA,IACjD;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,CAAC,WAA8B;AAClE,SAAO,CAAC,YAAY,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AACjD;AAEO,IAAM,4BAA4B,CAIvC,QACA,YAIG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,WAAW,cAAc,YAAY,sBAAsB,MAAM;AAEvE,QAAM,UAAiE,CAAC,EAAE,OAAO,MAC/E,WAAW,QAAQ,gBAAgB,MAAM;AAE3C,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,SAAO;AAGT;AA0DO,SAAS,cAId,QACA,SAIA,aACgF;AAChF,QAAM,eAAe,0BAA0B,QAAQ,OAAO;AAE9D,QAAM,QAAQ,SAAS,cAAc,WAAW;AAIhD,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAEO,IAAM,oCAAoC,CAI/C,QACA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AACT;AAEO,IAAM,wCAAwC,CAInD,QACA,QACA,YAMG;AACH,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,WAAW,cAAc,YAAY,0BAA0B,QAAQ,MAAM;AAEnF,QAAM,UAAqE,CAAC,EAAE,OAAO,MACnF,eAAe,QAAQ,QAAQ,gBAAgB,MAAM;AAEvD,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,SAAO;AAKT;AAqDO,SAAS,0BAId,QACA,QACA,SAMA,aACwF;AACxF,QAAM,eAAe,sCAAsC,QAAQ,QAAQ,OAAO;AAElF,QAAM,QAAQ,iBAAiB,cAAc,WAAW;AAKxD,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/options-mutator.ts
|
|
2
|
+
import "@tanstack/react-query";
|
|
3
|
+
var queryMutator = ({
|
|
4
|
+
queryKey,
|
|
5
|
+
...queryOptions
|
|
6
|
+
}) => {
|
|
7
|
+
const newQueryKey = ["account-server-api", ...queryKey];
|
|
8
|
+
return { queryKey: newQueryKey, ...queryOptions };
|
|
9
|
+
};
|
|
10
|
+
var mutationMutator = ({
|
|
11
|
+
mutationKey,
|
|
12
|
+
...mutationOptions
|
|
13
|
+
}) => {
|
|
14
|
+
if (Array.isArray(mutationKey)) {
|
|
15
|
+
const newMutationKey = ["account-server-api", ...mutationKey];
|
|
16
|
+
return { mutationKey: newMutationKey, ...mutationOptions };
|
|
17
|
+
}
|
|
18
|
+
return { mutationKey: void 0, ...mutationOptions };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
queryMutator,
|
|
23
|
+
mutationMutator
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-3WKSNKHE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/options-mutator.ts"],"sourcesContent":["import { type UseMutationOptions, type UseQueryOptions } from \"@tanstack/react-query\";\n\nexport const queryMutator = <TQueryFnData, TError, TData>({\n queryKey,\n ...queryOptions\n}: UseQueryOptions<TQueryFnData, TError, TData>): UseQueryOptions<TQueryFnData, TError, TData> => {\n const newQueryKey = [\"account-server-api\", ...queryKey];\n return { queryKey: newQueryKey, ...queryOptions };\n};\n\nexport const mutationMutator = <TData, TError, TVariables, TContext>({\n mutationKey,\n ...mutationOptions\n}: UseMutationOptions<TData, TError, TVariables, TContext>): UseMutationOptions<\n TData,\n TError,\n TVariables,\n TContext\n> => {\n if (Array.isArray(mutationKey)) {\n const newMutationKey = [\"account-server-api\", ...mutationKey];\n return { mutationKey: newMutationKey, ...mutationOptions };\n }\n return { mutationKey: undefined, ...mutationOptions };\n};\n\nexport default queryMutator;\n"],"mappings":";AAAA,OAA8D;AAEvD,IAAM,eAAe,CAA8B;AAAA,EACxD;AAAA,EACA,GAAG;AACL,MAAkG;AAChG,QAAM,cAAc,CAAC,sBAAsB,GAAG,QAAQ;AACtD,SAAO,EAAE,UAAU,aAAa,GAAG,aAAa;AAClD;AAEO,IAAM,kBAAkB,CAAsC;AAAA,EACnE;AAAA,EACA,GAAG;AACL,MAKK;AACH,MAAI,MAAM,QAAQ,WAAW,GAAG;AAC9B,UAAM,iBAAiB,CAAC,sBAAsB,GAAG,WAAW;AAC5D,WAAO,EAAE,aAAa,gBAAgB,GAAG,gBAAgB;AAAA,EAC3D;AACA,SAAO,EAAE,aAAa,QAAW,GAAG,gBAAgB;AACtD;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/options-mutator.ts
|
|
2
|
+
require('@tanstack/react-query');
|
|
3
|
+
var queryMutator = ({
|
|
4
|
+
queryKey,
|
|
5
|
+
...queryOptions
|
|
6
|
+
}) => {
|
|
7
|
+
const newQueryKey = ["account-server-api", ...queryKey];
|
|
8
|
+
return { queryKey: newQueryKey, ...queryOptions };
|
|
9
|
+
};
|
|
10
|
+
var mutationMutator = ({
|
|
11
|
+
mutationKey,
|
|
12
|
+
...mutationOptions
|
|
13
|
+
}) => {
|
|
14
|
+
if (Array.isArray(mutationKey)) {
|
|
15
|
+
const newMutationKey = ["account-server-api", ...mutationKey];
|
|
16
|
+
return { mutationKey: newMutationKey, ...mutationOptions };
|
|
17
|
+
}
|
|
18
|
+
return { mutationKey: void 0, ...mutationOptions };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.queryMutator = queryMutator; exports.mutationMutator = mutationMutator;
|
|
25
|
+
//# sourceMappingURL=chunk-NY2VJJG7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/squonk2-account-server-js-client/squonk2-account-server-js-client/dist/chunk-NY2VJJG7.cjs","../src/options-mutator.ts"],"names":[],"mappings":"AAAA;ACAA,iCAA8D;AAEvD,IAAM,aAAA,EAAe,CAA8B;AAAA,EACxD,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAA,GAAkG;AAChG,EAAA,MAAM,YAAA,EAAc,CAAC,oBAAA,EAAsB,GAAG,QAAQ,CAAA;AACtD,EAAA,OAAO,EAAE,QAAA,EAAU,WAAA,EAAa,GAAG,aAAa,CAAA;AAClD,CAAA;AAEO,IAAM,gBAAA,EAAkB,CAAsC;AAAA,EACnE,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAA,GAKK;AACH,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC9B,IAAA,MAAM,eAAA,EAAiB,CAAC,oBAAA,EAAsB,GAAG,WAAW,CAAA;AAC5D,IAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,GAAG,gBAAgB,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,KAAA,CAAA,EAAW,GAAG,gBAAgB,CAAA;AACtD,CAAA;ADLA;AACA;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/squonk2-account-server-js-client/squonk2-account-server-js-client/dist/chunk-NY2VJJG7.cjs","sourcesContent":[null,"import { type UseMutationOptions, type UseQueryOptions } from \"@tanstack/react-query\";\n\nexport const queryMutator = <TQueryFnData, TError, TData>({\n queryKey,\n ...queryOptions\n}: UseQueryOptions<TQueryFnData, TError, TData>): UseQueryOptions<TQueryFnData, TError, TData> => {\n const newQueryKey = [\"account-server-api\", ...queryKey];\n return { queryKey: newQueryKey, ...queryOptions };\n};\n\nexport const mutationMutator = <TData, TError, TVariables, TContext>({\n mutationKey,\n ...mutationOptions\n}: UseMutationOptions<TData, TError, TVariables, TContext>): UseMutationOptions<\n TData,\n TError,\n TVariables,\n TContext\n> => {\n if (Array.isArray(mutationKey)) {\n const newMutationKey = [\"account-server-api\", ...mutationKey];\n return { mutationKey: newMutationKey, ...mutationOptions };\n }\n return { mutationKey: undefined, ...mutationOptions };\n};\n\nexport default queryMutator;\n"]}
|
|
@@ -24,4 +24,4 @@ var customInstance = (config, options) => {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-RB2KVIEK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/squonk2-account-server-js-client/squonk2-account-server-js-client/dist/chunk-RB2KVIEK.cjs","../src/custom-instance.ts"],"names":[],"mappings":"AAAA;ACUA,4EAA2D;AAEpD,IAAM,eAAA,EAAiB,eAAA,CAAM,MAAA,CAAO,CAAA;AAOpC,IAAM,aAAA,EAAe,CAAC,KAAA,EAAA,GAAkB;AAC7C,EAAA,cAAA,CAAe,QAAA,CAAS,OAAA,CAAQ,MAAA,CAAO,eAAe,EAAA,EAAI,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAC3E;AAM+C;AACX,EAAA;AACpC;AAKuB;AACmB,EAAA;AAE6B,EAAA;AACrD,IAAA;AAChB,EAAA;AAGuB,EAAA;AACc,IAAA;AACrC,EAAA;AAEO,EAAA;AACT;AD5B4E;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/squonk2-account-server-js-client/squonk2-account-server-js-client/dist/chunk-RB2KVIEK.cjs","sourcesContent":[null,"/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, type AxiosRequestConfig } from \"axios\";\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common[\"Authorization\"] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel(\"Query was cancelled\");\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom-instance.ts"],"sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, type AxiosRequestConfig } from \"axios\";\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common[\"Authorization\"] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // @ts-expect-error need to add a cancel method to the promise\n promise.cancel = () => {\n source.cancel(\"Query was cancelled\");\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"],"mappings":";AAUA,OAAO,WAAoD;AAEpD,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU,KAAK;AAC3E;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAGA,UAAQ,SAAS,MAAM;AACrB,WAAO,OAAO,qBAAqB;AAAA,EACrC;AAEA,SAAO;AACT;","names":[]}
|