@squonk/account-server-client 4.2.5 → 4.4.0-4-4.2174353771
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/actions/actions.cjs +53 -0
- package/actions/actions.cjs.map +1 -0
- package/actions/actions.d.cts +72 -0
- package/actions/actions.d.ts +72 -0
- package/actions/actions.js +53 -0
- package/actions/actions.js.map +1 -0
- package/actions/package.json +7 -0
- package/asset/asset.cjs +99 -126
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +99 -99
- package/asset/asset.d.ts +99 -99
- package/asset/asset.js +107 -134
- package/asset/asset.js.map +1 -1
- package/charges/charges.cjs +73 -85
- package/charges/charges.cjs.map +1 -1
- package/charges/charges.d.cts +47 -47
- package/charges/charges.d.ts +47 -47
- package/charges/charges.js +78 -90
- package/charges/charges.js.map +1 -1
- package/chunk-76ADQBHZ.js +25 -0
- package/chunk-76ADQBHZ.js.map +1 -0
- package/chunk-KHB5TJT7.cjs +25 -0
- package/chunk-KHB5TJT7.cjs.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/event-stream/event-stream.cjs +53 -61
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +44 -44
- package/event-stream/event-stream.d.ts +44 -44
- package/event-stream/event-stream.js +58 -66
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +56 -58
- package/index.cjs.map +1 -1
- package/index.d.cts +867 -777
- package/index.d.ts +867 -777
- package/index.js +55 -57
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +38 -45
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +25 -25
- package/merchant/merchant.d.ts +25 -25
- package/merchant/merchant.js +42 -49
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +77 -87
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +72 -70
- package/organisation/organisation.d.ts +72 -70
- package/organisation/organisation.js +83 -93
- package/organisation/organisation.js.map +1 -1
- package/package.json +15 -18
- package/product/product.cjs +143 -153
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +100 -100
- package/product/product.d.ts +100 -100
- package/product/product.js +153 -163
- package/product/product.js.map +1 -1
- package/src/{account-server-api.schemas.ts → API_TARGET_NAME.schemas.ts} +931 -849
- package/src/actions/actions.ts +249 -0
- package/src/asset/asset.ts +899 -634
- package/src/charges/charges.ts +822 -498
- package/src/custom-instance.ts +3 -3
- package/src/event-stream/event-stream.ts +530 -344
- package/src/index.ts +3 -3
- package/src/merchant/merchant.ts +355 -234
- package/src/options-mutator.ts +27 -0
- package/src/organisation/organisation.ts +812 -504
- package/src/product/product.ts +1373 -841
- package/src/state/state.ts +174 -127
- package/src/unit/unit.ts +1273 -603
- package/src/user/user.ts +895 -564
- package/state/state.cjs +22 -24
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +14 -14
- package/state/state.d.ts +14 -14
- package/state/state.js +24 -26
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +171 -106
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +200 -90
- package/unit/unit.d.ts +200 -90
- package/unit/unit.js +179 -114
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +94 -110
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +77 -77
- package/user/user.d.ts +77 -77
- package/user/user.js +101 -117
- package/user/user.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.10.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Account Server API
|
|
5
|
+
* The Informatics Matters Account Server API.
|
|
6
|
+
|
|
7
|
+
A service that provides access to the Account Server, which gives *registered* users access to and management of **Organisations**, **Units**, **Products**, **Users**, and **Assets**.
|
|
8
|
+
|
|
9
|
+
* OpenAPI spec version: 4.4
|
|
10
|
+
*/
|
|
11
|
+
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
|
+
import type {
|
|
13
|
+
DataTag,
|
|
14
|
+
DefinedInitialDataOptions,
|
|
15
|
+
DefinedUseQueryResult,
|
|
16
|
+
QueryClient,
|
|
17
|
+
QueryFunction,
|
|
18
|
+
QueryKey,
|
|
19
|
+
UndefinedInitialDataOptions,
|
|
20
|
+
UseQueryOptions,
|
|
21
|
+
UseQueryResult,
|
|
22
|
+
UseSuspenseQueryOptions,
|
|
23
|
+
UseSuspenseQueryResult,
|
|
24
|
+
} from "@tanstack/react-query";
|
|
25
|
+
|
|
26
|
+
import type { ActionGetResponse, GetActionsParams } from "../API_TARGET_NAME.schemas";
|
|
27
|
+
|
|
28
|
+
import { customInstance } from ".././custom-instance";
|
|
29
|
+
import type { ErrorType } from ".././custom-instance";
|
|
30
|
+
import { queryMutator } from ".././options-mutator";
|
|
31
|
+
|
|
32
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This endpoint delivers Action records (protocol buffers) that can be selected based on a date and time range and limited to merchants, organisations, Units, or Products. You can receive Action content as a `PROTOCOL_STRING` (the default), or `JSON_STRING`. If you do not provide a `format` `PROTOCOL_STRING` will be assumed.
|
|
36
|
+
|
|
37
|
+
You can provide a `m_id`, `org_id`, `unit_id`, `product_id`, but only one.
|
|
38
|
+
|
|
39
|
+
You can also provide `from` and `until` dates to limit the response to Actions that occur on the days you select. Actions are returned that are not before the `from` data but are before the `until` date. If neither `from` or `until` is provided `from` is assumed to be from _today_ until _tomorrow_.
|
|
40
|
+
|
|
41
|
+
You need admin privilege to use this endpoint.
|
|
42
|
+
|
|
43
|
+
* @summary Gets Actions held on the Account Server
|
|
44
|
+
*/
|
|
45
|
+
export const getActions = (
|
|
46
|
+
params?: GetActionsParams,
|
|
47
|
+
options?: SecondParameter<typeof customInstance>,
|
|
48
|
+
signal?: AbortSignal,
|
|
49
|
+
) => {
|
|
50
|
+
return customInstance<ActionGetResponse>(
|
|
51
|
+
{ url: `/action`, method: "GET", params, signal },
|
|
52
|
+
options,
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const getGetActionsQueryKey = (params?: GetActionsParams) => {
|
|
57
|
+
return [`/action`, ...(params ? [params] : [])] as const;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const useGetActionsQueryOptions = <
|
|
61
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
62
|
+
TError = ErrorType<void>,
|
|
63
|
+
>(
|
|
64
|
+
params?: GetActionsParams,
|
|
65
|
+
options?: {
|
|
66
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
67
|
+
request?: SecondParameter<typeof customInstance>;
|
|
68
|
+
},
|
|
69
|
+
) => {
|
|
70
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
71
|
+
|
|
72
|
+
const queryKey = queryOptions?.queryKey ?? getGetActionsQueryKey(params);
|
|
73
|
+
|
|
74
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getActions>>> = ({ signal }) =>
|
|
75
|
+
getActions(params, requestOptions, signal);
|
|
76
|
+
|
|
77
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
78
|
+
|
|
79
|
+
return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData> & {
|
|
80
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type GetActionsQueryResult = NonNullable<Awaited<ReturnType<typeof getActions>>>;
|
|
85
|
+
export type GetActionsQueryError = ErrorType<void>;
|
|
86
|
+
|
|
87
|
+
export function useGetActions<
|
|
88
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
89
|
+
TError = ErrorType<void>,
|
|
90
|
+
>(
|
|
91
|
+
params: undefined | GetActionsParams,
|
|
92
|
+
options: {
|
|
93
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>> &
|
|
94
|
+
Pick<
|
|
95
|
+
DefinedInitialDataOptions<
|
|
96
|
+
Awaited<ReturnType<typeof getActions>>,
|
|
97
|
+
TError,
|
|
98
|
+
Awaited<ReturnType<typeof getActions>>
|
|
99
|
+
>,
|
|
100
|
+
"initialData"
|
|
101
|
+
>;
|
|
102
|
+
request?: SecondParameter<typeof customInstance>;
|
|
103
|
+
},
|
|
104
|
+
queryClient?: QueryClient,
|
|
105
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
106
|
+
export function useGetActions<
|
|
107
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
108
|
+
TError = ErrorType<void>,
|
|
109
|
+
>(
|
|
110
|
+
params?: GetActionsParams,
|
|
111
|
+
options?: {
|
|
112
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>> &
|
|
113
|
+
Pick<
|
|
114
|
+
UndefinedInitialDataOptions<
|
|
115
|
+
Awaited<ReturnType<typeof getActions>>,
|
|
116
|
+
TError,
|
|
117
|
+
Awaited<ReturnType<typeof getActions>>
|
|
118
|
+
>,
|
|
119
|
+
"initialData"
|
|
120
|
+
>;
|
|
121
|
+
request?: SecondParameter<typeof customInstance>;
|
|
122
|
+
},
|
|
123
|
+
queryClient?: QueryClient,
|
|
124
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
125
|
+
export function useGetActions<
|
|
126
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
127
|
+
TError = ErrorType<void>,
|
|
128
|
+
>(
|
|
129
|
+
params?: GetActionsParams,
|
|
130
|
+
options?: {
|
|
131
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
132
|
+
request?: SecondParameter<typeof customInstance>;
|
|
133
|
+
},
|
|
134
|
+
queryClient?: QueryClient,
|
|
135
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
136
|
+
/**
|
|
137
|
+
* @summary Gets Actions held on the Account Server
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
export function useGetActions<
|
|
141
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
142
|
+
TError = ErrorType<void>,
|
|
143
|
+
>(
|
|
144
|
+
params?: GetActionsParams,
|
|
145
|
+
options?: {
|
|
146
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
147
|
+
request?: SecondParameter<typeof customInstance>;
|
|
148
|
+
},
|
|
149
|
+
queryClient?: QueryClient,
|
|
150
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
151
|
+
const queryOptions = useGetActionsQueryOptions(params, options);
|
|
152
|
+
|
|
153
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
154
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
query.queryKey = queryOptions.queryKey;
|
|
158
|
+
|
|
159
|
+
return query;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const useGetActionsSuspenseQueryOptions = <
|
|
163
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
164
|
+
TError = ErrorType<void>,
|
|
165
|
+
>(
|
|
166
|
+
params?: GetActionsParams,
|
|
167
|
+
options?: {
|
|
168
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
169
|
+
request?: SecondParameter<typeof customInstance>;
|
|
170
|
+
},
|
|
171
|
+
) => {
|
|
172
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
173
|
+
|
|
174
|
+
const queryKey = queryOptions?.queryKey ?? getGetActionsQueryKey(params);
|
|
175
|
+
|
|
176
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getActions>>> = ({ signal }) =>
|
|
177
|
+
getActions(params, requestOptions, signal);
|
|
178
|
+
|
|
179
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
180
|
+
|
|
181
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
182
|
+
Awaited<ReturnType<typeof getActions>>,
|
|
183
|
+
TError,
|
|
184
|
+
TData
|
|
185
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export type GetActionsSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getActions>>>;
|
|
189
|
+
export type GetActionsSuspenseQueryError = ErrorType<void>;
|
|
190
|
+
|
|
191
|
+
export function useGetActionsSuspense<
|
|
192
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
193
|
+
TError = ErrorType<void>,
|
|
194
|
+
>(
|
|
195
|
+
params: undefined | GetActionsParams,
|
|
196
|
+
options: {
|
|
197
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
198
|
+
request?: SecondParameter<typeof customInstance>;
|
|
199
|
+
},
|
|
200
|
+
queryClient?: QueryClient,
|
|
201
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
202
|
+
export function useGetActionsSuspense<
|
|
203
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
204
|
+
TError = ErrorType<void>,
|
|
205
|
+
>(
|
|
206
|
+
params?: GetActionsParams,
|
|
207
|
+
options?: {
|
|
208
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
209
|
+
request?: SecondParameter<typeof customInstance>;
|
|
210
|
+
},
|
|
211
|
+
queryClient?: QueryClient,
|
|
212
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
213
|
+
export function useGetActionsSuspense<
|
|
214
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
215
|
+
TError = ErrorType<void>,
|
|
216
|
+
>(
|
|
217
|
+
params?: GetActionsParams,
|
|
218
|
+
options?: {
|
|
219
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
220
|
+
request?: SecondParameter<typeof customInstance>;
|
|
221
|
+
},
|
|
222
|
+
queryClient?: QueryClient,
|
|
223
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
224
|
+
/**
|
|
225
|
+
* @summary Gets Actions held on the Account Server
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
export function useGetActionsSuspense<
|
|
229
|
+
TData = Awaited<ReturnType<typeof getActions>>,
|
|
230
|
+
TError = ErrorType<void>,
|
|
231
|
+
>(
|
|
232
|
+
params?: GetActionsParams,
|
|
233
|
+
options?: {
|
|
234
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getActions>>, TError, TData>>;
|
|
235
|
+
request?: SecondParameter<typeof customInstance>;
|
|
236
|
+
},
|
|
237
|
+
queryClient?: QueryClient,
|
|
238
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
239
|
+
const queryOptions = useGetActionsSuspenseQueryOptions(params, options);
|
|
240
|
+
|
|
241
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
242
|
+
TData,
|
|
243
|
+
TError
|
|
244
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
245
|
+
|
|
246
|
+
query.queryKey = queryOptions.queryKey;
|
|
247
|
+
|
|
248
|
+
return query;
|
|
249
|
+
}
|