@squonk/account-server-client 0.1.24-rc.1 → 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.
Files changed (51) hide show
  1. package/{custom-instance-4a108741.d.ts → account-server-api.schemas-e6c5f956.d.ts} +15 -20
  2. package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
  3. package/chunk-GWBPVOL2.js.map +1 -0
  4. package/chunk-N3RLW53G.cjs +25 -0
  5. package/chunk-N3RLW53G.cjs.map +1 -0
  6. package/index.cjs +21 -5
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +20 -2
  9. package/index.js +21 -5
  10. package/index.js.map +1 -1
  11. package/organisation/organisation.cjs +31 -31
  12. package/organisation/organisation.cjs.map +1 -1
  13. package/organisation/organisation.d.ts +37 -28
  14. package/organisation/organisation.js +38 -38
  15. package/organisation/organisation.js.map +1 -1
  16. package/package.json +14 -14
  17. package/product/product.cjs +64 -61
  18. package/product/product.cjs.map +1 -1
  19. package/product/product.d.ts +70 -40
  20. package/product/product.js +75 -72
  21. package/product/product.js.map +1 -1
  22. package/service/service.cjs +23 -21
  23. package/service/service.cjs.map +1 -1
  24. package/service/service.d.ts +19 -15
  25. package/service/service.js +26 -24
  26. package/service/service.js.map +1 -1
  27. package/src/account-server-api.schemas.ts +14 -1
  28. package/src/organisation/organisation.ts +86 -83
  29. package/src/product/product.ts +210 -145
  30. package/src/service/service.ts +64 -56
  31. package/src/state/state.ts +31 -32
  32. package/src/unit/unit.ts +170 -149
  33. package/src/user/user.ts +171 -160
  34. package/state/state.cjs +12 -12
  35. package/state/state.cjs.map +1 -1
  36. package/state/state.d.ts +12 -10
  37. package/state/state.js +13 -13
  38. package/state/state.js.map +1 -1
  39. package/unit/unit.cjs +54 -58
  40. package/unit/unit.cjs.map +1 -1
  41. package/unit/unit.d.ts +64 -49
  42. package/unit/unit.js +67 -71
  43. package/unit/unit.js.map +1 -1
  44. package/user/user.cjs +56 -56
  45. package/user/user.cjs.map +1 -1
  46. package/user/user.d.ts +69 -55
  47. package/user/user.js +69 -69
  48. package/user/user.js.map +1 -1
  49. package/chunk-3DXYUDZH.cjs +0 -46
  50. package/chunk-3DXYUDZH.cjs.map +0 -1
  51. package/chunk-JR7F532L.js.map +0 -1
package/state/state.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import {
2
- __spreadValues,
3
- customInstance
4
- } from "../chunk-JR7F532L.js";
2
+ __spreadValues
3
+ } from "../chunk-GWBPVOL2.js";
5
4
 
6
5
  // src/state/state.ts
6
+ import axios from "axios";
7
7
  import {
8
8
  useQuery
9
9
  } from "react-query";
