@squonk/account-server-client 0.1.31 → 0.1.32
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 +133 -0
- package/asset/asset.cjs.map +1 -0
- package/asset/asset.d.ts +126 -0
- package/asset/asset.js +133 -0
- package/asset/asset.js.map +1 -0
- package/asset/package.json +7 -0
- package/{custom-instance-13412a15.d.ts → custom-instance-b985e1be.d.ts} +127 -40
- package/index.cjs +20 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +20 -2
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +48 -0
- package/merchant/merchant.cjs.map +1 -0
- package/merchant/merchant.d.ts +39 -0
- package/merchant/merchant.js +48 -0
- package/merchant/merchant.js.map +1 -0
- package/merchant/package.json +7 -0
- package/organisation/organisation.cjs +12 -12
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +10 -9
- package/organisation/organisation.js +12 -12
- package/organisation/organisation.js.map +1 -1
- package/package.json +9 -9
- package/product/product.cjs +36 -26
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +23 -16
- package/product/product.js +36 -26
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +155 -52
- package/src/asset/asset.ts +433 -0
- package/src/merchant/merchant.ts +145 -0
- package/src/organisation/organisation.ts +37 -37
- package/src/product/product.ts +97 -74
- package/src/state/state.ts +19 -16
- package/src/unit/unit.ts +64 -56
- package/src/user/user.ts +63 -62
- package/state/state.cjs +6 -4
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +7 -6
- package/state/state.js +6 -4
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +22 -18
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +16 -15
- package/unit/unit.js +22 -18
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +22 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +14 -13
- package/user/user.js +22 -20
- package/user/user.js.map +1 -1
- package/service/package.json +0 -7
- package/service/service.cjs +0 -44
- package/service/service.cjs.map +0 -1
- package/service/service.d.ts +0 -49
- package/service/service.js +0 -44
- package/service/service.js.map +0 -1
- package/src/service/service.ts +0 -136
package/user/user.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as react_query from 'react-query';
|
|
2
2
|
import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
|
|
3
|
-
import {
|
|
3
|
+
import { a9 as customInstance, k as UserAccountDetail, aa as ErrorType, a5 as AsError, a0 as UsersGetResponse } from '../custom-instance-b985e1be.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
declare type
|
|
6
|
+
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
7
|
+
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
7
8
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
8
9
|
/**
|
|
9
10
|
* Returns a summary of your account
|
|
10
11
|
|
|
11
12
|
* @summary Get information about your account
|
|
12
13
|
*/
|
|
13
|
-
declare const getUserAccount: (options?: SecondParameter<typeof customInstance
|
|
14
|
+
declare const getUserAccount: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UserAccountDetail>;
|
|
14
15
|
declare const getGetUserAccountQueryKey: () => string[];
|
|
15
|
-
declare type GetUserAccountQueryResult = NonNullable<
|
|
16
|
+
declare type GetUserAccountQueryResult = NonNullable<Awaited<ReturnType<typeof getUserAccount>>>;
|
|
16
17
|
declare type GetUserAccountQueryError = ErrorType<void | AsError>;
|
|
17
18
|
declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<void | AsError>>(options?: {
|
|
18
19
|
query?: UseQueryOptions<UserAccountDetail, TError, TData, QueryKey> | undefined;
|
|
@@ -25,9 +26,9 @@ declare const useGetUserAccount: <TData = UserAccountDetail, TError = ErrorType<
|
|
|
25
26
|
|
|
26
27
|
* @summary Gets users in an organisation
|
|
27
28
|
*/
|
|
28
|
-
declare const getOrganisationUsers: (orgId: string, options?: SecondParameter<typeof customInstance
|
|
29
|
+
declare const getOrganisationUsers: (orgId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UsersGetResponse>;
|
|
29
30
|
declare const getGetOrganisationUsersQueryKey: (orgId: string) => string[];
|
|
30
|
-
declare type GetOrganisationUsersQueryResult = NonNullable<
|
|
31
|
+
declare type GetOrganisationUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUsers>>>;
|
|
31
32
|
declare type GetOrganisationUsersQueryError = ErrorType<AsError | void>;
|
|
32
33
|
declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(orgId: string, options?: {
|
|
33
34
|
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -41,7 +42,7 @@ declare const useGetOrganisationUsers: <TData = UsersGetResponse, TError = Error
|
|
|
41
42
|
* @summary Adds a user to an organisation
|
|
42
43
|
*/
|
|
43
44
|
declare const addOrganisationUser: (orgId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
44
|
-
declare type AddOrganisationUserMutationResult = NonNullable<
|
|
45
|
+
declare type AddOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUser>>>;
|
|
45
46
|
declare type AddOrganisationUserMutationError = ErrorType<AsError>;
|
|
46
47
|
declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
47
48
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -59,7 +60,7 @@ declare const useAddOrganisationUser: <TError = ErrorType<AsError>, TContext = u
|
|
|
59
60
|
* @summary Deletes a user from an organisation
|
|
60
61
|
*/
|
|
61
62
|
declare const deleteOrganisationUser: (orgId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
62
|
-
declare type DeleteOrganisationUserMutationResult = NonNullable<
|
|
63
|
+
declare type DeleteOrganisationUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUser>>>;
|
|
63
64
|
declare type DeleteOrganisationUserMutationError = ErrorType<AsError>;
|
|
64
65
|
declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
65
66
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -76,9 +77,9 @@ declare const useDeleteOrganisationUser: <TError = ErrorType<AsError>, TContext
|
|
|
76
77
|
|
|
77
78
|
* @summary Gets users in an Organisational Unit
|
|
78
79
|
*/
|
|
79
|
-
declare const getOrganisationUnitUsers: (unitId: string, options?: SecondParameter<typeof customInstance
|
|
80
|
+
declare const getOrganisationUnitUsers: (unitId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<UsersGetResponse>;
|
|
80
81
|
declare const getGetOrganisationUnitUsersQueryKey: (unitId: string) => string[];
|
|
81
|
-
declare type GetOrganisationUnitUsersQueryResult = NonNullable<
|
|
82
|
+
declare type GetOrganisationUnitUsersQueryResult = NonNullable<Awaited<ReturnType<typeof getOrganisationUnitUsers>>>;
|
|
82
83
|
declare type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;
|
|
83
84
|
declare const useGetOrganisationUnitUsers: <TData = UsersGetResponse, TError = ErrorType<void | AsError>>(unitId: string, options?: {
|
|
84
85
|
query?: UseQueryOptions<UsersGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -96,7 +97,7 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
96
97
|
* @summary Adds a user to an Organisational Unit
|
|
97
98
|
*/
|
|
98
99
|
declare const addOrganisationUnitUser: (unitId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
99
|
-
declare type AddOrganisationUnitUserMutationResult = NonNullable<
|
|
100
|
+
declare type AddOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof addOrganisationUnitUser>>>;
|
|
100
101
|
declare type AddOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
101
102
|
declare const useAddOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
102
103
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -118,7 +119,7 @@ You have to be in the Organisation or Unit or an Admin user to use this endpoint
|
|
|
118
119
|
* @summary Deletes a user from an Organisational Unit
|
|
119
120
|
*/
|
|
120
121
|
declare const deleteOrganisationUnitUser: (unitId: string, userId: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
121
|
-
declare type DeleteOrganisationUnitUserMutationResult = NonNullable<
|
|
122
|
+
declare type DeleteOrganisationUnitUserMutationResult = NonNullable<Awaited<ReturnType<typeof deleteOrganisationUnitUser>>>;
|
|
122
123
|
declare type DeleteOrganisationUnitUserMutationError = ErrorType<AsError>;
|
|
123
124
|
declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TContext = unknown>(options?: {
|
|
124
125
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -131,4 +132,4 @@ declare const useDeleteOrganisationUnitUser: <TError = ErrorType<AsError>, TCont
|
|
|
131
132
|
userId: string;
|
|
132
133
|
}, TContext>;
|
|
133
134
|
|
|
134
|
-
export { AddOrganisationUnitUserMutationError, AddOrganisationUnitUserMutationResult, AddOrganisationUserMutationError, AddOrganisationUserMutationResult, DeleteOrganisationUnitUserMutationError, DeleteOrganisationUnitUserMutationResult, DeleteOrganisationUserMutationError, DeleteOrganisationUserMutationResult, GetOrganisationUnitUsersQueryError, GetOrganisationUnitUsersQueryResult, GetOrganisationUsersQueryError, GetOrganisationUsersQueryResult, GetUserAccountQueryError, GetUserAccountQueryResult, addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUsersQueryKey, getGetUserAccountQueryKey, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUser, useDeleteOrganisationUnitUser, useDeleteOrganisationUser, useGetOrganisationUnitUsers, useGetOrganisationUsers, useGetUserAccount };
|
|
135
|
+
export { AddOrganisationUnitUserMutationError, AddOrganisationUnitUserMutationResult, AddOrganisationUserMutationError, AddOrganisationUserMutationResult, Awaited, AwaitedInput, DeleteOrganisationUnitUserMutationError, DeleteOrganisationUnitUserMutationResult, DeleteOrganisationUserMutationError, DeleteOrganisationUserMutationResult, GetOrganisationUnitUsersQueryError, GetOrganisationUnitUsersQueryResult, GetOrganisationUsersQueryError, GetOrganisationUsersQueryResult, GetUserAccountQueryError, GetUserAccountQueryResult, addOrganisationUnitUser, addOrganisationUser, deleteOrganisationUnitUser, deleteOrganisationUser, getGetOrganisationUnitUsersQueryKey, getGetOrganisationUsersQueryKey, getGetUserAccountQueryKey, getOrganisationUnitUsers, getOrganisationUsers, getUserAccount, useAddOrganisationUnitUser, useAddOrganisationUser, useDeleteOrganisationUnitUser, useDeleteOrganisationUser, useGetOrganisationUnitUsers, useGetOrganisationUsers, useGetUserAccount };
|
package/user/user.js
CHANGED
|
@@ -8,29 +8,31 @@ import {
|
|
|
8
8
|
useQuery,
|
|
9
9
|
useMutation
|
|
10
10
|
} from "react-query";
|
|
11
|
-
var getUserAccount = (options) => {
|
|
12
|
-
return customInstance({ url: `/user/account`, method: "get" }, options);
|
|
11
|
+
var getUserAccount = (options, signal) => {
|
|
12
|
+
return customInstance({ url: `/user/account`, method: "get", signal }, options);
|
|
13
13
|
};
|
|
14
14
|
var getGetUserAccountQueryKey = () => [`/user/account`];
|
|
15
15
|
var useGetUserAccount = (options) => {
|
|
16
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
16
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
17
17
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetUserAccountQueryKey();
|
|
18
|
-
const queryFn = (
|
|
18
|
+
const queryFn = ({
|
|
19
|
+
signal
|
|
20
|
+
}) => getUserAccount(requestOptions, signal);
|
|
19
21
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
20
22
|
return __spreadValues({
|
|
21
23
|
queryKey
|
|
22
24
|
}, query);
|
|
23
25
|
};
|
|
24
|
-
var getOrganisationUsers = (orgId, options) => {
|
|
25
|
-
return customInstance({ url: `/organisation/${orgId}/user`, method: "get" }, options);
|
|
26
|
+
var getOrganisationUsers = (orgId, options, signal) => {
|
|
27
|
+
return customInstance({ url: `/organisation/${orgId}/user`, method: "get", signal }, options);
|
|
26
28
|
};
|
|
27
29
|
var getGetOrganisationUsersQueryKey = (orgId) => [
|
|
28
30
|
`/organisation/${orgId}/user`
|
|
29
31
|
];
|
|
30
32
|
var useGetOrganisationUsers = (orgId, options) => {
|
|
31
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
33
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
32
34
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUsersQueryKey(orgId);
|
|
33
|
-
const queryFn = () => getOrganisationUsers(orgId, requestOptions);
|
|
35
|
+
const queryFn = ({ signal }) => getOrganisationUsers(orgId, requestOptions, signal);
|
|
34
36
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!orgId }, queryOptions));
|
|
35
37
|
return __spreadValues({
|
|
36
38
|
queryKey
|
|
@@ -40,9 +42,9 @@ var addOrganisationUser = (orgId, userId, options) => {
|
|
|
40
42
|
return customInstance({ url: `/organisation/${orgId}/user/${userId}`, method: "put" }, options);
|
|
41
43
|
};
|
|
42
44
|
var useAddOrganisationUser = (options) => {
|
|
43
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
45
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
44
46
|
const mutationFn = (props) => {
|
|
45
|
-
const { orgId, userId } = props
|
|
47
|
+
const { orgId, userId } = props ?? {};
|
|
46
48
|
return addOrganisationUser(orgId, userId, requestOptions);
|
|
47
49
|
};
|
|
48
50
|
return useMutation(mutationFn, mutationOptions);
|
|
@@ -51,23 +53,23 @@ var deleteOrganisationUser = (orgId, userId, options) => {
|
|
|
51
53
|
return customInstance({ url: `/organisation/${orgId}/user/${userId}`, method: "delete" }, options);
|
|
52
54
|
};
|
|
53
55
|
var useDeleteOrganisationUser = (options) => {
|
|
54
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
56
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
55
57
|
const mutationFn = (props) => {
|
|
56
|
-
const { orgId, userId } = props
|
|
58
|
+
const { orgId, userId } = props ?? {};
|
|
57
59
|
return deleteOrganisationUser(orgId, userId, requestOptions);
|
|
58
60
|
};
|
|
59
61
|
return useMutation(mutationFn, mutationOptions);
|
|
60
62
|
};
|
|
61
|
-
var getOrganisationUnitUsers = (unitId, options) => {
|
|
62
|
-
return customInstance({ url: `/unit/${unitId}/user`, method: "get" }, options);
|
|
63
|
+
var getOrganisationUnitUsers = (unitId, options, signal) => {
|
|
64
|
+
return customInstance({ url: `/unit/${unitId}/user`, method: "get", signal }, options);
|
|
63
65
|
};
|
|
64
66
|
var getGetOrganisationUnitUsersQueryKey = (unitId) => [
|
|
65
67
|
`/unit/${unitId}/user`
|
|
66
68
|
];
|
|
67
69
|
var useGetOrganisationUnitUsers = (unitId, options) => {
|
|
68
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
70
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
69
71
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetOrganisationUnitUsersQueryKey(unitId);
|
|
70
|
-
const queryFn = () => getOrganisationUnitUsers(unitId, requestOptions);
|
|
72
|
+
const queryFn = ({ signal }) => getOrganisationUnitUsers(unitId, requestOptions, signal);
|
|
71
73
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!unitId }, queryOptions));
|
|
72
74
|
return __spreadValues({
|
|
73
75
|
queryKey
|
|
@@ -77,9 +79,9 @@ var addOrganisationUnitUser = (unitId, userId, options) => {
|
|
|
77
79
|
return customInstance({ url: `/unit/${unitId}/user/${userId}`, method: "put" }, options);
|
|
78
80
|
};
|
|
79
81
|
var useAddOrganisationUnitUser = (options) => {
|
|
80
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
82
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
81
83
|
const mutationFn = (props) => {
|
|
82
|
-
const { unitId, userId } = props
|
|
84
|
+
const { unitId, userId } = props ?? {};
|
|
83
85
|
return addOrganisationUnitUser(unitId, userId, requestOptions);
|
|
84
86
|
};
|
|
85
87
|
return useMutation(mutationFn, mutationOptions);
|
|
@@ -88,9 +90,9 @@ var deleteOrganisationUnitUser = (unitId, userId, options) => {
|
|
|
88
90
|
return customInstance({ url: `/unit/${unitId}/user/${userId}`, method: "delete" }, options);
|
|
89
91
|
};
|
|
90
92
|
var useDeleteOrganisationUnitUser = (options) => {
|
|
91
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
93
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
92
94
|
const mutationFn = (props) => {
|
|
93
|
-
const { unitId, userId } = props
|
|
95
|
+
const { unitId, userId } = props ?? {};
|
|
94
96
|
return deleteOrganisationUnitUser(unitId, userId, requestOptions);
|
|
95
97
|
};
|
|
96
98
|
return useMutation(mutationFn, mutationOptions);
|
package/user/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 {\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 type GetUserAccountQueryResult = NonNullable<\n AsyncReturnType<typeof getUserAccount>\n>;\nexport type GetUserAccountQueryError = ErrorType<void | AsError>;\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 type GetOrganisationUsersQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUsers>\n>;\nexport type GetOrganisationUsersQueryError = ErrorType<AsError | void>;\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 type AddOrganisationUserMutationResult = NonNullable<\n AsyncReturnType<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 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 type DeleteOrganisationUserMutationResult = NonNullable<\n AsyncReturnType<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 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 type GetOrganisationUnitUsersQueryResult = NonNullable<\n AsyncReturnType<typeof getOrganisationUnitUsers>\n>;\nexport type GetOrganisationUnitUsersQueryError = ErrorType<AsError | void>;\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 type AddOrganisationUnitUserMutationResult = NonNullable<\n AsyncReturnType<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 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 type DeleteOrganisationUnitUserMutationResult = NonNullable<\n AsyncReturnType<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 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,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,CACxC,QACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,SAAS,eAAe,UAAU,QAAQ,SAAS,GAC1D,OACF;AACF;AAQO,IAAM,gCAAgC,CAG3C,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,QAAQ,WAAW,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/user/user.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Account Server API\n * The Informatics Matters Account Server API.\n\nA service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.\n\n * OpenAPI spec version: 0.1\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n UserAccountGetResponse,\n AsError,\n UsersGetResponse,\n} from \"../account-server-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * 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 = () => [`/user/account`];\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 { 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 const query = useQuery<\n Awaited<ReturnType<typeof getUserAccount>>,\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 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 `/organisation/${orgId}/user`,\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 { 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 const query = useQuery<\n Awaited<ReturnType<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 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 { 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 useMutation<\n Awaited<ReturnType<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 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 { 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 useMutation<\n Awaited<ReturnType<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 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 `/unit/${unitId}/user`,\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 { 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 const query = useQuery<\n Awaited<ReturnType<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 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 { 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 useMutation<\n Awaited<ReturnType<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 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 { 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 useMutation<\n Awaited<ReturnType<typeof deleteOrganisationUnitUser>>,\n TError,\n { unitId: string; userId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAkCO,IAAM,iBAAiB,CAC5B,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,iBAAiB,QAAQ,OAAO,OAAO,GAC9C,OACF;AACF;AAEO,IAAM,4BAA4B,MAAM,CAAC,eAAe;AAOxD,IAAM,oBAAoB,CAG/B,YAO4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,0BAA0B;AAErE,QAAM,UAAqE,CAAC;AAAA,IAC1E;AAAA,QACI,eAAe,gBAAgB,MAAM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,UAAM,EAAE,QAAQ,WAAW,SAAS,CAAC;AAErC,WAAO,2BAA2B,QAAQ,QAAQ,cAAc;AAAA,EAClE;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
package/service/package.json
DELETED
package/service/service.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
5
|
-
|
|
6
|
-
// src/service/service.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _reactquery = require('react-query');
|
|
10
|
-
var getServices = (options) => {
|
|
11
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/service`, method: "get" }, options);
|
|
12
|
-
};
|
|
13
|
-
var getGetServicesQueryKey = () => [`/service`];
|
|
14
|
-
var useGetServices = (options) => {
|
|
15
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
16
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServicesQueryKey()));
|
|
17
|
-
const queryFn = () => getServices(requestOptions);
|
|
18
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
19
|
-
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
20
|
-
queryKey
|
|
21
|
-
}, query);
|
|
22
|
-
};
|
|
23
|
-
var getService = (svcId, options) => {
|
|
24
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/service/${svcId}`, method: "get" }, options);
|
|
25
|
-
};
|
|
26
|
-
var getGetServiceQueryKey = (svcId) => [`/service/${svcId}`];
|
|
27
|
-
var useGetService = (svcId, options) => {
|
|
28
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
29
|
-
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetServiceQueryKey(svcId)));
|
|
30
|
-
const queryFn = () => getService(svcId, requestOptions);
|
|
31
|
-
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!svcId }, queryOptions));
|
|
32
|
-
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
33
|
-
queryKey
|
|
34
|
-
}, query);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exports.getGetServiceQueryKey = getGetServiceQueryKey; exports.getGetServicesQueryKey = getGetServicesQueryKey; exports.getService = getService; exports.getServices = getServices; exports.useGetService = useGetService; exports.useGetServices = useGetServices;
|
|
44
|
-
//# sourceMappingURL=service.cjs.map
|
package/service/service.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/service.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","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 {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\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 * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcId: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcId: number) => [`/service/${svcId}`];\n\nexport type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
|
package/service/service.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
2
|
-
import { V as customInstance, h as ServicesGetResponse, W as ErrorType, N as AsError, g as ServiceGetResponse } from '../custom-instance-13412a15.js';
|
|
3
|
-
import 'axios';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generated by orval v6.7.1 🍺
|
|
7
|
-
* Do not edit manually.
|
|
8
|
-
* Account Server API
|
|
9
|
-
* The Informatics Matters Account Server API.
|
|
10
|
-
|
|
11
|
-
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
12
|
-
|
|
13
|
-
* OpenAPI spec version: 0.1
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
declare type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
17
|
-
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
18
|
-
/**
|
|
19
|
-
* Gets services known to the Account Server
|
|
20
|
-
|
|
21
|
-
* @summary Gets all Services
|
|
22
|
-
*/
|
|
23
|
-
declare const getServices: (options?: SecondParameter<typeof customInstance>) => Promise<ServicesGetResponse>;
|
|
24
|
-
declare const getGetServicesQueryKey: () => string[];
|
|
25
|
-
declare type GetServicesQueryResult = NonNullable<AsyncReturnType<typeof getServices>>;
|
|
26
|
-
declare type GetServicesQueryError = ErrorType<AsError | void>;
|
|
27
|
-
declare const useGetServices: <TData = ServicesGetResponse, TError = ErrorType<void | AsError>>(options?: {
|
|
28
|
-
query?: UseQueryOptions<ServicesGetResponse, TError, TData, QueryKey> | undefined;
|
|
29
|
-
request?: SecondParameter<typeof customInstance>;
|
|
30
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
31
|
-
queryKey: QueryKey;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Gets a known service
|
|
35
|
-
|
|
36
|
-
* @summary Gets a specific Service
|
|
37
|
-
*/
|
|
38
|
-
declare const getService: (svcId: number, options?: SecondParameter<typeof customInstance>) => Promise<ServiceGetResponse>;
|
|
39
|
-
declare const getGetServiceQueryKey: (svcId: number) => string[];
|
|
40
|
-
declare type GetServiceQueryResult = NonNullable<AsyncReturnType<typeof getService>>;
|
|
41
|
-
declare type GetServiceQueryError = ErrorType<AsError | void>;
|
|
42
|
-
declare const useGetService: <TData = ServiceGetResponse, TError = ErrorType<void | AsError>>(svcId: number, options?: {
|
|
43
|
-
query?: UseQueryOptions<ServiceGetResponse, TError, TData, QueryKey> | undefined;
|
|
44
|
-
request?: SecondParameter<typeof customInstance>;
|
|
45
|
-
} | undefined) => UseQueryResult<TData, TError> & {
|
|
46
|
-
queryKey: QueryKey;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { GetServiceQueryError, GetServiceQueryResult, GetServicesQueryError, GetServicesQueryResult, getGetServiceQueryKey, getGetServicesQueryKey, getService, getServices, useGetService, useGetServices };
|
package/service/service.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadValues,
|
|
3
|
-
customInstance
|
|
4
|
-
} from "../chunk-6EEIAH4R.js";
|
|
5
|
-
|
|
6
|
-
// src/service/service.ts
|
|
7
|
-
import {
|
|
8
|
-
useQuery
|
|
9
|
-
} from "react-query";
|
|
10
|
-
var getServices = (options) => {
|
|
11
|
-
return customInstance({ url: `/service`, method: "get" }, options);
|
|
12
|
-
};
|
|
13
|
-
var getGetServicesQueryKey = () => [`/service`];
|
|
14
|
-
var useGetServices = (options) => {
|
|
15
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
16
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServicesQueryKey();
|
|
17
|
-
const queryFn = () => getServices(requestOptions);
|
|
18
|
-
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
19
|
-
return __spreadValues({
|
|
20
|
-
queryKey
|
|
21
|
-
}, query);
|
|
22
|
-
};
|
|
23
|
-
var getService = (svcId, options) => {
|
|
24
|
-
return customInstance({ url: `/service/${svcId}`, method: "get" }, options);
|
|
25
|
-
};
|
|
26
|
-
var getGetServiceQueryKey = (svcId) => [`/service/${svcId}`];
|
|
27
|
-
var useGetService = (svcId, options) => {
|
|
28
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
29
|
-
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetServiceQueryKey(svcId);
|
|
30
|
-
const queryFn = () => getService(svcId, requestOptions);
|
|
31
|
-
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!svcId }, queryOptions));
|
|
32
|
-
return __spreadValues({
|
|
33
|
-
queryKey
|
|
34
|
-
}, query);
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
getGetServiceQueryKey,
|
|
38
|
-
getGetServicesQueryKey,
|
|
39
|
-
getService,
|
|
40
|
-
getServices,
|
|
41
|
-
useGetService,
|
|
42
|
-
useGetServices
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=service.js.map
|
package/service/service.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service/service.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 {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n ServicesGetResponse,\n AsError,\n ServiceGetResponse,\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 * Gets services known to the Account Server\n\n * @summary Gets all Services\n */\nexport const getServices = (\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServicesGetResponse>(\n { url: `/service`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServicesQueryKey = () => [`/service`];\n\nexport type GetServicesQueryResult = NonNullable<\n AsyncReturnType<typeof getServices>\n>;\nexport type GetServicesQueryError = ErrorType<AsError | void>;\n\nexport const useGetServices = <\n TData = AsyncReturnType<typeof getServices>,\n TError = ErrorType<AsError | void>\n>(options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>\n getServices(requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Gets a known service\n\n * @summary Gets a specific Service\n */\nexport const getService = (\n svcId: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<ServiceGetResponse>(\n { url: `/service/${svcId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetServiceQueryKey = (svcId: number) => [`/service/${svcId}`];\n\nexport type GetServiceQueryResult = NonNullable<\n AsyncReturnType<typeof getService>\n>;\nexport type GetServiceQueryError = ErrorType<AsError | void>;\n\nexport const useGetService = <\n TData = AsyncReturnType<typeof getService>,\n TError = ErrorType<AsError | void>\n>(\n svcId: number,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>\n getService(svcId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!svcId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAkCO,IAAM,cAAc,CACzB,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,QAAQ,MAAM,GACjC,OACF;AACF;AAEO,IAAM,yBAAyB,MAAM,CAAC,UAAU;AAOhD,IAAM,iBAAiB,CAG5B,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,cAAc;AAE5B,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AAOO,IAAM,aAAa,CACxB,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,SAAS,QAAQ,MAAM,GAC1C,OACF;AACF;AAEO,IAAM,wBAAwB,CAAC,UAAkB,CAAC,YAAY,OAAO;AAOrE,IAAM,gBAAgB,CAI3B,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,sBAAsB,KAAK;AAEtE,QAAM,UAA6D,MACjE,WAAW,OAAO,cAAc;AAElC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;","names":[]}
|
package/src/service/service.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v6.7.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* Account Server API
|
|
5
|
-
* The Informatics Matters Account Server API.
|
|
6
|
-
|
|
7
|
-
A service that provides access to the Account Server, which gives *registered* users access to and management of **Products**, **Organisations**, **Units** and **Users**.
|
|
8
|
-
|
|
9
|
-
* OpenAPI spec version: 0.1
|
|
10
|
-
*/
|
|
11
|
-
import {
|
|
12
|
-
useQuery,
|
|
13
|
-
UseQueryOptions,
|
|
14
|
-
QueryFunction,
|
|
15
|
-
UseQueryResult,
|
|
16
|
-
QueryKey,
|
|
17
|
-
} from "react-query";
|
|
18
|
-
import type {
|
|
19
|
-
ServicesGetResponse,
|
|
20
|
-
AsError,
|
|
21
|
-
ServiceGetResponse,
|
|
22
|
-
} from "../account-server-api.schemas";
|
|
23
|
-
import { customInstance, ErrorType } from ".././custom-instance";
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
|
27
|
-
...args: any
|
|
28
|
-
) => Promise<infer R>
|
|
29
|
-
? R
|
|
30
|
-
: any;
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
|
-
config: any,
|
|
35
|
-
args: infer P
|
|
36
|
-
) => any
|
|
37
|
-
? P
|
|
38
|
-
: never;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Gets services known to the Account Server
|
|
42
|
-
|
|
43
|
-
* @summary Gets all Services
|
|
44
|
-
*/
|
|
45
|
-
export const getServices = (
|
|
46
|
-
options?: SecondParameter<typeof customInstance>
|
|
47
|
-
) => {
|
|
48
|
-
return customInstance<ServicesGetResponse>(
|
|
49
|
-
{ url: `/service`, method: "get" },
|
|
50
|
-
options
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const getGetServicesQueryKey = () => [`/service`];
|
|
55
|
-
|
|
56
|
-
export type GetServicesQueryResult = NonNullable<
|
|
57
|
-
AsyncReturnType<typeof getServices>
|
|
58
|
-
>;
|
|
59
|
-
export type GetServicesQueryError = ErrorType<AsError | void>;
|
|
60
|
-
|
|
61
|
-
export const useGetServices = <
|
|
62
|
-
TData = AsyncReturnType<typeof getServices>,
|
|
63
|
-
TError = ErrorType<AsError | void>
|
|
64
|
-
>(options?: {
|
|
65
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getServices>, TError, TData>;
|
|
66
|
-
request?: SecondParameter<typeof customInstance>;
|
|
67
|
-
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
68
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
69
|
-
|
|
70
|
-
const queryKey = queryOptions?.queryKey ?? getGetServicesQueryKey();
|
|
71
|
-
|
|
72
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getServices>> = () =>
|
|
73
|
-
getServices(requestOptions);
|
|
74
|
-
|
|
75
|
-
const query = useQuery<AsyncReturnType<typeof getServices>, TError, TData>(
|
|
76
|
-
queryKey,
|
|
77
|
-
queryFn,
|
|
78
|
-
queryOptions
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
queryKey,
|
|
83
|
-
...query,
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Gets a known service
|
|
89
|
-
|
|
90
|
-
* @summary Gets a specific Service
|
|
91
|
-
*/
|
|
92
|
-
export const getService = (
|
|
93
|
-
svcId: number,
|
|
94
|
-
options?: SecondParameter<typeof customInstance>
|
|
95
|
-
) => {
|
|
96
|
-
return customInstance<ServiceGetResponse>(
|
|
97
|
-
{ url: `/service/${svcId}`, method: "get" },
|
|
98
|
-
options
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const getGetServiceQueryKey = (svcId: number) => [`/service/${svcId}`];
|
|
103
|
-
|
|
104
|
-
export type GetServiceQueryResult = NonNullable<
|
|
105
|
-
AsyncReturnType<typeof getService>
|
|
106
|
-
>;
|
|
107
|
-
export type GetServiceQueryError = ErrorType<AsError | void>;
|
|
108
|
-
|
|
109
|
-
export const useGetService = <
|
|
110
|
-
TData = AsyncReturnType<typeof getService>,
|
|
111
|
-
TError = ErrorType<AsError | void>
|
|
112
|
-
>(
|
|
113
|
-
svcId: number,
|
|
114
|
-
options?: {
|
|
115
|
-
query?: UseQueryOptions<AsyncReturnType<typeof getService>, TError, TData>;
|
|
116
|
-
request?: SecondParameter<typeof customInstance>;
|
|
117
|
-
}
|
|
118
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
119
|
-
const { query: queryOptions, request: requestOptions } = options || {};
|
|
120
|
-
|
|
121
|
-
const queryKey = queryOptions?.queryKey ?? getGetServiceQueryKey(svcId);
|
|
122
|
-
|
|
123
|
-
const queryFn: QueryFunction<AsyncReturnType<typeof getService>> = () =>
|
|
124
|
-
getService(svcId, requestOptions);
|
|
125
|
-
|
|
126
|
-
const query = useQuery<AsyncReturnType<typeof getService>, TError, TData>(
|
|
127
|
-
queryKey,
|
|
128
|
-
queryFn,
|
|
129
|
-
{ enabled: !!svcId, ...queryOptions }
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
queryKey,
|
|
134
|
-
...query,
|
|
135
|
-
};
|
|
136
|
-
};
|