@squonk/account-server-client 0.1.37-rc.1 → 1.0.0-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/asset/asset.cjs +39 -14
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +1 -1
- package/asset/asset.js +39 -14
- package/asset/asset.js.map +1 -1
- package/chunk-3O5KIRV4.js +27 -0
- package/{chunk-3TENYKS7.js.map → chunk-3O5KIRV4.js.map} +1 -1
- package/chunk-IUEU2LYC.cjs +27 -0
- package/chunk-IUEU2LYC.cjs.map +1 -0
- package/{custom-instance-323ee59a.d.ts → custom-instance-b8075093.d.ts} +91 -14
- package/index.cjs +11 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +10 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +14 -5
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +1 -1
- package/merchant/merchant.js +14 -5
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +22 -10
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +1 -1
- package/organisation/organisation.js +22 -10
- package/organisation/organisation.js.map +1 -1
- package/package.json +5 -5
- package/product/product.cjs +75 -26
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +22 -2
- package/product/product.js +74 -25
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +108 -13
- package/src/asset/asset.ts +1 -1
- package/src/merchant/merchant.ts +1 -1
- package/src/organisation/organisation.ts +1 -1
- package/src/product/product.ts +73 -1
- package/src/state/state.ts +1 -1
- package/src/unit/unit.ts +3 -3
- package/src/user/user.ts +3 -3
- package/state/state.cjs +10 -3
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +1 -1
- package/state/state.js +10 -3
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +42 -17
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +3 -3
- package/unit/unit.js +41 -16
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +34 -13
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +3 -3
- package/user/user.js +34 -13
- package/user/user.js.map +1 -1
- package/chunk-3TENYKS7.js +0 -46
- package/chunk-RHHRF25R.cjs +0 -46
- package/chunk-RHHRF25R.cjs.map +0 -1
package/src/user/user.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version: 0
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
11
|
import { useQuery, useMutation } from "react-query";
|
|
12
12
|
import type {
|
|
@@ -318,7 +318,7 @@ export const useGetOrganisationUnitUsers = <
|
|
|
318
318
|
/**
|
|
319
319
|
* Adds a user to an Organisational Unit.
|
|
320
320
|
|
|
321
|
-
Users cannot be added to **
|
|
321
|
+
Users cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).
|
|
322
322
|
|
|
323
323
|
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
324
324
|
|
|
@@ -374,7 +374,7 @@ export const useAddOrganisationUnitUser = <
|
|
|
374
374
|
/**
|
|
375
375
|
* Removes a user from an Organisational Unit.
|
|
376
376
|
|
|
377
|
-
Users cannot be removed from **
|
|
377
|
+
Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
|
|
378
378
|
|
|
379
379
|
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
380
380
|
|
package/state/state.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
|
|
4
4
|
|
|
5
5
|
// src/state/state.ts
|
|
6
6
|
var _reactquery = require('react-query');
|
|
7
7
|
var getVersion = (options, signal) => {
|
|
8
|
-
return
|
|
8
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
9
|
+
{ url: `/version`, method: "get", signal },
|
|
10
|
+
options
|
|
11
|
+
);
|
|
9
12
|
};
|
|
10
13
|
var getGetVersionQueryKey = () => [`/version`];
|
|
11
14
|
var useGetVersion = (options) => {
|
|
@@ -14,7 +17,11 @@ var useGetVersion = (options) => {
|
|
|
14
17
|
const queryFn = ({
|
|
15
18
|
signal
|
|
16
19
|
}) => getVersion(requestOptions, signal);
|
|
17
|
-
const query = _reactquery.useQuery.call(void 0,
|
|
20
|
+
const query = _reactquery.useQuery.call(void 0,
|
|
21
|
+
queryKey,
|
|
22
|
+
queryFn,
|
|
23
|
+
queryOptions
|
|
24
|
+
);
|
|
18
25
|
query.queryKey = queryKey;
|
|
19
26
|
return query;
|
|
20
27
|
};
|
package/state/state.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA;
|
|
1
|
+
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\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<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"]}
|
package/state/state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { ak as customInstance, ad as StateGetVersionResponse, al as ErrorType, ag as AsError } from '../custom-instance-b8075093.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
package/state/state.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-3O5KIRV4.js";
|
|
4
4
|
|
|
5
5
|
// src/state/state.ts
|
|
6
6
|
import { useQuery } from "react-query";
|
|
7
7
|
var getVersion = (options, signal) => {
|
|
8
|
-
return customInstance(
|
|
8
|
+
return customInstance(
|
|
9
|
+
{ url: `/version`, method: "get", signal },
|
|
10
|
+
options
|
|
11
|
+
);
|
|
9
12
|
};
|
|
10
13
|
var getGetVersionQueryKey = () => [`/version`];
|
|
11
14
|
var useGetVersion = (options) => {
|
|
@@ -14,7 +17,11 @@ var useGetVersion = (options) => {
|
|
|
14
17
|
const queryFn = ({
|
|
15
18
|
signal
|
|
16
19
|
}) => getVersion(requestOptions, signal);
|
|
17
|
-
const query = useQuery(
|
|
20
|
+
const query = useQuery(
|
|
21
|
+
queryKey,
|
|
22
|
+
queryFn,
|
|
23
|
+
queryOptions
|
|
24
|
+
);
|
|
18
25
|
query.queryKey = queryKey;
|
|
19
26
|
return query;
|
|
20
27
|
};
|
package/state/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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
|
+
{"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 signal?: AbortSignal\n) => {\n return customInstance<StateGetVersionResponse>(\n { url: `/version`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetVersionQueryKey = () => [`/version`];\n\nexport type GetVersionQueryResult = NonNullable<\n Awaited<ReturnType<typeof getVersion>>\n>;\nexport type GetVersionQueryError = ErrorType<AsError | void>;\n\nexport const useGetVersion = <\n TData = Awaited<ReturnType<typeof getVersion>>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getVersion>>,\n TError,\n TData\n >;\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<Awaited<ReturnType<typeof getVersion>>> = ({\n signal,\n }) => getVersion(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getVersion>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\n};\n"],"mappings":";;;;;AAUA,SAAS,gBAAgB;AAyBlB,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO;AAAA,IACzC;AAAA,EACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,EACF,MAAM,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
|
package/unit/unit.cjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
|
|
3
|
+
var _chunkIUEU2LYCcjs = require('../chunk-IUEU2LYC.cjs');
|
|
5
4
|
|
|
6
5
|
// src/unit/unit.ts
|
|
7
6
|
var _reactquery = require('react-query');
|
|
8
7
|
var getOrganisationUnits = (orgId, options, signal) => {
|
|
9
|
-
return
|
|
8
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
9
|
+
{ url: `/organisation/${orgId}/unit`, method: "get", signal },
|
|
10
|
+
options
|
|
11
|
+
);
|
|
10
12
|
};
|
|
11
13
|
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
12
14
|
`/organisation/${orgId}/unit`
|
|
@@ -15,17 +17,20 @@ var useGetOrganisationUnits = (orgId, options) => {
|
|
|
15
17
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
18
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
|
|
17
19
|
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
18
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
20
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
|
|
19
21
|
query.queryKey = queryKey;
|
|
20
22
|
return query;
|
|
21
23
|
};
|
|
22
24
|
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
26
|
+
{
|
|
27
|
+
url: `/organisation/${orgId}/unit`,
|
|
28
|
+
method: "post",
|
|
29
|
+
headers: { "Content-Type": "application/json" },
|
|
30
|
+
data: organisationUnitPostBodyBody
|
|
31
|
+
},
|
|
32
|
+
options
|
|
33
|
+
);
|
|
29
34
|
};
|
|
30
35
|
var useCreateOrganisationUnit = (options) => {
|
|
31
36
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -36,7 +41,10 @@ var useCreateOrganisationUnit = (options) => {
|
|
|
36
41
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
37
42
|
};
|
|
38
43
|
var getUnit = (unitId, options, signal) => {
|
|
39
|
-
return
|
|
44
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
45
|
+
{ url: `/unit/${unitId}`, method: "get", signal },
|
|
46
|
+
options
|
|
47
|
+
);
|
|
40
48
|
};
|
|
41
49
|
var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
|
|
42
50
|
var useGetUnit = (unitId, options) => {
|
|
@@ -45,12 +53,19 @@ var useGetUnit = (unitId, options) => {
|
|
|
45
53
|
const queryFn = ({
|
|
46
54
|
signal
|
|
47
55
|
}) => getUnit(unitId, requestOptions, signal);
|
|
48
|
-
const query = _reactquery.useQuery.call(void 0,
|
|
56
|
+
const query = _reactquery.useQuery.call(void 0,
|
|
57
|
+
queryKey,
|
|
58
|
+
queryFn,
|
|
59
|
+
{ enabled: !!unitId, ...queryOptions }
|
|
60
|
+
);
|
|
49
61
|
query.queryKey = queryKey;
|
|
50
62
|
return query;
|
|
51
63
|
};
|
|
52
64
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
53
|
-
return
|
|
65
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
66
|
+
{ url: `/unit/${unitId}`, method: "delete" },
|
|
67
|
+
options
|
|
68
|
+
);
|
|
54
69
|
};
|
|
55
70
|
var useDeleteOrganisationUnit = (options) => {
|
|
56
71
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -61,7 +76,10 @@ var useDeleteOrganisationUnit = (options) => {
|
|
|
61
76
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
62
77
|
};
|
|
63
78
|
var getUnits = (options, signal) => {
|
|
64
|
-
return
|
|
79
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
80
|
+
{ url: `/unit`, method: "get", signal },
|
|
81
|
+
options
|
|
82
|
+
);
|
|
65
83
|
};
|
|
66
84
|
var getGetUnitsQueryKey = () => [`/unit`];
|
|
67
85
|
var useGetUnits = (options) => {
|
|
@@ -70,12 +88,19 @@ var useGetUnits = (options) => {
|
|
|
70
88
|
const queryFn = ({
|
|
71
89
|
signal
|
|
72
90
|
}) => getUnits(requestOptions, signal);
|
|
73
|
-
const query = _reactquery.useQuery.call(void 0,
|
|
91
|
+
const query = _reactquery.useQuery.call(void 0,
|
|
92
|
+
queryKey,
|
|
93
|
+
queryFn,
|
|
94
|
+
queryOptions
|
|
95
|
+
);
|
|
74
96
|
query.queryKey = queryKey;
|
|
75
97
|
return query;
|
|
76
98
|
};
|
|
77
99
|
var createDefaultUnit = (options) => {
|
|
78
|
-
return
|
|
100
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0,
|
|
101
|
+
{ url: `/unit`, method: "put" },
|
|
102
|
+
options
|
|
103
|
+
);
|
|
79
104
|
};
|
|
80
105
|
var useCreateDefaultUnit = (options) => {
|
|
81
106
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -85,7 +110,7 @@ var useCreateDefaultUnit = (options) => {
|
|
|
85
110
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
86
111
|
};
|
|
87
112
|
var deleteDefaultUnit = (options) => {
|
|
88
|
-
return
|
|
113
|
+
return _chunkIUEU2LYCcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
|
|
89
114
|
};
|
|
90
115
|
var useDeleteDefaultUnit = (options) => {
|
|
91
116
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
package/unit/unit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;;AAUA;AAkCO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO,GAC5D,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,aA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\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 { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { 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 getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<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 type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAkC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,KAA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AG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,oBAAoB;AAE/D,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,EACF,MAAM,SAAS,gBAAgB,MAAM;AAErC,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,QAAQ,MAAM;AAAA,IAC9B;AAAA,EACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { 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 getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 Personal 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 type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<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 a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ak as customInstance, a6 as OrganisationUnitsGetResponse, al as ErrorType, ag as AsError, O as OrganisationUnitPostBodyBody, a9 as OrganisationUnitPostResponse, o as UnitDetail, a7 as UnitsGetResponse, a8 as PersonalUnitPutResponse } from '../custom-instance-b8075093.js';
|
|
2
2
|
import * as react_query from 'react-query';
|
|
3
3
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
4
4
|
import 'axios';
|
|
@@ -87,7 +87,7 @@ declare const useGetUnits: <TData = UnitsGetResponse, TError = ErrorType<void |
|
|
|
87
87
|
/**
|
|
88
88
|
* 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
|
|
89
89
|
|
|
90
|
-
* @summary Create a new
|
|
90
|
+
* @summary Create a new Personal Unit
|
|
91
91
|
*/
|
|
92
92
|
declare const createDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<PersonalUnitPutResponse>;
|
|
93
93
|
declare type CreateDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof createDefaultUnit>>>;
|
|
@@ -99,7 +99,7 @@ declare const useCreateDefaultUnit: <TError = ErrorType<void | AsError>, TVariab
|
|
|
99
99
|
/**
|
|
100
100
|
* Deletes a 'Personal' Unit. It must be your Unit, which belongs to the Default Organisation
|
|
101
101
|
|
|
102
|
-
* @summary Deletes
|
|
102
|
+
* @summary Deletes a Personal Unit
|
|
103
103
|
*/
|
|
104
104
|
declare const deleteDefaultUnit: (options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
105
105
|
declare type DeleteDefaultUnitMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDefaultUnit>>>;
|
package/unit/unit.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues,
|
|
3
2
|
customInstance
|
|
4
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-3O5KIRV4.js";
|
|
5
4
|
|
|
6
5
|
// src/unit/unit.ts
|
|
7
6
|
import { useQuery, useMutation } from "react-query";
|
|
8
7
|
var getOrganisationUnits = (orgId, options, signal) => {
|
|
9
|
-
return customInstance(
|
|
8
|
+
return customInstance(
|
|
9
|
+
{ url: `/organisation/${orgId}/unit`, method: "get", signal },
|
|
10
|
+
options
|
|
11
|
+
);
|
|
10
12
|
};
|
|
11
13
|
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
12
14
|
`/organisation/${orgId}/unit`
|
|
@@ -15,17 +17,20 @@ var useGetOrganisationUnits = (orgId, options) => {
|
|
|
15
17
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
18
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
17
19
|
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
18
|
-
const query = useQuery(queryKey, queryFn,
|
|
20
|
+
const query = useQuery(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });
|
|
19
21
|
query.queryKey = queryKey;
|
|
20
22
|
return query;
|
|
21
23
|
};
|
|
22
24
|
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
23
|
-
return customInstance(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return customInstance(
|
|
26
|
+
{
|
|
27
|
+
url: `/organisation/${orgId}/unit`,
|
|
28
|
+
method: "post",
|
|
29
|
+
headers: { "Content-Type": "application/json" },
|
|
30
|
+
data: organisationUnitPostBodyBody
|
|
31
|
+
},
|
|
32
|
+
options
|
|
33
|
+
);
|
|
29
34
|
};
|
|
30
35
|
var useCreateOrganisationUnit = (options) => {
|
|
31
36
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
@@ -36,7 +41,10 @@ var useCreateOrganisationUnit = (options) => {
|
|
|
36
41
|
return useMutation(mutationFn, mutationOptions);
|
|
37
42
|
};
|
|
38
43
|
var getUnit = (unitId, options, signal) => {
|
|
39
|
-
return customInstance(
|
|
44
|
+
return customInstance(
|
|
45
|
+
{ url: `/unit/${unitId}`, method: "get", signal },
|
|
46
|
+
options
|
|
47
|
+
);
|
|
40
48
|
};
|
|
41
49
|
var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
|
|
42
50
|
var useGetUnit = (unitId, options) => {
|
|
@@ -45,12 +53,19 @@ var useGetUnit = (unitId, options) => {
|
|
|
45
53
|
const queryFn = ({
|
|
46
54
|
signal
|
|
47
55
|
}) => getUnit(unitId, requestOptions, signal);
|
|
48
|
-
const query = useQuery(
|
|
56
|
+
const query = useQuery(
|
|
57
|
+
queryKey,
|
|
58
|
+
queryFn,
|
|
59
|
+
{ enabled: !!unitId, ...queryOptions }
|
|
60
|
+
);
|
|
49
61
|
query.queryKey = queryKey;
|
|
50
62
|
return query;
|
|
51
63
|
};
|
|
52
64
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
53
|
-
return customInstance(
|
|
65
|
+
return customInstance(
|
|
66
|
+
{ url: `/unit/${unitId}`, method: "delete" },
|
|
67
|
+
options
|
|
68
|
+
);
|
|
54
69
|
};
|
|
55
70
|
var useDeleteOrganisationUnit = (options) => {
|
|
56
71
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
@@ -61,7 +76,10 @@ var useDeleteOrganisationUnit = (options) => {
|
|
|
61
76
|
return useMutation(mutationFn, mutationOptions);
|
|
62
77
|
};
|
|
63
78
|
var getUnits = (options, signal) => {
|
|
64
|
-
return customInstance(
|
|
79
|
+
return customInstance(
|
|
80
|
+
{ url: `/unit`, method: "get", signal },
|
|
81
|
+
options
|
|
82
|
+
);
|
|
65
83
|
};
|
|
66
84
|
var getGetUnitsQueryKey = () => [`/unit`];
|
|
67
85
|
var useGetUnits = (options) => {
|
|
@@ -70,12 +88,19 @@ var useGetUnits = (options) => {
|
|
|
70
88
|
const queryFn = ({
|
|
71
89
|
signal
|
|
72
90
|
}) => getUnits(requestOptions, signal);
|
|
73
|
-
const query = useQuery(
|
|
91
|
+
const query = useQuery(
|
|
92
|
+
queryKey,
|
|
93
|
+
queryFn,
|
|
94
|
+
queryOptions
|
|
95
|
+
);
|
|
74
96
|
query.queryKey = queryKey;
|
|
75
97
|
return query;
|
|
76
98
|
};
|
|
77
99
|
var createDefaultUnit = (options) => {
|
|
78
|
-
return customInstance(
|
|
100
|
+
return customInstance(
|
|
101
|
+
{ url: `/unit`, method: "put" },
|
|
102
|
+
options
|
|
103
|
+
);
|
|
79
104
|
};
|
|
80
105
|
var useCreateDefaultUnit = (options) => {
|
|
81
106
|
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
package/unit/unit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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 { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { 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 getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<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 type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAkCO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO,GAC5D,OACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WACJ,8CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,aAAa,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,iBAA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AAU;AACb,UAAM,EAAE,WAAW,SAAS,CAAC;AAE7B,WAAO,uBAAuB,QAAQ,cAAc;AAAA,EACtD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,WAAW,CACtB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,QAAQ,OAAO,OAAO,GACtC,OACF;AACF;AAEO,IAAM,sBAAsB,MAAM,CAAC,OAAO;AAO1C,IAAM,cAAc,CAGzB,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,oBAAoB;AAE/D,QAAM,UAA+D,CAAC;AAAA,IACpE;AAAA,QACI,SAAS,gBAAgB,MAAM;AAErC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,QAAQ,MAAM,GAC9B,OACF;AACF;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAMO,IAAM,oBAAoB,CAC/B,YACG;AACH,SAAO,eAAqB,EAAE,KAAK,SAAS,QAAQ,SAAS,GAAG,OAAO;AACzE;AAQO,IAAM,uBAAuB,CAIlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,MAAM;AACR,WAAO,kBAAkB,cAAc;AAAA,EACzC;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/unit/unit.ts"],"sourcesContent":["/**\n * Generated by orval v6.9.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: 1.0\n */\nimport { useQuery, useMutation } from \"react-query\";\nimport type {\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 } from \".././custom-instance\";\nimport type { ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line\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 or that are public\n\n * @summary Gets Organisational Units\n */\nexport const getOrganisationUnits = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<OrganisationUnitsGetResponse>(\n { url: `/organisation/${orgId}/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitsQueryKey = (orgId: string) => [\n `/organisation/${orgId}/unit`,\n];\n\nexport type GetOrganisationUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnits>>\n>;\nexport type GetOrganisationUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetOrganisationUnits = <\n TData = Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError = ErrorType<void | AsError>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof getOrganisationUnits>>\n > = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getOrganisationUnits>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<\n TData,\n TError\n > & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 headers: { \"Content-Type\": \"application/json\" },\n data: organisationUnitPostBodyBody,\n },\n options\n );\n};\n\nexport type CreateOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createOrganisationUnit>>\n>;\nexport type CreateOrganisationUnitMutationBody = OrganisationUnitPostBodyBody;\nexport type CreateOrganisationUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateOrganisationUnit = <\n TError = ErrorType<AsError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<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 Awaited<ReturnType<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 or it is public. Admin users can see all Units\n\n * @summary Gets an Organisational Unit\n */\nexport const getUnit = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitGetResponse>(\n { url: `/unit/${unitId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitQueryKey = (unitId: string) => [`/unit/${unitId}`];\n\nexport type GetUnitQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnit>>\n>;\nexport type GetUnitQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnit = <\n TData = Awaited<ReturnType<typeof getUnit>>,\n TError = ErrorType<void | AsError>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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(unitId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUnit>>> = ({\n signal,\n }) => getUnit(unitId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnit>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!unitId, ...queryOptions }\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 unitId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteOrganisationUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>\n>;\n\nexport type DeleteOrganisationUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnit = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { unitId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n { unitId: string }\n > = (props) => {\n const { unitId } = props ?? {};\n\n return deleteOrganisationUnit(unitId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnit>>,\n TError,\n { 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 getUnits = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UnitsGetResponse>(\n { url: `/unit`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUnitsQueryKey = () => [`/unit`];\n\nexport type GetUnitsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUnits>>\n>;\nexport type GetUnitsQueryError = ErrorType<void | AsError>;\n\nexport const useGetUnits = <\n TData = Awaited<ReturnType<typeof getUnits>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<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<Awaited<ReturnType<typeof getUnits>>> = ({\n signal,\n }) => getUnits(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getUnits>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n ) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryKey;\n\n return query;\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 Personal 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 type CreateDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof createDefaultUnit>>\n>;\n\nexport type CreateDefaultUnitMutationError = ErrorType<AsError | void>;\n\nexport const useCreateDefaultUnit = <\n TError = ErrorType<AsError | void>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof createDefaultUnit>>,\n TVariables\n > = () => {\n return createDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<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 a Personal Unit\n */\nexport const deleteDefaultUnit = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>({ url: `/unit`, method: \"delete\" }, options);\n};\n\nexport type DeleteDefaultUnitMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteDefaultUnit>>\n>;\n\nexport type DeleteDefaultUnitMutationError = ErrorType<AsError>;\n\nexport const useDeleteDefaultUnit = <\n TError = ErrorType<AsError>,\n TVariables = void,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<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 Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TVariables\n > = () => {\n return deleteDefaultUnit(requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteDefaultUnit>>,\n TError,\n TVariables,\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AAkC/B,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OAAO,OAAO;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AACnB;AAOO,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YACJ,6CAAc,aAAY,gCAAgC,KAAK;AAEjE,QAAM,UAEF,CAAC,EAAE,OAAO,MAAM,qBAAqB,OAAO,gBAAgB,MAAM;AAEtE,QAAM,QAAQ,SAIZ,UAAU,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,GAAG,aAAa,CAAC;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO;AAAA,IACL;AAAA,MACE,KAAK,iBAAiB;AAAA,MACtB,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,OAAO,KAAK,IAAI,SAAS,CAAC;AAElC,WAAO,uBAAuB,OAAO,MAAM,cAAc;AAAA,EAC3D;AAEA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