10
- var getVersion = (options) => {
11
- return customInstance({ url: `/version`, method: "get" }, options);
10
+ var appApiStateGetVersion = (options) => {
11
+ return axios.get(`/version`, options);
12
12
  };
13
- var getGetVersionQueryKey = () => [`/version`];
14
- var useGetVersion = (options) => {
15
- const { query: queryOptions, request: requestOptions } = options || {};
16
- const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetVersionQueryKey();
17
- const queryFn = () => getVersion(requestOptions);
13
+ var getAppApiStateGetVersionQueryKey = () => [`/version`];
14
+ var useAppApiStateGetVersion = (options) => {
15
+ const { query: queryOptions, axios: axiosOptions } = options || {};
16
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiStateGetVersionQueryKey();
17
+ const queryFn = () => appApiStateGetVersion(axiosOptions);
18
18
  const query = useQuery(queryKey, queryFn, queryOptions);
19
19
  return __spreadValues({
20
20
  queryKey
21
21
  }, query);
22
22
  };
23
23
  export {
24
- getGetVersionQueryKey,
25
- getVersion,
26
- useGetVersion
24
+ appApiStateGetVersion,
25
+ getAppApiStateGetVersionQueryKey,
26
+ useAppApiStateGetVersion
27
27
  };
28
28
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\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// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * @summary Gets the Account Server version\n */\nexport const getVersion = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\" },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport const useGetVersion = <\n TData = AsyncReturnType<typeof getVersion>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>\n getVersion(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AA+BO,IAAM,aAAa,CACxB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,SAC3B;AAAA;AAIG,IAAM,wBAAwB,MAAM,CAAC;AAErC,IAAM,gBAAgB,CAG3B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAA6D,MACjE,WAAW;AAEb,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/state/state.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 UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n StateGetVersionResponse,\n AsError,\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 * @summary Gets the Account Server version\n */\nexport const appApiStateGetVersion = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<StateGetVersionResponse>> => {\n return axios.get(`/version`, options);\n};\n\nexport const getAppApiStateGetVersionQueryKey = () => [`/version`];\n\nexport type AppApiStateGetVersionQueryResult = NonNullable<\n AsyncReturnType<typeof appApiStateGetVersion>\n>;\nexport type AppApiStateGetVersionQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiStateGetVersion = <\n TData = AsyncReturnType<typeof appApiStateGetVersion>,\n TError = AxiosError<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiStateGetVersion>,\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 ?? getAppApiStateGetVersionQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiStateGetVersion>\n > = () => appApiStateGetVersion(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiStateGetVersion>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAsBO,IAAM,wBAAwB,CACnC,YACoD;AACpD,SAAO,MAAM,IAAI,YAAY,OAAO;AACtC;AAEO,IAAM,mCAAmC,MAAM,CAAC,UAAU;AAO1D,IAAM,2BAA2B,CAGtC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,iCAAiC;AAE5E,QAAM,UAEF,MAAM,sBAAsB,YAAY;AAE5C,QAAM,QAAQ,SAIZ,UAAU,SAAS,YAAY;AAEjC,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
package/unit/unit.cjs CHANGED
@@ -1,99 +1,95 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
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
2
 
3
-
4
- var _chunk3DXYUDZHcjs = require('../chunk-3DXYUDZH.cjs');
3
+ var _chunkN3RLW53Gcjs = require('../chunk-N3RLW53G.cjs');
5
4
 
6
5
  // src/unit/unit.ts
6
+ var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
7
7
 
8
8
 
9
9
 
10
10
  var _reactquery = require('react-query');
11
- var getOrganisationUnits = (orgid, options) => {
12
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/unit`, method: "get" }, options);
11
+ var appApiUnitGetOrgUnits = (orgId, options) => {
12
+ return _axios2.default.get(`/organisation/${orgId}/unit`, options);
13
13
  };
14
- var getGetOrganisationUnitsQueryKey = (orgid) => [
15
- `/organisation/${orgid}/unit`
14
+ var getAppApiUnitGetOrgUnitsQueryKey = (orgId) => [
15
+ `/organisation/${orgId}/unit`
16
16
  ];
17
- var useGetOrganisationUnits = (orgid, options) => {
18
- const { query: queryOptions, request: requestOptions } = options || {};
19
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgid)));
20
- const queryFn = () => getOrganisationUnits(orgid, requestOptions);
21
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!orgid }, queryOptions));
22
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
17
+ var useAppApiUnitGetOrgUnits = (orgId, options) => {
18
+ const { query: queryOptions, axios: axiosOptions } = options || {};
19
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiUnitGetOrgUnitsQueryKey(orgId)));
20
+ const queryFn = () => appApiUnitGetOrgUnits(orgId, axiosOptions);
21
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
22
+ return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
23
23
  queryKey
24
24
  }, query);
25
25
  };
26
- var createOrganisationUnit = (orgid, organisationUnitPostBodyBody, options) => {
27
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, {
28
- url: `/organisation/${orgid}/unit`,
29
- method: "post",
30
- data: organisationUnitPostBodyBody
31
- }, options);
26
+ var appApiUnitPost = (orgId, organisationUnitPostBodyBody, options) => {
27
+ return _axios2.default.post(`/organisation/${orgId}/unit`, organisationUnitPostBodyBody, options);
32
28
  };
33
- var useCreateOrganisationUnit = (options) => {
34
- const { mutation: mutationOptions, request: requestOptions } = options || {};
29
+ var useAppApiUnitPost = (options) => {
30
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
35
31
  const mutationFn = (props) => {
36
- const { orgid, data } = props || {};
37
- return createOrganisationUnit(orgid, data, requestOptions);
32
+ const { orgId, data } = props || {};
33
+ return appApiUnitPost(orgId, data, axiosOptions);
38
34
  };
39
35
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
40
36
  };
41
- var getUnit = (orgid, unitid, options) => {
42
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/unit/${unitid}`, method: "get" }, options);
37
+ var appApiUnitGetUnit = (orgId, unitId, options) => {
38
+ return _axios2.default.get(`/organisation/${orgId}/unit/${unitId}`, options);
43
39
  };
44
- var getGetUnitQueryKey = (orgid, unitid) => [
45
- `/organisation/${orgid}/unit/${unitid}`
40
+ var getAppApiUnitGetUnitQueryKey = (orgId, unitId) => [
41
+ `/organisation/${orgId}/unit/${unitId}`
46
42
  ];
47
- var useGetUnit = (orgid, unitid, options) => {
48
- const { query: queryOptions, request: requestOptions } = options || {};
49
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitQueryKey(orgid, unitid)));
50
- const queryFn = () => getUnit(orgid, unitid, requestOptions);
51
- const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunk3DXYUDZHcjs.__spreadValues.call(void 0, { enabled: !!(orgid && unitid) }, queryOptions));
52
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
43
+ var useAppApiUnitGetUnit = (orgId, unitId, options) => {
44
+ const { query: queryOptions, axios: axiosOptions } = options || {};
45
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiUnitGetUnitQueryKey(orgId, unitId)));
46
+ const queryFn = () => appApiUnitGetUnit(orgId, unitId, axiosOptions);
47
+ const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkN3RLW53Gcjs.__spreadValues.call(void 0, { enabled: !!(orgId && unitId) }, queryOptions));
48
+ return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
53
49
  queryKey
