@squonk/account-server-client 2.1.0-rc.2 → 2.1.0-rc.4
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/admin/admin.cjs +14 -7
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +33 -0
- package/admin/admin.d.ts +4 -1
- package/admin/admin.js +14 -7
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +44 -19
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +243 -0
- package/asset/asset.d.ts +49 -23
- package/asset/asset.js +37 -12
- package/asset/asset.js.map +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
- package/chunk-J22A7LHX.cjs.map +1 -0
- package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
- package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
- package/{custom-instance-35e5d4fd.d.ts → custom-instance-37bb38c1.d.ts} +159 -159
- package/event-stream/event-stream.cjs +34 -18
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +108 -0
- package/event-stream/event-stream.d.ts +16 -4
- package/event-stream/event-stream.js +31 -15
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +23 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +57 -0
- package/merchant/merchant.d.ts +7 -1
- package/merchant/merchant.js +22 -12
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +50 -25
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +203 -0
- package/organisation/organisation.d.ts +31 -10
- package/organisation/organisation.js +44 -19
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +80 -44
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +280 -0
- package/product/product.d.ts +40 -10
- package/product/product.js +71 -35
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +268 -276
- package/src/admin/admin.ts +72 -78
- package/src/asset/asset.ts +453 -560
- package/src/event-stream/event-stream.ts +222 -268
- package/src/merchant/merchant.ts +125 -136
- package/src/organisation/organisation.ts +394 -484
- package/src/product/product.ts +557 -682
- package/src/state/state.ts +70 -69
- package/src/unit/unit.ts +494 -593
- package/src/user/user.ts +377 -463
- package/state/state.cjs +13 -7
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +29 -0
- package/state/state.d.ts +4 -1
- package/state/state.js +13 -7
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +59 -28
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +254 -0
- package/unit/unit.d.ts +43 -16
- package/unit/unit.js +52 -21
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +52 -21
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +220 -0
- package/user/user.d.ts +31 -10
- package/user/user.js +46 -15
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/user/user.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from '@tanstack/react-query';
|
|
3
|
-
import { aF as customInstance, v as UserAccountDetail, aG as ErrorType, aB as AsError, au as UsersGetResponse } from '../custom-instance-
|
|
3
|
+
import { aF as customInstance, v as UserAccountDetail, aG as ErrorType, aB as AsError, au as UsersGetResponse } from '../custom-instance-37bb38c1.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
6
|
type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
@@ -19,6 +19,9 @@ declare const getGetUserAccountQueryOptions: <TData = UserAccountDetail, TError
|
|
|
19
19
|
};
|
|
20
20
|
type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>;
|
|
21
21
|
type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
22
|
+
/**
|
|
23
|
+
* @summary Get information about your account
|
|
24
|
+
*/
|
|
22
25
|
declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<void | AsError>>(options?: {
|
|
23
26
|
query?: UseQueryOptions<UserAccountDetail, TError, TData, QueryKey> | undefined;
|
|
24
27
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -42,6 +45,9 @@ declare const getGetOrganisationUsersQueryOptions: <TData = UsersGetResponse, TE
|
|
|
42
45
|
};
|
|
43
46
|
type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>;
|
|
44
47
|
type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
48
|
+
/**
|
|
49
|
+
* @summary Gets users in an Organisation
|
|
50
|
+
*/
|
|
45
51
|
declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
46
52
|
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
47
53
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -68,6 +74,9 @@ declare const getAddOrganisationUserMutationOptions: <TError = ErrorType<AsError
|
|
|
68
74
|
}, TContext>;
|
|
69
75
|
type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>;
|
|
70
76
|
type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
77
|
+
/**
|
|
78
|
+
* @summary Adds a User to an Organisation
|
|
79
|
+
*/
|
|
71
80
|
declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
72
81
|
mutation?: UseMutationOptions<void, TError, {
|
|
73
82
|
orgId: string;
|
|
@@ -79,12 +88,12 @@ declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = u
|
|
|
79
88
|
userId: string;
|
|
80
89
|
}, TContext>;
|
|
81
90
|
/**
|
|
82
|
-
|
|
91
|
+
* Removes a User from an **Organisation**.
|
|
83
92
|
|
|
84
93
|
You have to be in the Organisation or an admin user to use this endpoint
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
* @summary Deletes a User from an Organisation
|
|
96
|
+
*/
|
|
88
97
|
declare const deleteOrganisationUser: (orgId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
89
98
|
declare const getDeleteOrganisationUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
90
99
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -98,6 +107,9 @@ declare const getDeleteOrganisationUserMutationOptions: <TError = ErrorType<AsEr
|
|
|
98
107
|
}, TContext>;
|
|
99
108
|
type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>;
|
|
100
109
|
type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
110
|
+
/**
|
|
111
|
+
* @summary Deletes a User from an Organisation
|
|
112
|
+
*/
|
|
101
113
|
declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
102
114
|
mutation?: UseMutationOptions<void, TError, {
|
|
103
115
|
orgId: string;
|
|
@@ -109,12 +121,12 @@ declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext
|
|
|
109
121
|
userId: string;
|
|
110
122
|
}, TContext>;
|
|
111
123
|
/**
|
|
112
|
-
|
|
124
|
+
* Gets users in an Organisational Unit.
|
|
113
125
|
|
|
114
126
|
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
* @summary Gets users in an Organisational Unit
|
|
129
|
+
*/
|
|
118
130
|
declare const getOrganisationUnitUsers: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal) => Promise<UsersGetResponse>;
|
|
119
131
|
declare const getGetOrganisationUnitUsersQueryKey: (unitId: string) => readonly ["account-server-api", `/unit/${string}/user`];
|
|
120
132
|
declare const getGetOrganisationUnitUsersQueryOptions: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
@@ -125,6 +137,9 @@ declare const getGetOrganisationUnitUsersQueryOptions: <TData = UsersGetResponse
|
|
|
125
137
|
};
|
|
126
138
|
type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>;
|
|
127
139
|
type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
140
|
+
/**
|
|
141
|
+
* @summary Gets users in an Organisational Unit
|
|
142
|
+
*/
|
|
128
143
|
declare const useGetOrganisationUnitUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
129
144
|
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
130
145
|
request?: SecondParameter<typeof customInstance>;
|
|
@@ -153,6 +168,9 @@ declare const getAddOrganisationUnitUserMutationOptions: <TError = ErrorType<AsE
|
|
|
153
168
|
}, TContext>;
|
|
154
169
|
type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>;
|
|
155
170
|
type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
171
|
+
/**
|
|
172
|
+
* @summary Adds a user to an Organisational Unit
|
|
173
|
+
*/
|
|
156
174
|
declare const useAddOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
157
175
|
mutation?: UseMutationOptions<void, TError, {
|
|
158
176
|
unitId: string;
|
|
@@ -164,14 +182,14 @@ declare const useAddOrganisationUnitUser: <TError = ErrorType<AsError>, TContext
|
|
|
164
182
|
userId: string;
|
|
165
183
|
}, TContext>;
|
|
166
184
|
/**
|
|
167
|
-
|
|
185
|
+
* Removes a User from an Organisational Unit.
|
|
168
186
|
|
|
169
187
|
Users cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).
|
|
170
188
|
|
|
171
189
|
You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
172
190
|
|
|
173
|
-
|
|
174
|
-
|
|
191
|
+
* @summary Deletes a User from an Organisational Unit
|
|
192
|
+
*/
|
|
175
193
|
declare const deleteOrganisationUnitUser: (unitId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
176
194
|
declare const getDeleteOrganisationUnitUserMutationOptions: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
177
195
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -185,6 +203,9 @@ declare const getDeleteOrganisationUnitUserMutationOptions: <TError = ErrorType<
|
|
|
185
203
|
}, TContext>;
|
|
186
204
|
type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>;
|
|
187
205
|
type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
206
|
+
/**
|
|
207
|
+
* @summary Deletes a User from an Organisational Unit
|
|
208
|
+
*/
|
|
188
209
|
declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
189
210
|
mutation?: UseMutationOptions<void, TError, {
|
|
190
211
|
unitId: string;
|
package/user/user.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
customInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-UKA7G3OB.js";
|
|
4
4
|
|
|
5
5
|
// src/user/user.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useMutation,
|
|
8
|
+
useQuery
|
|
9
|
+
} from "@tanstack/react-query";
|
|
7
10
|
var getUserAccount = (options, signal) => {
|
|
8
11
|
return customInstance(
|
|
9
|
-
{
|
|
12
|
+
{
|
|
13
|
+
url: `/user/account`,
|
|
14
|
+
method: "get",
|
|
15
|
+
signal
|
|
16
|
+
},
|
|
10
17
|
options
|
|
11
18
|
);
|
|
12
19
|
};
|
|
13
|
-
var getGetUserAccountQueryKey = () =>
|
|
20
|
+
var getGetUserAccountQueryKey = () => {
|
|
21
|
+
return ["account-server-api", `/user/account`];
|
|
22
|
+
};
|
|
14
23
|
var getGetUserAccountQueryOptions = (options) => {
|
|
15
24
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
16
25
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
|
|
17
|
-
const queryFn = ({
|
|
18
|
-
signal
|
|
19
|
-
}) => getUserAccount(requestOptions, signal);
|
|
26
|
+
const queryFn = ({ signal }) => getUserAccount(requestOptions, signal);
|
|
20
27
|
return { queryKey, queryFn, ...queryOptions };
|
|
21
28
|
};
|
|
22
29
|
var useGetUserAccount = (options) => {
|
|
@@ -27,11 +34,17 @@ var useGetUserAccount = (options) => {
|
|
|
27
34
|
};
|
|
28
35
|
var getOrganisationUsers = (orgId, options, signal) => {
|
|
29
36
|
return customInstance(
|
|
30
|
-
{
|
|
37
|
+
{
|
|
38
|
+
url: `/organisation/${orgId}/user`,
|
|
39
|
+
method: "get",
|
|
40
|
+
signal
|
|
41
|
+
},
|
|
31
42
|
options
|
|
32
43
|
);
|
|
33
44
|
};
|
|
34
|
-
var getGetOrganisationUsersQueryKey = (orgId) =>
|
|
45
|
+
var getGetOrganisationUsersQueryKey = (orgId) => {
|
|
46
|
+
return ["account-server-api", `/organisation/${orgId}/user`];
|
|
47
|
+
};
|
|
35
48
|
var getGetOrganisationUsersQueryOptions = (orgId, options) => {
|
|
36
49
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
37
50
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgId);
|
|
@@ -46,7 +59,10 @@ var useGetOrganisationUsers = (orgId, options) => {
|
|
|
46
59
|
};
|
|
47
60
|
var addOrganisationUser = (orgId, userId, options) => {
|
|
48
61
|
return customInstance(
|
|
49
|
-
{
|
|
62
|
+
{
|
|
63
|
+
url: `/organisation/${orgId}/user/${userId}`,
|
|
64
|
+
method: "put"
|
|
65
|
+
},
|
|
50
66
|
options
|
|
51
67
|
);
|
|
52
68
|
};
|
|
@@ -64,7 +80,10 @@ var useAddOrganisationUser = (options) => {
|
|
|
64
80
|
};
|
|
65
81
|
var deleteOrganisationUser = (orgId, userId, options) => {
|
|
66
82
|
return customInstance(
|
|
67
|
-
{
|
|
83
|
+
{
|
|
84
|
+
url: `/organisation/${orgId}/user/${userId}`,
|
|
85
|
+
method: "delete"
|
|
86
|
+
},
|
|
68
87
|
options
|
|
69
88
|
);
|
|
70
89
|
};
|
|
@@ -82,11 +101,17 @@ var useDeleteOrganisationUser = (options) => {
|
|
|
82
101
|
};
|
|
83
102
|
var getOrganisationUnitUsers = (unitId, options, signal) => {
|
|
84
103
|
return customInstance(
|
|
85
|
-
{
|
|
104
|
+
{
|
|
105
|
+
url: `/unit/${unitId}/user`,
|
|
106
|
+
method: "get",
|
|
107
|
+
signal
|
|
108
|
+
},
|
|
86
109
|
options
|
|
87
110
|
);
|
|
88
111
|
};
|
|
89
|
-
var getGetOrganisationUnitUsersQueryKey = (unitId) =>
|
|
112
|
+
var getGetOrganisationUnitUsersQueryKey = (unitId) => {
|
|
113
|
+
return ["account-server-api", `/unit/${unitId}/user`];
|
|
114
|
+
};
|
|
90
115
|
var getGetOrganisationUnitUsersQueryOptions = (unitId, options) => {
|
|
91
116
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
92
117
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
@@ -101,7 +126,10 @@ var useGetOrganisationUnitUsers = (unitId, options) => {
|
|
|
101
126
|
};
|
|
102
127
|
var addOrganisationUnitUser = (unitId, userId, options) => {
|
|
103
128
|
return customInstance(
|
|
104
|
-
{
|
|
129
|
+
{
|
|
130
|
+
url: `/unit/${unitId}/user/${userId}`,
|
|
131
|
+
method: "put"
|
|
132
|
+
},
|
|
105
133
|
options
|
|
106
134
|
);
|
|
107
135
|
};
|
|
@@ -119,7 +147,10 @@ var useAddOrganisationUnitUser = (options) => {
|
|
|
119
147
|
};
|
|
120
148
|
var deleteOrganisationUnitUser = (unitId, userId, options) => {
|
|
121
149
|
return customInstance(
|
|
122
|
-
{
|
|
150
|
+
{
|
|
151
|
+
url: `/unit/${unitId}/user/${userId}`,
|
|
152
|
+
method: "delete"
|
|
153
|
+
},
|
|
123
154
|
options
|
|
124
155
|
);
|
|
125
156
|
};
|
package/user/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.15.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport { useQuery, useMutation } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"@tanstack/react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\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 * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [\"account-server-api\", `/user/account`] as const;\n\nexport const getGetUserAccountQueryOptions = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({\n signal,\n }) => getUserAccount(requestOptions, signal);\n\n return { queryKey, queryFn, ...queryOptions };\n};\n\nexport type GetUserAccountQueryResult = NonNullable<\n Awaited<ReturnType<typeof getUserAccount>>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\n\nexport const useGetUserAccount = <\n TData = Awaited<ReturnType<typeof getUserAccount>>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getUserAccount>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetUserAccountQueryOptions(options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Gets Users in an Organisation.\n\nYou have to be a member of the Organisation or an admin user to use this endpoint\n\n * @summary Gets users in an Organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgId: string) =>\n [\"account-server-api\", `/organisation/${orgId}/user`] as const;\n\nexport const getGetOrganisationUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n > = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!orgId, ...queryOptions };\n};\n\nexport type GetOrganisationUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUsers>>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError = ErrorType<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUsersQueryOptions(orgId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Adds a User to an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Adds a User to an Organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport const getAddOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return addOrganisationUser(orgId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUser>>\n>;\n\nexport type AddOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes a User from an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Deletes a User from an Organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/organisation/${orgId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props ?? {};\n\n return deleteOrganisationUser(orgId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUser>>\n>;\n\nexport type DeleteOrganisationUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUser>>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit.\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitId}/user`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string) =>\n [\"account-server-api\", `/unit/${unitId}/user`] as const;\n\nexport const getGetOrganisationUnitUsersQueryOptions = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey =\n queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n > = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n return { queryKey, queryFn, enabled: !!unitId, ...queryOptions };\n};\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\n\nexport const useGetOrganisationUnitUsers = <\n TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError = ErrorType<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getOrganisationUnitUsers>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId, options);\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {\n queryKey: QueryKey;\n };\n\n query.queryKey = queryOptions.queryKey;\n\n return query;\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"put\" },\n options\n );\n};\n\nexport const getAddOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return addOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type AddOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>\n>;\n\nexport type AddOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof addOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n/**\n * Removes a User from an Organisational Unit.\n\nUsers cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a User from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/unit/${unitId}/user/${userId}`, method: \"delete\" },\n options\n );\n};\n\nexport const getDeleteOrganisationUnitUserMutationOptions = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}): UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n> => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props ?? {};\n\n return deleteOrganisationUnitUser(unitId, userId, requestOptions);\n };\n\n return { mutationFn, ...mutationOptions };\n};\n\nexport type DeleteOrganisationUnitUserMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>\n>;\n\nexport type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;\n\nexport const useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n};\n"],"mappings":";;;;;AAUA,SAAS,UAAU,mBAAmB;AA8B/B,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,sBAAsB,eAAe;AAE9E,IAAM,gCAAgC,CAG3C,YAW4B;AAC5B,QAAM,EAAE,OAAO,cAAc,SAAS,eAAe,IAAI,WAAW,CAAC;AAErE,QAAM,YAAW,6CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,EACF,MAAM,eAAe,gBAAgB,MAAM;AAE3C,SAAO,EAAE,UAAU,SAAS,GAAG,aAAa;AAC9C;AAOO,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,eAAe,8BAA8B,OAAO;AAE1D,QAAM,QAAQ,SAAS,YAAY;AAInC,QAAM,WAAW,aAAa;AAE9B,SAAO;AACT;AASO,IAAM,uBAAuB,CAClC,OACA,SACA,WACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,OA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AAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,wBAAwB,QAAQ,QAAQ,cAAc;AAAA,EAC/D;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,6BAA6B,CAGxC,YAQI;AACJ,QAAM,kBAAkB,0CAA0C,OAAO;AAEzE,SAAO,YAAY,eAAe;AACpC;AAUO,IAAM,6BAA6B,CACxC,QACA,QACA,YACG;AACH,SAAO;AAAA,IACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS;AAAA,IAC1D;AAAA,EACF;AACF;AAEO,IAAM,+CAA+C,CAG1D,YAaG;AACH,QAAM,EAAE,UAAU,iBAAiB,SAAS,eAAe,IAAI,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,OAAO,IAAI,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,EAAE,YAAY,GAAG,gBAAgB;AAC1C;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,kBAAkB,6CAA6C,OAAO;AAE5E,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.20.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 **Organisations**, **Units**, **Products**, **Users**, and **Assets**.\n\n * OpenAPI spec version: 2.1\n */\nimport {\n useMutation,\n useQuery\n} from '@tanstack/react-query'\nimport type {\n MutationFunction,\n QueryFunction,\n QueryKey,\n UseMutationOptions,\n UseQueryOptions,\n UseQueryResult\n} from '@tanstack/react-query'\nimport type {\n AsError,\n UserAccountDetail,\n UsersGetResponse\n} from '../account-server-api.schemas'\nimport { customInstance } from '.././custom-instance';\nimport type { ErrorType } from '.././custom-instance';\n\n\n// eslint-disable-next-line\n type SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P,\n) => any\n ? P\n : never;\n\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n \n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UserAccountDetail>(\n {url: `/user/account`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetUserAccountQueryKey = () => {\n \n return [\"account-server-api\", `/user/account`] as const;\n }\n\n \nexport const getGetUserAccountQueryOptions = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetUserAccountQueryKey();\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getUserAccount>>> = ({ signal }) => getUserAccount(requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>\nexport type GetUserAccountQueryError = ErrorType<void | AsError>\n\n/**\n * @summary Get information about your account\n */\nexport const useGetUserAccount = <TData = Awaited<ReturnType<typeof getUserAccount>>, TError = ErrorType<void | AsError>>(\n options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getUserAccount>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetUserAccountQueryOptions(options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Gets Users in an Organisation.\n\nYou have to be a member of the Organisation or an admin user to use this endpoint\n\n * @summary Gets users in an Organisation\n */\nexport const getOrganisationUsers = (\n orgId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UsersGetResponse>(\n {url: `/organisation/${orgId}/user`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUsersQueryKey = (orgId: string,) => {\n \n return [\"account-server-api\", `/organisation/${orgId}/user`] as const;\n }\n\n \nexport const getGetOrganisationUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUsersQueryKey(orgId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUsers>>> = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(orgId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisation\n */\nexport const useGetOrganisationUsers = <TData = Awaited<ReturnType<typeof getOrganisationUsers>>, TError = ErrorType<AsError | void>>(\n orgId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUsersQueryOptions(orgId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Adds a User to an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Adds a User to an Organisation\n */\nexport const addOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/organisation/${orgId}/user/${userId}`, method: 'put'\n },\n options);\n }\n \n\n\nexport const getAddOrganisationUserMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUser>>, {orgId: string;userId: string}> = (props) => {\n const {orgId,userId} = props ?? {};\n\n return addOrganisationUser(orgId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>\n \n export type AddOrganisationUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Adds a User to an Organisation\n */\nexport const useAddOrganisationUser = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAddOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Removes a User from an **Organisation**.\n\nYou have to be in the Organisation or an admin user to use this endpoint\n\n * @summary Deletes a User from an Organisation\n */\nexport const deleteOrganisationUser = (\n orgId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/organisation/${orgId}/user/${userId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteOrganisationUserMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUser>>, {orgId: string;userId: string}> = (props) => {\n const {orgId,userId} = props ?? {};\n\n return deleteOrganisationUser(orgId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>\n \n export type DeleteOrganisationUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes a User from an Organisation\n */\nexport const useDeleteOrganisationUser = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUser>>, TError,{orgId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteOrganisationUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Gets users in an Organisational Unit.\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Gets users in an Organisational Unit\n */\nexport const getOrganisationUnitUsers = (\n unitId: string,\n options?: SecondParameter<typeof customInstance>,signal?: AbortSignal\n) => {\n \n \n return customInstance<UsersGetResponse>(\n {url: `/unit/${unitId}/user`, method: 'get', signal\n },\n options);\n }\n \n\nexport const getGetOrganisationUnitUsersQueryKey = (unitId: string,) => {\n \n return [\"account-server-api\", `/unit/${unitId}/user`] as const;\n }\n\n \nexport const getGetOrganisationUnitUsersQueryOptions = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n) => {\n\nconst {query: queryOptions, request: requestOptions} = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetOrganisationUnitUsersQueryKey(unitId);\n\n \n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisationUnitUsers>>> = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);\n\n \n\n \n\n return { queryKey, queryFn, enabled: !!(unitId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData> & { queryKey: QueryKey }\n}\n\nexport type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>\n\n/**\n * @summary Gets users in an Organisational Unit\n */\nexport const useGetOrganisationUnitUsers = <TData = Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError = ErrorType<AsError | void>>(\n unitId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisationUnitUsers>>, TError, TData>, request?: SecondParameter<typeof customInstance>}\n\n ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n\n const queryOptions = getGetOrganisationUnitUsersQueryOptions(unitId,options)\n\n const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };\n\n query.queryKey = queryOptions.queryKey ;\n\n return query;\n}\n\n\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Adds a user to an Organisational Unit\n */\nexport const addOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/unit/${unitId}/user/${userId}`, method: 'put'\n },\n options);\n }\n \n\n\nexport const getAddOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof addOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {\n const {unitId,userId} = props ?? {};\n\n return addOrganisationUnitUser(unitId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>\n \n export type AddOrganisationUnitUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Adds a user to an Organisational Unit\n */\nexport const useAddOrganisationUnitUser = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getAddOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n /**\n * Removes a User from an Organisational Unit.\n\nUsers cannot be removed from **Personal Units** (Units that are part of the ***Default** Organisation).\n\nYou have to be in the Organisation or Unit or an Admin user to use this endpoint\n\n * @summary Deletes a User from an Organisational Unit\n */\nexport const deleteOrganisationUnitUser = (\n unitId: string,\n userId: string,\n options?: SecondParameter<typeof customInstance>,) => {\n \n \n return customInstance<void>(\n {url: `/unit/${unitId}/user/${userId}`, method: 'delete'\n },\n options);\n }\n \n\n\nexport const getDeleteOrganisationUnitUserMutationOptions = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n): UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext> => {\n const {mutation: mutationOptions, request: requestOptions} = options ?? {};\n\n \n\n\n const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, {unitId: string;userId: string}> = (props) => {\n const {unitId,userId} = props ?? {};\n\n return deleteOrganisationUnitUser(unitId,userId,requestOptions)\n }\n\n \n\n\n return { mutationFn, ...mutationOptions }}\n\n export type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>\n \n export type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>\n\n /**\n * @summary Deletes a User from an Organisational Unit\n */\nexport const useDeleteOrganisationUnitUser = <TError = ErrorType<AsError>,\n \n TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>, TError,{unitId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}\n) => {\n\n const mutationOptions = getDeleteOrganisationUnitUserMutationOptions(options);\n\n return useMutation(mutationOptions);\n }\n "],"mappings":";;;;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAgCA,IAAM,iBAAiB,CAE7B,SAAiD,WAC7C;AAGC,SAAO;AAAA,IACP;AAAA,MAAC,KAAK;AAAA,MAAiB,QAAQ;AAAA,MAAO;AAAA,IACxC;AAAA,IACE;AAAA,EAAO;AACT;AAGG,IAAM,4BAA4B,MAAM;AAE3C,SAAO,CAAC,sBAAsB,eAAe;AAC7C;AAGG,IAAM,gCAAgC,CAA0F,YAClI;AAEL,QAAM,EAAC,OAAO,cAAc,SAAS,eAAc,IAAI,WAAW,CAAC;AAEjE,QAAM,YAAY,6CAAc,aAAY,0BAA0B;AAIpE,QAAM,UAAqE,CAA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jE;AAKL,SAAQ,EAAE,YAAY,GAAG,gBAAgB;AAAC;AAStC,IAAM,gCAAgC,CAErB,YACnB;AAEC,QAAM,kBAAkB,6CAA6C,OAAO;AAE5E,SAAO,YAAY,eAAe;AACpC;","names":[]}
|
package/chunk-UZTHSGDT.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";AAUA,OAAO,WAA+C;AAE/C,IAAM,iBAAiB,MAAM,OAAO;AAOpC,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,eAAe,IAAI,UAAU;AACtE;AAMO,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AACpC;AAEO,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY,OAAO;AAExC,QAAM,UAAU,eAAe,EAAE,GAAG,QAAQ,GAAG,SAAS,aAAa,OAAO,MAAM,CAAC,EAAE;AAAA,IACnF,CAAC,EAAE,KAAK,MAAM;AAAA,EAChB;AAIA,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO,oCAAoC;AAAA,EACpD;AAEA,SAAO;AACT","sourcesContent":["/** Based off the example custom-instance from Orval docs\n * https://github.com/anymaniax/orval/blob/master/samples/react-app-with-react-query/src/api/mutator/custom-instance.ts\n *\n * See https://react-query.tanstack.com/guides/query-cancellation\n *\n * TODO: Considering using Fetch-API instead of axios. This instance will have to change. Could be\n * achieved without changing much using `redaxios`\n * Or use 'ky'\n */\n\nimport Axios, { AxiosError, AxiosRequestConfig } from 'axios';\n\nexport const AXIOS_INSTANCE = Axios.create();\n\n/**\n * Set the access token to be added as the `Authorization: Bearer 'token'` header\n * Useful for client only apps where a proxy API route isn't involved to securely add the access token\n * @param token access token\n */\nexport const setAuthToken = (token: string) => {\n AXIOS_INSTANCE.defaults.headers.common['Authorization'] = `Bearer ${token}`;\n};\n\n/**\n * Set the url to which request paths are added to.\n * @param baseUrl origin + subpath e.g. 'https://example.com/subpath' or '/subpath'\n */\nexport const setBaseUrl = (baseUrl: string) => {\n AXIOS_INSTANCE.defaults.baseURL = baseUrl;\n};\n\nexport const customInstance = <TReturn>(\n config: AxiosRequestConfig,\n options?: AxiosRequestConfig,\n): Promise<TReturn> => {\n const source = Axios.CancelToken.source();\n\n const promise = AXIOS_INSTANCE({ ...config, ...options, cancelToken: source.token }).then(\n ({ data }) => data,\n );\n\n // Promise doesn't have a cancel method but react-query requires this method to make cancellations general.\n // This can either be a any assertion or a @ts-ignore comment.\n (promise as any).cancel = () => {\n source.cancel('Query was cancelled by React Query');\n };\n\n return promise;\n};\n\nexport type ErrorType<TError> = AxiosError<TError>;\n"]}
|