@squonk/account-server-client 2.0.6 → 2.0.7
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 +14 -7
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +33 -0
- package/admin/admin.d.ts +4 -1
- package/admin/admin.js +14 -7
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +44 -19
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +241 -0
- package/asset/asset.d.ts +43 -19
- package/asset/asset.js +37 -12
- package/asset/asset.js.map +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
- package/chunk-J22A7LHX.cjs.map +1 -0
- package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
- package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
- package/{custom-instance-f32f6506.d.ts → custom-instance-13ade7a9.d.ts} +159 -159
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +23 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +57 -0
- package/merchant/merchant.d.ts +7 -1
- package/merchant/merchant.js +22 -12
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +50 -25
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +203 -0
- package/organisation/organisation.d.ts +31 -10
- package/organisation/organisation.js +44 -19
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +80 -44
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +280 -0
- package/product/product.d.ts +40 -10
- package/product/product.js +71 -35
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +268 -276
- package/src/admin/admin.ts +72 -78
- package/src/asset/asset.ts +447 -556
- package/src/merchant/merchant.ts +125 -136
- package/src/organisation/organisation.ts +394 -484
- package/src/product/product.ts +557 -682
- package/src/state/state.ts +70 -69
- package/src/unit/unit.ts +494 -593
- package/src/user/user.ts +377 -463
- package/state/state.cjs +13 -7
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +29 -0
- package/state/state.d.ts +4 -1
- package/state/state.js +13 -7
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +59 -28
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +254 -0
- package/unit/unit.d.ts +43 -16
- package/unit/unit.js +52 -21
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +52 -21
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +220 -0
- package/user/user.d.ts +31 -10
- package/user/user.js +46 -15
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/unit/unit.d.cts
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
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-13ade7a9.js';
|
|
4
|
+
import 'axios';
|
|
5
|
+
|
|
6
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
7
|
+
/**
|
|
8
|
+
* Gets Organisational Units you have access to or that are public
|
|
9
|
+
|
|
10
|
+
* @summary Gets Organisational Units
|
|
11
|
+
*/
|
|
12
|
+
declare const getOrganisationUnits: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<OrganisationUnitsGetResponse>;
|
|
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
|
+
};
|
|
20
|
+
type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
|
|
21
|
+
type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Gets Organisational Units
|
|
24
|
+
*/
|
|
25
|
+
declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
26
|
+
query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
27
|
+
request?: SecondParameter<typeof customInstance>;
|
|
28
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
29
|
+
queryKey: QueryKey;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new Organisation Unit. You need to be a member of the **Organisation** or have administration rights to use this endpoint
|
|
33
|
+
|
|
34
|
+
* @summary Create a new Organisational Unit
|
|
35
|
+
*/
|
|
36
|
+
declare const createOrganisationUnit: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
|
|
37
|
+
declare const getCreateOrganisationUnitMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
38
|
+
mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
39
|
+
orgId: string;
|
|
40
|
+
data: OrganisationUnitPostBodyBody;
|
|
41
|
+
}, TContext> | undefined;
|
|
42
|
+
request?: SecondParameter<typeof customInstance>;
|
|
43
|
+
} | undefined) => UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
44
|
+
orgId: string;
|
|
45
|
+
data: OrganisationUnitPostBodyBody;
|
|
46
|
+
}, TContext>;
|
|
47
|
+
type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
|
|
48
|
+
type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
49
|
+
type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
50
|
+
/**
|
|
51
|
+
* @summary Create a new Organisational Unit
|
|
52
|
+
*/
|
|
53
|
+
declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
54
|
+
mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
55
|
+
orgId: string;
|
|
56
|
+
data: OrganisationUnitPostBodyBody;
|
|
57
|
+
}, TContext> | undefined;
|
|
58
|
+
request?: SecondParameter<typeof customInstance>;
|
|
59
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<OrganisationUnitPostResponse, TError, {
|
|
60
|
+
orgId: string;
|
|
61
|
+
data: OrganisationUnitPostBodyBody;
|
|
62
|
+
}, TContext>;
|
|
63
|
+
/**
|
|
64
|
+
* Gets a Unit, assuming it is public, you are a member of it or its **Organisation**. Admin users have access to all Units
|
|
65
|
+
|
|
66
|
+
* @summary Gets an Organisational Unit
|
|
67
|
+
*/
|
|
68
|
+
declare const getUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitDetail>;
|
|
69
|
+
declare const getGetUnitQueryKey: (unitId: string) => readonly ["account-server-api", `/unit/${string}`];
|
|
70
|
+
declare const getGetUnitQueryOptions: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
71
|
+
query?: UseQueryOptions<UnitDetail, TError, TData, QueryKey> | undefined;
|
|
72
|
+
request?: SecondParameter<typeof customInstance>;
|
|
73
|
+
} | undefined) => UseQueryOptions<UnitDetail, TError, TData, QueryKey> & {
|
|
74
|
+
queryKey: QueryKey;
|
|
75
|
+
};
|
|
76
|
+
type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
|
|
77
|
+
type GetUnitQueryError = ErrorType<void | AsError>;
|
|
78
|
+
/**
|
|
79
|
+
* @summary Gets an Organisational Unit
|
|
80
|
+
*/
|
|
81
|
+
declare const useGetUnit: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
82
|
+
query?: UseQueryOptions<UnitDetail, TError, TData, QueryKey> | undefined;
|
|
83
|
+
request?: SecondParameter<typeof customInstance>;
|
|
84
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
85
|
+
queryKey: QueryKey;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Used to update existing Unit.
|
|
89
|
+
|
|
90
|
+
You have to be the Unit owner, a member of its **Organisation** or an administrator to patch a Unit.
|
|
91
|
+
|
|
92
|
+
* @summary Adjust an existing Unit
|
|
93
|
+
*/
|
|
94
|
+
declare const patchUnit: (unitId: string, unitPatchBodyBody: UnitPatchBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
95
|
+
declare const getPatchUnitMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
96
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
97
|
+
unitId: string;
|
|
98
|
+
data: UnitPatchBodyBody;
|
|
99
|
+
}, TContext> | undefined;
|
|
100
|
+
request?: SecondParameter<typeof customInstance>;
|
|
101
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
102
|
+
unitId: string;
|
|
103
|
+
data: UnitPatchBodyBody;
|
|
104
|
+
}, TContext>;
|
|
105
|
+
type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>;
|
|
106
|
+
type PatchUnitMutationBody = UnitPatchBodyBody;
|
|
107
|
+
type PatchUnitMutationError = ErrorType<AsError>;
|
|
108
|
+
/**
|
|
109
|
+
* @summary Adjust an existing Unit
|
|
110
|
+
*/
|
|
111
|
+
declare const usePatchUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
112
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
113
|
+
unitId: string;
|
|
114
|
+
data: UnitPatchBodyBody;
|
|
115
|
+
}, TContext> | undefined;
|
|
116
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
|
|
118
|
+
unitId: string;
|
|
119
|
+
data: UnitPatchBodyBody;
|
|
120
|
+
}, TContext>;
|
|
121
|
+
/**
|
|
122
|
+
* Deletes an Organisational Unit you have access to. Units can only be deleted by members of the Unit, its Organisation users or admin users.
|
|
123
|
+
|
|
124
|
+
You cannot delete Units in the **Default Organisation**. These Units are **Personal Units** and need to be deleted using the `DELETE /unit` endpoint.
|
|
125
|
+
|
|
126
|
+
You cannot delete a Unit that contains undeleted **Products**
|
|
127
|
+
|
|
128
|
+
* @summary Deletes an Organisational Unit
|
|
129
|
+
*/
|
|
130
|
+
declare const deleteOrganisationUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
131
|
+
declare const getDeleteOrganisationUnitMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
132
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
133
|
+
unitId: string;
|
|
134
|
+
}, TContext> | undefined;
|
|
135
|
+
request?: SecondParameter<typeof customInstance>;
|
|
136
|
+
} | undefined) => UseMutationOptions<void, TError, {
|
|
137
|
+
unitId: string;
|
|
138
|
+
}, TContext>;
|
|
139
|
+
type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
|
|
140
|
+
type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
141
|
+
/**
|
|
142
|
+
* @summary Deletes an Organisational Unit
|
|
143
|
+
*/
|
|
144
|
+
declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
145
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
146
|
+
unitId: string;
|
|
147
|
+
}, TContext> | undefined;
|
|
148
|
+
request?: SecondParameter<typeof customInstance>;
|
|
149
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, {
|
|
150
|
+
unitId: string;
|
|
151
|
+
}, TContext>;
|
|
152
|
+
/**
|
|
153
|
+
* Gets all the Units that are public or you are a member of. Admin users can see all Units.
|
|
154
|
+
|
|
155
|
+
* @summary Gets Units
|
|
156
|
+
*/
|
|
157
|
+
declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitsGetResponse>;
|
|
158
|
+
declare const getGetUnitsQueryKey: () => readonly ["account-server-api", "/unit"];
|
|
159
|
+
declare const getGetUnitsQueryOptions: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
160
|
+
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
161
|
+
request?: SecondParameter<typeof customInstance>;
|
|
162
|
+
} | undefined) => UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> & {
|
|
163
|
+
queryKey: QueryKey;
|
|
164
|
+
};
|
|
165
|
+
type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
|
|
166
|
+
type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
167
|
+
/**
|
|
168
|
+
* @summary Gets Units
|
|
169
|
+
*/
|
|
170
|
+
declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
171
|
+
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
172
|
+
request?: SecondParameter<typeof customInstance>;
|
|
173
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
174
|
+
queryKey: QueryKey;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Creates a Personal Unit for a User. The unit will belong to the built-in **Default Organisation**.
|
|
178
|
+
|
|
179
|
+
Users can only create one Personal unit and you cannot add other Users to a Personal Unit.
|
|
180
|
+
|
|
181
|
+
* @summary Create a new Personal Unit
|
|
182
|
+
*/
|
|
183
|
+
declare const createDefaultUnit: (personalUnitPutBodyBody: PersonalUnitPutBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
|
|
184
|
+
declare const getCreateDefaultUnitMutationOptions: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
185
|
+
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
186
|
+
data: PersonalUnitPutBodyBody;
|
|
187
|
+
}, TContext> | undefined;
|
|
188
|
+
request?: SecondParameter<typeof customInstance>;
|
|
189
|
+
} | undefined) => UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
190
|
+
data: PersonalUnitPutBodyBody;
|
|
191
|
+
}, TContext>;
|
|
192
|
+
type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
|
|
193
|
+
type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
|
|
194
|
+
type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
195
|
+
/**
|
|
196
|
+
* @summary Create a new Personal Unit
|
|
197
|
+
*/
|
|
198
|
+
declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
199
|
+
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
200
|
+
data: PersonalUnitPutBodyBody;
|
|
201
|
+
}, TContext> | undefined;
|
|
202
|
+
request?: SecondParameter<typeof customInstance>;
|
|
203
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<PersonalUnitPutResponse, TError, {
|
|
204
|
+
data: PersonalUnitPutBodyBody;
|
|
205
|
+
}, TContext>;
|
|
206
|
+
/**
|
|
207
|
+
* Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
|
|
208
|
+
|
|
209
|
+
* @summary Deletes a Personal Unit
|
|
210
|
+
*/
|
|
211
|
+
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
212
|
+
declare const getDeleteDefaultUnitMutationOptions: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
213
|
+
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
214
|
+
request?: SecondParameter<typeof customInstance>;
|
|
215
|
+
} | undefined) => UseMutationOptions<void, TError, TVariables, TContext>;
|
|
216
|
+
type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
|
|
217
|
+
type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
218
|
+
/**
|
|
219
|
+
* @summary Deletes a Personal Unit
|
|
220
|
+
*/
|
|
221
|
+
declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
222
|
+
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
223
|
+
request?: SecondParameter<typeof customInstance>;
|
|
224
|
+
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, TVariables, TContext>;
|
|
225
|
+
/**
|
|
226
|
+
* 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.
|
|
227
|
+
Dates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.
|
|
228
|
+
|
|
229
|
+
**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.
|
|
230
|
+
|
|
231
|
+
You need to be part of the **Unit** or **Organisation** to use this method
|
|
232
|
+
* @summary Get charges made against a Unit
|
|
233
|
+
*/
|
|
234
|
+
declare const getUnitCharges: (unitId: string, params?: GetUnitChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitChargesGetResponse>;
|
|
235
|
+
declare const getGetUnitChargesQueryKey: (unitId: string, params?: GetUnitChargesParams) => readonly ["account-server-api", `/unit/${string}/charges`, ...GetUnitChargesParams[]];
|
|
236
|
+
declare const getGetUnitChargesQueryOptions: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
237
|
+
query?: UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> | undefined;
|
|
238
|
+
request?: SecondParameter<typeof customInstance>;
|
|
239
|
+
} | undefined) => UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> & {
|
|
240
|
+
queryKey: QueryKey;
|
|
241
|
+
};
|
|
242
|
+
type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;
|
|
243
|
+
type GetUnitChargesQueryError = ErrorType<AsError | void>;
|
|
244
|
+
/**
|
|
245
|
+
* @summary Get charges made against a Unit
|
|
246
|
+
*/
|
|
247
|
+
declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
248
|
+
query?: UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> | undefined;
|
|
249
|
+
request?: SecondParameter<typeof customInstance>;
|
|
250
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
251
|
+
queryKey: QueryKey;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
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 };
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-f32f6506.js';
|
|
2
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
+
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-13ade7a9.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
6
|
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
@@ -19,6 +19,9 @@ declare const getGetOrganisationUnitsQueryOptions: <TData = OrganisationUnitsGet
|
|
|
19
19
|
};
|
|
20
20
|
type GetOrganisationUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnits>>>;
|
|
21
21
|
type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Gets Organisational Units
|
|
24
|
+
*/
|
|
22
25
|
declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
23
26
|
query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
24
27
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -44,6 +47,9 @@ declare const getCreateOrganisationUnitMutationOptions: <TError = ErrorType<void
|
|
|
44
47
|
type CreateOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisationUnit>>>;
|
|
45
48
|
type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;
|
|
46
49
|
type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;
|
|
50
|
+
/**
|
|
51
|
+
* @summary Create a new Organisational Unit
|
|
52
|
+
*/
|
|
47
53
|
declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
48
54
|
mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
|
|
49
55
|
orgId: string;
|
|
@@ -55,10 +61,10 @@ declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TC
|
|
|
55
61
|
data: OrganisationUnitPostBodyBody;
|
|
56
62
|
}, TContext>;
|
|
57
63
|
/**
|
|
58
|
-
|
|
64
|
+
* Gets a Unit, assuming it is public, you are a member of it or its **Organisation**. Admin users have access to all Units
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
* @summary Gets an Organisational Unit
|
|
67
|
+
*/
|
|
62
68
|
declare const getUnit: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitDetail>;
|
|
63
69
|
declare const getGetUnitQueryKey: (unitId: string) => readonly ["account-server-api", `/unit/${string}`];
|
|
64
70
|
declare const getGetUnitQueryOptions: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
@@ -69,6 +75,9 @@ declare const getGetUnitQueryOptions: <TData = UnitDetail, TError = ErrorType<vo
|
|
|
69
75
|
};
|
|
70
76
|
type GetUnitQueryResult = NonNullable<Awaited<ReturnType<typeof getUnit>>>;
|
|
71
77
|
type GetUnitQueryError = ErrorType<void | AsError>;
|
|
78
|
+
/**
|
|
79
|
+
* @summary Gets an Organisational Unit
|
|
80
|
+
*/
|
|
72
81
|
declare const useGetUnit: <TData = UnitDetail, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
73
82
|
query?: UseQueryOptions<UnitDetail, TError, TData, QueryKey> | undefined;
|
|
74
83
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -96,6 +105,9 @@ declare const getPatchUnitMutationOptions: <TError = ErrorType<AsError>, TContex
|
|
|
96
105
|
type PatchUnitMutationResult = NonNullable<Awaited<ReturnType<typeof patchUnit>>>;
|
|
97
106
|
type PatchUnitMutationBody = UnitPatchBodyBody;
|
|
98
107
|
type PatchUnitMutationError = ErrorType<AsError>;
|
|
108
|
+
/**
|
|
109
|
+
* @summary Adjust an existing Unit
|
|
110
|
+
*/
|
|
99
111
|
declare const usePatchUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
100
112
|
mutation?: UseMutationOptions<void, TError, {
|
|
101
113
|
unitId: string;
|
|
@@ -107,14 +119,14 @@ declare const usePatchUnit: <TError = ErrorType<AsError>, TContext = unknown>(op
|
|
|
107
119
|
data: UnitPatchBodyBody;
|
|
108
120
|
}, TContext>;
|
|
109
121
|
/**
|
|
110
|
-
|
|
122
|
+
* Deletes an Organisational Unit you have access to. Units can only be deleted by members of the Unit, its Organisation users or admin users.
|
|
111
123
|
|
|
112
124
|
You cannot delete Units in the **Default Organisation**. These Units are **Personal Units** and need to be deleted using the `DELETE /unit` endpoint.
|
|
113
125
|
|
|
114
126
|
You cannot delete a Unit that contains undeleted **Products**
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
* @summary Deletes an Organisational Unit
|
|
129
|
+
*/
|
|
118
130
|
declare const deleteOrganisationUnit: (unitId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
119
131
|
declare const getDeleteOrganisationUnitMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
120
132
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -126,6 +138,9 @@ declare const getDeleteOrganisationUnitMutationOptions: <TError = ErrorType<AsEr
|
|
|
126
138
|
}, TContext>;
|
|
127
139
|
type DeleteOrganisationUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnit>>>;
|
|
128
140
|
type DeleteOrganisationUnitMutationError = ErrorType<AsError>;
|
|
141
|
+
/**
|
|
142
|
+
* @summary Deletes an Organisational Unit
|
|
143
|
+
*/
|
|
129
144
|
declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
130
145
|
mutation?: UseMutationOptions<void, TError, {
|
|
131
146
|
unitId: string;
|
|
@@ -135,10 +150,10 @@ declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext
|
|
|
135
150
|
unitId: string;
|
|
136
151
|
}, TContext>;
|
|
137
152
|
/**
|
|
138
|
-
|
|
153
|
+
* Gets all the Units that are public or you are a member of. Admin users can see all Units.
|
|
139
154
|
|
|
140
|
-
|
|
141
|
-
|
|
155
|
+
* @summary Gets Units
|
|
156
|
+
*/
|
|
142
157
|
declare const getUnits: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitsGetResponse>;
|
|
143
158
|
declare const getGetUnitsQueryKey: () => readonly ["account-server-api", "/unit"];
|
|
144
159
|
declare const getGetUnitsQueryOptions: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
@@ -149,6 +164,9 @@ declare const getGetUnitsQueryOptions: <TData = UnitsGetResponse, TError = Error
|
|
|
149
164
|
};
|
|
150
165
|
type GetUnitsQueryResult = NonNullable<Awaited<ReturnType<typeof getUnits>>>;
|
|
151
166
|
type GetUnitsQueryError = ErrorType<void | AsError>;
|
|
167
|
+
/**
|
|
168
|
+
* @summary Gets Units
|
|
169
|
+
*/
|
|
152
170
|
declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
153
171
|
query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
|
|
154
172
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -174,6 +192,9 @@ declare const getCreateDefaultUnitMutationOptions: <TError = ErrorType<void | As
|
|
|
174
192
|
type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
|
|
175
193
|
type CreateDefaultUnitMutationBody = PersonalUnitPutBodyBody;
|
|
176
194
|
type CreateDefaultUnitMutationError = ErrorType<AsError | void>;
|
|
195
|
+
/**
|
|
196
|
+
* @summary Create a new Personal Unit
|
|
197
|
+
*/
|
|
177
198
|
declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
|
|
178
199
|
mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, {
|
|
179
200
|
data: PersonalUnitPutBodyBody;
|
|
@@ -183,10 +204,10 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TContex
|
|
|
183
204
|
data: PersonalUnitPutBodyBody;
|
|
184
205
|
}, TContext>;
|
|
185
206
|
/**
|
|
186
|
-
|
|
207
|
+
* Deletes a Personal Unit. The Unit is *your* Unit, and belongs to the **Default Organisation**
|
|
187
208
|
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
* @summary Deletes a Personal Unit
|
|
210
|
+
*/
|
|
190
211
|
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
191
212
|
declare const getDeleteDefaultUnitMutationOptions: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
192
213
|
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
@@ -194,19 +215,22 @@ declare const getDeleteDefaultUnitMutationOptions: <TError = ErrorType<AsError>,
|
|
|
194
215
|
} | undefined) => UseMutationOptions<void, TError, TVariables, TContext>;
|
|
195
216
|
type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
|
|
196
217
|
type DeleteDefaultUnitMutationError = ErrorType<AsError>;
|
|
218
|
+
/**
|
|
219
|
+
* @summary Deletes a Personal Unit
|
|
220
|
+
*/
|
|
197
221
|
declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
|
|
198
222
|
mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
|
|
199
223
|
request?: SecondParameter<typeof customInstance>;
|
|
200
224
|
} | undefined) => _tanstack_react_query.UseMutationResult<void, TError, TVariables, TContext>;
|
|
201
225
|
/**
|
|
202
|
-
|
|
226
|
+
* 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.
|
|
203
227
|
Dates are interpreted using the Python `dateutil` parser, so the input strings are extremely flexible with, for example, `1 December 2021` as an acceptable input.
|
|
204
228
|
|
|
205
229
|
**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.
|
|
206
230
|
|
|
207
231
|
You need to be part of the **Unit** or **Organisation** to use this method
|
|
208
|
-
|
|
209
|
-
|
|
232
|
+
* @summary Get charges made against a Unit
|
|
233
|
+
*/
|
|
210
234
|
declare const getUnitCharges: (unitId: string, params?: GetUnitChargesParams, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UnitChargesGetResponse>;
|
|
211
235
|
declare const getGetUnitChargesQueryKey: (unitId: string, params?: GetUnitChargesParams) => readonly ["account-server-api", `/unit/${string}/charges`, ...GetUnitChargesParams[]];
|
|
212
236
|
declare const getGetUnitChargesQueryOptions: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
@@ -217,6 +241,9 @@ declare const getGetUnitChargesQueryOptions: <TData = UnitChargesGetResponse, TE
|
|
|
217
241
|
};
|
|
218
242
|
type GetUnitChargesQueryResult = NonNullable<Awaited<ReturnType<typeof getUnitCharges>>>;
|
|
219
243
|
type GetUnitChargesQueryError = ErrorType<AsError | void>;
|
|
244
|
+
/**
|
|
245
|
+
* @summary Get charges made against a Unit
|
|
246
|
+
*/
|
|
220
247
|
declare const useGetUnitCharges: <TData = UnitChargesGetResponse, TError = ErrorType<void | AsError>>(unitId: string, params?: GetUnitChargesParams, options?: {
|
|
221
248
|
query?: UseQueryOptions<UnitChargesGetResponse, TError, TData, QueryKey> | undefined;
|
|
222
249
|
request?: SecondParameter<typeof customInstance>;
|
package/unit/unit.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-UKA7G3OB.js";
|
|
4
4
|
|
|
5
5
|
// src/unit/unit.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useMutation,
|
|
8
|
+
useQuery
|
|
9
|
+
} from "@tanstack/react-query";
|
|
7
10
|
var getOrganisationUnits = (orgId, options, signal) => {
|
|
8
11
|
return customInstance(
|
|
9
|
-
{
|
|
12
|
+
{
|
|
13
|
+
url: `/organisation/${orgId}/unit`,
|
|
14
|
+
method: "get",
|
|
15
|
+
signal
|
|
16
|
+
},
|
|
10
17
|
options
|
|
11
18
|
);
|
|
12
19
|
};
|
|
13
|
-
var getGetOrganisationUnitsQueryKey = (orgId) =>
|
|
20
|
+
var getGetOrganisationUnitsQueryKey = (orgId) => {
|
|
21
|
+
return ["account-server-api", `/organisation/${orgId}/unit`];
|
|
22
|
+
};
|
|
14
23
|
var getGetOrganisationUnitsQueryOptions = (orgId, options) => {
|
|
15
24
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
25
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
@@ -48,17 +57,21 @@ var useCreateOrganisationUnit = (options) => {
|
|
|
48
57
|
};
|
|
49
58
|
var getUnit = (unitId, options, signal) => {
|
|
50
59
|
return customInstance(
|
|
51
|
-
{
|
|
60
|
+
{
|
|
61
|
+
url: `/unit/${unitId}`,
|
|
62
|
+
method: "get",
|
|
63
|
+
signal
|
|
64
|
+
},
|
|
52
65
|
options
|
|
53
66
|
);
|
|
54
67
|
};
|
|
55
|
-
var getGetUnitQueryKey = (unitId) =>
|
|
68
|
+
var getGetUnitQueryKey = (unitId) => {
|
|
69
|
+
return ["account-server-api", `/unit/${unitId}`];
|
|
70
|
+
};
|
|
56
71
|
var getGetUnitQueryOptions = (unitId, options) => {
|
|
57
72
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
58
73
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitQueryKey(unitId);
|
|
59
|
-
const queryFn = ({
|
|
60
|
-
signal
|
|
61
|
-
}) => getUnit(unitId, requestOptions, signal);
|
|
74
|
+
const queryFn = ({ signal }) => getUnit(unitId, requestOptions, signal);
|
|
62
75
|
return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
|
|
63
76
|
};
|
|
64
77
|
var useGetUnit = (unitId, options) => {
|
|
@@ -92,7 +105,10 @@ var usePatchUnit = (options) => {
|
|
|
92
105
|
};
|
|
93
106
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
94
107
|
return customInstance(
|
|
95
|
-
{
|
|
108
|
+
{
|
|
109
|
+
url: `/unit/${unitId}`,
|
|
110
|
+
method: "delete"
|
|
111
|
+
},
|
|
96
112
|
options
|
|
97
113
|
);
|
|
98
114
|
};
|
|
@@ -110,17 +126,21 @@ var useDeleteOrganisationUnit = (options) => {
|
|
|
110
126
|
};
|
|
111
127
|
var getUnits = (options, signal) => {
|
|
112
128
|
return customInstance(
|
|
113
|
-
{
|
|
129
|
+
{
|
|
130
|
+
url: `/unit`,
|
|
131
|
+
method: "get",
|
|
132
|
+
signal
|
|
133
|
+
},
|
|
114
134
|
options
|
|
115
135
|
);
|
|
116
136
|
};
|
|
117
|
-
var getGetUnitsQueryKey = () =>
|
|
137
|
+
var getGetUnitsQueryKey = () => {
|
|
138
|
+
return ["account-server-api", `/unit`];
|
|
139
|
+
};
|
|
118
140
|
var getGetUnitsQueryOptions = (options) => {
|
|
119
141
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
120
142
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitsQueryKey();
|
|
121
|
-
const queryFn = ({
|
|
122
|
-
signal
|
|
123
|
-
}) => getUnits(requestOptions, signal);
|
|
143
|
+
const queryFn = ({ signal }) => getUnits(requestOptions, signal);
|
|
124
144
|
return { queryKey, queryFn, ...queryOptions };
|
|
125
145
|
};
|
|
126
146
|
var useGetUnits = (options) => {
|
|
@@ -153,7 +173,13 @@ var useCreateDefaultUnit = (options) => {
|
|
|
153
173
|
return useMutation(mutationOptions);
|
|
154
174
|
};
|
|
155
175
|
var deleteDefaultUnit = (options) => {
|
|
156
|
-
return customInstance(
|
|
176
|
+
return customInstance(
|
|
177
|
+
{
|
|
178
|
+
url: `/unit`,
|
|
179
|
+
method: "delete"
|
|
180
|
+
},
|
|
181
|
+
options
|
|
182
|
+
);
|
|
157
183
|
};
|
|
158
184
|
var getDeleteDefaultUnitMutationOptions = (options) => {
|
|
159
185
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
@@ -168,17 +194,22 @@ var useDeleteDefaultUnit = (options) => {
|
|
|
168
194
|
};
|
|
169
195
|
var getUnitCharges = (unitId, params, options, signal) => {
|
|
170
196
|
return customInstance(
|
|
171
|
-
{
|
|
197
|
+
{
|
|
198
|
+
url: `/unit/${unitId}/charges`,
|
|
199
|
+
method: "get",
|
|
200
|
+
params,
|
|
201
|
+
signal
|
|
202
|
+
},
|
|
172
203
|
options
|
|
173
204
|
);
|
|
174
205
|
};
|
|
175
|
-
var getGetUnitChargesQueryKey = (unitId, params) =>
|
|
206
|
+
var getGetUnitChargesQueryKey = (unitId, params) => {
|
|
207
|
+
return ["account-server-api", `/unit/${unitId}/charges`, ...params ? [params] : []];
|
|
208
|
+
};
|
|
176
209
|
var getGetUnitChargesQueryOptions = (unitId, params, options) => {
|
|
177
210
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
178
211
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUnitChargesQueryKey(unitId, params);
|
|
179
|
-
const queryFn = ({
|
|
180
|
-
signal
|
|
181
|
-
}) => getUnitCharges(unitId, params, requestOptions, signal);
|
|
212
|
+
const queryFn = ({ signal }) => getUnitCharges(unitId, params, requestOptions, signal);
|
|
182
213
|
return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };
|
|
183
214
|
};
|
|
184
215
|
var useGetUnitCharges = (unitId, params, options) => {
|