@squonk/account-server-client 0.1.24-rc.1 → 0.1.27-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{custom-instance-4a108741.d.ts → account-server-api.schemas-e6c5f956.d.ts} +15 -20
- package/{chunk-JR7F532L.js → chunk-GWBPVOL2.js} +2 -23
- package/chunk-GWBPVOL2.js.map +1 -0
- package/chunk-N3RLW53G.cjs +25 -0
- package/chunk-N3RLW53G.cjs.map +1 -0
- package/index.cjs +21 -5
- package/index.cjs.map +1 -1
- package/index.d.ts +20 -2
- package/index.js +21 -5
- package/index.js.map +1 -1
- package/organisation/organisation.cjs +31 -31
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +37 -28
- package/organisation/organisation.js +38 -38
- package/organisation/organisation.js.map +1 -1
- package/package.json +14 -14
- package/product/product.cjs +64 -61
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +70 -40
- package/product/product.js +75 -72
- package/product/product.js.map +1 -1
- package/service/service.cjs +23 -21
- package/service/service.cjs.map +1 -1
- package/service/service.d.ts +19 -15
- package/service/service.js +26 -24
- package/service/service.js.map +1 -1
- package/src/account-server-api.schemas.ts +14 -1
- package/src/organisation/organisation.ts +86 -83
- package/src/product/product.ts +210 -145
- package/src/service/service.ts +64 -56
- package/src/state/state.ts +31 -32
- package/src/unit/unit.ts +170 -149
- package/src/user/user.ts +171 -160
- package/state/state.cjs +12 -12
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +12 -10
- package/state/state.js +13 -13
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +54 -58
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +64 -49
- package/unit/unit.js +67 -71
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +56 -56
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +69 -55
- package/user/user.js +69 -69
- package/user/user.js.map +1 -1
- package/chunk-3DXYUDZH.cjs +0 -46
- package/chunk-3DXYUDZH.cjs.map +0 -1
- package/chunk-JR7F532L.js.map +0 -1
package/user/user.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as react_query from 'react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
-
import {
|
|
4
|
-
import 'axios';
|
|
3
|
+
import { w as UserAccountGetResponse, N as AsError, e as UserAccountDetail, K as UsersGetResponse } from '../account-server-api.schemas-e6c5f956.js';
|
|
4
|
+
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
5
5
|
|
|
6
|
-
declare type
|
|
6
|
+
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a summary of your account
|
|
9
9
|
|
|
10
10
|
* @summary Get information about your account
|
|
11
11
|
*/
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
declare const appApiUserGetAccount: (options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UserAccountGetResponse>>;
|
|
13
|
+
declare const getAppApiUserGetAccountQueryKey: () => string[];
|
|
14
|
+
declare type AppApiUserGetAccountQueryResult = NonNullable<AsyncReturnType<typeof appApiUserGetAccount>>;
|
|
15
|
+
declare type AppApiUserGetAccountQueryError = AxiosError<void | AsError>;
|
|
16
|
+
declare const useAppApiUserGetAccount: <TData = AxiosResponse<UserAccountDetail, any>, TError = AxiosError<void | AsError, any>>(options?: {
|
|
17
|
+
query?: UseQueryOptions<AxiosResponse<UserAccountDetail, any>, TError, TData, QueryKey> | undefined;
|
|
18
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
17
19
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
18
20
|
queryKey: QueryKey;
|
|
19
21
|
};
|
|
@@ -22,11 +24,13 @@ declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<
|
|
|
22
24
|
|
|
23
25
|
* @summary Gets users in an organisation
|
|
24
26
|
*/
|
|
25
|
-
declare const
|
|
26
|
-
declare const
|
|
27
|
-
declare
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
declare const appApiUserOrgGetUsers: (orgId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UsersGetResponse>>;
|
|
28
|
+
declare const getAppApiUserOrgGetUsersQueryKey: (orgId: string) => string[];
|
|
29
|
+
declare type AppApiUserOrgGetUsersQueryResult = NonNullable<AsyncReturnType<typeof appApiUserOrgGetUsers>>;
|
|
30
|
+
declare type AppApiUserOrgGetUsersQueryError = AxiosError<AsError | void>;
|
|
31
|
+
declare const useAppApiUserOrgGetUsers: <TData = AxiosResponse<UsersGetResponse, any>, TError = AxiosError<void | AsError, any>>(orgId: string, options?: {
|
|
32
|
+
query?: UseQueryOptions<AxiosResponse<UsersGetResponse, any>, TError, TData, QueryKey> | undefined;
|
|
33
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
30
34
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
31
35
|
queryKey: QueryKey;
|
|
32
36
|
};
|
|
@@ -35,43 +39,49 @@ declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = Error
|
|
|
35
39
|
|
|
36
40
|
* @summary Adds a user to an organisation
|
|
37
41
|
*/
|
|
38
|
-
declare const
|
|
39
|
-
declare
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
declare const appApiUserOrgUserPut: (orgId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
43
|
+
declare type AppApiUserOrgUserPutMutationResult = NonNullable<AsyncReturnType<typeof appApiUserOrgUserPut>>;
|
|
44
|
+
declare type AppApiUserOrgUserPutMutationError = AxiosError<AsError>;
|
|
45
|
+
declare const useAppApiUserOrgUserPut: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
46
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
47
|
+
orgId: string;
|
|
48
|
+
userId: string;
|
|
43
49
|
}, TContext> | undefined;
|
|
44
|
-
|
|
45
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
51
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
52
|
+
orgId: string;
|
|
53
|
+
userId: string;
|
|
48
54
|
}, TContext>;
|
|
49
55
|
/**
|
|
50
56
|
* Removes a user from an organisation. You have to be in the Organisation or an Admin user to use this endpoint
|
|
51
57
|
|
|
52
58
|
* @summary Deletes a user from an organisation
|
|
53
59
|
*/
|
|
54
|
-
declare const
|
|
55
|
-
declare
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
declare const appApiUserOrgUserDelete: (orgId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
61
|
+
declare type AppApiUserOrgUserDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiUserOrgUserDelete>>;
|
|
62
|
+
declare type AppApiUserOrgUserDeleteMutationError = AxiosError<AsError>;
|
|
63
|
+
declare const useAppApiUserOrgUserDelete: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
64
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
65
|
+
orgId: string;
|
|
66
|
+
userId: string;
|
|
59
67
|
}, TContext> | undefined;
|
|
60
|
-
|
|
61
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
69
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
70
|
+
orgId: string;
|
|
71
|
+
userId: string;
|
|
64
72
|
}, TContext>;
|
|
65
73
|
/**
|
|
66
74
|
* Gets users in an Organisational Unit. You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
67
75
|
|
|
68
76
|
* @summary Gets users in an Organisational Unit
|
|
69
77
|
*/
|
|
70
|
-
declare const
|
|
71
|
-
declare const
|
|
72
|
-
declare
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
declare const appApiUserGetUnitUsers: (unitId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<UsersGetResponse>>;
|
|
79
|
+
declare const getAppApiUserGetUnitUsersQueryKey: (unitId: string) => string[];
|
|
80
|
+
declare type AppApiUserGetUnitUsersQueryResult = NonNullable<AsyncReturnType<typeof appApiUserGetUnitUsers>>;
|
|
81
|
+
declare type AppApiUserGetUnitUsersQueryError = AxiosError<AsError | void>;
|
|
82
|
+
declare const useAppApiUserGetUnitUsers: <TData = AxiosResponse<UsersGetResponse, any>, TError = AxiosError<void | AsError, any>>(unitId: string, options?: {
|
|
83
|
+
query?: UseQueryOptions<AxiosResponse<UsersGetResponse, any>, TError, TData, QueryKey> | undefined;
|
|
84
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
75
85
|
} | undefined) => UseQueryResult<TData, TError> & {
|
|
76
86
|
queryKey: QueryKey;
|
|
77
87
|
};
|
|
@@ -84,16 +94,18 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
84
94
|
|
|
85
95
|
* @summary Adds a user to an Organisational Unit
|
|
86
96
|
*/
|
|
87
|
-
declare const
|
|
88
|
-
declare
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
declare const appApiUserUnitUserPut: (unitId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
98
|
+
declare type AppApiUserUnitUserPutMutationResult = NonNullable<AsyncReturnType<typeof appApiUserUnitUserPut>>;
|
|
99
|
+
declare type AppApiUserUnitUserPutMutationError = AxiosError<AsError>;
|
|
100
|
+
declare const useAppApiUserUnitUserPut: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
101
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
102
|
+
unitId: string;
|
|
103
|
+
userId: string;
|
|
92
104
|
}, TContext> | undefined;
|
|
93
|
-
|
|
94
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
106
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
107
|
+
unitId: string;
|
|
108
|
+
userId: string;
|
|
97
109
|
}, TContext>;
|
|
98
110
|
/**
|
|
99
111
|
* Removes a user from an Organisational Unit.
|
|
@@ -104,16 +116,18 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
104
116
|
|
|
105
117
|
* @summary Deletes a user from an Organisational Unit
|
|
106
118
|
*/
|
|
107
|
-
declare const
|
|
108
|
-
declare
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
declare const appApiUserUnitUserDelete: (unitId: string, userId: string, options?: AxiosRequestConfig<any> | undefined) => Promise<AxiosResponse<void>>;
|
|
120
|
+
declare type AppApiUserUnitUserDeleteMutationResult = NonNullable<AsyncReturnType<typeof appApiUserUnitUserDelete>>;
|
|
121
|
+
declare type AppApiUserUnitUserDeleteMutationError = AxiosError<AsError>;
|
|
122
|
+
declare const useAppApiUserUnitUserDelete: <TError = AxiosError<AsError, any>, TContext = unknown>(options?: {
|
|
123
|
+
mutation?: UseMutationOptions<AxiosResponse<void, any>, TError, {
|
|
124
|
+
unitId: string;
|
|
125
|
+
userId: string;
|
|
112
126
|
}, TContext> | undefined;
|
|
113
|
-
|
|
114
|
-
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
axios?: AxiosRequestConfig<any> | undefined;
|
|
128
|
+
} | undefined) => react_query.UseMutationResult<AxiosResponse<void, any>, TError, {
|
|
129
|
+
unitId: string;
|
|
130
|
+
userId: string;
|
|
117
131
|
}, TContext>;
|
|
118
132
|
|
|
119
|
-
export {
|
|
133
|
+
export { AppApiUserGetAccountQueryError, AppApiUserGetAccountQueryResult, AppApiUserGetUnitUsersQueryError, AppApiUserGetUnitUsersQueryResult, AppApiUserOrgGetUsersQueryError, AppApiUserOrgGetUsersQueryResult, AppApiUserOrgUserDeleteMutationError, AppApiUserOrgUserDeleteMutationResult, AppApiUserOrgUserPutMutationError, AppApiUserOrgUserPutMutationResult, AppApiUserUnitUserDeleteMutationError, AppApiUserUnitUserDeleteMutationResult, AppApiUserUnitUserPutMutationError, AppApiUserUnitUserPutMutationResult, appApiUserGetAccount, appApiUserGetUnitUsers, appApiUserOrgGetUsers, appApiUserOrgUserDelete, appApiUserOrgUserPut, appApiUserUnitUserDelete, appApiUserUnitUserPut, getAppApiUserGetAccountQueryKey, getAppApiUserGetUnitUsersQueryKey, getAppApiUserOrgGetUsersQueryKey, useAppApiUserGetAccount, useAppApiUserGetUnitUsers, useAppApiUserOrgGetUsers, useAppApiUserOrgUserDelete, useAppApiUserOrgUserPut, useAppApiUserUnitUserDelete, useAppApiUserUnitUserPut };
|
package/user/user.js
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
|
|
4
|
-
} from "../chunk-JR7F532L.js";
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../chunk-GWBPVOL2.js";
|
|
5
4
|
|
|
6
5
|
// src/user/user.ts
|
|
6
|
+
import axios from "axios";
|
|
7
7
|
import {
|
|
8
8
|
useQuery,
|
|
9
9
|
useMutation
|
|
10
10
|
} from "react-query";
|
|
11
|
-
var
|
|
12
|
-
return
|
|
11
|
+
var appApiUserGetAccount = (options) => {
|
|
12
|
+
return axios.get(`/user/account`, options);
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
const { query: queryOptions,
|
|
17
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
18
|
-
const queryFn = () =>
|
|
14
|
+
var getAppApiUserGetAccountQueryKey = () => [`/user/account`];
|
|
15
|
+
var useAppApiUserGetAccount = (options) => {
|
|
16
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
17
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiUserGetAccountQueryKey();
|
|
18
|
+
const queryFn = () => appApiUserGetAccount(axiosOptions);
|
|
19
19
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
20
|
return __spreadValues({
|
|
21
21
|
queryKey
|
|
22
22
|
}, query);
|
|
23
23
|
};
|
|
24
|
-
var
|
|
25
|
-
return
|
|
24
|
+
var appApiUserOrgGetUsers = (orgId, options) => {
|
|
25
|
+
return axios.get(`/organisation/${orgId}/user`, options);
|
|
26
26
|
};
|
|
27
|
-
var
|
|
28
|
-
`/organisation/${
|
|
27
|
+
var getAppApiUserOrgGetUsersQueryKey = (orgId) => [
|
|
28
|
+
`/organisation/${orgId}/user`
|
|
29
29
|
];
|
|
30
|
-
var
|
|
31
|
-
const { query: queryOptions,
|
|
32
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
33
|
-
const queryFn = () =>
|
|
34
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!
|
|
30
|
+
var useAppApiUserOrgGetUsers = (orgId, options) => {
|
|
31
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
32
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiUserOrgGetUsersQueryKey(orgId);
|
|
33
|
+
const queryFn = () => appApiUserOrgGetUsers(orgId, axiosOptions);
|
|
34
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
|
|
35
35
|
return __spreadValues({
|
|
36
36
|
queryKey
|
|
37
37
|
}, query);
|
|
38
38
|
};
|
|
39
|
-
var
|
|
40
|
-
return
|
|
39
|
+
var appApiUserOrgUserPut = (orgId, userId, options) => {
|
|
40
|
+
return axios.put(`/organisation/${orgId}/user/${userId}`, void 0, options);
|
|
41
41
|
};
|
|
42
|
-
var
|
|
43
|
-
const { mutation: mutationOptions,
|
|
42
|
+
var useAppApiUserOrgUserPut = (options) => {
|
|
43
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
44
44
|
const mutationFn = (props) => {
|
|
45
|
-
const {
|
|
46
|
-
return
|
|
45
|
+
const { orgId, userId } = props || {};
|
|
46
|
+
return appApiUserOrgUserPut(orgId, userId, axiosOptions);
|
|
47
47
|
};
|
|
48
48
|
return useMutation(mutationFn, mutationOptions);
|
|
49
49
|
};
|
|
50
|
-
var
|
|
51
|
-
return
|
|
50
|
+
var appApiUserOrgUserDelete = (orgId, userId, options) => {
|
|
51
|
+
return axios.delete(`/organisation/${orgId}/user/${userId}`, options);
|
|
52
52
|
};
|
|
53
|
-
var
|
|
54
|
-
const { mutation: mutationOptions,
|
|
53
|
+
var useAppApiUserOrgUserDelete = (options) => {
|
|
54
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
55
55
|
const mutationFn = (props) => {
|
|
56
|
-
const {
|
|
57
|
-
return
|
|
56
|
+
const { orgId, userId } = props || {};
|
|
57
|
+
return appApiUserOrgUserDelete(orgId, userId, axiosOptions);
|
|
58
58
|
};
|
|
59
59
|
return useMutation(mutationFn, mutationOptions);
|
|
60
60
|
};
|
|
61
|
-
var
|
|
62
|
-
return
|
|
61
|
+
var appApiUserGetUnitUsers = (unitId, options) => {
|
|
62
|
+
return axios.get(`/unit/${unitId}/user`, options);
|
|
63
63
|
};
|
|
64
|
-
var
|
|
65
|
-
`/unit/${
|
|
64
|
+
var getAppApiUserGetUnitUsersQueryKey = (unitId) => [
|
|
65
|
+
`/unit/${unitId}/user`
|
|
66
66
|
];
|
|
67
|
-
var
|
|
68
|
-
const { query: queryOptions,
|
|
69
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ??
|
|
70
|
-
const queryFn = () =>
|
|
71
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!
|
|
67
|
+
var useAppApiUserGetUnitUsers = (unitId, options) => {
|
|
68
|
+
const { query: queryOptions, axios: axiosOptions } = options || {};
|
|
69
|
+
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getAppApiUserGetUnitUsersQueryKey(unitId);
|
|
70
|
+
const queryFn = () => appApiUserGetUnitUsers(unitId, axiosOptions);
|
|
71
|
+
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
|
|
72
72
|
return __spreadValues({
|
|
73
73
|
queryKey
|
|
74
74
|
}, query);
|
|
75
75
|
};
|
|
76
|
-
var
|
|
77
|
-
return
|
|
76
|
+
var appApiUserUnitUserPut = (unitId, userId, options) => {
|
|
77
|
+
return axios.put(`/unit/${unitId}/user/${userId}`, void 0, options);
|
|
78
78
|
};
|
|
79
|
-
var
|
|
80
|
-
const { mutation: mutationOptions,
|
|
79
|
+
var useAppApiUserUnitUserPut = (options) => {
|
|
80
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
81
81
|
const mutationFn = (props) => {
|
|
82
|
-
const {
|
|
83
|
-
return
|
|
82
|
+
const { unitId, userId } = props || {};
|
|
83
|
+
return appApiUserUnitUserPut(unitId, userId, axiosOptions);
|
|
84
84
|
};
|
|
85
85
|
return useMutation(mutationFn, mutationOptions);
|
|
86
86
|
};
|
|
87
|
-
var
|
|
88
|
-
return
|
|
87
|
+
var appApiUserUnitUserDelete = (unitId, userId, options) => {
|
|
88
|
+
return axios.delete(`/unit/${unitId}/user/${userId}`, options);
|
|
89
89
|
};
|
|
90
|
-
var
|
|
91
|
-
const { mutation: mutationOptions,
|
|
90
|
+
var useAppApiUserUnitUserDelete = (options) => {
|
|
91
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options || {};
|
|
92
92
|
const mutationFn = (props) => {
|
|
93
|
-
const {
|
|
94
|
-
return
|
|
93
|
+
const { unitId, userId } = props || {};
|
|
94
|
+
return appApiUserUnitUserDelete(unitId, userId, axiosOptions);
|
|
95
95
|
};
|
|
96
96
|
return useMutation(mutationFn, mutationOptions);
|
|
97
97
|
};
|
|
98
98
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
99
|
+
appApiUserGetAccount,
|
|
100
|
+
appApiUserGetUnitUsers,
|
|
101
|
+
appApiUserOrgGetUsers,
|
|
102
|
+
appApiUserOrgUserDelete,
|
|
103
|
+
appApiUserOrgUserPut,
|
|
104
|
+
appApiUserUnitUserDelete,
|
|
105
|
+
appApiUserUnitUserPut,
|
|
106
|
+
getAppApiUserGetAccountQueryKey,
|
|
107
|
+
getAppApiUserGetUnitUsersQueryKey,
|
|
108
|
+
getAppApiUserOrgGetUsersQueryKey,
|
|
109
|
+
useAppApiUserGetAccount,
|
|
110
|
+
useAppApiUserGetUnitUsers,
|
|
111
|
+
useAppApiUserOrgGetUsers,
|
|
112
|
+
useAppApiUserOrgUserDelete,
|
|
113
|
+
useAppApiUserOrgUserPut,
|
|
114
|
+
useAppApiUserUnitUserDelete,
|
|
115
|
+
useAppApiUserUnitUserPut
|
|
116
116
|
};
|
|
117
117
|
//# sourceMappingURL=user.js.map
|
package/user/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const getUserAccount = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<UserAccountGetResponse>(\n { url: `/user/account`, method: \"get\" },\n options\n );\n};\n\nexport const getGetUserAccountQueryKey = () => [`/user/account`];\n\nexport const useGetUserAccount = <\n TData = AsyncReturnType<typeof getUserAccount>,\n TError = ErrorType<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getUserAccount>,\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 ?? getGetUserAccountQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getUserAccount>> = () =>\n getUserAccount(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getUserAccount>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in 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) => {\n return customInstance<UsersGetResponse>(\n { url: `/organisation/${orgid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUsersQueryKey = (orgid: string) => [\n `/organisation/${orgid}/user`,\n];\n\nexport const useGetOrganisationUsers = <\n TData = AsyncReturnType<typeof getOrganisationUsers>,\n TError = ErrorType<AsError | void>\n>(\n orgid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUsers>,\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 ?? getGetOrganisationUsersQueryKey(orgid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUsers>\n > = () => getOrganisationUsers(orgid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You 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 useAddOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return addOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You 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 useDeleteOrganisationUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUser>,\n { orgid: string; userid: string }\n > = (props) => {\n const { orgid, userid } = props || {};\n\n return deleteOrganisationUser(orgid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUser>,\n TError,\n { orgid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You 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) => {\n return customInstance<UsersGetResponse>(\n { url: `/unit/${unitid}/user`, method: \"get\" },\n options\n );\n};\n\nexport const getGetOrganisationUnitUsersQueryKey = (unitid: string) => [\n `/unit/${unitid}/user`,\n];\n\nexport const useGetOrganisationUnitUsers = <\n TData = AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError = ErrorType<AsError | void>\n>(\n unitid: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\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 ?? getGetOrganisationUnitUsersQueryKey(unitid);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n > = () => getOrganisationUnitUsers(unitid, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getOrganisationUnitUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitid, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent 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 useAddOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return addOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent 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 useDeleteOrganisationUnitUser = <\n TError = ErrorType<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n { unitid: string; userid: string }\n > = (props) => {\n const { unitid, userid } = props || {};\n\n return deleteOrganisationUnitUser(unitid, userid, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof deleteOrganisationUnitUser>,\n TError,\n { unitid: string; userid: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAqCO,IAAM,iBAAiB,CAC5B,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,SAChC;AAAA;AAIG,IAAM,4BAA4B,MAAM,CAAC;AAEzC,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY;AAE3C,QAAM,UAAiE,MACrE,eAAe;AAEjB,QAAM,QAAQ,SACZ,UACA,SACA;AAGF,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AASA,IAAM,uBAAuB,CAClC,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,cAAc,QAAQ,SAC9C;AAAA;AAIG,IAAM,kCAAkC,CAAC,UAAkB;AAAA,EAChE,iBAAiB;AAAA;AAGZ,IAAM,0BAA0B,CAIrC,OACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WACJ,8CAAc,aAAY,gCAAgC;AAE5D,QAAM,UAEF,MAAM,qBAAqB,OAAO;AAE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B,CACrC,QACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SACjD;AAAA;AAIG,IAAM,6BAA6B,CAGxC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS;AAEpC,WAAO,wBAAwB,QAAQ,QAAQ;AAAA;AAGjD,SAAO,YAKL,YAAY;AAAA;AAWT,IAAM,6BAA6B,CACxC,QACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,YACjD;AAAA;AAIG,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS;AAEpC,WAAO,2BAA2B,QAAQ,QAAQ;AAAA;AAGpD,SAAO,YAKL,YAAY;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from \"axios\";\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n/**\n * Returns a summary of your account\n\n * @summary Get information about your account\n */\nexport const appApiUserGetAccount = (\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UserAccountGetResponse>> => {\n return axios.get(`/user/account`, options);\n};\n\nexport const getAppApiUserGetAccountQueryKey = () => [`/user/account`];\n\nexport type AppApiUserGetAccountQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUserGetAccount>\n>;\nexport type AppApiUserGetAccountQueryError = AxiosError<void | AsError>;\n\nexport const useAppApiUserGetAccount = <\n TData = AsyncReturnType<typeof appApiUserGetAccount>,\n TError = AxiosError<void | AsError>\n>(options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiUserGetAccount>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getAppApiUserGetAccountQueryKey();\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiUserGetAccount>\n > = () => appApiUserGetAccount(axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiUserGetAccount>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets users in an Organisation. You have to be in the Organisation or an Admin user to use this endpoint\n\n * @summary Gets users in an organisation\n */\nexport const appApiUserOrgGetUsers = (\n orgId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UsersGetResponse>> => {\n return axios.get(`/organisation/${orgId}/user`, options);\n};\n\nexport const getAppApiUserOrgGetUsersQueryKey = (orgId: string) => [\n `/organisation/${orgId}/user`,\n];\n\nexport type AppApiUserOrgGetUsersQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUserOrgGetUsers>\n>;\nexport type AppApiUserOrgGetUsersQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiUserOrgGetUsers = <\n TData = AsyncReturnType<typeof appApiUserOrgGetUsers>,\n TError = AxiosError<AsError | void>\n>(\n orgId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiUserOrgGetUsers>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiUserOrgGetUsersQueryKey(orgId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiUserOrgGetUsers>\n > = () => appApiUserOrgGetUsers(orgId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiUserOrgGetUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!orgId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an organisation. You 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 appApiUserOrgUserPut = (\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.put(`/organisation/${orgId}/user/${userId}`, undefined, options);\n};\n\nexport type AppApiUserOrgUserPutMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUserOrgUserPut>\n>;\n\nexport type AppApiUserOrgUserPutMutationError = AxiosError<AsError>;\n\nexport const useAppApiUserOrgUserPut = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUserOrgUserPut>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUserOrgUserPut>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props || {};\n\n return appApiUserOrgUserPut(orgId, userId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUserOrgUserPut>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an organisation. You 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 appApiUserOrgUserDelete = (\n orgId: string,\n userId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/organisation/${orgId}/user/${userId}`, options);\n};\n\nexport type AppApiUserOrgUserDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUserOrgUserDelete>\n>;\n\nexport type AppApiUserOrgUserDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiUserOrgUserDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUserOrgUserDelete>,\n TError,\n { orgId: string; userId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUserOrgUserDelete>,\n { orgId: string; userId: string }\n > = (props) => {\n const { orgId, userId } = props || {};\n\n return appApiUserOrgUserDelete(orgId, userId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUserOrgUserDelete>,\n TError,\n { orgId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Gets users in an Organisational Unit. You 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 appApiUserGetUnitUsers = (\n unitId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<UsersGetResponse>> => {\n return axios.get(`/unit/${unitId}/user`, options);\n};\n\nexport const getAppApiUserGetUnitUsersQueryKey = (unitId: string) => [\n `/unit/${unitId}/user`,\n];\n\nexport type AppApiUserGetUnitUsersQueryResult = NonNullable<\n AsyncReturnType<typeof appApiUserGetUnitUsers>\n>;\nexport type AppApiUserGetUnitUsersQueryError = AxiosError<AsError | void>;\n\nexport const useAppApiUserGetUnitUsers = <\n TData = AsyncReturnType<typeof appApiUserGetUnitUsers>,\n TError = AxiosError<AsError | void>\n>(\n unitId: string,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof appApiUserGetUnitUsers>,\n TError,\n TData\n >;\n axios?: AxiosRequestConfig;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, axios: axiosOptions } = options || {};\n\n const queryKey =\n queryOptions?.queryKey ?? getAppApiUserGetUnitUsersQueryKey(unitId);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof appApiUserGetUnitUsers>\n > = () => appApiUserGetUnitUsers(unitId, axiosOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof appApiUserGetUnitUsers>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!unitId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Adds a user to an Organisational Unit.\n\nUsers cannot be added to **Independent 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 appApiUserUnitUserPut = (\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.put(`/unit/${unitId}/user/${userId}`, undefined, options);\n};\n\nexport type AppApiUserUnitUserPutMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUserUnitUserPut>\n>;\n\nexport type AppApiUserUnitUserPutMutationError = AxiosError<AsError>;\n\nexport const useAppApiUserUnitUserPut = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUserUnitUserPut>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUserUnitUserPut>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props || {};\n\n return appApiUserUnitUserPut(unitId, userId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUserUnitUserPut>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Removes a user from an Organisational Unit.\n\nUsers cannot be removed from **Independent 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 appApiUserUnitUserDelete = (\n unitId: string,\n userId: string,\n options?: AxiosRequestConfig\n): Promise<AxiosResponse<void>> => {\n return axios.delete(`/unit/${unitId}/user/${userId}`, options);\n};\n\nexport type AppApiUserUnitUserDeleteMutationResult = NonNullable<\n AsyncReturnType<typeof appApiUserUnitUserDelete>\n>;\n\nexport type AppApiUserUnitUserDeleteMutationError = AxiosError<AsError>;\n\nexport const useAppApiUserUnitUserDelete = <\n TError = AxiosError<AsError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof appApiUserUnitUserDelete>,\n TError,\n { unitId: string; userId: string },\n TContext\n >;\n axios?: AxiosRequestConfig;\n}) => {\n const { mutation: mutationOptions, axios: axiosOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof appApiUserUnitUserDelete>,\n { unitId: string; userId: string }\n > = (props) => {\n const { unitId, userId } = props || {};\n\n return appApiUserUnitUserDelete(unitId, userId, axiosOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof appApiUserUnitUserDelete>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;AAUA;AACA;AAAA;AAAA;AAAA;AA4BO,IAAM,uBAAuB,CAClC,YACmD;AACnD,SAAO,MAAM,IAAI,iBAAiB,OAAO;AAC3C;AAEO,IAAM,kCAAkC,MAAM,CAAC,eAAe;AAO9D,IAAM,0BAA0B,CAGrC,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,OAAO,iB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AAQ,YAAY;AAAA,EAC9D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
package/chunk-3DXYUDZH.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
|
-
// src/custom-instance.ts
|
|
22
|
-
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
23
|
-
var AXIOS_INSTANCE = _axios2.default.create();
|
|
24
|
-
var setAuthToken = (token) => {
|
|
25
|
-
AXIOS_INSTANCE.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
26
|
-
};
|
|
27
|
-
var setBaseUrl = (baseUrl) => {
|
|
28
|
-
AXIOS_INSTANCE.defaults.baseURL = baseUrl;
|
|
29
|
-
};
|
|
30
|
-
var customInstance = (config, options) => {
|
|
31
|
-
const source = _axios2.default.CancelToken.source();
|
|
32
|
-
const promise = AXIOS_INSTANCE(__spreadProps(__spreadValues(__spreadValues({}, config), options), { cancelToken: source.token })).then(({ data }) => data);
|
|
33
|
-
promise.cancel = () => {
|
|
34
|
-
source.cancel("Query was cancelled by React Query");
|
|
35
|
-
};
|
|
36
|
-
return promise;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.__spreadValues = __spreadValues; exports.AXIOS_INSTANCE = AXIOS_INSTANCE; exports.setAuthToken = setAuthToken; exports.setBaseUrl = setBaseUrl; exports.customInstance = customInstance;
|
|
46
|
-
//# sourceMappingURL=chunk-3DXYUDZH.cjs.map
|
package/chunk-3DXYUDZH.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM;AAO7B,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA","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"]}
|
package/chunk-JR7F532L.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/custom-instance.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA;AAEO,IAAM,iBAAiB,MAAM;AAO7B,IAAM,eAAe,CAAC,UAAkB;AAC7C,iBAAe,SAAS,QAAQ,OAAO,mBAAmB,UAAU;AAAA;AAO/D,IAAM,aAAa,CAAC,YAAoB;AAC7C,iBAAe,SAAS,UAAU;AAAA;AAG7B,IAAM,iBAAiB,CAC5B,QACA,YACqB;AACrB,QAAM,SAAS,MAAM,YAAY;AAEjC,QAAM,UAAU,eAAe,gDAAK,SAAW,UAAhB,EAAyB,aAAa,OAAO,UAAS,KACnF,CAAC,EAAE,WAAW;AAKhB,EAAC,QAAgB,SAAS,MAAM;AAC9B,WAAO,OAAO;AAAA;AAGhB,SAAO;AAAA;","names":[]}
|