54
50
  }, query);
55
51
  };
56
- var deleteOrganisationUnit = (orgid, unitid, options) => {
57
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/organisation/${orgid}/unit/${unitid}`, method: "delete" }, options);
52
+ var appApiUnitDelete = (orgId, unitId, options) => {
53
+ return _axios2.default.delete(`/organisation/${orgId}/unit/${unitId}`, options);
58
54
  };
59
- var useDeleteOrganisationUnit = (options) => {
60
- const { mutation: mutationOptions, request: requestOptions } = options || {};
55
+ var useAppApiUnitDelete = (options) => {
56
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
61
57
  const mutationFn = (props) => {
62
- const { orgid, unitid } = props || {};
63
- return deleteOrganisationUnit(orgid, unitid, requestOptions);
58
+ const { orgId, unitId } = props || {};
59
+ return appApiUnitDelete(orgId, unitId, axiosOptions);
64
60
  };
65
61
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
66
62
  };
67
- var getUnits = (options) => {
68
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/unit`, method: "get" }, options);
63
+ var appApiUnitGet = (options) => {
64
+ return _axios2.default.get(`/unit`, options);
69
65
  };
70
- var getGetUnitsQueryKey = () => [`/unit`];
71
- var useGetUnits = (options) => {
72
- const { query: queryOptions, request: requestOptions } = options || {};
73
- const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetUnitsQueryKey()));
74
- const queryFn = () => getUnits(requestOptions);
66
+ var getAppApiUnitGetQueryKey = () => [`/unit`];
67
+ var useAppApiUnitGet = (options) => {
68
+ const { query: queryOptions, axios: axiosOptions } = options || {};
69
+ const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getAppApiUnitGetQueryKey()));
70
+ const queryFn = () => appApiUnitGet(axiosOptions);
75
71
  const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
