@squonk/account-server-client 2.0.4-rc.1 → 2.0.4-rc.3
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/admin/admin.cjs +10 -14
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +9 -3
- package/admin/admin.js +9 -13
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +59 -28
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +71 -3
- package/asset/asset.js +58 -27
- package/asset/asset.js.map +1 -1
- package/{custom-instance-85497958.d.ts → custom-instance-8a11f2d1.d.ts} +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +19 -16
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +16 -4
- package/merchant/merchant.js +18 -15
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +64 -40
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +56 -6
- package/organisation/organisation.js +63 -39
- package/organisation/organisation.js.map +1 -1
- package/package.json +10 -9
- package/product/product.cjs +92 -55
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +79 -9
- package/product/product.js +91 -54
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +1 -1
- package/src/admin/admin.ts +34 -18
- package/src/asset/asset.ts +223 -88
- package/src/merchant/merchant.ts +60 -27
- package/src/organisation/organisation.ts +215 -97
- package/src/product/product.ts +310 -134
- package/src/state/state.ts +30 -15
- package/src/unit/unit.ts +263 -117
- package/src/user/user.ts +207 -88
- package/state/state.cjs +10 -11
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +9 -3
- package/state/state.js +9 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +74 -46
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +70 -6
- package/unit/unit.js +73 -45
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -31
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +63 -5
- package/user/user.js +55 -30
- package/user/user.js.map +1 -1
- package/chunk-7XN3IQYV.cjs +0 -13
- package/chunk-7XN3IQYV.cjs.map +0 -1
- package/chunk-YEX2SGER.js +0 -13
- package/chunk-YEX2SGER.js.map +0 -1
- package/src/queryMutator.ts +0 -12
package/unit/unit.cjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var _chunk7XN3IQYVcjs = require('../chunk-7XN3IQYV.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
3
|
var _chunkUZTHSGDTcjs = require('../chunk-UZTHSGDT.cjs');
|
|
7
4
|
|
|
8
5
|
// src/unit/unit.ts
|
|
@@ -13,16 +10,17 @@ var getOrganisationUnits = (orgId, options, signal) => {
|
|
|
13
10
|
options
|
|
14
11
|
);
|
|
15
12
|
};
|
|
16
|
-
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
17
|
-
|
|
18
|
-
];
|
|
19
|
-
var useGetOrganisationUnits = (orgId, options) => {
|
|
13
|
+
var getGetOrganisationUnitsQueryKey = (orgId) => ["account-server-api", `/organisation/${orgId}/unit`];
|
|
14
|
+
var getGetOrganisationUnitsQueryOptions = (orgId, options) => {
|
|
20
15
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
21
16
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
|
|
22
17
|
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };
|
|
19
|
+
};
|
|
20
|
+
var useGetOrganisationUnits = (orgId, options) => {
|
|
21
|
+
const queryOptions = getGetOrganisationUnitsQueryOptions(orgId, options);
|
|
22
|
+
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
23
|
+
query.queryKey = queryOptions.queryKey;
|
|
26
24
|
return query;
|
|
27
25
|
};
|
|
28
26
|
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
@@ -36,13 +34,17 @@ var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
|
36
34
|
options
|
|
37
35
|
);
|
|
38
36
|
};
|
|
39
|
-
var
|
|
37
|
+
var getCreateOrganisationUnitMutationOptions = (options) => {
|
|
40
38
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
41
39
|
const mutationFn = (props) => {
|
|
42
40
|
const { orgId, data } = _nullishCoalesce(props, () => ( {}));
|
|
43
41
|
return createOrganisationUnit(orgId, data, requestOptions);
|
|
44
42
|
};
|
|
45
|
-
return
|
|
43
|
+
return { mutationFn, ...mutationOptions };
|
|
44
|
+
};
|
|
45
|
+
var useCreateOrganisationUnit = (options) => {
|
|
46
|
+
const mutationOptions = getCreateOrganisationUnitMutationOptions(options);
|
|
47
|
+
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
46
48
|
};
|
|
47
49
|
var getUnit = (unitId, options, signal) => {
|
|
48
50
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
@@ -50,42 +52,43 @@ var getUnit = (unitId, options, signal) => {
|
|
|
50
52
|
options
|
|
51
53
|
);
|
|
52
54
|
};
|
|
53
|
-
var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
|
|
54
|
-
var
|
|
55
|
+
var getGetUnitQueryKey = (unitId) => ["account-server-api", `/unit/${unitId}`];
|
|
56
|
+
var getGetUnitQueryOptions = (unitId, options) => {
|
|
55
57
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
56
58
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitQueryKey(unitId)));
|
|
57
59
|
const queryFn = ({
|
|
58
60
|
signal
|
|
59
61
|
}) => getUnit(unitId, requestOptions, signal);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
query
|
|
62
|
+
return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
|
|
63
|
+
};
|
|
64
|
+
var useGetUnit = (unitId, options) => {
|
|
65
|
+
const queryOptions = getGetUnitQueryOptions(unitId, options);
|
|
66
|
+
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
67
|
+
query.queryKey = queryOptions.queryKey;
|
|
65
68
|
return query;
|
|
66
69
|
};
|
|
67
70
|
var patchUnit = (unitId, unitPatchBodyBody, options) => {
|
|
68
|
-
const formData = new FormData();
|
|
69
|
-
if (unitPatchBodyBody.name !== void 0) {
|
|
70
|
-
formData.append("name", unitPatchBodyBody.name);
|
|
71
|
-
}
|
|
72
71
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
73
72
|
{
|
|
74
73
|
url: `/unit/${unitId}`,
|
|
75
74
|
method: "patch",
|
|
76
|
-
headers: { "Content-Type": "
|
|
77
|
-
data:
|
|
75
|
+
headers: { "Content-Type": "application/json" },
|
|
76
|
+
data: unitPatchBodyBody
|
|
78
77
|
},
|
|
79
78
|
options
|
|
80
79
|
);
|
|
81
80
|
};
|
|
82
|
-
var
|
|
81
|
+
var getPatchUnitMutationOptions = (options) => {
|
|
83
82
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
84
83
|
const mutationFn = (props) => {
|
|
85
84
|
const { unitId, data } = _nullishCoalesce(props, () => ( {}));
|
|
86
85
|
return patchUnit(unitId, data, requestOptions);
|
|
87
86
|
};
|
|
88
|
-
return
|
|
87
|
+
return { mutationFn, ...mutationOptions };
|
|
88
|
+
};
|
|
89
|
+
var usePatchUnit = (options) => {
|
|
90
|
+
const mutationOptions = getPatchUnitMutationOptions(options);
|
|
91
|
+
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
89
92
|
};
|
|
90
93
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
91
94
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
@@ -93,13 +96,17 @@ var deleteOrganisationUnit = (unitId, options) => {
|
|
|
93
96
|
options
|
|
94
97
|
);
|
|
95
98
|
};
|
|
96
|
-
var
|
|
99
|
+
var getDeleteOrganisationUnitMutationOptions = (options) => {
|
|
97
100
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
98
101
|
const mutationFn = (props) => {
|
|
99
102
|
const { unitId } = _nullishCoalesce(props, () => ( {}));
|
|
100
103
|
return deleteOrganisationUnit(unitId, requestOptions);
|
|
101
104
|
};
|
|
102
|
-
return
|
|
105
|
+
return { mutationFn, ...mutationOptions };
|
|
106
|
+
};
|
|
107
|
+
var useDeleteOrganisationUnit = (options) => {
|
|
108
|
+
const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);
|
|
109
|
+
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
103
110
|
};
|
|
104
111
|
var getUnits = (options, signal) => {
|
|
105
112
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
@@ -107,18 +114,19 @@ var getUnits = (options, signal) => {
|
|
|
107
114
|
options
|
|
108
115
|
);
|
|
109
116
|
};
|
|
110
|
-
var getGetUnitsQueryKey = () => [`/unit`];
|
|
111
|
-
var
|
|
117
|
+
var getGetUnitsQueryKey = () => ["account-server-api", `/unit`];
|
|
118
|
+
var getGetUnitsQueryOptions = (options) => {
|
|
112
119
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
113
120
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitsQueryKey()));
|
|
114
121
|
const queryFn = ({
|
|
115
122
|
signal
|
|
116
123
|
}) => getUnits(requestOptions, signal);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
121
|
-
query
|
|
124
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
125
|
+
};
|
|
126
|
+
var useGetUnits = (options) => {
|
|
127
|
+
const queryOptions = getGetUnitsQueryOptions(options);
|
|
128
|
+
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
129
|
+
query.queryKey = queryOptions.queryKey;
|
|
122
130
|
return query;
|
|
123
131
|
};
|
|
124
132
|
var createDefaultUnit = (personalUnitPutBodyBody, options) => {
|
|
@@ -132,23 +140,31 @@ var createDefaultUnit = (personalUnitPutBodyBody, options) => {
|
|
|
132
140
|
options
|
|
133
141
|
);
|
|
134
142
|
};
|
|
135
|
-
var
|
|
143
|
+
var getCreateDefaultUnitMutationOptions = (options) => {
|
|
136
144
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
137
145
|
const mutationFn = (props) => {
|
|
138
146
|
const { data } = _nullishCoalesce(props, () => ( {}));
|
|
139
147
|
return createDefaultUnit(data, requestOptions);
|
|
140
148
|
};
|
|
141
|
-
return
|
|
149
|
+
return { mutationFn, ...mutationOptions };
|
|
150
|
+
};
|
|
151
|
+
var useCreateDefaultUnit = (options) => {
|
|
152
|
+
const mutationOptions = getCreateDefaultUnitMutationOptions(options);
|
|
153
|
+
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
142
154
|
};
|
|
143
155
|
var deleteDefaultUnit = (options) => {
|
|
144
156
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
|
|
145
157
|
};
|
|
146
|
-
var
|
|
158
|
+
var getDeleteDefaultUnitMutationOptions = (options) => {
|
|
147
159
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
148
160
|
const mutationFn = () => {
|
|
149
161
|
return deleteDefaultUnit(requestOptions);
|
|
150
162
|
};
|
|
151
|
-
return
|
|
163
|
+
return { mutationFn, ...mutationOptions };
|
|
164
|
+
};
|
|
165
|
+
var useDeleteDefaultUnit = (options) => {
|
|
166
|
+
const mutationOptions = getDeleteDefaultUnitMutationOptions(options);
|
|
167
|
+
return _reactquery.useMutation.call(void 0, mutationOptions);
|
|
152
168
|
};
|
|
153
169
|
var getUnitCharges = (unitId, params, options, signal) => {
|
|
154
170
|
return _chunkUZTHSGDTcjs.customInstance.call(void 0,
|
|
@@ -156,16 +172,19 @@ var getUnitCharges = (unitId, params, options, signal) => {
|
|
|
156
172
|
options
|
|
157
173
|
);
|
|
158
174
|
};
|
|
159
|
-
var getGetUnitChargesQueryKey = (unitId, params) => [`/unit/${unitId}/charges`, ...params ? [params] : []];
|
|
160
|
-
var
|
|
175
|
+
var getGetUnitChargesQueryKey = (unitId, params) => ["account-server-api", `/unit/${unitId}/charges`, ...params ? [params] : []];
|
|
176
|
+
var getGetUnitChargesQueryOptions = (unitId, params, options) => {
|
|
161
177
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
162
178
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitChargesQueryKey(unitId, params)));
|
|
163
179
|
const queryFn = ({
|
|
164
180
|
signal
|
|
165
181
|
}) => getUnitCharges(unitId, params, requestOptions, signal);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
|
|
183
|
+
};
|
|
184
|
+
var useGetUnitCharges = (unitId, params, options) => {
|
|
185
|
+
const queryOptions = getGetUnitChargesQueryOptions(unitId, params, options);
|
|
186
|
+
const query = _reactquery.useQuery.call(void 0, queryOptions);
|
|
187
|
+
query.queryKey = queryOptions.queryKey;
|
|
169
188
|
return query;
|
|
170
189
|
};
|
|
171
190
|
|
|
@@ -191,5 +210,14 @@ var useGetUnitCharges = (unitId, params, options) => {
|
|
|
191
210
|
|
|
192
211
|
|
|
193
212
|
|
|
194
|
-
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
exports.createDefaultUnit = createDefaultUnit; exports.createOrganisationUnit = createOrganisationUnit; exports.deleteDefaultUnit = deleteDefaultUnit; exports.deleteOrganisationUnit = deleteOrganisationUnit; exports.getCreateDefaultUnitMutationOptions = getCreateDefaultUnitMutationOptions; exports.getCreateOrganisationUnitMutationOptions = getCreateOrganisationUnitMutationOptions; exports.getDeleteDefaultUnitMutationOptions = getDeleteDefaultUnitMutationOptions; exports.getDeleteOrganisationUnitMutationOptions = getDeleteOrganisationUnitMutationOptions; exports.getGetOrganisationUnitsQueryKey = getGetOrganisationUnitsQueryKey; exports.getGetOrganisationUnitsQueryOptions = getGetOrganisationUnitsQueryOptions; exports.getGetUnitChargesQueryKey = getGetUnitChargesQueryKey; exports.getGetUnitChargesQueryOptions = getGetUnitChargesQueryOptions; exports.getGetUnitQueryKey = getGetUnitQueryKey; exports.getGetUnitQueryOptions = getGetUnitQueryOptions; exports.getGetUnitsQueryKey = getGetUnitsQueryKey; exports.getGetUnitsQueryOptions = getGetUnitsQueryOptions; exports.getOrganisationUnits = getOrganisationUnits; exports.getPatchUnitMutationOptions = getPatchUnitMutationOptions; exports.getUnit = getUnit; exports.getUnitCharges = getUnitCharges; exports.getUnits = getUnits; exports.patchUnit = patchUnit; exports.useCreateDefaultUnit = useCreateDefaultUnit; exports.useCreateOrganisationUnit = useCreateOrganisationUnit; exports.useDeleteDefaultUnit = useDeleteDefaultUnit; exports.useDeleteOrganisationUnit = useDeleteOrganisationUnit; exports.useGetOrganisationUnits = useGetOrganisationUnits; exports.useGetUnit = useGetUnit; exports.useGetUnitCharges = useGetUnitCharges; exports.useGetUnits = useGetUnits; exports.usePatchUnit = usePatchUnit;
|
|
195
223
|
//# sourceMappingURL=unit.cjs.map
|
package/unit/unit.cjs.map
CHANGED
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,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAWO,IAAM,iBAAiB,CAC5B,QACA,QACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,kBAAkB,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAChE;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,CACvC,QACA,WACG,CAAC,SAAS,kBAAkB,GAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAE;AAOrD,IAAM,oBAAoB,CAI/B,QACA,QACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,0BAA0B,QAAQ,MAAM;AAEpE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,QAAQ,QAAQ,gBAAgB,MAAM;AAE3D,QAAM,gBAAgB,aAAa,EAAE,GAAG,cAAc,UAAU,QAAQ,CAAC;AAEzE,QAAM,QAAQ,SAIZ,aAAa;AAEf,QAAM,WAAW,cAAc;AAE/B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.12.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitPatchBodyBody,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n PersonalUnitPutBodyBody,\n UnitChargesGetResponse,\n GetUnitChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\nimport { queryMutator } from \".././queryMutator\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Used to update existing **Unit**.\n\nYou have to be the Unit owner (or an administrator) to patch a Unit.\n\n * @summary Adjust an existing Unit\n */\nexport const patchUnit = (\n unitId: string,\n unitPatchBodyBody: UnitPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (unitPatchBodyBody.name !== undefined) {\n formData.append(\"name\", unitPatchBodyBody.name);\n }\n\n return customInstance<void>(\n {\n url: `/unit/${unitId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type PatchUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchUnit>>\n>;\nexport type PatchUnitMutationBody = UnitPatchBodyBody;\nexport type PatchUnitMutationError = ErrorType<AsError>;\n\nexport const usePatchUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchUnit>>,\n { unitId: string; data: UnitPatchBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return patchUnit(unitId, data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n customOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Personal Unit\n */\nexport const createDefaultUnit = (\n personalUnitPutBodyBody: PersonalUnitPutBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n {\n url: `/unit`,\n method: \"put\",\n headers: { \"Content-Type\": \"application/json\" },\n data: personalUnitPutBodyBody,\n },\n options\n );\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\nexport type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n { data: PersonalUnitPutBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createDefaultUnit(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\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.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a 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: `/unit/${unitId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetUnitChargesQueryKey = (\n unitId: string,\n params?: GetUnitChargesParams\n) => [`/unit/${unitId}/charges`, ...(params ? [params] : [])];\n\nexport type GetUnitChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnitCharges>>\n>;\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetUnitCharges = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({\n signal,\n }) => getUnitCharges(unitId, params, requestOptions, signal);\n\n const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });\n\n const query = useQuery<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >(customOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = customOptions.queryKey;\n\n return query;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAsC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAC9C,CAAC,sBAAsB,iBAAiB,YAAY;AAE/C,IAAM,sCAAsC,CAIjD,OACA,YAY4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa;AAChE;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,eAAe,oCAAoC,OAAO,OAAO;AAEvE,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,2CAA2C,CAGtD,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,KAAK,IAAI,SAAS,CAAC;AAElC,WAAO,uBAAuB,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AC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,0BAA0B,QAAQ,MAAM;AAEpE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,QAAQ,QAAQ,gBAAgB,MAAM;AAE3D,SAAO,EAAE,UAAU,SAAS,SAAS,CAAC,CAAC,QAAQ,GAAG,aAAa;AACjE;AAOO,IAAM,oBAAoB,CAI/B,QACA,QACA,YAQ2D;AAC3D,QAAM,eAAe,8BAA8B,QAAQ,QAAQ,OAAO;AAE1E,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.15.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 2.0\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitPatchBodyBody,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n PersonalUnitPutBodyBody,\n UnitChargesGetResponse,\n GetUnitChargesParams,\n} from \"../account-server-api.schemas\";\nimport { customInstance } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) =>\n [\"account-server-api\", `/organisation/${orgId}/unit`] as const;\n\nexport const getGetOrganisationUnitsQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUnitsQueryOptions(orgId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgId}/unit`,\n method: \"post\",\n headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport const getCreateOrganisationUnitMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props ?? {};\n\n return createOrganisationUnit(orgId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createOrganisationUnit>>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateOrganisationUnitMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) =>\n [\"account-server-api\", `/unit/${unitId}`] as const;\n\nexport const getGetUnitQueryOptions = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnit>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUnitQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Used to update existing **Unit**.\n\nYou have to be the Unit owner (or an administrator) to patch a Unit.\n\n * @summary Adjust an existing Unit\n */\nexport const patchUnit = (\n unitId: string,\n unitPatchBodyBody: UnitPatchBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n {\n url: `/unit/${unitId}`,\n method: \"patch\",\n headers: { \"Content-Type\": \"application/json\" },\n data: unitPatchBodyBody,\n },\n options\n );\n};\n\nexport const getPatchUnitMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchUnit>>,\n { unitId: string; data: UnitPatchBodyBody }\n > = (props) => {\n const { unitId, data } = props ?? {};\n\n return patchUnit(unitId, data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type PatchUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchUnit>>\n>;\nexport type PatchUnitMutationBody = UnitPatchBodyBody;\nexport type PatchUnitMutationError = ErrorType<AsError>;\n\nexport const usePatchUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchUnit>>,\n TError,\n { unitId: string; data: UnitPatchBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getPatchUnitMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUnitMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationUnitMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [\"account-server-api\", `/unit`] as const;\n\nexport const getGetUnitsQueryOptions = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData> & {\n queryKey: QueryKey;\n} => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getUnits>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUnitsQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Personal Unit\n */\nexport const createDefaultUnit = (\n personalUnitPutBodyBody: PersonalUnitPutBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n {\n url: `/unit`,\n method: \"put\",\n headers: { \"Content-Type\": \"application/json\" },\n data: personalUnitPutBodyBody,\n },\n options\n );\n};\n\nexport const getCreateDefaultUnitMutationOptions = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n { data: PersonalUnitPutBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createDefaultUnit(data, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\nexport type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createDefaultUnit>>,\n TError,\n { data: PersonalUnitPutBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getCreateDefaultUnitMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport const getDeleteDefaultUnitMutationOptions = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteDefaultUnitMutationOptions(options);\n\n return useMutation(mutationOptions);\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.\n\nDates are interpreted using the Python dateutil parser so the input strings are extremely flexible, i.e. `1 December 2021` is an acceptable format.\n\n**from** must be a date (day) prior to **until**. For example, to see the charges for the 11th July 2022 set **from** to `11 July 2022` and **until** to `12 July 2022`. As an alternative to **From** and **Until** you can provide a **Prior Billing Period**, a value that identifies the prior period to retrieve. A value of `-1` would indicate the *prior period* (month) with an oldest retrieval value of `-23` (approximately two years).\n\nYou need to be part of the **Unit** or **Organisation** to use this method\n * @summary Get charges made against a 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: `/unit/${unitId}/charges`, method: \"get\", params, signal },\n options\n );\n};\n\nexport const getGetUnitChargesQueryKey = (\n unitId: string,\n params?: GetUnitChargesParams\n) => [\"account-server-api\", `/unit/${unitId}/charges`, ...(params ? [params] : [])] as const;\n\nexport const getGetUnitChargesQueryOptions = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetUnitChargesQueryKey(unitId, params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnitCharges>>> = ({\n signal,\n }) => getUnitCharges(unitId, params, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetUnitChargesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnitCharges>>\n>;\nexport type GetUnitChargesQueryError = ErrorType<AsError | void>;\n\nexport const useGetUnitCharges = <\n TData = Awaited<ReturnType<typeof getUnitCharges>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n params?: GetUnitChargesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUnitCharges>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUnitChargesQueryOptions(unitId, params, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n"]}
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aE as customInstance, ap as OrganisationUnitsGetResponse, aF as ErrorType, aA as AsError, o as OrganisationUnitPostBodyBody, as as OrganisationUnitPostResponse, w as UnitDetail, n as UnitPatchBodyBody, a4 as UnitsGetResponse, p as PersonalUnitPutBodyBody, ar as PersonalUnitPutResponse, k as GetUnitChargesParams, ab as UnitChargesGetResponse } from '../custom-instance-
|
|
1
|
+
import { aE as customInstance, ap as OrganisationUnitsGetResponse, aF as ErrorType, aA as AsError, o as OrganisationUnitPostBodyBody, as as OrganisationUnitPostResponse, w as UnitDetail, n as UnitPatchBodyBody, a4 as UnitsGetResponse, p as PersonalUnitPutBodyBody, ar as PersonalUnitPutResponse, k as GetUnitChargesParams, ab as UnitChargesGetResponse } from '../custom-instance-8a11f2d1.js';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
4
4
|
import 'axios';
|
|
@@ -10,7 +10,13 @@ type SecondParameter<T extends (...args: any) => any> = T extends (config: any,
|
|
|
10
10
|
* @summary Gets Organisational Units
|
|
11
11
|
*/
|
|
12
12
|
declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationUnitsGetResponse>;
|
|
13
|
-
declare const getGetOrganisationUnitsQueryKey: (orgId: string) => string
|
|
13
|
+
declare const getGetOrganisationUnitsQueryKey: (orgId: string) => readonly ["account-server-api", `/organisation/${string}/unit`];
|
|
14
|
+
declare const getGetOrganisationUnitsQueryOptions: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
15
|
+
query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
16
|
+
request?: SecondParameter<typeof customInstance>;
|
|
17
|
+
} | undefined) => UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> & {
|
|
18
|
+
queryKey: QueryKey;
|
|
19
|
+
};
|
|
14
20
|
type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
|
|
15
21
|
type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
16
22
|
declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
@@ -25,6 +31,16 @@ declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TE
|
|
|
25
31
|
* @summary Create a new Organisational Unit
|
|
26
32
|
*/
|
|
27
33
|
declare const createOrganisationUnit: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
|
|
34
|
+
declare const getCreateOrganisationUnitMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
35
|
+
mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
36
|
+
orgId: string;
|
|
37
|
+
data: OrganisationUnitPostBodyBody;
|
|
38
|
+
}, TContext> | undefined;
|
|
39
|
+
request?: SecondParameter<typeof customInstance>;
|
|
40
|
+
} | undefined) => UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
41
|
+
orgId: string;
|
|
42
|
+
data: OrganisationUnitPostBodyBody;
|
|
43
|
+
}, TContext>;
|
|
28
44
|
type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
|
|
29
45
|
type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
30
46
|
type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
@@ -44,7 +60,13 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
|
|
|
44
60
|
* @summary Gets an Organisational Unit
|
|
45
61
|
*/
|
|
46
62
|
declare const getUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitDetail>;
|
|
47
|
-
declare const getGetUnitQueryKey: (unitId: string) => string
|
|
63
|
+
declare const getGetUnitQueryKey: (unitId: string) => readonly ["account-server-api", `/unit/${string}`];
|
|
64
|
+
declare const getGetUnitQueryOptions: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
65
|
+
query?: UseQueryOptions<UnitDetail, TError, TData, QueryKey> | undefined;
|
|
66
|
+
request?: SecondParameter<typeof customInstance>;
|
|
67
|
+
} | undefined) => UseQueryOptions<UnitDetail, TError, TData, QueryKey> & {
|
|
68
|
+
queryKey: QueryKey;
|
|
69
|
+
};
|
|
48
70
|
type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
|
|
49
71
|
type GetUnitQueryError = ErrorType<void | AsError>;
|
|
50
72
|
declare const useGetUnit: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
@@ -61,6 +83,16 @@ You have to be the Unit owner (or an administrator) to patch a Unit.
|
|
|
61
83
|
* @summary Adjust an existing Unit
|
|
62
84
|
*/
|
|
63
85
|
declare const patchUnit: (unitId: string, unitPatchBodyBody: UnitPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
86
|
+
declare const getPatchUnitMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
87
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
88
|
+
unitId: string;
|
|
89
|
+
data: UnitPatchBodyBody;
|
|
90
|
+
}, TContext> | undefined;
|
|
91
|
+
request?: SecondParameter<typeof customInstance>;
|
|
92
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
93
|
+
unitId: string;
|
|
94
|
+
data: UnitPatchBodyBody;
|
|
95
|
+
}, TContext>;
|
|
64
96
|
type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>;
|
|
65
97
|
type PatchUnitMutationBody = UnitPatchBodyBody;
|
|
66
98
|
type PatchUnitMutationError = ErrorType<AsError>;
|
|
@@ -80,6 +112,14 @@ declare const usePatchUnit: <TError = ErrorType<AsError>, TContext = unknown>(op
|
|
|
80
112
|
* @summary Deletes an Organisational Unit
|
|
81
113
|
*/
|
|
82
114
|
declare const deleteOrganisationUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
115
|
+
declare const getDeleteOrganisationUnitMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
116
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
117
|
+
unitId: string;
|
|
118
|
+
}, TContext> | undefined;
|
|
119
|
+
request?: SecondParameter<typeof customInstance>;
|
|
120
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
121
|
+
unitId: string;
|
|
122
|
+
}, TContext>;
|
|
83
123
|
type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
|
|
84
124
|
type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
85
125
|
declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
@@ -96,7 +136,13 @@ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext
|
|
|
96
136
|
* @summary Gets Units
|
|
97
137
|
*/
|
|
98
138
|
declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitsGetResponse>;
|
|
99
|
-
declare const getGetUnitsQueryKey: () =>
|
|
139
|
+
declare const getGetUnitsQueryKey: () => readonly ["account-server-api", "/unit"];
|
|
140
|
+
declare const getGetUnitsQueryOptions: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
141
|
+
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
142
|
+
request?: SecondParameter<typeof customInstance>;
|
|
143
|
+
} | undefined) => UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> & {
|
|
144
|
+
queryKey: QueryKey;
|
|
145
|
+
};
|
|
100
146
|
type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
|
|
101
147
|
type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
102
148
|
declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
@@ -111,6 +157,14 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
|
|
|
111
157
|
* @summary Create a new Personal Unit
|
|
112
158
|
*/
|
|
113
159
|
declare const createDefaultUnit: (personalUnitPutBodyBody: PersonalUnitPutBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
|
|
160
|
+
declare const getCreateDefaultUnitMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
161
|
+
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
162
|
+
data: PersonalUnitPutBodyBody;
|
|
163
|
+
}, TContext> | undefined;
|
|
164
|
+
request?: SecondParameter<typeof customInstance>;
|
|
165
|
+
} | undefined) => UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
166
|
+
data: PersonalUnitPutBodyBody;
|
|
167
|
+
}, TContext>;
|
|
114
168
|
type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
|
|
115
169
|
type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
|
|
116
170
|
type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
@@ -128,6 +182,10 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContex
|
|
|
128
182
|
* @summary Deletes a Personal Unit
|
|
129
183
|
*/
|
|
130
184
|
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
185
|
+
declare const getDeleteDefaultUnitMutationOptions: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
186
|
+
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
187
|
+
request?: SecondParameter<typeof customInstance>;
|
|
188
|
+
} | undefined) => UseMutationOptions<void, TError, TVariables, TContext>;
|
|
131
189
|
type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
|
|
132
190
|
type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
133
191
|
declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
@@ -145,7 +203,13 @@ You need to be part of the **Unit** or **Organisation** to use this method
|
|
|
145
203
|
* @summary Get charges made against a Unit
|
|
146
204
|
*/
|
|
147
205
|
declare const getUnitCharges: (unitId: string, params?: GetUnitChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitChargesGetResponse>;
|
|
148
|
-
declare const getGetUnitChargesQueryKey: (unitId: string, params?: GetUnitChargesParams) =>
|
|
206
|
+
declare const getGetUnitChargesQueryKey: (unitId: string, params?: GetUnitChargesParams) => readonly ["account-server-api", `/unit/${string}/charges`, ...GetUnitChargesParams[]];
|
|
207
|
+
declare const getGetUnitChargesQueryOptions: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
208
|
+
query?: UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> | undefined;
|
|
209
|
+
request?: SecondParameter<typeof customInstance>;
|
|
210
|
+
} | undefined) => UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> & {
|
|
211
|
+
queryKey: QueryKey;
|
|
212
|
+
};
|
|
149
213
|
type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;
|
|
150
214
|
type GetUnitChargesQueryError = ErrorType<AsError | void>;
|
|
151
215
|
declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
@@ -155,4 +219,4 @@ declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = Error
|
|
|
155
219
|
queryKey: QueryKey;
|
|
156
220
|
};
|
|
157
221
|
|
|
158
|
-
export { CreateDefaultUnitMutationBody, CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitChargesQueryError, GetUnitChargesQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, PatchUnitMutationBody, PatchUnitMutationError, PatchUnitMutationResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitChargesQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnitCharges, getUnits, patchUnit, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnitCharges, useGetUnits, usePatchUnit };
|
|
222
|
+
export { CreateDefaultUnitMutationBody, CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitChargesQueryError, GetUnitChargesQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, PatchUnitMutationBody, PatchUnitMutationError, PatchUnitMutationResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getCreateDefaultUnitMutationOptions, getCreateOrganisationUnitMutationOptions, getDeleteDefaultUnitMutationOptions, getDeleteOrganisationUnitMutationOptions, getGetOrganisationUnitsQueryKey, getGetOrganisationUnitsQueryOptions, getGetUnitChargesQueryKey, getGetUnitChargesQueryOptions, getGetUnitQueryKey, getGetUnitQueryOptions, getGetUnitsQueryKey, getGetUnitsQueryOptions, getOrganisationUnits, getPatchUnitMutationOptions, getUnit, getUnitCharges, getUnits, patchUnit, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnitCharges, useGetUnits, usePatchUnit };
|