@squonk/account-server-client 0.1.35 → 0.1.36
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 +10 -15
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +2 -4
- package/asset/asset.js +5 -10
- package/asset/asset.js.map +1 -1
- package/{chunk-6EEIAH4R.js → chunk-3TENYKS7.js} +1 -1
- package/{chunk-6EEIAH4R.js.map → chunk-3TENYKS7.js.map} +0 -0
- package/{chunk-NGBTCJWS.cjs → chunk-RHHRF25R.cjs} +1 -1
- package/{chunk-NGBTCJWS.cjs.map → chunk-RHHRF25R.cjs.map} +0 -0
- package/{custom-instance-aeeba2ba.d.ts → custom-instance-323ee59a.d.ts} +1 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +8 -12
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +2 -4
- package/merchant/merchant.js +6 -10
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +9 -15
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +2 -4
- package/organisation/organisation.js +6 -12
- package/organisation/organisation.js.map +1 -1
- package/package.json +9 -10
- package/product/product.cjs +24 -30
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +2 -4
- package/product/product.js +15 -21
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +1 -1
- package/src/asset/asset.ts +11 -16
- package/src/merchant/merchant.ts +16 -19
- package/src/organisation/organisation.ts +18 -20
- package/src/product/product.ts +36 -35
- package/src/state/state.ts +10 -14
- package/src/unit/unit.ts +21 -25
- package/src/user/user.ts +26 -25
- package/state/state.cjs +4 -8
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +2 -15
- package/state/state.js +4 -8
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +16 -22
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +2 -4
- package/unit/unit.js +8 -14
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +18 -22
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +2 -4
- package/user/user.js +11 -15
- package/user/user.js.map +1 -1
package/src/user/user.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.9.1 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,9 +8,8 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 0.1
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
useMutation,
|
|
11
|
+
import { useQuery, useMutation } from "react-query";
|
|
12
|
+
import type {
|
|
14
13
|
UseQueryOptions,
|
|
15
14
|
UseMutationOptions,
|
|
16
15
|
QueryFunction,
|
|
@@ -23,13 +22,10 @@ import type {
|
|
|
23
22
|
AsError,
|
|
24
23
|
UsersGetResponse,
|
|
25
24
|
} from "../account-server-api.schemas";
|
|
26
|
-
import { customInstance
|
|
27
|
-
|
|
28
|
-
export type AwaitedInput<T> = PromiseLike<T> | T;
|
|
29
|
-
|
|
30
|
-
export type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
25
|
+
import { customInstance } from ".././custom-instance";
|
|
26
|
+
import type { ErrorType } from ".././custom-instance";
|
|
31
27
|
|
|
32
|
-
// eslint-disable-next-line
|
|
28
|
+
// eslint-disable-next-line
|
|
33
29
|
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
30
|
config: any,
|
|
35
31
|
args: infer P
|
|
@@ -82,12 +78,13 @@ export const useGetUserAccount = <
|
|
|
82
78
|
Awaited<ReturnType<typeof getUserAccount>>,
|
|
83
79
|
TError,
|
|
84
80
|
TData
|
|
85
|
-
>(queryKey, queryFn, queryOptions)
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
queryKey,
|
|
89
|
-
...query,
|
|
81
|
+
>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
|
|
82
|
+
queryKey: QueryKey;
|
|
90
83
|
};
|
|
84
|
+
|
|
85
|
+
query.queryKey = queryKey;
|
|
86
|
+
|
|
87
|
+
return query;
|
|
91
88
|
};
|
|
92
89
|
|
|
93
90
|
/**
|
|
@@ -142,12 +139,14 @@ export const useGetOrganisationUsers = <
|
|
|
142
139
|
Awaited<ReturnType<typeof getOrganisationUsers>>,
|
|
143
140
|
TError,
|
|
144
141
|
TData
|
|
145
|
-
>(queryKey, queryFn, { enabled: !!orgId, ...queryOptions })
|
|
142
|
+
>(queryKey, queryFn, { enabled: !!orgId, ...queryOptions }) as UseQueryResult<
|
|
143
|
+
TData,
|
|
144
|
+
TError
|
|
145
|
+
> & { queryKey: QueryKey };
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
};
|
|
147
|
+
query.queryKey = queryKey;
|
|
148
|
+
|
|
149
|
+
return query;
|
|
151
150
|
};
|
|
152
151
|
|
|
153
152
|
/**
|
|
@@ -306,12 +305,14 @@ export const useGetOrganisationUnitUsers = <
|
|
|
306
305
|
Awaited<ReturnType<typeof getOrganisationUnitUsers>>,
|
|
307
306
|
TError,
|
|
308
307
|
TData
|
|
309
|
-
>(queryKey, queryFn, {
|
|
308
|
+
>(queryKey, queryFn, {
|
|
309
|
+
enabled: !!unitId,
|
|
310
|
+
...queryOptions,
|
|
311
|
+
}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
310
312
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
};
|
|
313
|
+
query.queryKey = queryKey;
|
|
314
|
+
|
|
315
|
+
return query;
|
|
315
316
|
};
|
|
316
317
|
|
|
317
318
|
/**
|
package/state/state.cjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
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 _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
3
|
+
var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
|
|
5
4
|
|
|
6
5
|
// src/state/state.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
6
|
var _reactquery = require('react-query');
|
|
10
7
|
var getVersion = (options, signal) => {
|
|
11
|
-
return
|
|
8
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/version`, method: "get", signal }, options);
|
|
12
9
|
};
|
|
13
10
|
var getGetVersionQueryKey = () => [`/version`];
|
|
14
11
|
var useGetVersion = (options) => {
|
|
@@ -18,9 +15,8 @@ var useGetVersion = (options) => {
|
|
|
18
15
|
signal
|
|
19
16
|
}) => getVersion(requestOptions, signal);
|
|
20
17
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, query);
|
|
18
|
+
query.queryKey = queryKey;
|
|
19
|
+
return query;
|
|
24
20
|
};
|
|
25
21
|
|
|
26
22
|
|
package/state/state.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/state/state.ts"],"names":[],"mappings":";;;;;AAUA;AAyBO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;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: 0.1\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,20 +1,7 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
2
|
-
import { a9 as customInstance, a2 as StateGetVersionResponse, aa as ErrorType, a5 as AsError } from '../custom-instance-
|
|
2
|
+
import { a9 as customInstance, a2 as StateGetVersionResponse, aa as ErrorType, a5 as AsError } from '../custom-instance-323ee59a.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Generated by orval v6.8.0 🍺
|
|
7
|
-
* Do not edit manually.
|
|
8
|
-
* Account Server API
|
|
9
|
-
* The Informatics Matters Account Server API.
|
|
10
|
-
|
|
11
|
-
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
12
|
-
|
|
13
|
-
* OpenAPI spec version: 0.1
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
17
|
-
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
18
5
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
19
6
|
/**
|
|
20
7
|
* @summary Gets the Account Server version
|
|
@@ -30,4 +17,4 @@ declare const useGetVersion: <TData = StateGetVersionResponse, TError = ErrorTyp
|
|
|
30
17
|
queryKey: QueryKey;
|
|
31
18
|
};
|
|
32
19
|
|
|
33
|
-
export {
|
|
20
|
+
export { GetVersionQueryError, GetVersionQueryResult, getGetVersionQueryKey, getVersion, useGetVersion };
|
package/state/state.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues,
|
|
3
2
|
customInstance
|
|
4
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-3TENYKS7.js";
|
|
5
4
|
|
|
6
5
|
// src/state/state.ts
|
|
7
|
-
import {
|
|
8
|
-
useQuery
|
|
9
|
-
} from "react-query";
|
|
6
|
+
import { useQuery } from "react-query";
|
|
10
7
|
var getVersion = (options, signal) => {
|
|
11
8
|
return customInstance({ url: `/version`, method: "get", signal }, options);
|
|
12
9
|
};
|
|
@@ -18,9 +15,8 @@ var useGetVersion = (options) => {
|
|
|
18
15
|
signal
|
|
19
16
|
}) => getVersion(requestOptions, signal);
|
|
20
17
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, query);
|
|
18
|
+
query.queryKey = queryKey;
|
|
19
|
+
return query;
|
|
24
20
|
};
|
|
25
21
|
export {
|
|
26
22
|
getGetVersionQueryKey,
|
package/state/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/state.ts"],"sourcesContent":["/**\n * Generated by orval v6.
|
|
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\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;AAyBO,IAAM,aAAa,CACxB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,OAAO,OAAO,GACzC,OACF;AACF;AAEO,IAAM,wBAAwB,MAAM,CAAC,UAAU;AAO/C,IAAM,gBAAgB,CAG3B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB;AAEjE,QAAM,UAAiE,CAAC;AAAA,IACtE;AAAA,QACI,WAAW,gBAAgB,MAAM;AAEvC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,QAAM,WAAW;AAEjB,SAAO;AACT;","names":[]}
|
package/unit/unit.cjs
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
|
|
5
5
|
|
|
6
6
|
// src/unit/unit.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
var _reactquery = require('react-query');
|
|
11
8
|
var getOrganisationUnits = (orgId, options, signal) => {
|
|
12
|
-
return
|
|
9
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/organisation/${orgId}/unit`, method: "get", signal }, options);
|
|
13
10
|
};
|
|
14
11
|
var getGetOrganisationUnitsQueryKey = (orgId) => [
|
|
15
12
|
`/organisation/${orgId}/unit`
|
|
@@ -18,13 +15,12 @@ var useGetOrganisationUnits = (orgId, options) => {
|
|
|
18
15
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
19
16
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitsQueryKey(orgId)));
|
|
20
17
|
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
21
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, query);
|
|
18
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
|
|
19
|
+
query.queryKey = queryKey;
|
|
20
|
+
return query;
|
|
25
21
|
};
|
|
26
22
|
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
27
|
-
return
|
|
23
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, {
|
|
28
24
|
url: `/organisation/${orgId}/unit`,
|
|
29
25
|
method: "post",
|
|
30
26
|
headers: { "Content-Type": "application/json" },
|
|
@@ -40,7 +36,7 @@ var useCreateOrganisationUnit = (options) => {
|
|
|
40
36
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
41
37
|
};
|
|
42
38
|
var getUnit = (unitId, options, signal) => {
|
|
43
|
-
return
|
|
39
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}`, method: "get", signal }, options);
|
|
44
40
|
};
|
|
45
41
|
var getGetUnitQueryKey = (unitId) => [`/unit/${unitId}`];
|
|
46
42
|
var useGetUnit = (unitId, options) => {
|
|
@@ -49,13 +45,12 @@ var useGetUnit = (unitId, options) => {
|
|
|
49
45
|
const queryFn = ({
|
|
50
46
|
signal
|
|
51
47
|
}) => getUnit(unitId, requestOptions, signal);
|
|
52
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, query);
|
|
48
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, { enabled: !!unitId }, queryOptions));
|
|
49
|
+
query.queryKey = queryKey;
|
|
50
|
+
return query;
|
|
56
51
|
};
|
|
57
52
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
58
|
-
return
|
|
53
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}`, method: "delete" }, options);
|
|
59
54
|
};
|
|
60
55
|
var useDeleteOrganisationUnit = (options) => {
|
|
61
56
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -66,7 +61,7 @@ var useDeleteOrganisationUnit = (options) => {
|
|
|
66
61
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
67
62
|
};
|
|
68
63
|
var getUnits = (options, signal) => {
|
|
69
|
-
return
|
|
64
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "get", signal }, options);
|
|
70
65
|
};
|
|
71
66
|
var getGetUnitsQueryKey = () => [`/unit`];
|
|
72
67
|
var useGetUnits = (options) => {
|
|
@@ -76,12 +71,11 @@ var useGetUnits = (options) => {
|
|
|
76
71
|
signal
|
|
77
72
|
}) => getUnits(requestOptions, signal);
|
|
78
73
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, query);
|
|
74
|
+
query.queryKey = queryKey;
|
|
75
|
+
return query;
|
|
82
76
|
};
|
|
83
77
|
var createDefaultUnit = (options) => {
|
|
84
|
-
return
|
|
78
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "put" }, options);
|
|
85
79
|
};
|
|
86
80
|
var useCreateDefaultUnit = (options) => {
|
|
87
81
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -91,7 +85,7 @@ var useCreateDefaultUnit = (options) => {
|
|
|
91
85
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
92
86
|
};
|
|
93
87
|
var deleteDefaultUnit = (options) => {
|
|
94
|
-
return
|
|
88
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit`, method: "delete" }, options);
|
|
95
89
|
};
|
|
96
90
|
var useDeleteDefaultUnit = (options) => {
|
|
97
91
|
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;AAAA;AAAA;AAAA;AAsCO,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,YA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,mBAAmB,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.8.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\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 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 });\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 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 );\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 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 );\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 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;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,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAK1D,QAAM,WAAW;AAEjB,SAAO;AACT;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB;AAAA,IACtB,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM;AAAA,EACR,GACA,OACF;AACF;AAQO,IAAM,4BAA4B,CAGvC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AAC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AAY,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","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"]}
|
package/unit/unit.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { a9 as customInstance, Y as OrganisationUnitsGetResponse, aa as ErrorType, a5 as AsError, O as OrganisationUnitPostBodyBody, _ as OrganisationUnitPostResponse, l as UnitDetail, K as UnitsGetResponse, Z as PersonalUnitPutResponse } from '../custom-instance-
|
|
1
|
+
import { a9 as customInstance, Y as OrganisationUnitsGetResponse, aa as ErrorType, a5 as AsError, O as OrganisationUnitPostBodyBody, _ as OrganisationUnitPostResponse, l as UnitDetail, K as UnitsGetResponse, Z as PersonalUnitPutResponse } from '../custom-instance-323ee59a.js';
|
|
2
2
|
import * as react_query from 'react-query';
|
|
3
3
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
7
|
-
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
8
6
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
9
7
|
/**
|
|
10
8
|
* Gets Organisational Units you have access to or that are public
|
|
@@ -111,4 +109,4 @@ declare const useDeleteDefaultUnit: <TError = ErrorType<AsError>, TVariables = v
|
|
|
111
109
|
request?: SecondParameter<typeof customInstance>;
|
|
112
110
|
} | undefined) => react_query.UseMutationResult<void, TError, TVariables, TContext>;
|
|
113
111
|
|
|
114
|
-
export {
|
|
112
|
+
export { CreateDefaultUnitMutationError, CreateDefaultUnitMutationResult, CreateOrganisationUnitMutationBody, CreateOrganisationUnitMutationError, CreateOrganisationUnitMutationResult, DeleteDefaultUnitMutationError, DeleteDefaultUnitMutationResult, DeleteOrganisationUnitMutationError, DeleteOrganisationUnitMutationResult, GetOrganisationUnitsQueryError, GetOrganisationUnitsQueryResult, GetUnitQueryError, GetUnitQueryResult, GetUnitsQueryError, GetUnitsQueryResult, createDefaultUnit, createOrganisationUnit, deleteDefaultUnit, deleteOrganisationUnit, getGetOrganisationUnitsQueryKey, getGetUnitQueryKey, getGetUnitsQueryKey, getOrganisationUnits, getUnit, getUnits, useCreateDefaultUnit, useCreateOrganisationUnit, useDeleteDefaultUnit, useDeleteOrganisationUnit, useGetOrganisationUnits, useGetUnit, useGetUnits };
|
package/unit/unit.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues,
|
|
3
3
|
customInstance
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-3TENYKS7.js";
|
|
5
5
|
|
|
6
6
|
// src/unit/unit.ts
|
|
7
|
-
import {
|
|
8
|
-
useQuery,
|
|
9
|
-
useMutation
|
|
10
|
-
} from "react-query";
|
|
7
|
+
import { useQuery, useMutation } from "react-query";
|
|
11
8
|
var getOrganisationUnits = (orgId, options, signal) => {
|
|
12
9
|
return customInstance({ url: `/organisation/${orgId}/unit`, method: "get", signal }, options);
|
|
13
10
|
};
|
|
@@ -19,9 +16,8 @@ var useGetOrganisationUnits = (orgId, options) => {
|
|
|
19
16
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitsQueryKey(orgId);
|
|
20
17
|
const queryFn = ({ signal }) => getOrganisationUnits(orgId, requestOptions, signal);
|
|
21
18
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, query);
|
|
19
|
+
query.queryKey = queryKey;
|
|
20
|
+
return query;
|
|
25
21
|
};
|
|
26
22
|
var createOrganisationUnit = (orgId, organisationUnitPostBodyBody, options) => {
|
|
27
23
|
return customInstance({
|
|
@@ -50,9 +46,8 @@ var useGetUnit = (unitId, options) => {
|
|
|
50
46
|
signal
|
|
51
47
|
}) => getUnit(unitId, requestOptions, signal);
|
|
52
48
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, query);
|
|
49
|
+
query.queryKey = queryKey;
|
|
50
|
+
return query;
|
|
56
51
|
};
|
|
57
52
|
var deleteOrganisationUnit = (unitId, options) => {
|
|
58
53
|
return customInstance({ url: `/unit/${unitId}`, method: "delete" }, options);
|
|
@@ -76,9 +71,8 @@ var useGetUnits = (options) => {
|
|
|
76
71
|
signal
|
|
77
72
|
}) => getUnits(requestOptions, signal);
|
|
78
73
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, query);
|
|
74
|
+
query.queryKey = queryKey;
|
|
75
|
+
return query;
|
|
82
76
|
};
|
|
83
77
|
var createDefaultUnit = (options) => {
|
|
84
78
|
return customInstance({ url: `/unit`, method: "put" }, options);
|
package/unit/unit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/unit/unit.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.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\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\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 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 });\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 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 );\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 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 );\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 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;AAAA;AAAA;AAAA;AAsCO,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,iBAAE,SAAS,CAAC,CAAC,SAAU,aAAc;AAE1D,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,yBAAyB,CACpC,OACA,8BACA,YACG;AACH,SAAO,eACL;AAAA,IACE,KAAK,iBAAiB;AAAA,IACtB,QAAQ;AAAA,IAC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E,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,SAAO;AAAA,IACL;AAAA,KACG;AAEP;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: 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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,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":[]}
|
package/user/user.cjs
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkRHHRF25Rcjs = require('../chunk-RHHRF25R.cjs');
|
|
5
5
|
|
|
6
6
|
// src/user/user.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
var _reactquery = require('react-query');
|
|
11
8
|
var getUserAccount = (options, signal) => {
|
|
12
|
-
return
|
|
9
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/user/account`, method: "get", signal }, options);
|
|
13
10
|
};
|
|
14
11
|
var getGetUserAccountQueryKey = () => [`/user/account`];
|
|
15
12
|
var useGetUserAccount = (options) => {
|
|
@@ -19,12 +16,11 @@ var useGetUserAccount = (options) => {
|
|
|
19
16
|
signal
|
|
20
17
|
}) => getUserAccount(requestOptions, signal);
|
|
21
18
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, query);
|
|
19
|
+
query.queryKey = queryKey;
|
|
20
|
+
return query;
|
|
25
21
|
};
|
|
26
22
|
var getOrganisationUsers = (orgId, options, signal) => {
|
|
27
|
-
return
|
|
23
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user`, method: "get", signal }, options);
|
|
28
24
|
};
|
|
29
25
|
var getGetOrganisationUsersQueryKey = (orgId) => [
|
|
30
26
|
`/organisation/${orgId}/user`
|
|
@@ -33,13 +29,12 @@ var useGetOrganisationUsers = (orgId, options) => {
|
|
|
33
29
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
34
30
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUsersQueryKey(orgId)));
|
|
35
31
|
const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
|
|
36
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, query);
|
|
32
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, { enabled: !!orgId }, queryOptions));
|
|
33
|
+
query.queryKey = queryKey;
|
|
34
|
+
return query;
|
|
40
35
|
};
|
|
41
36
|
var addOrganisationUser = (orgId, userId, options) => {
|
|
42
|
-
return
|
|
37
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user/${userId}`, method: "put" }, options);
|
|
43
38
|
};
|
|
44
39
|
var useAddOrganisationUser = (options) => {
|
|
45
40
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -50,7 +45,7 @@ var useAddOrganisationUser = (options) => {
|
|
|
50
45
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
51
46
|
};
|
|
52
47
|
var deleteOrganisationUser = (orgId, userId, options) => {
|
|
53
|
-
return
|
|
48
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/organisation/${orgId}/user/${userId}`, method: "delete" }, options);
|
|
54
49
|
};
|
|
55
50
|
var useDeleteOrganisationUser = (options) => {
|
|
56
51
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -61,7 +56,7 @@ var useDeleteOrganisationUser = (options) => {
|
|
|
61
56
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
62
57
|
};
|
|
63
58
|
var getOrganisationUnitUsers = (unitId, options, signal) => {
|
|
64
|
-
return
|
|
59
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}/user`, method: "get", signal }, options);
|
|
65
60
|
};
|
|
66
61
|
var getGetOrganisationUnitUsersQueryKey = (unitId) => [
|
|
67
62
|
`/unit/${unitId}/user`
|
|
@@ -70,13 +65,14 @@ var useGetOrganisationUnitUsers = (unitId, options) => {
|
|
|
70
65
|
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
71
66
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetOrganisationUnitUsersQueryKey(unitId)));
|
|
72
67
|
const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
73
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkRHHRF25Rcjs.__spreadValues.call(void 0, {
|
|
69
|
+
enabled: !!unitId
|
|
70
|
+
}, queryOptions));
|
|
71
|
+
query.queryKey = queryKey;
|
|
72
|
+
return query;
|
|
77
73
|
};
|
|
78
74
|
var addOrganisationUnitUser = (unitId, userId, options) => {
|
|
79
|
-
return
|
|
75
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}/user/${userId}`, method: "put" }, options);
|
|
80
76
|
};
|
|
81
77
|
var useAddOrganisationUnitUser = (options) => {
|
|
82
78
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
@@ -87,7 +83,7 @@ var useAddOrganisationUnitUser = (options) => {
|
|
|
87
83
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
88
84
|
};
|
|
89
85
|
var deleteOrganisationUnitUser = (unitId, userId, options) => {
|
|
90
|
-
return
|
|
86
|
+
return _chunkRHHRF25Rcjs.customInstance.call(void 0, { url: `/unit/${unitId}/user/${userId}`, method: "delete" }, options);
|
|
91
87
|
};
|
|
92
88
|
var useDeleteOrganisationUnitUser = (options) => {
|
|
93
89
|
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|