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