@squonk/account-server-client 2.1.0-rc.1 → 2.1.0-rc.10
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/README.md +1 -1
- package/admin/admin.cjs +30 -8
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +50 -0
- package/admin/admin.d.ts +26 -6
- package/admin/admin.js +30 -8
- package/admin/admin.js.map +1 -1
- package/asset/asset.cjs +62 -22
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.cts +260 -0
- package/asset/asset.d.ts +79 -36
- package/asset/asset.js +54 -14
- package/asset/asset.js.map +1 -1
- package/{chunk-3RNIDX7T.js → chunk-EBOQPVLG.js} +2 -2
- package/{chunk-3RNIDX7T.js.map → chunk-EBOQPVLG.js.map} +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-TKLTUR4R.cjs} +2 -2
- package/chunk-TKLTUR4R.cjs.map +1 -0
- package/event-stream/event-stream.cjs +64 -19
- package/event-stream/event-stream.cjs.map +1 -1
- package/event-stream/event-stream.d.cts +142 -0
- package/event-stream/event-stream.d.ts +66 -20
- package/event-stream/event-stream.js +61 -16
- package/event-stream/event-stream.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/{custom-instance-35e5d4fd.d.ts → index.d.cts} +163 -163
- package/index.d.ts +700 -2
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +53 -14
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.cts +91 -0
- package/merchant/merchant.d.ts +48 -8
- package/merchant/merchant.js +52 -13
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +110 -28
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.cts +271 -0
- package/organisation/organisation.d.ts +114 -25
- package/organisation/organisation.js +103 -21
- package/organisation/organisation.js.map +1 -1
- package/package.json +12 -12
- package/product/product.cjs +182 -47
- package/product/product.cjs.map +1 -1
- package/product/product.d.cts +399 -0
- package/product/product.d.ts +180 -31
- package/product/product.js +172 -37
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +272 -280
- package/src/admin/admin.ts +114 -84
- package/src/asset/asset.ts +480 -565
- package/src/custom-instance.ts +3 -4
- package/src/event-stream/event-stream.ts +300 -275
- package/src/merchant/merchant.ts +206 -142
- package/src/organisation/organisation.ts +549 -490
- package/src/product/product.ts +829 -688
- package/src/state/state.ts +112 -75
- package/src/unit/unit.ts +645 -599
- package/src/user/user.ts +489 -469
- package/state/state.cjs +29 -8
- package/state/state.cjs.map +1 -1
- package/state/state.d.cts +46 -0
- package/state/state.d.ts +26 -6
- package/state/state.js +29 -8
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +120 -32
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.cts +322 -0
- package/unit/unit.d.ts +133 -38
- package/unit/unit.js +112 -24
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +96 -22
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +271 -0
- package/user/user.d.ts +96 -24
- package/user/user.js +90 -16
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/asset/asset.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.25.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Account Server API
|
|
5
5
|
* The Informatics Matters Account Server API.
|
|
@@ -8,207 +8,219 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 2.1
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useMutation,
|
|
13
|
+
useQuery,
|
|
14
|
+
useSuspenseQuery
|
|
15
|
+
} from '@tanstack/react-query'
|
|
12
16
|
import type {
|
|
13
|
-
UseQueryOptions,
|
|
14
|
-
UseMutationOptions,
|
|
15
|
-
QueryFunction,
|
|
16
17
|
MutationFunction,
|
|
17
|
-
|
|
18
|
+
QueryFunction,
|
|
18
19
|
QueryKey,
|
|
19
|
-
|
|
20
|
+
UseMutationOptions,
|
|
21
|
+
UseQueryOptions,
|
|
22
|
+
UseQueryResult,
|
|
23
|
+
UseSuspenseQueryOptions,
|
|
24
|
+
UseSuspenseQueryResult
|
|
25
|
+
} from '@tanstack/react-query'
|
|
20
26
|
import type {
|
|
21
|
-
AssetGetResponse,
|
|
22
27
|
AsError,
|
|
23
|
-
|
|
24
|
-
AssetPostResponse,
|
|
25
|
-
AssetPostBodyBody,
|
|
28
|
+
AssetGetResponse,
|
|
26
29
|
AssetPatchBodyBody,
|
|
30
|
+
AssetPostBodyBody,
|
|
31
|
+
AssetPostResponse,
|
|
27
32
|
AttachAssetParams,
|
|
28
33
|
DetachAssetParams,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
) => any
|
|
38
|
-
? P
|
|
39
|
-
: never;
|
|
34
|
+
GetAssetParams
|
|
35
|
+
} from '../account-server-api.schemas'
|
|
36
|
+
import { customInstance } from '.././custom-instance';
|
|
37
|
+
import type { ErrorType } from '.././custom-instance';
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
41
|
+
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
44
|
* Gets Assets you have access to.
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
* @summary Gets Assets
|
|
47
|
+
*/
|
|
48
|
+
export const getAsset = (
|
|
49
|
+
params?: GetAssetParams,
|
|
50
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
51
|
+
) => {
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
return customInstance<AssetGetResponse>(
|
|
55
|
+
{url: `/asset`, method: 'GET',
|
|
56
|
+
params, signal
|
|
57
|
+
},
|
|
58
|
+
options);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const getGetAssetQueryKey = (params?: GetAssetParams,) => {
|
|
63
|
+
return ["account-server-api", `/asset`, ...(params ? [params]: [])] as const;
|
|
64
|
+
}
|
|
45
65
|
|
|
46
|
-
|
|
66
|
+
|
|
67
|
+
export const getGetAssetQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
68
|
+
) => {
|
|
69
|
+
|
|
70
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
71
|
+
|
|
72
|
+
const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);
|
|
77
|
+
|
|
78
|
+
|
|
47
79
|
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>
|
|
86
|
+
export type GetAssetQueryError = ErrorType<AsError | void>
|
|
87
|
+
|
|
88
|
+
/**
|
|
48
89
|
* @summary Gets Assets
|
|
49
90
|
*/
|
|
50
|
-
export const getAsset = (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
91
|
+
export const useGetAsset = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(
|
|
92
|
+
params?: GetAssetParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
93
|
+
|
|
94
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
95
|
+
|
|
96
|
+
const queryOptions = getGetAssetQueryOptions(params,options)
|
|
97
|
+
|
|
98
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
99
|
+
|
|
100
|
+
query.queryKey = queryOptions.queryKey ;
|
|
101
|
+
|
|
102
|
+
return query;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export const getGetAssetSuspenseQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
54
108
|
) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export type GetAssetQueryResult = NonNullable<
|
|
92
|
-
Awaited<ReturnType<typeof getAsset>>
|
|
93
|
-
>;
|
|
94
|
-
export type GetAssetQueryError = ErrorType<AsError | void>;
|
|
95
|
-
|
|
96
|
-
export const useGetAsset = <
|
|
97
|
-
TData = Awaited<ReturnType<typeof getAsset>>,
|
|
98
|
-
TError = ErrorType<AsError | void>
|
|
99
|
-
>(
|
|
100
|
-
params?: GetAssetParams,
|
|
101
|
-
options?: {
|
|
102
|
-
query?: UseQueryOptions<
|
|
103
|
-
Awaited<ReturnType<typeof getAsset>>,
|
|
104
|
-
TError,
|
|
105
|
-
TData
|
|
106
|
-
>;
|
|
107
|
-
request?: SecondParameter<typeof customInstance>;
|
|
108
|
-
}
|
|
109
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
110
|
-
const queryOptions = getGetAssetQueryOptions(params, options);
|
|
111
|
-
|
|
112
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
113
|
-
queryKey: QueryKey;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
query.queryKey = queryOptions.queryKey;
|
|
109
|
+
|
|
110
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
111
|
+
|
|
112
|
+
const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
return { queryKey, queryFn, ...queryOptions} as UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: QueryKey }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type GetAssetSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>
|
|
126
|
+
export type GetAssetSuspenseQueryError = ErrorType<AsError | void>
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @summary Gets Assets
|
|
130
|
+
*/
|
|
131
|
+
export const useGetAssetSuspense = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(
|
|
132
|
+
params?: GetAssetParams, options?: { query?:Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, request?: SecondParameter<typeof customInstance>}
|
|
133
|
+
|
|
134
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
135
|
+
|
|
136
|
+
const queryOptions = getGetAssetSuspenseQueryOptions(params,options)
|
|
137
|
+
|
|
138
|
+
const query = useSuspenseQuery(queryOptions) as UseSuspenseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
139
|
+
|
|
140
|
+
query.queryKey = queryOptions.queryKey ;
|
|
117
141
|
|
|
118
142
|
return query;
|
|
119
|
-
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
120
146
|
|
|
121
147
|
/**
|
|
122
148
|
* Creates an Asset, which can be attached to a **User** account, a **Product**, **Unit**, **Organisation** or can be made **Global**
|
|
123
149
|
|
|
150
|
+
Assets are text and file resources that can be requested by **Merchants**. The Data Manager **Merchant** uses assets to provide additional information that's often sensitive to **Job** (and **Application**) **Instances**.
|
|
151
|
+
|
|
152
|
+
Assets must be *enabled* before they can be used.
|
|
153
|
+
|
|
154
|
+
They must also be *attached* to a **Merchant** before the **Merchant** can ue them. Assets are only available to merchants if they are enabled and attached.
|
|
155
|
+
|
|
124
156
|
* @summary Create an Asset
|
|
125
157
|
*/
|
|
126
158
|
export const createAsset = (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
152
|
-
data: formData,
|
|
159
|
+
assetPostBodyBody: AssetPostBodyBody,
|
|
160
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
161
|
+
|
|
162
|
+
const formData = new FormData();
|
|
163
|
+
formData.append('name', assetPostBodyBody.name)
|
|
164
|
+
if(assetPostBodyBody.content_file !== undefined) {
|
|
165
|
+
formData.append('content_file', assetPostBodyBody.content_file)
|
|
166
|
+
}
|
|
167
|
+
if(assetPostBodyBody.content_string !== undefined) {
|
|
168
|
+
formData.append('content_string', assetPostBodyBody.content_string)
|
|
169
|
+
}
|
|
170
|
+
formData.append('scope', assetPostBodyBody.scope)
|
|
171
|
+
if(assetPostBodyBody.scope_id !== undefined) {
|
|
172
|
+
formData.append('scope_id', assetPostBodyBody.scope_id)
|
|
173
|
+
}
|
|
174
|
+
formData.append('secret', assetPostBodyBody.secret.toString())
|
|
175
|
+
if(assetPostBodyBody.description !== undefined) {
|
|
176
|
+
formData.append('description', assetPostBodyBody.description)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return customInstance<AssetPostResponse>(
|
|
180
|
+
{url: `/asset`, method: 'POST',
|
|
181
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
182
|
+
data: formData
|
|
153
183
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
Awaited<ReturnType<typeof createAsset
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
export const useCreateAsset = <
|
|
196
|
-
TError = ErrorType<AsError | void>,
|
|
197
|
-
TContext = unknown
|
|
198
|
-
>(options?: {
|
|
199
|
-
mutation?: UseMutationOptions<
|
|
200
|
-
Awaited<ReturnType<typeof createAsset>>,
|
|
201
|
-
TError,
|
|
202
|
-
{ data: AssetPostBodyBody },
|
|
203
|
-
TContext
|
|
204
|
-
>;
|
|
205
|
-
request?: SecondParameter<typeof customInstance>;
|
|
206
|
-
}) => {
|
|
207
|
-
const mutationOptions = getCreateAssetMutationOptions(options);
|
|
208
|
-
|
|
209
|
-
return useMutation(mutationOptions);
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
184
|
+
options);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
export const getCreateAssetMutationOptions = <TError = ErrorType<AsError | void>,
|
|
190
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
191
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext> => {
|
|
192
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: AssetPostBodyBody}> = (props) => {
|
|
198
|
+
const {data} = props ?? {};
|
|
199
|
+
|
|
200
|
+
return createAsset(data,requestOptions)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
return { mutationFn, ...mutationOptions }}
|
|
207
|
+
|
|
208
|
+
export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>
|
|
209
|
+
export type CreateAssetMutationBody = AssetPostBodyBody
|
|
210
|
+
export type CreateAssetMutationError = ErrorType<AsError | void>
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @summary Create an Asset
|
|
214
|
+
*/
|
|
215
|
+
export const useCreateAsset = <TError = ErrorType<AsError | void>,
|
|
216
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
217
|
+
) => {
|
|
218
|
+
|
|
219
|
+
const mutationOptions = getCreateAssetMutationOptions(options);
|
|
220
|
+
|
|
221
|
+
return useMutation(mutationOptions);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
212
224
|
* Used to update or replace Asset *Content* or *Description*.
|
|
213
225
|
|
|
214
226
|
The content of an Asset currently in use will not be affected by a change made here. If a **Merchant** has already obtained the Asset it may continue to use the original value until the **Merchant** requests the **Asset** again.
|
|
@@ -216,424 +228,327 @@ The content of an Asset currently in use will not be affected by a change made h
|
|
|
216
228
|
* @summary Adjust an existing Asset
|
|
217
229
|
*/
|
|
218
230
|
export const patchAsset = (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
239
|
-
data: formData,
|
|
231
|
+
assetId: string,
|
|
232
|
+
assetPatchBodyBody: AssetPatchBodyBody,
|
|
233
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
234
|
+
|
|
235
|
+
const formData = new FormData();
|
|
236
|
+
if(assetPatchBodyBody.content_file !== undefined) {
|
|
237
|
+
formData.append('content_file', assetPatchBodyBody.content_file)
|
|
238
|
+
}
|
|
239
|
+
if(assetPatchBodyBody.content_string !== undefined) {
|
|
240
|
+
formData.append('content_string', assetPatchBodyBody.content_string)
|
|
241
|
+
}
|
|
242
|
+
if(assetPatchBodyBody.description !== undefined) {
|
|
243
|
+
formData.append('description', assetPatchBodyBody.description)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return customInstance<void>(
|
|
247
|
+
{url: `/asset/${assetId}`, method: 'PATCH',
|
|
248
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
249
|
+
data: formData
|
|
240
250
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
Awaited<ReturnType<typeof patchAsset
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
export const usePatchAsset = <
|
|
283
|
-
TError = ErrorType<AsError>,
|
|
284
|
-
TContext = unknown
|
|
285
|
-
>(options?: {
|
|
286
|
-
mutation?: UseMutationOptions<
|
|
287
|
-
Awaited<ReturnType<typeof patchAsset>>,
|
|
288
|
-
TError,
|
|
289
|
-
{ assetId: string; data: AssetPatchBodyBody },
|
|
290
|
-
TContext
|
|
291
|
-
>;
|
|
292
|
-
request?: SecondParameter<typeof customInstance>;
|
|
293
|
-
}) => {
|
|
294
|
-
const mutationOptions = getPatchAssetMutationOptions(options);
|
|
295
|
-
|
|
296
|
-
return useMutation(mutationOptions);
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
251
|
+
options);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
export const getPatchAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
257
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
258
|
+
): UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext> => {
|
|
259
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchAsset>>, {assetId: string;data: AssetPatchBodyBody}> = (props) => {
|
|
265
|
+
const {assetId,data} = props ?? {};
|
|
266
|
+
|
|
267
|
+
return patchAsset(assetId,data,requestOptions)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
return { mutationFn, ...mutationOptions }}
|
|
274
|
+
|
|
275
|
+
export type PatchAssetMutationResult = NonNullable<Awaited<ReturnType<typeof patchAsset>>>
|
|
276
|
+
export type PatchAssetMutationBody = AssetPatchBodyBody
|
|
277
|
+
export type PatchAssetMutationError = ErrorType<AsError>
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @summary Adjust an existing Asset
|
|
281
|
+
*/
|
|
282
|
+
export const usePatchAsset = <TError = ErrorType<AsError>,
|
|
283
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchAsset>>, TError,{assetId: string;data: AssetPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
284
|
+
) => {
|
|
285
|
+
|
|
286
|
+
const mutationOptions = getPatchAssetMutationOptions(options);
|
|
287
|
+
|
|
288
|
+
return useMutation(mutationOptions);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
299
291
|
* Deletes a known Asset. Assets that are attached to **Merchants** cannot be deleted
|
|
300
292
|
|
|
301
293
|
* @summary Deletes an Asset
|
|
302
294
|
*/
|
|
303
295
|
export const deleteAsset = (
|
|
304
|
-
|
|
305
|
-
|
|
296
|
+
assetId: string,
|
|
297
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
return customInstance<void>(
|
|
301
|
+
{url: `/asset/${assetId}`, method: 'DELETE'
|
|
302
|
+
},
|
|
303
|
+
options);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
export const getDeleteAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
309
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
310
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext> => {
|
|
311
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {assetId: string}> = (props) => {
|
|
317
|
+
const {assetId} = props ?? {};
|
|
318
|
+
|
|
319
|
+
return deleteAsset(assetId,requestOptions)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
return { mutationFn, ...mutationOptions }}
|
|
326
|
+
|
|
327
|
+
export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>
|
|
328
|
+
|
|
329
|
+
export type DeleteAssetMutationError = ErrorType<AsError>
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @summary Deletes an Asset
|
|
333
|
+
*/
|
|
334
|
+
export const useDeleteAsset = <TError = ErrorType<AsError>,
|
|
335
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
306
336
|
) => {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export const getDeleteAssetMutationOptions = <
|
|
314
|
-
TError = ErrorType<AsError>,
|
|
315
|
-
TContext = unknown
|
|
316
|
-
>(options?: {
|
|
317
|
-
mutation?: UseMutationOptions<
|
|
318
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
319
|
-
TError,
|
|
320
|
-
{ assetId: string },
|
|
321
|
-
TContext
|
|
322
|
-
>;
|
|
323
|
-
request?: SecondParameter<typeof customInstance>;
|
|
324
|
-
}): UseMutationOptions<
|
|
325
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
326
|
-
TError,
|
|
327
|
-
{ assetId: string },
|
|
328
|
-
TContext
|
|
329
|
-
> => {
|
|
330
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
331
|
-
|
|
332
|
-
const mutationFn: MutationFunction<
|
|
333
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
334
|
-
{ assetId: string }
|
|
335
|
-
> = (props) => {
|
|
336
|
-
const { assetId } = props ?? {};
|
|
337
|
-
|
|
338
|
-
return deleteAsset(assetId, requestOptions);
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
return { mutationFn, ...mutationOptions };
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
export type DeleteAssetMutationResult = NonNullable<
|
|
345
|
-
Awaited<ReturnType<typeof deleteAsset>>
|
|
346
|
-
>;
|
|
347
|
-
|
|
348
|
-
export type DeleteAssetMutationError = ErrorType<AsError>;
|
|
349
|
-
|
|
350
|
-
export const useDeleteAsset = <
|
|
351
|
-
TError = ErrorType<AsError>,
|
|
352
|
-
TContext = unknown
|
|
353
|
-
>(options?: {
|
|
354
|
-
mutation?: UseMutationOptions<
|
|
355
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
356
|
-
TError,
|
|
357
|
-
{ assetId: string },
|
|
358
|
-
TContext
|
|
359
|
-
>;
|
|
360
|
-
request?: SecondParameter<typeof customInstance>;
|
|
361
|
-
}) => {
|
|
362
|
-
const mutationOptions = getDeleteAssetMutationOptions(options);
|
|
363
|
-
|
|
364
|
-
return useMutation(mutationOptions);
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
337
|
+
|
|
338
|
+
const mutationOptions = getDeleteAssetMutationOptions(options);
|
|
339
|
+
|
|
340
|
+
return useMutation(mutationOptions);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
367
343
|
* Disables a known Asset
|
|
368
344
|
|
|
369
345
|
* @summary Disables an Asset
|
|
370
346
|
*/
|
|
371
347
|
export const disableAsset = (
|
|
372
|
-
|
|
373
|
-
|
|
348
|
+
assetId: string,
|
|
349
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
return customInstance<void>(
|
|
353
|
+
{url: `/asset/${assetId}/disable`, method: 'PATCH'
|
|
354
|
+
},
|
|
355
|
+
options);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
export const getDisableAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
361
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
362
|
+
): UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext> => {
|
|
363
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof disableAsset>>, {assetId: string}> = (props) => {
|
|
369
|
+
const {assetId} = props ?? {};
|
|
370
|
+
|
|
371
|
+
return disableAsset(assetId,requestOptions)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
return { mutationFn, ...mutationOptions }}
|
|
378
|
+
|
|
379
|
+
export type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>
|
|
380
|
+
|
|
381
|
+
export type DisableAssetMutationError = ErrorType<AsError>
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @summary Disables an Asset
|
|
385
|
+
*/
|
|
386
|
+
export const useDisableAsset = <TError = ErrorType<AsError>,
|
|
387
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
374
388
|
) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export const getDisableAssetMutationOptions = <
|
|
382
|
-
TError = ErrorType<AsError>,
|
|
383
|
-
TContext = unknown
|
|
384
|
-
>(options?: {
|
|
385
|
-
mutation?: UseMutationOptions<
|
|
386
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
387
|
-
TError,
|
|
388
|
-
{ assetId: string },
|
|
389
|
-
TContext
|
|
390
|
-
>;
|
|
391
|
-
request?: SecondParameter<typeof customInstance>;
|
|
392
|
-
}): UseMutationOptions<
|
|
393
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
394
|
-
TError,
|
|
395
|
-
{ assetId: string },
|
|
396
|
-
TContext
|
|
397
|
-
> => {
|
|
398
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
399
|
-
|
|
400
|
-
const mutationFn: MutationFunction<
|
|
401
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
402
|
-
{ assetId: string }
|
|
403
|
-
> = (props) => {
|
|
404
|
-
const { assetId } = props ?? {};
|
|
405
|
-
|
|
406
|
-
return disableAsset(assetId, requestOptions);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
return { mutationFn, ...mutationOptions };
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
export type DisableAssetMutationResult = NonNullable<
|
|
413
|
-
Awaited<ReturnType<typeof disableAsset>>
|
|
414
|
-
>;
|
|
415
|
-
|
|
416
|
-
export type DisableAssetMutationError = ErrorType<AsError>;
|
|
417
|
-
|
|
418
|
-
export const useDisableAsset = <
|
|
419
|
-
TError = ErrorType<AsError>,
|
|
420
|
-
TContext = unknown
|
|
421
|
-
>(options?: {
|
|
422
|
-
mutation?: UseMutationOptions<
|
|
423
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
424
|
-
TError,
|
|
425
|
-
{ assetId: string },
|
|
426
|
-
TContext
|
|
427
|
-
>;
|
|
428
|
-
request?: SecondParameter<typeof customInstance>;
|
|
429
|
-
}) => {
|
|
430
|
-
const mutationOptions = getDisableAssetMutationOptions(options);
|
|
431
|
-
|
|
432
|
-
return useMutation(mutationOptions);
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
389
|
+
|
|
390
|
+
const mutationOptions = getDisableAssetMutationOptions(options);
|
|
391
|
+
|
|
392
|
+
return useMutation(mutationOptions);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
435
395
|
* Enables a known Asset
|
|
436
396
|
|
|
437
397
|
* @summary Enables an Asset
|
|
438
398
|
*/
|
|
439
399
|
export const enableAsset = (
|
|
440
|
-
|
|
441
|
-
|
|
400
|
+
assetId: string,
|
|
401
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
return customInstance<void>(
|
|
405
|
+
{url: `/asset/${assetId}/enable`, method: 'PATCH'
|
|
406
|
+
},
|
|
407
|
+
options);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
export const getEnableAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
413
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
414
|
+
): UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext> => {
|
|
415
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof enableAsset>>, {assetId: string}> = (props) => {
|
|
421
|
+
const {assetId} = props ?? {};
|
|
422
|
+
|
|
423
|
+
return enableAsset(assetId,requestOptions)
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
return { mutationFn, ...mutationOptions }}
|
|
430
|
+
|
|
431
|
+
export type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>
|
|
432
|
+
|
|
433
|
+
export type EnableAssetMutationError = ErrorType<AsError>
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* @summary Enables an Asset
|
|
437
|
+
*/
|
|
438
|
+
export const useEnableAsset = <TError = ErrorType<AsError>,
|
|
439
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
442
440
|
) => {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
export const getEnableAssetMutationOptions = <
|
|
450
|
-
TError = ErrorType<AsError>,
|
|
451
|
-
TContext = unknown
|
|
452
|
-
>(options?: {
|
|
453
|
-
mutation?: UseMutationOptions<
|
|
454
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
455
|
-
TError,
|
|
456
|
-
{ assetId: string },
|
|
457
|
-
TContext
|
|
458
|
-
>;
|
|
459
|
-
request?: SecondParameter<typeof customInstance>;
|
|
460
|
-
}): UseMutationOptions<
|
|
461
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
462
|
-
TError,
|
|
463
|
-
{ assetId: string },
|
|
464
|
-
TContext
|
|
465
|
-
> => {
|
|
466
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
467
|
-
|
|
468
|
-
const mutationFn: MutationFunction<
|
|
469
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
470
|
-
{ assetId: string }
|
|
471
|
-
> = (props) => {
|
|
472
|
-
const { assetId } = props ?? {};
|
|
473
|
-
|
|
474
|
-
return enableAsset(assetId, requestOptions);
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
return { mutationFn, ...mutationOptions };
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
export type EnableAssetMutationResult = NonNullable<
|
|
481
|
-
Awaited<ReturnType<typeof enableAsset>>
|
|
482
|
-
>;
|
|
483
|
-
|
|
484
|
-
export type EnableAssetMutationError = ErrorType<AsError>;
|
|
485
|
-
|
|
486
|
-
export const useEnableAsset = <
|
|
487
|
-
TError = ErrorType<AsError>,
|
|
488
|
-
TContext = unknown
|
|
489
|
-
>(options?: {
|
|
490
|
-
mutation?: UseMutationOptions<
|
|
491
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
492
|
-
TError,
|
|
493
|
-
{ assetId: string },
|
|
494
|
-
TContext
|
|
495
|
-
>;
|
|
496
|
-
request?: SecondParameter<typeof customInstance>;
|
|
497
|
-
}) => {
|
|
498
|
-
const mutationOptions = getEnableAssetMutationOptions(options);
|
|
499
|
-
|
|
500
|
-
return useMutation(mutationOptions);
|
|
501
|
-
};
|
|
502
|
-
/**
|
|
441
|
+
|
|
442
|
+
const mutationOptions = getEnableAssetMutationOptions(options);
|
|
443
|
+
|
|
444
|
+
return useMutation(mutationOptions);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
503
447
|
* Attaches an Asset to a **Merchant**. This allows the **Merchant** to query the Asset. **Merchants** cannot obtain Assets that are not attached to them.
|
|
504
448
|
|
|
505
449
|
* @summary Attaches an Asset to a Merchant
|
|
506
450
|
*/
|
|
507
451
|
export const attachAsset = (
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
452
|
+
assetId: string,
|
|
453
|
+
params?: AttachAssetParams,
|
|
454
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
return customInstance<void>(
|
|
458
|
+
{url: `/asset/${assetId}/attach`, method: 'PATCH',
|
|
459
|
+
params
|
|
460
|
+
},
|
|
461
|
+
options);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
export const getAttachAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
467
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
468
|
+
): UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext> => {
|
|
469
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachAsset>>, {assetId: string;params?: AttachAssetParams}> = (props) => {
|
|
475
|
+
const {assetId,params} = props ?? {};
|
|
476
|
+
|
|
477
|
+
return attachAsset(assetId,params,requestOptions)
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
return { mutationFn, ...mutationOptions }}
|
|
484
|
+
|
|
485
|
+
export type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>
|
|
486
|
+
|
|
487
|
+
export type AttachAssetMutationError = ErrorType<AsError>
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* @summary Attaches an Asset to a Merchant
|
|
491
|
+
*/
|
|
492
|
+
export const useAttachAsset = <TError = ErrorType<AsError>,
|
|
493
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
511
494
|
) => {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
export const getAttachAssetMutationOptions = <
|
|
519
|
-
TError = ErrorType<AsError>,
|
|
520
|
-
TContext = unknown
|
|
521
|
-
>(options?: {
|
|
522
|
-
mutation?: UseMutationOptions<
|
|
523
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
524
|
-
TError,
|
|
525
|
-
{ assetId: string; params?: AttachAssetParams },
|
|
526
|
-
TContext
|
|
527
|
-
>;
|
|
528
|
-
request?: SecondParameter<typeof customInstance>;
|
|
529
|
-
}): UseMutationOptions<
|
|
530
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
531
|
-
TError,
|
|
532
|
-
{ assetId: string; params?: AttachAssetParams },
|
|
533
|
-
TContext
|
|
534
|
-
> => {
|
|
535
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
536
|
-
|
|
537
|
-
const mutationFn: MutationFunction<
|
|
538
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
539
|
-
{ assetId: string; params?: AttachAssetParams }
|
|
540
|
-
> = (props) => {
|
|
541
|
-
const { assetId, params } = props ?? {};
|
|
542
|
-
|
|
543
|
-
return attachAsset(assetId, params, requestOptions);
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
return { mutationFn, ...mutationOptions };
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
export type AttachAssetMutationResult = NonNullable<
|
|
550
|
-
Awaited<ReturnType<typeof attachAsset>>
|
|
551
|
-
>;
|
|
552
|
-
|
|
553
|
-
export type AttachAssetMutationError = ErrorType<AsError>;
|
|
554
|
-
|
|
555
|
-
export const useAttachAsset = <
|
|
556
|
-
TError = ErrorType<AsError>,
|
|
557
|
-
TContext = unknown
|
|
558
|
-
>(options?: {
|
|
559
|
-
mutation?: UseMutationOptions<
|
|
560
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
561
|
-
TError,
|
|
562
|
-
{ assetId: string; params?: AttachAssetParams },
|
|
563
|
-
TContext
|
|
564
|
-
>;
|
|
565
|
-
request?: SecondParameter<typeof customInstance>;
|
|
566
|
-
}) => {
|
|
567
|
-
const mutationOptions = getAttachAssetMutationOptions(options);
|
|
568
|
-
|
|
569
|
-
return useMutation(mutationOptions);
|
|
570
|
-
};
|
|
571
|
-
/**
|
|
495
|
+
|
|
496
|
+
const mutationOptions = getAttachAssetMutationOptions(options);
|
|
497
|
+
|
|
498
|
+
return useMutation(mutationOptions);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
572
501
|
* Detaches an Asset from a **Merchant**
|
|
573
502
|
|
|
574
503
|
* @summary Detaches an Asset from a Merchant
|
|
575
504
|
*/
|
|
576
505
|
export const detachAsset = (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
506
|
+
assetId: string,
|
|
507
|
+
params?: DetachAssetParams,
|
|
508
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
return customInstance<void>(
|
|
512
|
+
{url: `/asset/${assetId}/detach`, method: 'PATCH',
|
|
513
|
+
params
|
|
514
|
+
},
|
|
515
|
+
options);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
export const getDetachAssetMutationOptions = <TError = ErrorType<AsError>,
|
|
521
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
522
|
+
): UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext> => {
|
|
523
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof detachAsset>>, {assetId: string;params?: DetachAssetParams}> = (props) => {
|
|
529
|
+
const {assetId,params} = props ?? {};
|
|
530
|
+
|
|
531
|
+
return detachAsset(assetId,params,requestOptions)
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
return { mutationFn, ...mutationOptions }}
|
|
538
|
+
|
|
539
|
+
export type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>
|
|
540
|
+
|
|
541
|
+
export type DetachAssetMutationError = ErrorType<AsError>
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* @summary Detaches an Asset from a Merchant
|
|
545
|
+
*/
|
|
546
|
+
export const useDetachAsset = <TError = ErrorType<AsError>,
|
|
547
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
580
548
|
) => {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
export const getDetachAssetMutationOptions = <
|
|
588
|
-
TError = ErrorType<AsError>,
|
|
589
|
-
TContext = unknown
|
|
590
|
-
>(options?: {
|
|
591
|
-
mutation?: UseMutationOptions<
|
|
592
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
593
|
-
TError,
|
|
594
|
-
{ assetId: string; params?: DetachAssetParams },
|
|
595
|
-
TContext
|
|
596
|
-
>;
|
|
597
|
-
request?: SecondParameter<typeof customInstance>;
|
|
598
|
-
}): UseMutationOptions<
|
|
599
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
600
|
-
TError,
|
|
601
|
-
{ assetId: string; params?: DetachAssetParams },
|
|
602
|
-
TContext
|
|
603
|
-
> => {
|
|
604
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
605
|
-
|
|
606
|
-
const mutationFn: MutationFunction<
|
|
607
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
608
|
-
{ assetId: string; params?: DetachAssetParams }
|
|
609
|
-
> = (props) => {
|
|
610
|
-
const { assetId, params } = props ?? {};
|
|
611
|
-
|
|
612
|
-
return detachAsset(assetId, params, requestOptions);
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
return { mutationFn, ...mutationOptions };
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
export type DetachAssetMutationResult = NonNullable<
|
|
619
|
-
Awaited<ReturnType<typeof detachAsset>>
|
|
620
|
-
>;
|
|
621
|
-
|
|
622
|
-
export type DetachAssetMutationError = ErrorType<AsError>;
|
|
623
|
-
|
|
624
|
-
export const useDetachAsset = <
|
|
625
|
-
TError = ErrorType<AsError>,
|
|
626
|
-
TContext = unknown
|
|
627
|
-
>(options?: {
|
|
628
|
-
mutation?: UseMutationOptions<
|
|
629
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
630
|
-
TError,
|
|
631
|
-
{ assetId: string; params?: DetachAssetParams },
|
|
632
|
-
TContext
|
|
633
|
-
>;
|
|
634
|
-
request?: SecondParameter<typeof customInstance>;
|
|
635
|
-
}) => {
|
|
636
|
-
const mutationOptions = getDetachAssetMutationOptions(options);
|
|
637
|
-
|
|
638
|
-
return useMutation(mutationOptions);
|
|
639
|
-
};
|
|
549
|
+
|
|
550
|
+
const mutationOptions = getDetachAssetMutationOptions(options);
|
|
551
|
+
|
|
552
|
+
return useMutation(mutationOptions);
|
|
553
|
+
}
|
|
554
|
+
|