@squonk/account-server-client 0.1.23 → 0.1.26
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/{custom-instance-86dd5ce6.d.ts → account-server-api.schemas-078442c3.d.ts} +4 -22
- package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
- package/chunk-GWBPVOL2.js.map +1 -0
- package/chunk-N3RLW53G.cjs +25 -0
- package/chunk-N3RLW53G.cjs.map +1 -0
- package/index.cjs +21 -5
- package/index.cjs.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +21 -5
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +20 -65
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +18 -58
- package/organisation/organisation.js +20 -65
- package/organisation/organisation.js.map +1 -1
- package/package.json +14 -14
- package/product/product.cjs +32 -107
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +24 -84
- package/product/product.js +32 -107
- package/product/product.js.map +1 -1
- package/service/service.cjs +11 -38
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +9 -31
- package/service/service.js +11 -38
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +3 -3
- package/src/organisation/organisation.ts +43 -191
- package/src/product/product.ts +87 -294
- package/src/service/service.ts +17 -101
- package/src/state/state.ts +17 -66
- package/src/unit/unit.ts +71 -315
- package/src/user/user.ts +68 -330
- package/state/state.cjs +8 -22
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -16
- package/state/state.js +8 -22
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +30 -109
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +25 -92
- package/unit/unit.js +30 -109
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +30 -107
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +20 -118
- package/user/user.js +30 -107
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs +0 -46
- package/chunk-3DXYUDZH.cjs.map +0 -1
- package/chunk-JR7F532L.js.map +0 -1
package/src/product/product.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,331 +8,124 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 0.1
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
useQuery,
|
|
13
|
-
useMutation,
|
|
14
|
-
UseQueryOptions,
|
|
15
|
-
UseMutationOptions,
|
|
16
|
-
QueryFunction,
|
|
17
|
-
MutationFunction,
|
|
18
|
-
UseQueryResult,
|
|
19
|
-
QueryKey,
|
|
20
|
-
} from "react-query";
|
|
11
|
+
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
21
12
|
import type {
|
|
22
13
|
ProductsGetTypesResponse,
|
|
23
|
-
AsError,
|
|
24
14
|
ProductsGetResponse,
|
|
25
15
|
UnitProductPostResponse,
|
|
26
16
|
UnitProductPostBodyBody,
|
|
27
17
|
ProductUnitGetResponse,
|
|
28
18
|
ProductPatchBodyBody,
|
|
29
19
|
} from "../account-server-api.schemas";
|
|
30
|
-
import { customInstance, ErrorType } from ".././custom-instance";
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...args: any
|
|
35
|
-
) => Promise<infer R>
|
|
36
|
-
? R
|
|
37
|
-
: any;
|
|
38
|
-
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
41
|
-
config: any,
|
|
42
|
-
args: infer P
|
|
43
|
-
) => any
|
|
44
|
-
? P
|
|
45
|
-
: never;
|
|
46
|
-
|
|
47
|
-
/**
|
|
21
|
+
export const getProduct = () => {
|
|
22
|
+
/**
|
|
48
23
|
* Gets product types you can purchase
|
|
49
24
|
|
|
50
25
|
* @summary Gets all Product Types
|
|
51
26
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
options
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const getGetProductTypesQueryKey = () => [`/product-type`];
|
|
62
|
-
|
|
63
|
-
export const useGetProductTypes = <
|
|
64
|
-
TData = AsyncReturnType<typeof getProductTypes>,
|
|
65
|
-
TError = ErrorType<AsError | void>
|
|
66
|
-
>(options?: {
|
|
67
|
-
query?: UseQueryOptions<
|
|
68
|
-
AsyncReturnType<typeof getProductTypes>,
|
|
69
|
-
TError,
|
|
70
|
-
TData
|
|
71
|
-
>;
|
|
72
|
-
request?: SecondParameter<typeof customInstance>;
|
|
73
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
74
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
75
|
-
|
|
76
|
-
const queryKey = queryOptions?.queryKey ?? getGetProductTypesQueryKey();
|
|
77
|
-
|
|
78
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getProductTypes>> = () =>
|
|
79
|
-
getProductTypes(requestOptions);
|
|
80
|
-
|
|
81
|
-
const query = useQuery<
|
|
82
|
-
AsyncReturnType<typeof getProductTypes>,
|
|
83
|
-
TError,
|
|
84
|
-
TData
|
|
85
|
-
>(queryKey, queryFn, queryOptions);
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
queryKey,
|
|
89
|
-
...query,
|
|
27
|
+
const appApiProductGetTypes = <
|
|
28
|
+
TData = AxiosResponse<ProductsGetTypesResponse>
|
|
29
|
+
>(
|
|
30
|
+
options?: AxiosRequestConfig
|
|
31
|
+
): Promise<TData> => {
|
|
32
|
+
return axios.get(`/product-type`, options);
|
|
90
33
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/**
|
|
34
|
+
/**
|
|
94
35
|
* Gets products you have access to, across all Units and Organisations
|
|
95
36
|
|
|
96
37
|
* @summary Gets all Products
|
|
97
38
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
) => {
|
|
101
|
-
|
|
102
|
-
{ url: `/product`, method: "get" },
|
|
103
|
-
options
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export const getGetProductsQueryKey = () => [`/product`];
|
|
108
|
-
|
|
109
|
-
export const useGetProducts = <
|
|
110
|
-
TData = AsyncReturnType<typeof getProducts>,
|
|
111
|
-
TError = ErrorType<AsError | void>
|
|
112
|
-
>(options?: {
|
|
113
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getProducts>, TError, TData>;
|
|
114
|
-
request?: SecondParameter<typeof customInstance>;
|
|
115
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
116
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
117
|
-
|
|
118
|
-
const queryKey = queryOptions?.queryKey ?? getGetProductsQueryKey();
|
|
119
|
-
|
|
120
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getProducts>> = () =>
|
|
121
|
-
getProducts(requestOptions);
|
|
122
|
-
|
|
123
|
-
const query = useQuery<AsyncReturnType<typeof getProducts>, TError, TData>(
|
|
124
|
-
queryKey,
|
|
125
|
-
queryFn,
|
|
126
|
-
queryOptions
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
queryKey,
|
|
131
|
-
...query,
|
|
39
|
+
const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(
|
|
40
|
+
options?: AxiosRequestConfig
|
|
41
|
+
): Promise<TData> => {
|
|
42
|
+
return axios.get(`/product`, options);
|
|
132
43
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
method: "post",
|
|
147
|
-
data: unitProductPostBodyBody,
|
|
148
|
-
},
|
|
149
|
-
options
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const useCreateUnitProduct = <
|
|
154
|
-
TError = ErrorType<AsError | void>,
|
|
155
|
-
TContext = unknown
|
|
156
|
-
>(options?: {
|
|
157
|
-
mutation?: UseMutationOptions<
|
|
158
|
-
AsyncReturnType<typeof createUnitProduct>,
|
|
159
|
-
TError,
|
|
160
|
-
{ unitid: string; data: UnitProductPostBodyBody },
|
|
161
|
-
TContext
|
|
162
|
-
>;
|
|
163
|
-
request?: SecondParameter<typeof customInstance>;
|
|
164
|
-
}) => {
|
|
165
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
166
|
-
|
|
167
|
-
const mutationFn: MutationFunction<
|
|
168
|
-
AsyncReturnType<typeof createUnitProduct>,
|
|
169
|
-
{ unitid: string; data: UnitProductPostBodyBody }
|
|
170
|
-
> = (props) => {
|
|
171
|
-
const { unitid, data } = props || {};
|
|
172
|
-
|
|
173
|
-
return createUnitProduct(unitid, data, requestOptions);
|
|
44
|
+
/**
|
|
45
|
+
* @summary Creates a Product for an Organisational Unit
|
|
46
|
+
*/
|
|
47
|
+
const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(
|
|
48
|
+
unitId: string,
|
|
49
|
+
unitProductPostBodyBody: UnitProductPostBodyBody,
|
|
50
|
+
options?: AxiosRequestConfig
|
|
51
|
+
): Promise<TData> => {
|
|
52
|
+
return axios.post(
|
|
53
|
+
`/product/unit/${unitId}`,
|
|
54
|
+
unitProductPostBodyBody,
|
|
55
|
+
options
|
|
56
|
+
);
|
|
174
57
|
};
|
|
175
|
-
|
|
176
|
-
return useMutation<
|
|
177
|
-
AsyncReturnType<typeof createUnitProduct>,
|
|
178
|
-
TError,
|
|
179
|
-
{ unitid: string; data: UnitProductPostBodyBody },
|
|
180
|
-
TContext
|
|
181
|
-
>(mutationFn, mutationOptions);
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
58
|
+
/**
|
|
184
59
|
* Gets products you have access to based on an Organisational Unit
|
|
185
60
|
|
|
186
61
|
* @summary Gets Products for an Organisational Unit
|
|
187
62
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
) => {
|
|
192
|
-
|
|
193
|
-
{ url: `/product/unit/${unitid}`, method: "get" },
|
|
194
|
-
options
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export const getGetProductsForUnitQueryKey = (unitid: string) => [
|
|
199
|
-
`/product/unit/${unitid}`,
|
|
200
|
-
];
|
|
201
|
-
|
|
202
|
-
export const useGetProductsForUnit = <
|
|
203
|
-
TData = AsyncReturnType<typeof getProductsForUnit>,
|
|
204
|
-
TError = ErrorType<void | AsError>
|
|
205
|
-
>(
|
|
206
|
-
unitid: string,
|
|
207
|
-
options?: {
|
|
208
|
-
query?: UseQueryOptions<
|
|
209
|
-
AsyncReturnType<typeof getProductsForUnit>,
|
|
210
|
-
TError,
|
|
211
|
-
TData
|
|
212
|
-
>;
|
|
213
|
-
request?: SecondParameter<typeof customInstance>;
|
|
214
|
-
}
|
|
215
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
216
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
217
|
-
|
|
218
|
-
const queryKey =
|
|
219
|
-
queryOptions?.queryKey ?? getGetProductsForUnitQueryKey(unitid);
|
|
220
|
-
|
|
221
|
-
const queryFn: QueryFunction<
|
|
222
|
-
AsyncReturnType<typeof getProductsForUnit>
|
|
223
|
-
> = () => getProductsForUnit(unitid, requestOptions);
|
|
224
|
-
|
|
225
|
-
const query = useQuery<
|
|
226
|
-
AsyncReturnType<typeof getProductsForUnit>,
|
|
227
|
-
TError,
|
|
228
|
-
TData
|
|
229
|
-
>(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
queryKey,
|
|
233
|
-
...query,
|
|
63
|
+
const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(
|
|
64
|
+
unitId: string,
|
|
65
|
+
options?: AxiosRequestConfig
|
|
66
|
+
): Promise<TData> => {
|
|
67
|
+
return axios.get(`/product/unit/${unitId}`, options);
|
|
234
68
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
/**
|
|
69
|
+
/**
|
|
238
70
|
* Gets a Unit's Product
|
|
239
71
|
|
|
240
72
|
* @summary Gets a Unit's Product
|
|
241
73
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
options
|
|
250
|
-
);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
export const getGetProductQueryKey = (unitid: string, productid: string) => [
|
|
254
|
-
`/product/unit/${unitid}/product/${productid}`,
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
export const useGetProduct = <
|
|
258
|
-
TData = AsyncReturnType<typeof getProduct>,
|
|
259
|
-
TError = ErrorType<AsError | void>
|
|
260
|
-
>(
|
|
261
|
-
unitid: string,
|
|
262
|
-
productid: string,
|
|
263
|
-
options?: {
|
|
264
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getProduct>, TError, TData>;
|
|
265
|
-
request?: SecondParameter<typeof customInstance>;
|
|
266
|
-
}
|
|
267
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
268
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
269
|
-
|
|
270
|
-
const queryKey =
|
|
271
|
-
queryOptions?.queryKey ?? getGetProductQueryKey(unitid, productid);
|
|
272
|
-
|
|
273
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getProduct>> = () =>
|
|
274
|
-
getProduct(unitid, productid, requestOptions);
|
|
275
|
-
|
|
276
|
-
const query = useQuery<AsyncReturnType<typeof getProduct>, TError, TData>(
|
|
277
|
-
queryKey,
|
|
278
|
-
queryFn,
|
|
279
|
-
{ enabled: !!(unitid && productid), ...queryOptions }
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
return {
|
|
283
|
-
queryKey,
|
|
284
|
-
...query,
|
|
74
|
+
const appApiProductGetUnitProduct = <
|
|
75
|
+
TData = AxiosResponse<ProductUnitGetResponse>
|
|
76
|
+
>(
|
|
77
|
+
unitId: string,
|
|
78
|
+
productId: string,
|
|
79
|
+
options?: AxiosRequestConfig
|
|
80
|
+
): Promise<TData> => {
|
|
81
|
+
return axios.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
285
82
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
83
|
+
/**
|
|
84
|
+
* @summary Deletes an existing Product
|
|
85
|
+
*/
|
|
86
|
+
const appApiProductDelete = <TData = AxiosResponse<void>>(
|
|
87
|
+
unitId: string,
|
|
88
|
+
productId: string,
|
|
89
|
+
options?: AxiosRequestConfig
|
|
90
|
+
): Promise<TData> => {
|
|
91
|
+
return axios.delete(
|
|
92
|
+
`/product/unit/${unitId}/product/${productId}`,
|
|
93
|
+
options
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Used to update some adjustable parameters of a Product, i.e. to extend the Allowance or Limit. At the moment Data Manager products can be patched by changing the `name`, it's coin `allowance` or `limit`
|
|
290
98
|
|
|
291
99
|
* @summary Adjust an existing Product
|
|
292
100
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
) => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
mutation?: UseMutationOptions<
|
|
314
|
-
AsyncReturnType<typeof patchProduct>,
|
|
315
|
-
TError,
|
|
316
|
-
{ unitid: string; productid: string; data: ProductPatchBodyBody },
|
|
317
|
-
TContext
|
|
318
|
-
>;
|
|
319
|
-
request?: SecondParameter<typeof customInstance>;
|
|
320
|
-
}) => {
|
|
321
|
-
const { mutation: mutationOptions, request: requestOptions } = options || {};
|
|
322
|
-
|
|
323
|
-
const mutationFn: MutationFunction<
|
|
324
|
-
AsyncReturnType<typeof patchProduct>,
|
|
325
|
-
{ unitid: string; productid: string; data: ProductPatchBodyBody }
|
|
326
|
-
> = (props) => {
|
|
327
|
-
const { unitid, productid, data } = props || {};
|
|
328
|
-
|
|
329
|
-
return patchProduct(unitid, productid, data, requestOptions);
|
|
101
|
+
const appApiProductPatch = <TData = AxiosResponse<void>>(
|
|
102
|
+
unitId: string,
|
|
103
|
+
productId: string,
|
|
104
|
+
productPatchBodyBody: ProductPatchBodyBody,
|
|
105
|
+
options?: AxiosRequestConfig
|
|
106
|
+
): Promise<TData> => {
|
|
107
|
+
return axios.patch(
|
|
108
|
+
`/product/unit/${unitId}/product/${productId}`,
|
|
109
|
+
productPatchBodyBody,
|
|
110
|
+
options
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
appApiProductGetTypes,
|
|
115
|
+
appApiProductGet,
|
|
116
|
+
appApiProductPost,
|
|
117
|
+
appApiProductGetForUnit,
|
|
118
|
+
appApiProductGetUnitProduct,
|
|
119
|
+
appApiProductDelete,
|
|
120
|
+
appApiProductPatch,
|
|
330
121
|
};
|
|
331
|
-
|
|
332
|
-
return useMutation<
|
|
333
|
-
AsyncReturnType<typeof patchProduct>,
|
|
334
|
-
TError,
|
|
335
|
-
{ unitid: string; productid: string; data: ProductPatchBodyBody },
|
|
336
|
-
TContext
|
|
337
|
-
>(mutationFn, mutationOptions);
|
|
338
122
|
};
|
|
123
|
+
export type AppApiProductGetTypesResult =
|
|
124
|
+
AxiosResponse<ProductsGetTypesResponse>;
|
|
125
|
+
export type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;
|
|
126
|
+
export type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;
|
|
127
|
+
export type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;
|
|
128
|
+
export type AppApiProductGetUnitProductResult =
|
|
129
|
+
AxiosResponse<ProductUnitGetResponse>;
|
|
130
|
+
export type AppApiProductDeleteResult = AxiosResponse<void>;
|
|
131
|
+
export type AppApiProductPatchResult = AxiosResponse<void>;
|
package/src/service/service.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,119 +8,35 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 0.1
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
useQuery,
|
|
13
|
-
UseQueryOptions,
|
|
14
|
-
QueryFunction,
|
|
15
|
-
UseQueryResult,
|
|
16
|
-
QueryKey,
|
|
17
|
-
} from "react-query";
|
|
11
|
+
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
18
12
|
import type {
|
|
19
13
|
ServicesGetResponse,
|
|
20
|
-
AsError,
|
|
21
14
|
ServiceGetResponse,
|
|
22
15
|
} from "../account-server-api.schemas";
|
|
23
|
-
import { customInstance, ErrorType } from ".././custom-instance";
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...args: any
|
|
28
|
-
) => Promise<infer R>
|
|
29
|
-
? R
|
|
30
|
-
: any;
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
|
-
config: any,
|
|
35
|
-
args: infer P
|
|
36
|
-
) => any
|
|
37
|
-
? P
|
|
38
|
-
: never;
|
|
39
|
-
|
|
40
|
-
/**
|
|
17
|
+
export const getService = () => {
|
|
18
|
+
/**
|
|
41
19
|
* Gets services known to the Account Server
|
|
42
20
|
|
|
43
21
|
* @summary Gets all Services
|
|
44
22
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
) => {
|
|
48
|
-
|
|
49
|
-
{ url: `/service`, method: "get" },
|
|
50
|
-
options
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const getGetServicesQueryKey = () => [`/service`];
|
|
55
|
-
|
|
56
|
-
export const useGetServices = <
|
|
57
|
-
TData = AsyncReturnType<typeof getServices>,
|
|
58
|
-
TError = ErrorType<AsError | void>
|
|
59
|
-
>(options?: {
|
|
60
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;
|
|
61
|
-
request?: SecondParameter<typeof customInstance>;
|
|
62
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
63
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
64
|
-
|
|
65
|
-
const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();
|
|
66
|
-
|
|
67
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>
|
|
68
|
-
getServices(requestOptions);
|
|
69
|
-
|
|
70
|
-
const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(
|
|
71
|
-
queryKey,
|
|
72
|
-
queryFn,
|
|
73
|
-
queryOptions
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
queryKey,
|
|
78
|
-
...query,
|
|
23
|
+
const appApiServiceGet = <TData = AxiosResponse<ServicesGetResponse>>(
|
|
24
|
+
options?: AxiosRequestConfig
|
|
25
|
+
): Promise<TData> => {
|
|
26
|
+
return axios.get(`/service`, options);
|
|
79
27
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/**
|
|
28
|
+
/**
|
|
83
29
|
* Gets a known service
|
|
84
30
|
|
|
85
31
|
* @summary Gets a specific Service
|
|
86
32
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
) => {
|
|
91
|
-
|
|
92
|
-
{ url: `/service/${svcid}`, method: "get" },
|
|
93
|
-
options
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const getGetServiceQueryKey = (svcid: number) => [`/service/${svcid}`];
|
|
98
|
-
|
|
99
|
-
export const useGetService = <
|
|
100
|
-
TData = AsyncReturnType<typeof getService>,
|
|
101
|
-
TError = ErrorType<AsError | void>
|
|
102
|
-
>(
|
|
103
|
-
svcid: number,
|
|
104
|
-
options?: {
|
|
105
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;
|
|
106
|
-
request?: SecondParameter<typeof customInstance>;
|
|
107
|
-
}
|
|
108
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
109
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
110
|
-
|
|
111
|
-
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcid);
|
|
112
|
-
|
|
113
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>
|
|
114
|
-
getService(svcid, requestOptions);
|
|
115
|
-
|
|
116
|
-
const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(
|
|
117
|
-
queryKey,
|
|
118
|
-
queryFn,
|
|
119
|
-
{ enabled: !!svcid, ...queryOptions }
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
queryKey,
|
|
124
|
-
...query,
|
|
33
|
+
const appApiServiceGetId = <TData = AxiosResponse<ServiceGetResponse>>(
|
|
34
|
+
svcId: number,
|
|
35
|
+
options?: AxiosRequestConfig
|
|
36
|
+
): Promise<TData> => {
|
|
37
|
+
return axios.get(`/service/${svcId}`, options);
|
|
125
38
|
};
|
|
39
|
+
return { appApiServiceGet, appApiServiceGetId };
|
|
126
40
|
};
|
|
41
|
+
export type AppApiServiceGetResult = AxiosResponse<ServicesGetResponse>;
|
|
42
|
+
export type AppApiServiceGetIdResult = AxiosResponse<ServiceGetResponse>;
|
package/src/state/state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.7.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,70 +8,21 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 0.1
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
26
|
-
...args: any
|
|
27
|
-
) => Promise<infer R>
|
|
28
|
-
? R
|
|
29
|
-
: any;
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
33
|
-
config: any,
|
|
34
|
-
args: infer P
|
|
35
|
-
) => any
|
|
36
|
-
? P
|
|
37
|
-
: never;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @summary Gets the Account Server version
|
|
41
|
-
*/
|
|
42
|
-
export const getVersion = (
|
|
43
|
-
options?: SecondParameter<typeof customInstance>
|
|
44
|
-
) => {
|
|
45
|
-
return customInstance<StateGetVersionResponse>(
|
|
46
|
-
{ url: `/version`, method: "get" },
|
|
47
|
-
options
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const getGetVersionQueryKey = () => [`/version`];
|
|
52
|
-
|
|
53
|
-
export const useGetVersion = <
|
|
54
|
-
TData = AsyncReturnType<typeof getVersion>,
|
|
55
|
-
TError = ErrorType<AsError | void>
|
|
56
|
-
>(options?: {
|
|
57
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;
|
|
58
|
-
request?: SecondParameter<typeof customInstance>;
|
|
59
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
60
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
61
|
-
|
|
62
|
-
const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
|
|
63
|
-
|
|
64
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>
|
|
65
|
-
getVersion(requestOptions);
|
|
66
|
-
|
|
67
|
-
const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(
|
|
68
|
-
queryKey,
|
|
69
|
-
queryFn,
|
|
70
|
-
queryOptions
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
queryKey,
|
|
75
|
-
...query,
|
|
11
|
+
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
12
|
+
import type { StateGetVersionResponse } from "../account-server-api.schemas";
|
|
13
|
+
|
|
14
|
+
export const getState = () => {
|
|
15
|
+
/**
|
|
16
|
+
* @summary Gets the Account Server version
|
|
17
|
+
*/
|
|
18
|
+
const appApiStateGetVersion = <
|
|
19
|
+
TData = AxiosResponse<StateGetVersionResponse>
|
|
20
|
+
>(
|
|
21
|
+
options?: AxiosRequestConfig
|
|
22
|
+
): Promise<TData> => {
|
|
23
|
+
return axios.get(`/version`, options);
|
|
76
24
|
};
|
|
25
|
+
return { appApiStateGetVersion };
|
|
77
26
|
};
|
|
27
|
+
export type AppApiStateGetVersionResult =
|
|
28
|
+
AxiosResponse<StateGetVersionResponse>;
|