76
- return _chunk3DXYUDZHcjs.__spreadValues.call(void 0, {
72
+ return _chunkN3RLW53Gcjs.__spreadValues.call(void 0, {
77
73
  queryKey
78
74
  }, query);
79
75
  };
80
- var createDefaultUnit = (options) => {
81
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/unit`, method: "put" }, options);
76
+ var appApiUnitPersonalPut = (options) => {
77
+ return _axios2.default.put(`/unit`, void 0, options);
82
78
  };
83
- var useCreateDefaultUnit = (options) => {
84
- const { mutation: mutationOptions, request: requestOptions } = options || {};
79
+ var useAppApiUnitPersonalPut = (options) => {
80
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
85
81
  const mutationFn = () => {
86
- return createDefaultUnit(requestOptions);
82
+ return appApiUnitPersonalPut(axiosOptions);
87
83
  };
88
84
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
89
85
  };
90
- var deleteDefaultUnit = (options) => {
91
- return _chunk3DXYUDZHcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
86
+ var appApiUnitPersonalDelete = (options) => {
87
+ return _axios2.default.delete(`/unit`, options);
92
88
  };
93
- var useDeleteDefaultUnit = (options) => {
94
- const { mutation: mutationOptions, request: requestOptions } = options || {};
89
+ var useAppApiUnitPersonalDelete = (options) => {
90
+ const { mutation: mutationOptions, axios: axiosOptions } = options || {};
95
91
  const mutationFn = () => {
96
- return deleteDefaultUnit(requestOptions);
92
+ return appApiUnitPersonalDelete(axiosOptions);
97
93
  };
98
94
  return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
99
95
  };
@@ -115,5 +111,5 @@ var useDeleteDefaultUnit = (options) => {
115
111
 
116
112
 
117
113
 
118
- exports.createDefaultUnit = createDefaultUnit; exports.createOrganisationUnit = createOrganisationUnit; exports.deleteDefaultUnit = deleteDefaultUnit; exports.deleteOrganisationUnit = deleteOrganisationUnit; exports.getGetOrganisationUnitsQueryKey = getGetOrganisationUnitsQueryKey; exports.getGetUnitQueryKey = getGetUnitQueryKey; exports.getGetUnitsQueryKey = getGetUnitsQueryKey; exports.getOrganisationUnits = getOrganisationUnits; exports.getUnit = getUnit; exports.getUnits = getUnits; exports.useCreateDefaultUnit = useCreateDefaultUnit; exports.useCreateOrganisationUnit = useCreateOrganisationUnit; exports.useDeleteDefaultUnit = useDeleteDefaultUnit; exports.useDeleteOrganisationUnit = useDeleteOrganisationUnit; exports.useGetOrganisationUnits = useGetOrganisationUnits; exports.useGetUnit = useGetUnit; exports.useGetUnits = useGetUnits;
114
+ exports.appApiUnitDelete = appApiUnitDelete; exports.appApiUnitGet = appApiUnitGet; exports.appApiUnitGetOrgUnits = appApiUnitGetOrgUnits; exports.appApiUnitGetUnit = appApiUnitGetUnit; exports.appApiUnitPersonalDelete = appApiUnitPersonalDelete; exports.appApiUnitPersonalPut = appApiUnitPersonalPut; exports.appApiUnitPost = appApiUnitPost; exports.getAppApiUnitGetOrgUnitsQueryKey = getAppApiUnitGetOrgUnitsQueryKey; exports.getAppApiUnitGetQueryKey = getAppApiUnitGetQueryKey; exports.getAppApiUnitGetUnitQueryKey = getAppApiUnitGetUnitQueryKey; exports.useAppApiUnitDelete = useAppApiUnitDelete; exports.useAppApiUnitGet = useAppApiUnitGet; exports.useAppApiUnitGetOrgUnits = useAppApiUnitGetOrgUnits; exports.useAppApiUnitGetUnit = useAppApiUnitGetUnit; exports.useAppApiUnitPersonalDelete = useAppApiUnitPersonalDelete; exports.useAppApiUnitPersonalPut = useAppApiUnitPersonalPut; exports.useAppApiUnitPost = useAppApiUnitPost;
119
115
  //# sourceMappingURL=unit.cjs.map
package/unit/unit.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAyCO,IAAM,uBAAuB,CAClC,OACA,YACG;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.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\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// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Gets Organisational Units you have access to\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgid}/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgid: string) => [\n `/organisation/${orgid}/unit`,\n];\n\nexport const useGetOrganisationUnits = <\n TData = AsyncReturnType<typeof getOrganisationUnits>,\n TError = ErrorType<void | AsError>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitsQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnits>\n > = () => getOrganisationUnits(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const createOrganisationUnit = (\n orgid: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<OrganisationUnitPostResponse>(\n {\n url: `/organisation/${orgid}/unit`,\n method: \"post\",\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createOrganisationUnit>,\n { orgid: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgid, data } = props || {};\n\n return createOrganisationUnit(orgid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createOrganisationUnit>,\n TError,\n { orgid: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const getUnit = (\n orgid: string,\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/organisation/${orgid}/unit/${unitid}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (orgid: string, unitid: string) => [\n `/organisation/${orgid}/unit/${unitid}`,\n];\n\nexport const useGetUnit = <\n TData = AsyncReturnType<typeof getUnit>,\n TError = ErrorType<void | AsError>\n>(\n orgid: string,\n unitid: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnit>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitQueryKey(orgid, unitid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnit>> = () =>\n getUnit(orgid, unitid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnit>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!(orgid && unitid), ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const deleteOrganisationUnit = (\n orgid: string,\n unitid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgid}/unit/${unitid}`, method: \"delete\" },\n options\n );\n};\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgid: string; unitid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n { orgid: string; unitid: string }\n > = (props) => {\n const { orgid, unitid } = props || {};\n\n return deleteOrganisationUnit(orgid, unitid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnit>,\n TError,\n { orgid: string; unitid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units you are a member of. Admin users can see all Units\n\n * @summary Gets Units a User has access to\n */\nexport const getUnits = (options?: SecondParameter<typeof customInstance>) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport const useGetUnits = <\n TData = AsyncReturnType<typeof getUnits>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getUnits>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUnitsQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUnits>> = () =>\n getUnits(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUnits>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const createDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<PersonalUnitPutResponse>(\n { url: `/unit`, method: \"put\" },\n options\n );\n};\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createDefaultUnit>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteDefaultUnit>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
1
+ {"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAAA;AAgCO,IAAM,wBAAwB,CACnC,OACA,YACyD;AACzD,SAAO,MAAM,IAAI,iBAAiB,cAAc,OAAO;AACzD;AAEO,IAAM,mCAAmC,CAAC,UAAkB;AAAA,EACjE,iBAAiB;AACnB;AAOO,IAAM,2BAA2B,CAItC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WACJ,8CAAc,aAAY,iCAAiC,KAAK;AAElE,QAAM,UAEF,MAAM,sBAAsB,OAAO,YAAY;AAEnD,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,iBAAiB,CAC5B,OACA,8BACA,YACyD;AACzD,SAAO,MAAM,KACX,iBAAiB,cACjB,8BACA,OACF;AACF;AAQO,IAAM,oBAAoB,CAG/B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAA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Ac,OAAO,iBAAiB,WAAW,CAAC;AAEjE,QAAM,WAAW,8CAAc,aAAY,yBAAyB;AAEpE,QAAM,UAAgE,MACpE,cAAc,YAAY;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,wBAAwB,CACnC,YACoD;AACpD,SAAO,MAAM,IAAI,SAAS,QAAW,OAAO;AAC9C;AAQO,IAAM,2BAA2B,CAItC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,OAAO,iBAAiB,WAAW,CAAC;AAEvE,QAAM,aAGF,MAAM;AACR,WAAO,sBAAsB,YAAY;AAAA,EAC3C;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,2BAA2B,CACtC,YACiC;AACjC,SAAO,MAAM,OAAO,SAAS,OAAO;AACtC;AAQO,IAAM,8BAA8B,CAIzC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,OAAO,iBAAiB,WAAW,CAAC;AAEvE,QAAM,aAGF,MAAM;AACR,WAAO,yBAAyB,YAAY;AAAA,EAC9C;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","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 OrganisationUnitsGetResponse,\n AsError,\n OrganisationUnitPostResponse,\n OrganisationUnitPostBodyBody,\n UnitGetResponse,\n UnitsGetResponse,\n PersonalUnitPutResponse,\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 Organisational Units you have access to or that are public\n\n * @summary Gets Organisational Units\n */\nexport const appApiUnitGetOrgUnits = (\n orgId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<OrganisationUnitsGetResponse>> => {\n return axios.get(`/organisation/${orgId}/unit`, options);\n};\n\nexport const getAppApiUnitGetOrgUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type AppApiUnitGetOrgUnitsQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUnitGetOrgUnits>\n>;\nexport type AppApiUnitGetOrgUnitsQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiUnitGetOrgUnits = <\n TData = AsyncReturnType<typeof appApiUnitGetOrgUnits>,\n TError = AxiosError<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiUnitGetOrgUnits>,\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 ?? getAppApiUnitGetOrgUnitsQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiUnitGetOrgUnits>\n > = () => appApiUnitGetOrgUnits(orgId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiUnitGetOrgUnits>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a new organisation unit. You need to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Create a new Organisational Unit\n */\nexport const appApiUnitPost = (\n orgId: string,\n organisationUnitPostBodyBody: OrganisationUnitPostBodyBody,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<OrganisationUnitPostResponse>> => {\n return axios.post(\n `/organisation/${orgId}/unit`,\n organisationUnitPostBodyBody,\n options\n );\n};\n\nexport type AppApiUnitPostMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUnitPost>\n>;\nexport type AppApiUnitPostMutationBody = OrganisationUnitPostBodyBody;\nexport type AppApiUnitPostMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiUnitPost = <\n TError = AxiosError<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUnitPost>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUnitPost>,\n { orgId: string; data: OrganisationUnitPostBodyBody }\n > = (props) => {\n const { orgId, data } = props || {};\n\n return appApiUnitPost(orgId, data, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUnitPost>,\n TError,\n { orgId: string; data: OrganisationUnitPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units\n\n * @summary Gets a Unit\n */\nexport const appApiUnitGetUnit = (\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UnitGetResponse>> => {\n return axios.get(`/organisation/${orgId}/unit/${unitId}`, options);\n};\n\nexport const getAppApiUnitGetUnitQueryKey = (orgId: string, unitId: string) => [\n `/organisation/${orgId}/unit/${unitId}`,\n];\n\nexport type AppApiUnitGetUnitQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUnitGetUnit>\n>;\nexport type AppApiUnitGetUnitQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiUnitGetUnit = <\n TData = AsyncReturnType<typeof appApiUnitGetUnit>,\n TError = AxiosError<void | AsError>\n>(\n orgId: string,\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiUnitGetUnit>,\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 ?? getAppApiUnitGetUnitQueryKey(orgId, unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiUnitGetUnit>\n > = () => appApiUnitGetUnit(orgId, unitId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiUnitGetUnit>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!(orgId && unitId), ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Deletes an Organisational Unit you have access to. Units can only be deleted by Organisation users or Admin users. You cannot delete a Unit that contains Products\n\n * @summary Deletes an Organisational Unit\n */\nexport const appApiUnitDelete = (\n orgId: string,\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/organisation/${orgId}/unit/${unitId}`, options);\n};\n\nexport type AppApiUnitDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUnitDelete>\n>;\n\nexport type AppApiUnitDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiUnitDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUnitDelete>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUnitDelete>,\n { orgId: string; unitId: string }\n > = (props) => {\n const { orgId, unitId } = props || {};\n\n return appApiUnitDelete(orgId, unitId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUnitDelete>,\n TError,\n { orgId: string; unitId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets all the Units that are public or you are a member of. Admin users can see all Units\n\n * @summary Gets Units\n */\nexport const appApiUnitGet = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UnitsGetResponse>> => {\n return axios.get(`/unit`, options);\n};\n\nexport const getAppApiUnitGetQueryKey = () => [`/unit`];\n\nexport type AppApiUnitGetQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUnitGet>\n>;\nexport type AppApiUnitGetQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiUnitGet = <\n TData = AsyncReturnType<typeof appApiUnitGet>,\n TError = AxiosError<void | AsError>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof appApiUnitGet>, TError, TData>;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiUnitGetQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof appApiUnitGet>> = () =>\n appApiUnitGet(axiosOptions);\n\n const query = useQuery<AsyncReturnType<typeof appApiUnitGet>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Creates a 'Personal' Unit for a User. The unit will belong to the built-in **Default** Organisation. Users can only have one Personal Unit and Personal Units cannot have other Users\n\n * @summary Create a new Independent User Unit\n */\nexport const appApiUnitPersonalPut = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<PersonalUnitPutResponse>> => {\n return axios.put(`/unit`, undefined, options);\n};\n\nexport type AppApiUnitPersonalPutMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUnitPersonalPut>\n>;\n\nexport type AppApiUnitPersonalPutMutationError = AxiosError<AsError | void>;\n\nexport const useAppApiUnitPersonalPut = <\n TError = AxiosError<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUnitPersonalPut>,\n TError,\n TVariables,\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUnitPersonalPut>,\n TVariables\n > = () => {\n return appApiUnitPersonalPut(axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUnitPersonalPut>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation\n\n * @summary Deletes an Independent Unit\n */\nexport const appApiUnitPersonalDelete = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/unit`, options);\n};\n\nexport type AppApiUnitPersonalDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUnitPersonalDelete>\n>;\n\nexport type AppApiUnitPersonalDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiUnitPersonalDelete = <\n TError = AxiosError<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUnitPersonalDelete>,\n TError,\n TVariables,\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUnitPersonalDelete>,\n TVariables\n > = () => {\n return appApiUnitPersonalDelete(axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUnitPersonalDelete>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
package/unit/unit.d.ts CHANGED
@@ -1,19 +1,21 @@
1
1
  import * as react_query from 'react-query';
2
2
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
3
- import { V as customInstance, F as OrganisationUnitsGetResponse, W as ErrorType, N as AsError, O as OrganisationUnitPostBodyBody, I as OrganisationUnitPostResponse, x as UnitGetResponse, G as UnitsGetResponse, H as PersonalUnitPutResponse } from '../custom-instance-4a108741';
4
- import 'axios';
3
+ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
4
+ import { F as OrganisationUnitsGetResponse, N as AsError, O as OrganisationUnitPostBodyBody, I as OrganisationUnitPostResponse, x as UnitGetResponse, G as UnitsGetResponse, H as PersonalUnitPutResponse } from '../account-server-api.schemas-e6c5f956.js';
5
5
 
6
- declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
6
+ declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
7
7
  /**
8
- * Gets Organisational Units you have access to
8
+ * Gets Organisational Units you have access to or that are public
9
9
 
10
10
  * @summary Gets Organisational Units
11
11
  */
12
- declare const getOrganisationUnits: (orgid: string, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitsGetResponse>;
13
- declare const getGetOrganisationUnitsQueryKey: (orgid: string) => string[];
14
- declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TError = ErrorType<void | AsError>>(orgid: string, options?: {
15
- query?: UseQueryOptions<OrganisationUnitsGetResponse, TError, TData, QueryKey> | undefined;
16
- request?: SecondParameter<typeof customInstance>;
12
+ declare const appApiUnitGetOrgUnits: (orgId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<OrganisationUnitsGetResponse>>;
13
+ declare const getAppApiUnitGetOrgUnitsQueryKey: (orgId: string) => string[];
14
+ declare type AppApiUnitGetOrgUnitsQueryResult = NonNullable<AsyncReturnType<typeof appApiUnitGetOrgUnits>>;
15
+ declare type AppApiUnitGetOrgUnitsQueryError = AxiosError<void | AsError>;
16
+ declare const useAppApiUnitGetOrgUnits: <TData = AxiosResponse<OrganisationUnitsGetResponse, any>, TError = AxiosError<void | AsError, any>>(orgId: string, options?: {
17
+ query?: UseQueryOptions<AxiosResponse<OrganisationUnitsGetResponse, any>, TError, TData, QueryKey> | undefined;
18
+ axios?: AxiosRequestConfig<any> | undefined;
17
19
  } | undefined) => UseQueryResult<TData, TError> & {
18
20
  queryKey: QueryKey;
19
21
  };
@@ -22,27 +24,32 @@ declare const useGetOrganisationUnits: <TData = OrganisationUnitsGetResponse, TE
22
24
 
23
25
  * @summary Create a new Organisational Unit
24
26
  */
25
- declare const createOrganisationUnit: (orgid: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<OrganisationUnitPostResponse>;
26
- declare const useCreateOrganisationUnit: <TError = ErrorType<void | AsError>, TContext = unknown>(options?: {
27
- mutation?: UseMutationOptions<OrganisationUnitPostResponse, TError, {
28
- orgid: string;
27
+ declare const appApiUnitPost: (orgId: string, organisationUnitPostBodyBody: OrganisationUnitPostBodyBody, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<OrganisationUnitPostResponse>>;
28
+ declare type AppApiUnitPostMutationResult = NonNullable<AsyncReturnType<typeof appApiUnitPost>>;
29
+ declare type AppApiUnitPostMutationBody = OrganisationUnitPostBodyBody;
30
+ declare type AppApiUnitPostMutationError = AxiosError<AsError | void>;
31
+ declare const useAppApiUnitPost: <TError = AxiosError<void | AsError, any>, TContext = unknown>(options?: {
32
+ mutation?: UseMutationOptions<AxiosResponse<OrganisationUnitPostResponse, any>, TError, {
33
+ orgId: string;
29
34
  data: OrganisationUnitPostBodyBody;
30
35
  }, TContext> | undefined;
31
- request?: SecondParameter<typeof customInstance>;
32
- } | undefined) => react_query.UseMutationResult<OrganisationUnitPostResponse, TError, {
33
- orgid: string;
36
+ axios?: AxiosRequestConfig<any> | undefined;
37
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<OrganisationUnitPostResponse, any>, TError, {
38
+ orgId: string;
34
39
  data: OrganisationUnitPostBodyBody;
35
40
  }, TContext>;
36
41
  /**
37
- * Gets the Unit, assuming you are a member of it. Admin users can see all Units
42
+ * Gets the Unit, assuming you are a member of it or it is public. Admin users can see all Units
38
43
 
39
44
  * @summary Gets a Unit
40
45
  */
41
- declare const getUnit: (orgid: string, unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<UnitGetResponse>;
42
- declare const getGetUnitQueryKey: (orgid: string, unitid: string) => string[];
43
- declare const useGetUnit: <TData = UnitGetResponse, TError = ErrorType<void | AsError>>(orgid: string, unitid: string, options?: {
44
- query?: UseQueryOptions<UnitGetResponse, TError, TData, QueryKey> | undefined;
45
- request?: SecondParameter<typeof customInstance>;
46
+ declare const appApiUnitGetUnit: (orgId: string, unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UnitGetResponse>>;
47
+ declare const getAppApiUnitGetUnitQueryKey: (orgId: string, unitId: string) => string[];
48
+ declare type AppApiUnitGetUnitQueryResult = NonNullable<AsyncReturnType<typeof appApiUnitGetUnit>>;
49
+ declare type AppApiUnitGetUnitQueryError = AxiosError<void | AsError>;
50
+ declare const useAppApiUnitGetUnit: <TData = AxiosResponse<UnitGetResponse, any>, TError = AxiosError<void | AsError, any>>(orgId: string, unitId: string, options?: {
51
+ query?: UseQueryOptions<AxiosResponse<UnitGetResponse, any>, TError, TData, QueryKey> | undefined;
52
+ axios?: AxiosRequestConfig<any> | undefined;
46
53
  } | undefined) => UseQueryResult<TData, TError> & {
47
54
  queryKey: QueryKey;
48
55
  };
@@ -51,27 +58,31 @@ declare const useGetUnit: <TData = UnitGetResponse, TError = ErrorType<void | As
51
58
 
52
59
  * @summary Deletes an Organisational Unit
53
60
  */
54
- declare const deleteOrganisationUnit: (orgid: string, unitid: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
55
- declare const useDeleteOrganisationUnit: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
56
- mutation?: UseMutationOptions<void, TError, {
57
- orgid: string;
58
- unitid: string;
61
+ declare const appApiUnitDelete: (orgId: string, unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
62
+ declare type AppApiUnitDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiUnitDelete>>;
63
+ declare type AppApiUnitDeleteMutationError = AxiosError<AsError>;
64
+ declare const useAppApiUnitDelete: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
65
+ mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
66
+ orgId: string;
67
+ unitId: string;
59
68
  }, TContext> | undefined;
60
- request?: SecondParameter<typeof customInstance>;
61
- } | undefined) => react_query.UseMutationResult<void, TError, {
62
- orgid: string;
63
- unitid: string;
69
+ axios?: AxiosRequestConfig<any> | undefined;
70
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
71
+ orgId: string;
72
+ unitId: string;
64
73
  }, TContext>;
65
74
  /**
66
- * Gets all the Units you are a member of. Admin users can see all Units
75
+ * Gets all the Units that are public or you are a member of. Admin users can see all Units
67
76
 
68
- * @summary Gets Units a User has access to
77
+ * @summary Gets Units
69
78
  */
70
- declare const getUnits: (options?: SecondParameter<typeof customInstance>) => Promise<UnitsGetResponse>;
71
- declare const getGetUnitsQueryKey: () => string[];
72
- declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void | AsError>>(options?: {
73
- query?: UseQueryOptions<UnitsGetResponse, TError, TData, QueryKey> | undefined;
74
- request?: SecondParameter<typeof customInstance>;
79
+ declare const appApiUnitGet: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UnitsGetResponse>>;
80
+ declare const getAppApiUnitGetQueryKey: () => string[];
81
+ declare type AppApiUnitGetQueryResult = NonNullable<AsyncReturnType<typeof appApiUnitGet>>;
82
+ declare type AppApiUnitGetQueryError = AxiosError<void | AsError>;
83
+ declare const useAppApiUnitGet: <TData = AxiosResponse<UnitsGetResponse, any>, TError = AxiosError<void | AsError, any>>(options?: {
84
+ query?: UseQueryOptions<AxiosResponse<UnitsGetResponse, any>, TError, TData, QueryKey> | undefined;
85
+ axios?: AxiosRequestConfig<any> | undefined;
75
86
  } | undefined) => UseQueryResult<TData, TError> & {
76
87
  queryKey: QueryKey;
77
88
  };
@@ -80,20 +91,24 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
80
91
 
81
92
  * @summary Create a new Independent User Unit
82
93
  */
83
- declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
84
- declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariables = void, TContext = unknown>(options?: {
85
- mutation?: UseMutationOptions<PersonalUnitPutResponse, TError, TVariables, TContext> | undefined;
86
- request?: SecondParameter<typeof customInstance>;
87
- } | undefined) => react_query.UseMutationResult<PersonalUnitPutResponse, TError, TVariables, TContext>;
94
+ declare const appApiUnitPersonalPut: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<PersonalUnitPutResponse>>;
95
+ declare type AppApiUnitPersonalPutMutationResult = NonNullable<AsyncReturnType<typeof appApiUnitPersonalPut>>;
96
+ declare type AppApiUnitPersonalPutMutationError = AxiosError<AsError | void>;
97
+ declare const useAppApiUnitPersonalPut: <TError = AxiosError<void | AsError, any>, TVariables = void, TContext = unknown>(options?: {
98
+ mutation?: UseMutationOptions<AxiosResponse<PersonalUnitPutResponse, any>, TError, TVariables, TContext> | undefined;
99
+ axios?: AxiosRequestConfig<any> | undefined;
100
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<PersonalUnitPutResponse, any>, TError, TVariables, TContext>;
88
101
  /**
89
102
  * Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
90
103
 
91
104
  * @summary Deletes an Independent Unit
92
105
  */
93
- declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
94
- declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = void, TContext = unknown>(options?: {
95
- mutation?: UseMutationOptions<void, TError, TVariables, TContext> | undefined;
96
- request?: SecondParameter<typeof customInstance>;
97
- } | undefined) => react_query.UseMutationResult<void, TError, TVariables, TContext>;
106
+ declare const appApiUnitPersonalDelete: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
107
+ declare type AppApiUnitPersonalDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiUnitPersonalDelete>>;
108
+ declare type AppApiUnitPersonalDeleteMutationError = AxiosError<AsError>;
109
+ declare const useAppApiUnitPersonalDelete: <TError = AxiosError<AsError, any>, TVariables = void, TContext = unknown>(options?: {
110
+ mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, TVariables, TContext> | undefined;
111
+ axios?: AxiosRequestConfig<any> | undefined;
112
+ } | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, TVariables, TContext>;
98
113
 
99
- export { createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnits };
114
+ export { AppApiUnitDeleteMutationError, AppApiUnitDeleteMutationResult, AppApiUnitGetOrgUnitsQueryError, AppApiUnitGetOrgUnitsQueryResult, AppApiUnitGetQueryError, AppApiUnitGetQueryResult, AppApiUnitGetUnitQueryError, AppApiUnitGetUnitQueryResult, AppApiUnitPersonalDeleteMutationError, AppApiUnitPersonalDeleteMutationResult, AppApiUnitPersonalPutMutationError, AppApiUnitPersonalPutMutationResult, AppApiUnitPostMutationBody, AppApiUnitPostMutationError, AppApiUnitPostMutationResult, appApiUnitDelete, appApiUnitGet, appApiUnitGetOrgUnits, appApiUnitGetUnit, appApiUnitPersonalDelete, appApiUnitPersonalPut, appApiUnitPost, getAppApiUnitGetOrgUnitsQueryKey, getAppApiUnitGetQueryKey, getAppApiUnitGetUnitQueryKey, useAppApiUnitDelete, useAppApiUnitGet, useAppApiUnitGetOrgUnits, useAppApiUnitGetUnit, useAppApiUnitPersonalDelete, useAppApiUnitPersonalPut, useAppApiUnitPost };