@squonk/account-server-client 0.1.26 → 0.1.27-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{account-server-api.schemas-078442c3.d.ts → account-server-api.schemas-e6c5f956.d.ts} +13 -0
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +64 -19
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +67 -18
- package/organisation/organisation.js +64 -19
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +108 -30
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +114 -24
- package/product/product.js +108 -30
- package/product/product.js.map +1 -1
- package/service/service.cjs +39 -10
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +34 -8
- package/service/service.js +39 -10
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +13 -0
- package/src/organisation/organisation.ts +195 -44
- package/src/product/product.ts +356 -84
- package/src/service/service.ts +108 -16
- package/src/state/state.ts +64 -16
- package/src/unit/unit.ts +339 -74
- package/src/user/user.ts +340 -67
- package/state/state.cjs +21 -7
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +17 -6
- package/state/state.js +21 -7
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +104 -29
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +107 -25
- package/unit/unit.js +104 -29
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +106 -29
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +132 -20
- package/user/user.js +106 -29
- package/user/user.js.map +1 -1
package/product/product.cjs
CHANGED
|
@@ -1,40 +1,118 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
|
|
2
4
|
|
|
3
5
|
// src/product/product.ts
|
|
4
6
|
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _reactquery = require('react-query');
|
|
11
|
+
var appApiProductGetTypes = (options) => {
|
|
12
|
+
return _axios2.default.get(`/product-type`, options);
|
|
13
|
+
};
|
|
14
|
+
var getAppApiProductGetTypesQueryKey = () => [`/product-type`];
|
|
15
|
+
var useAppApiProductGetTypes = (options) => {
|
|
16
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
17
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetTypesQueryKey()));
|
|
18
|
+
const queryFn = () => appApiProductGetTypes(axiosOptions);
|
|
19
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
20
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
21
|
+
queryKey
|
|
22
|
+
}, query);
|
|
23
|
+
};
|
|
24
|
+
var appApiProductGet = (options) => {
|
|
25
|
+
return _axios2.default.get(`/product`, options);
|
|
26
|
+
};
|
|
27
|
+
var getAppApiProductGetQueryKey = () => [`/product`];
|
|
28
|
+
var useAppApiProductGet = (options) => {
|
|
29
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
30
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetQueryKey()));
|
|
31
|
+
const queryFn = () => appApiProductGet(axiosOptions);
|
|
32
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
33
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
34
|
+
queryKey
|
|
35
|
+
}, query);
|
|
36
|
+
};
|
|
37
|
+
var appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
|
|
38
|
+
return _axios2.default.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
|
|
39
|
+
};
|
|
40
|
+
var useAppApiProductPost = (options) => {
|
|
41
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
42
|
+
const mutationFn = (props) => {
|
|
43
|
+
const { unitId, data } = props || {};
|
|
44
|
+
return appApiProductPost(unitId, data, axiosOptions);
|
|
23
45
|
};
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
47
|
+
};
|
|
48
|
+
var appApiProductGetForUnit = (unitId, options) => {
|
|
49
|
+
return _axios2.default.get(`/product/unit/${unitId}`, options);
|
|
50
|
+
};
|
|
51
|
+
var getAppApiProductGetForUnitQueryKey = (unitId) => [
|
|
52
|
+
`/product/unit/${unitId}`
|
|
53
|
+
];
|
|
54
|
+
var useAppApiProductGetForUnit = (unitId, options) => {
|
|
55
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
56
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetForUnitQueryKey(unitId)));
|
|
57
|
+
const queryFn = () => appApiProductGetForUnit(unitId, axiosOptions);
|
|
58
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
|
|
59
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
60
|
+
queryKey
|
|
61
|
+
}, query);
|
|
62
|
+
};
|
|
63
|
+
var appApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
64
|
+
return _axios2.default.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
65
|
+
};
|
|
66
|
+
var getAppApiProductGetUnitProductQueryKey = (unitId, productId) => [`/product/unit/${unitId}/product/${productId}`];
|
|
67
|
+
var useAppApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
68
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
69
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiProductGetUnitProductQueryKey(unitId, productId)));
|
|
70
|
+
const queryFn = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);
|
|
71
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!(unitId && productId) }, queryOptions));
|
|
72
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
73
|
+
queryKey
|
|
74
|
+
}, query);
|
|
75
|
+
};
|
|
76
|
+
var appApiProductDelete = (unitId, productId, options) => {
|
|
77
|
+
return _axios2.default.delete(`/product/unit/${unitId}/product/${productId}`, options);
|
|
78
|
+
};
|
|
79
|
+
var useAppApiProductDelete = (options) => {
|
|
80
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
81
|
+
const mutationFn = (props) => {
|
|
82
|
+
const { unitId, productId } = props || {};
|
|
83
|
+
return appApiProductDelete(unitId, productId, axiosOptions);
|
|
26
84
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
85
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
86
|
+
};
|
|
87
|
+
var appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
|
|
88
|
+
return _axios2.default.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
|
|
89
|
+
};
|
|
90
|
+
var useAppApiProductPatch = (options) => {
|
|
91
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
92
|
+
const mutationFn = (props) => {
|
|
93
|
+
const { unitId, productId, data } = props || {};
|
|
94
|
+
return appApiProductPatch(unitId, productId, data, axiosOptions);
|
|
35
95
|
};
|
|
96
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
36
97
|
};
|
|
37
98
|
|
|
38
99
|
|
|
39
|
-
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
exports.appApiProductDelete = appApiProductDelete; exports.appApiProductGet = appApiProductGet; exports.appApiProductGetForUnit = appApiProductGetForUnit; exports.appApiProductGetTypes = appApiProductGetTypes; exports.appApiProductGetUnitProduct = appApiProductGetUnitProduct; exports.appApiProductPatch = appApiProductPatch; exports.appApiProductPost = appApiProductPost; exports.getAppApiProductGetForUnitQueryKey = getAppApiProductGetForUnitQueryKey; exports.getAppApiProductGetQueryKey = getAppApiProductGetQueryKey; exports.getAppApiProductGetTypesQueryKey = getAppApiProductGetTypesQueryKey; exports.getAppApiProductGetUnitProductQueryKey = getAppApiProductGetUnitProductQueryKey; exports.useAppApiProductDelete = useAppApiProductDelete; exports.useAppApiProductGet = useAppApiProductGet; exports.useAppApiProductGetForUnit = useAppApiProductGetForUnit; exports.useAppApiProductGetTypes = useAppApiProductGetTypes; exports.useAppApiProductGetUnitProduct = useAppApiProductGetUnitProduct; exports.useAppApiProductPatch = useAppApiProductPatch; exports.useAppApiProductPost = useAppApiProductPost;
|
|
40
118
|
//# sourceMappingURL=product.cjs.map
|
package/product/product.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":";;;AAUA;AAUO,IAAM,aAAa,MAAM;AAM9B,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAIA,QAAM,oBAAoB,CACxB,QACA,yBACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,UACjB,yBACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,UAAU,OAAO;AAAA,EACrD;AAMA,QAAM,8BAA8B,CAGlC,QACA,WACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,kBAAkB,aAAa,OAAO;AAAA,EAC1E;AAIA,QAAM,sBAAsB,CAC1B,QACA,WACA,YACmB;AACnB,WAAO,MAAM,OACX,iBAAiB,kBAAkB,aACnC,OACF;AAAA,EACF;AAMA,QAAM,qBAAqB,CACzB,QACA,WACA,sBACA,YACmB;AACnB,WAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ProductsGetTypesResponse,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\nexport const getProduct = () => {\n /**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\n const appApiProductGetTypes = <\n TData = AxiosResponse<ProductsGetTypesResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product-type`, options);\n };\n /**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\n const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product`, options);\n };\n /**\n * @summary Creates a Product for an Organisational Unit\n */\n const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n };\n /**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\n const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}`, options);\n };\n /**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\n const appApiProductGetUnitProduct = <\n TData = AxiosResponse<ProductUnitGetResponse>\n >(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n };\n /**\n * @summary Deletes an existing Product\n */\n const appApiProductDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(\n `/product/unit/${unitId}/product/${productId}`,\n options\n );\n };\n /**\n * 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`\n\n * @summary Adjust an existing Product\n */\n const appApiProductPatch = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n };\n return {\n appApiProductGetTypes,\n appApiProductGet,\n appApiProductPost,\n appApiProductGetForUnit,\n appApiProductGetUnitProduct,\n appApiProductDelete,\n appApiProductPatch,\n };\n};\nexport type AppApiProductGetTypesResult =\n AxiosResponse<ProductsGetTypesResponse>;\nexport type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;\nexport type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductGetUnitProductResult =\n AxiosResponse<ProductUnitGetResponse>;\nexport type AppApiProductDeleteResult = AxiosResponse<void>;\nexport type AppApiProductPatchResult = AxiosResponse<void>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const appApiProductGetTypes = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetTypesResponse>> => {\n return axios.get(`/product-type`, options);\n};\n\nexport const getAppApiProductGetTypesQueryKey = () => [`/product-type`];\n\nexport type AppApiProductGetTypesQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetTypes>\n>;\nexport type AppApiProductGetTypesQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetTypes = <\n TData = AsyncReturnType<typeof appApiProductGetTypes>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetTypes>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiProductGetTypesQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetTypes>\n > = () => appApiProductGetTypes(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const appApiProductGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product`, options);\n};\n\nexport const getAppApiProductGetQueryKey = () => [`/product`];\n\nexport type AppApiProductGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGet>\n>;\nexport type AppApiProductGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGet = <\n TData = AsyncReturnType<typeof appApiProductGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGet>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiProductGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiProductGet>> = () =>\n appApiProductGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const appApiProductPost = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UnitProductPostResponse>> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n};\n\nexport type AppApiProductPostMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPost>\n>;\nexport type AppApiProductPostMutationBody = UnitProductPostBodyBody;\nexport type AppApiProductPostMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiProductPost = <\n TError = AxiosError<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPost>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props || {};\n\n return appApiProductPost(unitId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const appApiProductGetForUnit = (\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product/unit/${unitId}`, options);\n};\n\nexport const getAppApiProductGetForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type AppApiProductGetForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetForUnit>\n>;\nexport type AppApiProductGetForUnitQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiProductGetForUnit = <\n TData = AsyncReturnType<typeof appApiProductGetForUnit>,\n TError = AxiosError<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiProductGetForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetForUnit>\n > = () => appApiProductGetForUnit(unitId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const appApiProductGetUnitProduct = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductUnitGetResponse>> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport const getAppApiProductGetUnitProductQueryKey = (\n unitId: string,\n productId: string\n) => [`/product/unit/${unitId}/product/${productId}`];\n\nexport type AppApiProductGetUnitProductQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n>;\nexport type AppApiProductGetUnitProductQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetUnitProduct = <\n TData = AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError = AxiosError<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ??\n getAppApiProductGetUnitProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n > = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!(unitId && productId), ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const appApiProductDelete = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport type AppApiProductDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductDelete>\n>;\n\nexport type AppApiProductDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductDelete>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return appApiProductDelete(unitId, productId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * 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`\n\n * @summary Adjust an existing Product\n */\nexport const appApiProductPatch = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n};\n\nexport type AppApiProductPatchMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPatch>\n>;\nexport type AppApiProductPatchMutationBody = ProductPatchBodyBody;\nexport type AppApiProductPatchMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductPatch = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPatch>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props || {};\n\n return appApiProductPatch(unitId, productId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/product/product.d.ts
CHANGED
|
@@ -1,32 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as react_query from 'react-query';
|
|
2
|
+
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
+
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
4
|
+
import { B as ProductsGetTypesResponse, N as AsError, D as ProductsGetResponse, b as UnitProductPostBodyBody, y as UnitProductPostResponse, A as ProductUnitGetResponse, P as ProductPatchBodyBody } from '../account-server-api.schemas-e6c5f956.js';
|
|
3
5
|
|
|
6
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Do not edit manually.
|
|
7
|
-
* Account Server API
|
|
8
|
-
* The Informatics Matters Account Server API.
|
|
8
|
+
* Gets product types you can purchase
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
* @summary Gets all Product Types
|
|
11
|
+
*/
|
|
12
|
+
declare const appApiProductGetTypes: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetTypesResponse>>;
|
|
13
|
+
declare const getAppApiProductGetTypesQueryKey: () => string[];
|
|
14
|
+
declare type AppApiProductGetTypesQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetTypes>>;
|
|
15
|
+
declare type AppApiProductGetTypesQueryError = AxiosError<AsError | void>;
|
|
16
|
+
declare const useAppApiProductGetTypes: <TData = AxiosResponse<ProductsGetTypesResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
|
|
17
|
+
query?: UseQueryOptions<AxiosResponse<ProductsGetTypesResponse, any>, TError, TData, QueryKey> | undefined;
|
|
18
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
19
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
20
|
+
queryKey: QueryKey;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Gets products you have access to, across all Units and Organisations
|
|
11
24
|
|
|
12
|
-
*
|
|
25
|
+
* @summary Gets all Products
|
|
13
26
|
*/
|
|
27
|
+
declare const appApiProductGet: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetResponse>>;
|
|
28
|
+
declare const getAppApiProductGetQueryKey: () => string[];
|
|
29
|
+
declare type AppApiProductGetQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGet>>;
|
|
30
|
+
declare type AppApiProductGetQueryError = AxiosError<AsError | void>;
|
|
31
|
+
declare const useAppApiProductGet: <TData = AxiosResponse<ProductsGetResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
|
|
32
|
+
query?: UseQueryOptions<AxiosResponse<ProductsGetResponse, any>, TError, TData, QueryKey> | undefined;
|
|
33
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
34
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @summary Creates a Product for an Organisational Unit
|
|
39
|
+
*/
|
|
40
|
+
declare const appApiProductPost: (unitId: string, unitProductPostBodyBody: UnitProductPostBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UnitProductPostResponse>>;
|
|
41
|
+
declare type AppApiProductPostMutationResult = NonNullable<AsyncReturnType<typeof appApiProductPost>>;
|
|
42
|
+
declare type AppApiProductPostMutationBody = UnitProductPostBodyBody;
|
|
43
|
+
declare type AppApiProductPostMutationError = AxiosError<AsError | void>;
|
|
44
|
+
declare const useAppApiProductPost: <TError = AxiosError<void | AsError, any>, TContext = unknown>(options?: {
|
|
45
|
+
mutation?: UseMutationOptions<AxiosResponse<UnitProductPostResponse, any>, TError, {
|
|
46
|
+
unitId: string;
|
|
47
|
+
data: UnitProductPostBodyBody;
|
|
48
|
+
}, TContext> | undefined;
|
|
49
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
50
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<UnitProductPostResponse, any>, TError, {
|
|
51
|
+
unitId: string;
|
|
52
|
+
data: UnitProductPostBodyBody;
|
|
53
|
+
}, TContext>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets products you have access to based on an Organisational Unit
|
|
14
56
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
57
|
+
* @summary Gets Products for an Organisational Unit
|
|
58
|
+
*/
|
|
59
|
+
declare const appApiProductGetForUnit: (unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductsGetResponse>>;
|
|
60
|
+
declare const getAppApiProductGetForUnitQueryKey: (unitId: string) => string[];
|
|
61
|
+
declare type AppApiProductGetForUnitQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetForUnit>>;
|
|
62
|
+
declare type AppApiProductGetForUnitQueryError = AxiosError<void | AsError>;
|
|
63
|
+
declare const useAppApiProductGetForUnit: <TData = AxiosResponse<ProductsGetResponse, any>, TError = AxiosError<void | AsError, any>>(unitId: string, options?: {
|
|
64
|
+
query?: UseQueryOptions<AxiosResponse<ProductsGetResponse, any>, TError, TData, QueryKey> | undefined;
|
|
65
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
66
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
67
|
+
queryKey: QueryKey;
|
|
23
68
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
declare
|
|
30
|
-
declare
|
|
69
|
+
/**
|
|
70
|
+
* Gets a Unit's Product
|
|
71
|
+
|
|
72
|
+
* @summary Gets a Unit's Product
|
|
73
|
+
*/
|
|
74
|
+
declare const appApiProductGetUnitProduct: (unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<ProductUnitGetResponse>>;
|
|
75
|
+
declare const getAppApiProductGetUnitProductQueryKey: (unitId: string, productId: string) => string[];
|
|
76
|
+
declare type AppApiProductGetUnitProductQueryResult = NonNullable<AsyncReturnType<typeof appApiProductGetUnitProduct>>;
|
|
77
|
+
declare type AppApiProductGetUnitProductQueryError = AxiosError<AsError | void>;
|
|
78
|
+
declare const useAppApiProductGetUnitProduct: <TData = AxiosResponse<ProductUnitGetResponse, any>, TError = AxiosError<void | AsError, any>>(unitId: string, productId: string, options?: {
|
|
79
|
+
query?: UseQueryOptions<AxiosResponse<ProductUnitGetResponse, any>, TError, TData, QueryKey> | undefined;
|
|
80
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
81
|
+
} | undefined) => UseQueryResult<TData, TError> & {
|
|
82
|
+
queryKey: QueryKey;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @summary Deletes an existing Product
|
|
86
|
+
*/
|
|
87
|
+
declare const appApiProductDelete: (unitId: string, productId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
88
|
+
declare type AppApiProductDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiProductDelete>>;
|
|
89
|
+
declare type AppApiProductDeleteMutationError = AxiosError<AsError>;
|
|
90
|
+
declare const useAppApiProductDelete: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
91
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
92
|
+
unitId: string;
|
|
93
|
+
productId: string;
|
|
94
|
+
}, TContext> | undefined;
|
|
95
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
96
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
97
|
+
unitId: string;
|
|
98
|
+
productId: string;
|
|
99
|
+
}, TContext>;
|
|
100
|
+
/**
|
|
101
|
+
* 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`
|
|
102
|
+
|
|
103
|
+
* @summary Adjust an existing Product
|
|
104
|
+
*/
|
|
105
|
+
declare const appApiProductPatch: (unitId: string, productId: string, productPatchBodyBody: ProductPatchBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
106
|
+
declare type AppApiProductPatchMutationResult = NonNullable<AsyncReturnType<typeof appApiProductPatch>>;
|
|
107
|
+
declare type AppApiProductPatchMutationBody = ProductPatchBodyBody;
|
|
108
|
+
declare type AppApiProductPatchMutationError = AxiosError<AsError>;
|
|
109
|
+
declare const useAppApiProductPatch: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
110
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
111
|
+
unitId: string;
|
|
112
|
+
productId: string;
|
|
113
|
+
data: ProductPatchBodyBody;
|
|
114
|
+
}, TContext> | undefined;
|
|
115
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
116
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
117
|
+
unitId: string;
|
|
118
|
+
productId: string;
|
|
119
|
+
data: ProductPatchBodyBody;
|
|
120
|
+
}, TContext>;
|
|
31
121
|
|
|
32
|
-
export {
|
|
122
|
+
export { AppApiProductDeleteMutationError, AppApiProductDeleteMutationResult, AppApiProductGetForUnitQueryError, AppApiProductGetForUnitQueryResult, AppApiProductGetQueryError, AppApiProductGetQueryResult, AppApiProductGetTypesQueryError, AppApiProductGetTypesQueryResult, AppApiProductGetUnitProductQueryError, AppApiProductGetUnitProductQueryResult, AppApiProductPatchMutationBody, AppApiProductPatchMutationError, AppApiProductPatchMutationResult, AppApiProductPostMutationBody, AppApiProductPostMutationError, AppApiProductPostMutationResult, appApiProductDelete, appApiProductGet, appApiProductGetForUnit, appApiProductGetTypes, appApiProductGetUnitProduct, appApiProductPatch, appApiProductPost, getAppApiProductGetForUnitQueryKey, getAppApiProductGetQueryKey, getAppApiProductGetTypesQueryKey, getAppApiProductGetUnitProductQueryKey, useAppApiProductDelete, useAppApiProductGet, useAppApiProductGetForUnit, useAppApiProductGetTypes, useAppApiProductGetUnitProduct, useAppApiProductPatch, useAppApiProductPost };
|
package/product/product.js
CHANGED
|
@@ -1,40 +1,118 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../chunk-GWBPVOL2.js";
|
|
2
4
|
|
|
3
5
|
// src/product/product.ts
|
|
4
6
|
import axios from "axios";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
import {
|
|
8
|
+
useQuery,
|
|
9
|
+
useMutation
|
|
10
|
+
} from "react-query";
|
|
11
|
+
var appApiProductGetTypes = (options) => {
|
|
12
|
+
return axios.get(`/product-type`, options);
|
|
13
|
+
};
|
|
14
|
+
var getAppApiProductGetTypesQueryKey = () => [`/product-type`];
|
|
15
|
+
var useAppApiProductGetTypes = (options) => {
|
|
16
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
17
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetTypesQueryKey();
|
|
18
|
+
const queryFn = () => appApiProductGetTypes(axiosOptions);
|
|
19
|
+
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
|
+
return __spreadValues({
|
|
21
|
+
queryKey
|
|
22
|
+
}, query);
|
|
23
|
+
};
|
|
24
|
+
var appApiProductGet = (options) => {
|
|
25
|
+
return axios.get(`/product`, options);
|
|
26
|
+
};
|
|
27
|
+
var getAppApiProductGetQueryKey = () => [`/product`];
|
|
28
|
+
var useAppApiProductGet = (options) => {
|
|
29
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
30
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetQueryKey();
|
|
31
|
+
const queryFn = () => appApiProductGet(axiosOptions);
|
|
32
|
+
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
33
|
+
return __spreadValues({
|
|
34
|
+
queryKey
|
|
35
|
+
}, query);
|
|
36
|
+
};
|
|
37
|
+
var appApiProductPost = (unitId, unitProductPostBodyBody, options) => {
|
|
38
|
+
return axios.post(`/product/unit/${unitId}`, unitProductPostBodyBody, options);
|
|
39
|
+
};
|
|
40
|
+
var useAppApiProductPost = (options) => {
|
|
41
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
42
|
+
const mutationFn = (props) => {
|
|
43
|
+
const { unitId, data } = props || {};
|
|
44
|
+
return appApiProductPost(unitId, data, axiosOptions);
|
|
23
45
|
};
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
return useMutation(mutationFn, mutationOptions);
|
|
47
|
+
};
|
|
48
|
+
var appApiProductGetForUnit = (unitId, options) => {
|
|
49
|
+
return axios.get(`/product/unit/${unitId}`, options);
|
|
50
|
+
};
|
|
51
|
+
var getAppApiProductGetForUnitQueryKey = (unitId) => [
|
|
52
|
+
`/product/unit/${unitId}`
|
|
53
|
+
];
|
|
54
|
+
var useAppApiProductGetForUnit = (unitId, options) => {
|
|
55
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
56
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetForUnitQueryKey(unitId);
|
|
57
|
+
const queryFn = () => appApiProductGetForUnit(unitId, axiosOptions);
|
|
58
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
|
|
59
|
+
return __spreadValues({
|
|
60
|
+
queryKey
|
|
61
|
+
}, query);
|
|
62
|
+
};
|
|
63
|
+
var appApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
64
|
+
return axios.get(`/product/unit/${unitId}/product/${productId}`, options);
|
|
65
|
+
};
|
|
66
|
+
var getAppApiProductGetUnitProductQueryKey = (unitId, productId) => [`/product/unit/${unitId}/product/${productId}`];
|
|
67
|
+
var useAppApiProductGetUnitProduct = (unitId, productId, options) => {
|
|
68
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
69
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiProductGetUnitProductQueryKey(unitId, productId);
|
|
70
|
+
const queryFn = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);
|
|
71
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!(unitId && productId) }, queryOptions));
|
|
72
|
+
return __spreadValues({
|
|
73
|
+
queryKey
|
|
74
|
+
}, query);
|
|
75
|
+
};
|
|
76
|
+
var appApiProductDelete = (unitId, productId, options) => {
|
|
77
|
+
return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);
|
|
78
|
+
};
|
|
79
|
+
var useAppApiProductDelete = (options) => {
|
|
80
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
81
|
+
const mutationFn = (props) => {
|
|
82
|
+
const { unitId, productId } = props || {};
|
|
83
|
+
return appApiProductDelete(unitId, productId, axiosOptions);
|
|
26
84
|
};
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
85
|
+
return useMutation(mutationFn, mutationOptions);
|
|
86
|
+
};
|
|
87
|
+
var appApiProductPatch = (unitId, productId, productPatchBodyBody, options) => {
|
|
88
|
+
return axios.patch(`/product/unit/${unitId}/product/${productId}`, productPatchBodyBody, options);
|
|
89
|
+
};
|
|
90
|
+
var useAppApiProductPatch = (options) => {
|
|
91
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
92
|
+
const mutationFn = (props) => {
|
|
93
|
+
const { unitId, productId, data } = props || {};
|
|
94
|
+
return appApiProductPatch(unitId, productId, data, axiosOptions);
|
|
35
95
|
};
|
|
96
|
+
return useMutation(mutationFn, mutationOptions);
|
|
36
97
|
};
|
|
37
98
|
export {
|
|
38
|
-
|
|
99
|
+
appApiProductDelete,
|
|
100
|
+
appApiProductGet,
|
|
101
|
+
appApiProductGetForUnit,
|
|
102
|
+
appApiProductGetTypes,
|
|
103
|
+
appApiProductGetUnitProduct,
|
|
104
|
+
appApiProductPatch,
|
|
105
|
+
appApiProductPost,
|
|
106
|
+
getAppApiProductGetForUnitQueryKey,
|
|
107
|
+
getAppApiProductGetQueryKey,
|
|
108
|
+
getAppApiProductGetTypesQueryKey,
|
|
109
|
+
getAppApiProductGetUnitProductQueryKey,
|
|
110
|
+
useAppApiProductDelete,
|
|
111
|
+
useAppApiProductGet,
|
|
112
|
+
useAppApiProductGetForUnit,
|
|
113
|
+
useAppApiProductGetTypes,
|
|
114
|
+
useAppApiProductGetUnitProduct,
|
|
115
|
+
useAppApiProductPatch,
|
|
116
|
+
useAppApiProductPost
|
|
39
117
|
};
|
|
40
118
|
//# sourceMappingURL=product.js.map
|
package/product/product.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport type {\n ProductsGetTypesResponse,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\nexport const getProduct = () => {\n /**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\n const appApiProductGetTypes = <\n TData = AxiosResponse<ProductsGetTypesResponse>\n >(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product-type`, options);\n };\n /**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\n const appApiProductGet = <TData = AxiosResponse<ProductsGetResponse>>(\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product`, options);\n };\n /**\n * @summary Creates a Product for an Organisational Unit\n */\n const appApiProductPost = <TData = AxiosResponse<UnitProductPostResponse>>(\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n };\n /**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\n const appApiProductGetForUnit = <TData = AxiosResponse<ProductsGetResponse>>(\n unitId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}`, options);\n };\n /**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\n const appApiProductGetUnitProduct = <\n TData = AxiosResponse<ProductUnitGetResponse>\n >(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n };\n /**\n * @summary Deletes an existing Product\n */\n const appApiProductDelete = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.delete(\n `/product/unit/${unitId}/product/${productId}`,\n options\n );\n };\n /**\n * 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`\n\n * @summary Adjust an existing Product\n */\n const appApiProductPatch = <TData = AxiosResponse<void>>(\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n ): Promise<TData> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n };\n return {\n appApiProductGetTypes,\n appApiProductGet,\n appApiProductPost,\n appApiProductGetForUnit,\n appApiProductGetUnitProduct,\n appApiProductDelete,\n appApiProductPatch,\n };\n};\nexport type AppApiProductGetTypesResult =\n AxiosResponse<ProductsGetTypesResponse>;\nexport type AppApiProductGetResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductPostResult = AxiosResponse<UnitProductPostResponse>;\nexport type AppApiProductGetForUnitResult = AxiosResponse<ProductsGetResponse>;\nexport type AppApiProductGetUnitProductResult =\n AxiosResponse<ProductUnitGetResponse>;\nexport type AppApiProductDeleteResult = AxiosResponse<void>;\nexport type AppApiProductPatchResult = AxiosResponse<void>;\n"],"mappings":";;;AAUA;AAUO,IAAM,aAAa,MAAM;AAM9B,QAAM,wBAAwB,CAG5B,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,OAAO;AAAA,EAC3C;AAMA,QAAM,mBAAmB,CACvB,YACmB;AACnB,WAAO,MAAM,IAAI,YAAY,OAAO;AAAA,EACtC;AAIA,QAAM,oBAAoB,CACxB,QACA,yBACA,YACmB;AACnB,WAAO,MAAM,KACX,iBAAiB,UACjB,yBACA,OACF;AAAA,EACF;AAMA,QAAM,0BAA0B,CAC9B,QACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,UAAU,OAAO;AAAA,EACrD;AAMA,QAAM,8BAA8B,CAGlC,QACA,WACA,YACmB;AACnB,WAAO,MAAM,IAAI,iBAAiB,kBAAkB,aAAa,OAAO;AAAA,EAC1E;AAIA,QAAM,sBAAsB,CAC1B,QACA,WACA,YACmB;AACnB,WAAO,MAAM,OACX,iBAAiB,kBAAkB,aACnC,OACF;AAAA,EACF;AAMA,QAAM,qBAAqB,CACzB,QACA,WACA,sBACA,YACmB;AACnB,WAAO,MAAM,MACX,iBAAiB,kBAAkB,aACnC,sBACA,OACF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/product/product.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ProductsGetTypesResponse,\n AsError,\n ProductsGetResponse,\n UnitProductPostResponse,\n UnitProductPostBodyBody,\n ProductUnitGetResponse,\n ProductPatchBodyBody,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * Gets product types you can purchase\n\n * @summary Gets all Product Types\n */\nexport const appApiProductGetTypes = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetTypesResponse>> => {\n return axios.get(`/product-type`, options);\n};\n\nexport const getAppApiProductGetTypesQueryKey = () => [`/product-type`];\n\nexport type AppApiProductGetTypesQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetTypes>\n>;\nexport type AppApiProductGetTypesQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetTypes = <\n TData = AsyncReturnType<typeof appApiProductGetTypes>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetTypes>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiProductGetTypesQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetTypes>\n > = () => appApiProductGetTypes(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetTypes>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets products you have access to, across all Units and Organisations\n\n * @summary Gets all Products\n */\nexport const appApiProductGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product`, options);\n};\n\nexport const getAppApiProductGetQueryKey = () => [`/product`];\n\nexport type AppApiProductGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGet>\n>;\nexport type AppApiProductGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGet = <\n TData = AsyncReturnType<typeof appApiProductGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGet>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiProductGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiProductGet>> = () =>\n appApiProductGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Creates a Product for an Organisational Unit\n */\nexport const appApiProductPost = (\n unitId: string,\n unitProductPostBodyBody: UnitProductPostBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UnitProductPostResponse>> => {\n return axios.post(\n `/product/unit/${unitId}`,\n unitProductPostBodyBody,\n options\n );\n};\n\nexport type AppApiProductPostMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPost>\n>;\nexport type AppApiProductPostMutationBody = UnitProductPostBodyBody;\nexport type AppApiProductPostMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiProductPost = <\n TError = AxiosError<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPost>,\n { unitId: string; data: UnitProductPostBodyBody }\n > = (props) => {\n const { unitId, data } = props || {};\n\n return appApiProductPost(unitId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPost>,\n TError,\n { unitId: string; data: UnitProductPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets products you have access to based on an Organisational Unit\n\n * @summary Gets Products for an Organisational Unit\n */\nexport const appApiProductGetForUnit = (\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductsGetResponse>> => {\n return axios.get(`/product/unit/${unitId}`, options);\n};\n\nexport const getAppApiProductGetForUnitQueryKey = (unitId: string) => [\n `/product/unit/${unitId}`,\n];\n\nexport type AppApiProductGetForUnitQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetForUnit>\n>;\nexport type AppApiProductGetForUnitQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiProductGetForUnit = <\n TData = AsyncReturnType<typeof appApiProductGetForUnit>,\n TError = AxiosError<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiProductGetForUnitQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetForUnit>\n > = () => appApiProductGetForUnit(unitId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetForUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a Unit's Product\n\n * @summary Gets a Unit's Product\n */\nexport const appApiProductGetUnitProduct = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ProductUnitGetResponse>> => {\n return axios.get(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport const getAppApiProductGetUnitProductQueryKey = (\n unitId: string,\n productId: string\n) => [`/product/unit/${unitId}/product/${productId}`];\n\nexport type AppApiProductGetUnitProductQueryResult = NonNullable<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n>;\nexport type AppApiProductGetUnitProductQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiProductGetUnitProduct = <\n TData = AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError = AxiosError<AsError | void>\n>(\n unitId: string,\n productId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ??\n getAppApiProductGetUnitProductQueryKey(unitId, productId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiProductGetUnitProduct>\n > = () => appApiProductGetUnitProduct(unitId, productId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiProductGetUnitProduct>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!(unitId && productId), ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * @summary Deletes an existing Product\n */\nexport const appApiProductDelete = (\n unitId: string,\n productId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/product/unit/${unitId}/product/${productId}`, options);\n};\n\nexport type AppApiProductDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductDelete>\n>;\n\nexport type AppApiProductDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductDelete>,\n { unitId: string; productId: string }\n > = (props) => {\n const { unitId, productId } = props || {};\n\n return appApiProductDelete(unitId, productId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductDelete>,\n TError,\n { unitId: string; productId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * 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`\n\n * @summary Adjust an existing Product\n */\nexport const appApiProductPatch = (\n unitId: string,\n productId: string,\n productPatchBodyBody: ProductPatchBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.patch(\n `/product/unit/${unitId}/product/${productId}`,\n productPatchBodyBody,\n options\n );\n};\n\nexport type AppApiProductPatchMutationResult = NonNullable<\n AsyncReturnType<typeof appApiProductPatch>\n>;\nexport type AppApiProductPatchMutationBody = ProductPatchBodyBody;\nexport type AppApiProductPatchMutationError = AxiosError<AsError>;\n\nexport const useAppApiProductPatch = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiProductPatch>,\n { unitId: string; productId: string; data: ProductPatchBodyBody }\n > = (props) => {\n const { unitId, productId, data } = props || {};\n\n return appApiProductPatch(unitId, productId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiProductPatch>,\n TError,\n { unitId: string; productId: string; data: ProductPatchBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":"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","names":[]}
|
package/service/service.cjs
CHANGED
|
@@ -1,17 +1,46 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
|
|
2
4
|
|
|
3
5
|
// src/service/service.ts
|
|
4
6
|
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _reactquery = require('react-query');
|
|
10
|
+
var appApiServiceGet = (options) => {
|
|
11
|
+
return _axios2.default.get(`/service`, options);
|
|
12
|
+
};
|
|
13
|
+
var getAppApiServiceGetQueryKey = () => [`/service`];
|
|
14
|
+
var useAppApiServiceGet = (options) => {
|
|
15
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
16
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiServiceGetQueryKey()));
|
|
17
|
+
const queryFn = () => appApiServiceGet(axiosOptions);
|
|
18
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
19
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
20
|
+
queryKey
|
|
21
|
+
}, query);
|
|
22
|
+
};
|
|
23
|
+
var appApiServiceGetId = (svcId, options) => {
|
|
24
|
+
return _axios2.default.get(`/service/${svcId}`, options);
|
|
25
|
+
};
|
|
26
|
+
var getAppApiServiceGetIdQueryKey = (svcId) => [
|
|
27
|
+
`/service/${svcId}`
|
|
28
|
+
];
|
|
29
|
+
var useAppApiServiceGetId = (svcId, options) => {
|
|
30
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
31
|
+
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiServiceGetIdQueryKey(svcId)));
|
|
32
|
+
const queryFn = () => appApiServiceGetId(svcId, axiosOptions);
|
|
33
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!svcId }, queryOptions));
|
|
34
|
+
return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
|
|
35
|
+
queryKey
|
|
36
|
+
}, query);
|
|
13
37
|
};
|
|
14
38
|
|
|
15
39
|
|
|
16
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.appApiServiceGet = appApiServiceGet; exports.appApiServiceGetId = appApiServiceGetId; exports.getAppApiServiceGetIdQueryKey = getAppApiServiceGetIdQueryKey; exports.getAppApiServiceGetQueryKey = getAppApiServiceGetQueryKey; exports.useAppApiServiceGet = useAppApiServiceGet; exports.useAppApiServiceGetId = useAppApiServiceGetId;
|
|
17
46
|
//# sourceMappingURL=service.cjs.map
|
package/service/service.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAyBO,IAAM,mBAAmB,CAC9B,YACgD;AAChD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,8BAA8B,MAAM,CAAC,UAAU;AAOrD,IAAM,sBAAsB,CAGjC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,4BAA4B;AAEvE,QAAM,UAAmE,MACvE,iBAAiB,YAAY;AAE/B,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,qBAAqB,CAChC,OACA,YAC+C;AAC/C,SAAO,MAAM,IAAI,YAAY,SAAS,OAAO;AAC/C;AAEO,IAAM,gCAAgC,CAAC,UAAkB;AAAA,EAC9D,YAAY;AACd;AAOO,IAAM,wBAAwB,CAInC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WACJ,8CAAc,aAAY,8BAA8B,KAAK;AAE/D,QAAM,UAEF,MAAM,mBAAmB,OAAO,YAAY;AAEhD,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.7.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: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const appApiServiceGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServicesGetResponse>> => {\n return axios.get(`/service`, options);\n};\n\nexport const getAppApiServiceGetQueryKey = () => [`/service`];\n\nexport type AppApiServiceGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGet>\n>;\nexport type AppApiServiceGetQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGet = <\n TData = AsyncReturnType<typeof appApiServiceGet>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGet>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiServiceGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiServiceGet>> = () =>\n appApiServiceGet(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGet>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const appApiServiceGetId = (\n svcId: number,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<ServiceGetResponse>> => {\n return axios.get(`/service/${svcId}`, options);\n};\n\nexport const getAppApiServiceGetIdQueryKey = (svcId: number) => [\n `/service/${svcId}`,\n];\n\nexport type AppApiServiceGetIdQueryResult = NonNullable<\n AsyncReturnType<typeof appApiServiceGetId>\n>;\nexport type AppApiServiceGetIdQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiServiceGetId = <\n TData = AsyncReturnType<typeof appApiServiceGetId>,\n TError = AxiosError<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiServiceGetId>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiServiceGetIdQueryKey(svcId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiServiceGetId>\n > = () => appApiServiceGetId(svcId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiServiceGetId>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!svcId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
|