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