@squonk/account-server-client 1.0.2 → 1.0.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/asset/asset.cjs +34 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +16 -16
- package/asset/asset.js +35 -19
- package/asset/asset.js.map +1 -1
- package/{custom-instance-e2d92e5c.d.ts → custom-instance-93fb01eb.d.ts} +17 -17
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +15 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +1 -1
- package/merchant/merchant.js +16 -14
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +18 -6
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +7 -7
- package/organisation/organisation.js +19 -7
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +47 -38
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +10 -10
- package/product/product.js +48 -39
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +68 -84
- package/src/asset/asset.ts +248 -345
- package/src/merchant/merchant.ts +62 -84
- package/src/organisation/organisation.ts +131 -184
- package/src/product/product.ts +279 -422
- package/src/state/state.ts +36 -42
- package/src/unit/unit.ts +218 -301
- package/src/user/user.ts +224 -327
- package/state/state.cjs +9 -9
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +1 -1
- package/state/state.js +10 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +40 -25
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +10 -10
- package/unit/unit.js +41 -26
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +38 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +10 -10
- package/user/user.js +39 -21
- package/user/user.js.map +1 -1
package/src/merchant/merchant.ts
CHANGED
|
@@ -8,25 +8,28 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery
|
|
13
|
+
} from 'react-query'
|
|
12
14
|
import type {
|
|
13
15
|
UseQueryOptions,
|
|
14
16
|
QueryFunction,
|
|
15
17
|
UseQueryResult,
|
|
16
|
-
QueryKey
|
|
17
|
-
} from
|
|
18
|
+
QueryKey
|
|
19
|
+
} from 'react-query'
|
|
18
20
|
import type {
|
|
19
21
|
MerchantsGetResponse,
|
|
20
22
|
AsError,
|
|
21
|
-
MerchantGetResponse
|
|
22
|
-
} from
|
|
23
|
-
import { customInstance } from
|
|
24
|
-
import type { ErrorType } from
|
|
23
|
+
MerchantGetResponse
|
|
24
|
+
} from '../account-server-api.schemas'
|
|
25
|
+
import { customInstance } from '.././custom-instance'
|
|
26
|
+
import type { ErrorType } from '.././custom-instance'
|
|
27
|
+
|
|
25
28
|
|
|
26
29
|
// eslint-disable-next-line
|
|
27
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
30
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
28
31
|
config: any,
|
|
29
|
-
args: infer P
|
|
32
|
+
args: infer P,
|
|
30
33
|
) => any
|
|
31
34
|
? P
|
|
32
35
|
: never;
|
|
@@ -37,53 +40,41 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
37
40
|
* @summary Gets all Merchants
|
|
38
41
|
*/
|
|
39
42
|
export const getMerchants = (
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
|
|
44
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
42
45
|
) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
46
|
+
return customInstance<MerchantsGetResponse>(
|
|
47
|
+
{url: `/merchant`, method: 'get', signal
|
|
48
|
+
},
|
|
49
|
+
options);
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
|
|
49
53
|
export const getGetMerchantsQueryKey = () => [`/merchant`];
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
TError
|
|
59
|
-
|
|
60
|
-
query
|
|
61
|
-
Awaited<ReturnType<typeof getMerchants>>,
|
|
62
|
-
TError,
|
|
63
|
-
TData
|
|
64
|
-
>;
|
|
65
|
-
request?: SecondParameter<typeof customInstance>;
|
|
66
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
67
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
55
|
+
|
|
56
|
+
export type GetMerchantsQueryResult = NonNullable<Awaited<ReturnType<typeof getMerchants>>>
|
|
57
|
+
export type GetMerchantsQueryError = ErrorType<AsError | void>
|
|
58
|
+
|
|
59
|
+
export const useGetMerchants = <TData = Awaited<ReturnType<typeof getMerchants>>, TError = ErrorType<AsError | void>>(
|
|
60
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getMerchants>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
61
|
+
|
|
62
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
63
|
+
|
|
64
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
68
65
|
|
|
69
66
|
const queryKey = queryOptions?.queryKey ?? getGetMerchantsQueryKey();
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}) => getMerchants(requestOptions, signal);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMerchants>>> = ({ signal }) => getMerchants(requestOptions, signal);
|
|
74
71
|
|
|
75
|
-
const query = useQuery<
|
|
76
|
-
Awaited<ReturnType<typeof getMerchants>>,
|
|
77
|
-
TError,
|
|
78
|
-
TData
|
|
79
|
-
>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
|
|
80
|
-
queryKey: QueryKey;
|
|
81
|
-
};
|
|
72
|
+
const query = useQuery<Awaited<ReturnType<typeof getMerchants>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
82
73
|
|
|
83
74
|
query.queryKey = queryKey;
|
|
84
75
|
|
|
85
76
|
return query;
|
|
86
|
-
}
|
|
77
|
+
}
|
|
87
78
|
|
|
88
79
|
/**
|
|
89
80
|
* Gets a known merchant
|
|
@@ -91,52 +82,39 @@ export const useGetMerchants = <
|
|
|
91
82
|
* @summary Gets a specific Merchant
|
|
92
83
|
*/
|
|
93
84
|
export const getService = (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
signal?: AbortSignal
|
|
85
|
+
mId: number,
|
|
86
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
97
87
|
) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
export type GetServiceQueryError = ErrorType<AsError | void
|
|
110
|
-
|
|
111
|
-
export const useGetService = <
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
>
|
|
115
|
-
|
|
116
|
-
options
|
|
117
|
-
query?: UseQueryOptions<
|
|
118
|
-
Awaited<ReturnType<typeof getService>>,
|
|
119
|
-
TError,
|
|
120
|
-
TData
|
|
121
|
-
>;
|
|
122
|
-
request?: SecondParameter<typeof customInstance>;
|
|
123
|
-
}
|
|
124
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
125
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
88
|
+
return customInstance<MerchantGetResponse>(
|
|
89
|
+
{url: `/merchant/${mId}`, method: 'get', signal
|
|
90
|
+
},
|
|
91
|
+
options);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
export const getGetServiceQueryKey = (mId: number,) => [`/merchant/${mId}`];
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export type GetServiceQueryResult = NonNullable<Awaited<ReturnType<typeof getService>>>
|
|
99
|
+
export type GetServiceQueryError = ErrorType<AsError | void>
|
|
100
|
+
|
|
101
|
+
export const useGetService = <TData = Awaited<ReturnType<typeof getService>>, TError = ErrorType<AsError | void>>(
|
|
102
|
+
mId: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getService>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
103
|
+
|
|
104
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
105
|
+
|
|
106
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
126
107
|
|
|
127
108
|
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(mId);
|
|
128
109
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}) => getService(mId, requestOptions, signal);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getService>>> = ({ signal }) => getService(mId, requestOptions, signal);
|
|
132
113
|
|
|
133
|
-
const query = useQuery<Awaited<ReturnType<typeof getService>>, TError, TData>(
|
|
134
|
-
queryKey,
|
|
135
|
-
queryFn,
|
|
136
|
-
{ enabled: !!mId, ...queryOptions }
|
|
137
|
-
) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
114
|
+
const query = useQuery<Awaited<ReturnType<typeof getService>>, TError, TData>(queryKey, queryFn, {enabled: !!(mId), ...queryOptions}) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
138
115
|
|
|
139
116
|
query.queryKey = queryKey;
|
|
140
117
|
|
|
141
118
|
return query;
|
|
142
|
-
}
|
|
119
|
+
}
|
|
120
|
+
|
|
@@ -8,29 +8,33 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery,
|
|
13
|
+
useMutation
|
|
14
|
+
} from 'react-query'
|
|
12
15
|
import type {
|
|
13
16
|
UseQueryOptions,
|
|
14
17
|
UseMutationOptions,
|
|
15
18
|
QueryFunction,
|
|
16
19
|
MutationFunction,
|
|
17
20
|
UseQueryResult,
|
|
18
|
-
QueryKey
|
|
19
|
-
} from
|
|
21
|
+
QueryKey
|
|
22
|
+
} from 'react-query'
|
|
20
23
|
import type {
|
|
21
24
|
OrganisationsGetResponse,
|
|
22
25
|
AsError,
|
|
23
26
|
OrganisationPostResponse,
|
|
24
27
|
OrganisationPostBodyBody,
|
|
25
|
-
OrganisationGetDefaultResponse
|
|
26
|
-
} from
|
|
27
|
-
import { customInstance } from
|
|
28
|
-
import type { ErrorType } from
|
|
28
|
+
OrganisationGetDefaultResponse
|
|
29
|
+
} from '../account-server-api.schemas'
|
|
30
|
+
import { customInstance } from '.././custom-instance'
|
|
31
|
+
import type { ErrorType } from '.././custom-instance'
|
|
32
|
+
|
|
29
33
|
|
|
30
34
|
// eslint-disable-next-line
|
|
31
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
35
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
32
36
|
config: any,
|
|
33
|
-
args: infer P
|
|
37
|
+
args: infer P,
|
|
34
38
|
) => any
|
|
35
39
|
? P
|
|
36
40
|
: never;
|
|
@@ -41,53 +45,41 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
41
45
|
* @summary Gets Organisations
|
|
42
46
|
*/
|
|
43
47
|
export const getOrganisations = (
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
|
|
49
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
46
50
|
) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
51
|
+
return customInstance<OrganisationsGetResponse>(
|
|
52
|
+
{url: `/organisation`, method: 'get', signal
|
|
53
|
+
},
|
|
54
|
+
options);
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
|
|
53
58
|
export const getGetOrganisationsQueryKey = () => [`/organisation`];
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
TError
|
|
63
|
-
|
|
64
|
-
query
|
|
65
|
-
Awaited<ReturnType<typeof getOrganisations>>,
|
|
66
|
-
TError,
|
|
67
|
-
TData
|
|
68
|
-
>;
|
|
69
|
-
request?: SecondParameter<typeof customInstance>;
|
|
70
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
71
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
60
|
+
|
|
61
|
+
export type GetOrganisationsQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisations>>>
|
|
62
|
+
export type GetOrganisationsQueryError = ErrorType<void | AsError>
|
|
63
|
+
|
|
64
|
+
export const useGetOrganisations = <TData = Awaited<ReturnType<typeof getOrganisations>>, TError = ErrorType<void | AsError>>(
|
|
65
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
66
|
+
|
|
67
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
68
|
+
|
|
69
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
72
70
|
|
|
73
71
|
const queryKey = queryOptions?.queryKey ?? getGetOrganisationsQueryKey();
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
Awaited<ReturnType<typeof getOrganisations>>
|
|
77
|
-
> = ({ signal }) => getOrganisations(requestOptions, signal);
|
|
73
|
+
|
|
78
74
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
TData
|
|
83
|
-
>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
|
|
84
|
-
queryKey: QueryKey;
|
|
85
|
-
};
|
|
75
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getOrganisations>>> = ({ signal }) => getOrganisations(requestOptions, signal);
|
|
76
|
+
|
|
77
|
+
const query = useQuery<Awaited<ReturnType<typeof getOrganisations>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
86
78
|
|
|
87
79
|
query.queryKey = queryKey;
|
|
88
80
|
|
|
89
81
|
return query;
|
|
90
|
-
}
|
|
82
|
+
}
|
|
91
83
|
|
|
92
84
|
/**
|
|
93
85
|
* Creates a new Organisation
|
|
@@ -97,57 +89,40 @@ You need **admin** rights to use this method
|
|
|
97
89
|
* @summary Create a new organisation
|
|
98
90
|
*/
|
|
99
91
|
export const createOrganisation = (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
method: "post",
|
|
107
|
-
headers: { "Content-Type": "application/json" },
|
|
108
|
-
data: organisationPostBodyBody,
|
|
92
|
+
organisationPostBodyBody: OrganisationPostBodyBody,
|
|
93
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
94
|
+
return customInstance<OrganisationPostResponse>(
|
|
95
|
+
{url: `/organisation`, method: 'post',
|
|
96
|
+
headers: {'Content-Type': 'application/json', },
|
|
97
|
+
data: organisationPostBodyBody
|
|
109
98
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
export type
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
> = (props) => {
|
|
138
|
-
const { data } = props ?? {};
|
|
139
|
-
|
|
140
|
-
return createOrganisation(data, requestOptions);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
return useMutation<
|
|
144
|
-
Awaited<ReturnType<typeof createOrganisation>>,
|
|
145
|
-
TError,
|
|
146
|
-
{ data: OrganisationPostBodyBody },
|
|
147
|
-
TContext
|
|
148
|
-
>(mutationFn, mutationOptions);
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
99
|
+
options);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
export type CreateOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof createOrganisation>>>
|
|
105
|
+
export type CreateOrganisationMutationBody = OrganisationPostBodyBody
|
|
106
|
+
export type CreateOrganisationMutationError = ErrorType<AsError | void>
|
|
107
|
+
|
|
108
|
+
export const useCreateOrganisation = <TError = ErrorType<AsError | void>,
|
|
109
|
+
|
|
110
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createOrganisation>>, TError,{data: OrganisationPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
111
|
+
) => {
|
|
112
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createOrganisation>>, {data: OrganisationPostBodyBody}> = (props) => {
|
|
118
|
+
const {data} = props ?? {};
|
|
119
|
+
|
|
120
|
+
return createOrganisation(data,requestOptions)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return useMutation<Awaited<ReturnType<typeof createOrganisation>>, TError, {data: OrganisationPostBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
151
126
|
* Units must first be deleted before an Organisation can be deleted
|
|
152
127
|
|
|
153
128
|
You need **admin** rights to use this method
|
|
@@ -155,104 +130,76 @@ You need **admin** rights to use this method
|
|
|
155
130
|
* @summary Deletes an Organisation
|
|
156
131
|
*/
|
|
157
132
|
export const deleteOrganisation = (
|
|
158
|
-
|
|
159
|
-
|
|
133
|
+
orgId: string,
|
|
134
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
135
|
+
return customInstance<void>(
|
|
136
|
+
{url: `/organisation/${orgId}`, method: 'delete'
|
|
137
|
+
},
|
|
138
|
+
options);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
export type DeleteOrganisationMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisation>>>
|
|
144
|
+
|
|
145
|
+
export type DeleteOrganisationMutationError = ErrorType<AsError>
|
|
146
|
+
|
|
147
|
+
export const useDeleteOrganisation = <TError = ErrorType<AsError>,
|
|
148
|
+
|
|
149
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteOrganisation>>, TError,{orgId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
160
150
|
) => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
TContext = unknown
|
|
176
|
-
>(options?: {
|
|
177
|
-
mutation?: UseMutationOptions<
|
|
178
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
179
|
-
TError,
|
|
180
|
-
{ orgId: string },
|
|
181
|
-
TContext
|
|
182
|
-
>;
|
|
183
|
-
request?: SecondParameter<typeof customInstance>;
|
|
184
|
-
}) => {
|
|
185
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
186
|
-
|
|
187
|
-
const mutationFn: MutationFunction<
|
|
188
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
189
|
-
{ orgId: string }
|
|
190
|
-
> = (props) => {
|
|
191
|
-
const { orgId } = props ?? {};
|
|
192
|
-
|
|
193
|
-
return deleteOrganisation(orgId, requestOptions);
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
return useMutation<
|
|
197
|
-
Awaited<ReturnType<typeof deleteOrganisation>>,
|
|
198
|
-
TError,
|
|
199
|
-
{ orgId: string },
|
|
200
|
-
TContext
|
|
201
|
-
>(mutationFn, mutationOptions);
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
151
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteOrganisation>>, {orgId: string}> = (props) => {
|
|
157
|
+
const {orgId} = props ?? {};
|
|
158
|
+
|
|
159
|
+
return deleteOrganisation(orgId,requestOptions)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return useMutation<Awaited<ReturnType<typeof deleteOrganisation>>, TError, {orgId: string}, TContext>(mutationFn, mutationOptions)
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
204
165
|
* Gets the built-in Default Organisation, used exclusively for Personal Units
|
|
205
166
|
|
|
206
167
|
* @summary Gets the (built-in) Default Organisation
|
|
207
168
|
*/
|
|
208
169
|
export const getDefaultOrganisation = (
|
|
209
|
-
|
|
210
|
-
|
|
170
|
+
|
|
171
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
211
172
|
) => {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
export type GetDefaultOrganisationQueryResult = NonNullable<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
export
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
TData
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const queryKey =
|
|
241
|
-
queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
|
|
242
|
-
|
|
243
|
-
const queryFn: QueryFunction<
|
|
244
|
-
Awaited<ReturnType<typeof getDefaultOrganisation>>
|
|
245
|
-
> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
|
|
246
|
-
|
|
247
|
-
const query = useQuery<
|
|
248
|
-
Awaited<ReturnType<typeof getDefaultOrganisation>>,
|
|
249
|
-
TError,
|
|
250
|
-
TData
|
|
251
|
-
>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & {
|
|
252
|
-
queryKey: QueryKey;
|
|
253
|
-
};
|
|
173
|
+
return customInstance<OrganisationGetDefaultResponse>(
|
|
174
|
+
{url: `/organisation/default`, method: 'get', signal
|
|
175
|
+
},
|
|
176
|
+
options);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
export const getGetDefaultOrganisationQueryKey = () => [`/organisation/default`];
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
export type GetDefaultOrganisationQueryResult = NonNullable<Awaited<ReturnType<typeof getDefaultOrganisation>>>
|
|
184
|
+
export type GetDefaultOrganisationQueryError = ErrorType<void | AsError>
|
|
185
|
+
|
|
186
|
+
export const useGetDefaultOrganisation = <TData = Awaited<ReturnType<typeof getDefaultOrganisation>>, TError = ErrorType<void | AsError>>(
|
|
187
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
188
|
+
|
|
189
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
190
|
+
|
|
191
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
192
|
+
|
|
193
|
+
const queryKey = queryOptions?.queryKey ?? getGetDefaultOrganisationQueryKey();
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDefaultOrganisation>>> = ({ signal }) => getDefaultOrganisation(requestOptions, signal);
|
|
198
|
+
|
|
199
|
+
const query = useQuery<Awaited<ReturnType<typeof getDefaultOrganisation>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
254
200
|
|
|
255
201
|
query.queryKey = queryKey;
|
|
256
202
|
|
|
257
203
|
return query;
|
|
258
|
-
}
|
|
204
|
+
}
|
|
205
|
+
|