@squonk/account-server-client 1.0.2-rc.3 → 1.0.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/asset/asset.cjs +34 -18
- package/asset/asset.cjs.map +1 -1
- package/asset/asset.d.ts +16 -16
- package/asset/asset.js +35 -19
- package/asset/asset.js.map +1 -1
- package/{custom-instance-b8075093.d.ts → custom-instance-93fb01eb.d.ts} +22 -20
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/merchant/merchant.cjs +15 -13
- package/merchant/merchant.cjs.map +1 -1
- package/merchant/merchant.d.ts +1 -1
- package/merchant/merchant.js +16 -14
- package/merchant/merchant.js.map +1 -1
- package/organisation/organisation.cjs +18 -6
- package/organisation/organisation.cjs.map +1 -1
- package/organisation/organisation.d.ts +7 -7
- package/organisation/organisation.js +19 -7
- package/organisation/organisation.js.map +1 -1
- package/package.json +1 -1
- package/product/product.cjs +47 -38
- package/product/product.cjs.map +1 -1
- package/product/product.d.ts +10 -10
- package/product/product.js +48 -39
- package/product/product.js.map +1 -1
- package/src/account-server-api.schemas.ts +73 -87
- package/src/asset/asset.ts +248 -345
- package/src/merchant/merchant.ts +62 -84
- package/src/organisation/organisation.ts +131 -184
- package/src/product/product.ts +279 -422
- package/src/state/state.ts +36 -42
- package/src/unit/unit.ts +218 -301
- package/src/user/user.ts +224 -327
- package/state/state.cjs +9 -9
- package/state/state.cjs.map +1 -1
- package/state/state.d.ts +1 -1
- package/state/state.js +10 -10
- package/state/state.js.map +1 -1
- package/unit/unit.cjs +40 -25
- package/unit/unit.cjs.map +1 -1
- package/unit/unit.d.ts +10 -10
- package/unit/unit.js +41 -26
- package/unit/unit.js.map +1 -1
- package/user/user.cjs +38 -20
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +10 -10
- package/user/user.js +39 -21
- package/user/user.js.map +1 -1
package/src/asset/asset.ts
CHANGED
|
@@ -8,15 +8,18 @@ A service that provides access to the Account Server, which gives *registered* u
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useQuery,
|
|
13
|
+
useMutation
|
|
14
|
+
} from 'react-query'
|
|
12
15
|
import type {
|
|
13
16
|
UseQueryOptions,
|
|
14
17
|
UseMutationOptions,
|
|
15
18
|
QueryFunction,
|
|
16
19
|
MutationFunction,
|
|
17
20
|
UseQueryResult,
|
|
18
|
-
QueryKey
|
|
19
|
-
} from
|
|
21
|
+
QueryKey
|
|
22
|
+
} from 'react-query'
|
|
20
23
|
import type {
|
|
21
24
|
AssetGetResponse,
|
|
22
25
|
AsError,
|
|
@@ -24,15 +27,16 @@ import type {
|
|
|
24
27
|
AssetPostResponse,
|
|
25
28
|
AssetPostBodyBody,
|
|
26
29
|
AttachAssetParams,
|
|
27
|
-
DetachAssetParams
|
|
28
|
-
} from
|
|
29
|
-
import { customInstance } from
|
|
30
|
-
import type { ErrorType } from
|
|
30
|
+
DetachAssetParams
|
|
31
|
+
} from '../account-server-api.schemas'
|
|
32
|
+
import { customInstance } from '.././custom-instance'
|
|
33
|
+
import type { ErrorType } from '.././custom-instance'
|
|
34
|
+
|
|
31
35
|
|
|
32
36
|
// eslint-disable-next-line
|
|
33
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
37
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
34
38
|
config: any,
|
|
35
|
-
args: infer P
|
|
39
|
+
args: infer P,
|
|
36
40
|
) => any
|
|
37
41
|
? P
|
|
38
42
|
: never;
|
|
@@ -43,58 +47,42 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
|
43
47
|
* @summary Gets Assets
|
|
44
48
|
*/
|
|
45
49
|
export const getAsset = (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
signal?: AbortSignal
|
|
50
|
+
params?: GetAssetParams,
|
|
51
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
49
52
|
) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export type GetAssetQueryResult = NonNullable<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
TData
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
params?: GetAssetParams,
|
|
71
|
-
options?: {
|
|
72
|
-
query?: UseQueryOptions<
|
|
73
|
-
Awaited<ReturnType<typeof getAsset>>,
|
|
74
|
-
TError,
|
|
75
|
-
TData
|
|
76
|
-
>;
|
|
77
|
-
request?: SecondParameter<typeof customInstance>;
|
|
78
|
-
}
|
|
79
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
80
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
53
|
+
return customInstance<AssetGetResponse>(
|
|
54
|
+
{url: `/asset`, method: 'get',
|
|
55
|
+
params, signal
|
|
56
|
+
},
|
|
57
|
+
options);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export const getGetAssetQueryKey = (params?: GetAssetParams,) => [`/asset`, ...(params ? [params]: [])];
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>
|
|
65
|
+
export type GetAssetQueryError = ErrorType<AsError | void>
|
|
66
|
+
|
|
67
|
+
export const useGetAsset = <TData = Awaited<ReturnType<typeof getAsset>>, TError = ErrorType<AsError | void>>(
|
|
68
|
+
params?: GetAssetParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
69
|
+
|
|
70
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
71
|
+
|
|
72
|
+
const {query: queryOptions, request: requestOptions} = options ?? {}
|
|
81
73
|
|
|
82
74
|
const queryKey = queryOptions?.queryKey ?? getGetAssetQueryKey(params);
|
|
83
75
|
|
|
84
|
-
|
|
85
|
-
signal,
|
|
86
|
-
}) => getAsset(params, requestOptions, signal);
|
|
76
|
+
|
|
87
77
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
queryOptions
|
|
92
|
-
) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
78
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(params, requestOptions, signal);
|
|
79
|
+
|
|
80
|
+
const query = useQuery<Awaited<ReturnType<typeof getAsset>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
93
81
|
|
|
94
82
|
query.queryKey = queryKey;
|
|
95
83
|
|
|
96
84
|
return query;
|
|
97
|
-
}
|
|
85
|
+
}
|
|
98
86
|
|
|
99
87
|
/**
|
|
100
88
|
* Creates an Asset, which can be attached to our User account, or a Product, Unit or Organisation you have access to
|
|
@@ -102,327 +90,242 @@ export const useGetAsset = <
|
|
|
102
90
|
* @summary Create an Asset
|
|
103
91
|
*/
|
|
104
92
|
export const createAsset = (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
url: `/asset`,
|
|
128
|
-
method: "post",
|
|
129
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
130
|
-
data: formData,
|
|
93
|
+
assetPostBodyBody: AssetPostBodyBody,
|
|
94
|
+
options?: SecondParameter<typeof customInstance>,) => {const formData = new FormData();
|
|
95
|
+
formData.append('name', assetPostBodyBody.name)
|
|
96
|
+
if(assetPostBodyBody.content_file !== undefined) {
|
|
97
|
+
formData.append('content_file', assetPostBodyBody.content_file)
|
|
98
|
+
}
|
|
99
|
+
if(assetPostBodyBody.content_string !== undefined) {
|
|
100
|
+
formData.append('content_string', assetPostBodyBody.content_string)
|
|
101
|
+
}
|
|
102
|
+
formData.append('scope', assetPostBodyBody.scope)
|
|
103
|
+
if(assetPostBodyBody.scope_id !== undefined) {
|
|
104
|
+
formData.append('scope_id', assetPostBodyBody.scope_id)
|
|
105
|
+
}
|
|
106
|
+
formData.append('secret', assetPostBodyBody.secret.toString())
|
|
107
|
+
if(assetPostBodyBody.description !== undefined) {
|
|
108
|
+
formData.append('description', assetPostBodyBody.description)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return customInstance<AssetPostResponse>(
|
|
112
|
+
{url: `/asset`, method: 'post',
|
|
113
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
114
|
+
data: formData
|
|
131
115
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
export type
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
> = (props) => {
|
|
160
|
-
const { data } = props ?? {};
|
|
161
|
-
|
|
162
|
-
return createAsset(data, requestOptions);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return useMutation<
|
|
166
|
-
Awaited<ReturnType<typeof createAsset>>,
|
|
167
|
-
TError,
|
|
168
|
-
{ data: AssetPostBodyBody },
|
|
169
|
-
TContext
|
|
170
|
-
>(mutationFn, mutationOptions);
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
116
|
+
options);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>
|
|
122
|
+
export type CreateAssetMutationBody = AssetPostBodyBody
|
|
123
|
+
export type CreateAssetMutationError = ErrorType<AsError | void>
|
|
124
|
+
|
|
125
|
+
export const useCreateAsset = <TError = ErrorType<AsError | void>,
|
|
126
|
+
|
|
127
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: AssetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
128
|
+
) => {
|
|
129
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: AssetPostBodyBody}> = (props) => {
|
|
135
|
+
const {data} = props ?? {};
|
|
136
|
+
|
|
137
|
+
return createAsset(data,requestOptions)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return useMutation<Awaited<ReturnType<typeof createAsset>>, TError, {data: AssetPostBodyBody}, TContext>(mutationFn, mutationOptions)
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
173
143
|
* Deletes a known Asset. Assets that are attached to merchants cannot be deleted
|
|
174
144
|
|
|
175
145
|
* @summary Deletes an Asset
|
|
176
146
|
*/
|
|
177
147
|
export const deleteAsset = (
|
|
178
|
-
|
|
179
|
-
|
|
148
|
+
assetId: string,
|
|
149
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
150
|
+
return customInstance<void>(
|
|
151
|
+
{url: `/asset/${assetId}`, method: 'delete'
|
|
152
|
+
},
|
|
153
|
+
options);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>
|
|
159
|
+
|
|
160
|
+
export type DeleteAssetMutationError = ErrorType<AsError>
|
|
161
|
+
|
|
162
|
+
export const useDeleteAsset = <TError = ErrorType<AsError>,
|
|
163
|
+
|
|
164
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
180
165
|
) => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
TContext = unknown
|
|
196
|
-
>(options?: {
|
|
197
|
-
mutation?: UseMutationOptions<
|
|
198
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
199
|
-
TError,
|
|
200
|
-
{ assetId: string },
|
|
201
|
-
TContext
|
|
202
|
-
>;
|
|
203
|
-
request?: SecondParameter<typeof customInstance>;
|
|
204
|
-
}) => {
|
|
205
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
206
|
-
|
|
207
|
-
const mutationFn: MutationFunction<
|
|
208
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
209
|
-
{ assetId: string }
|
|
210
|
-
> = (props) => {
|
|
211
|
-
const { assetId } = props ?? {};
|
|
212
|
-
|
|
213
|
-
return deleteAsset(assetId, requestOptions);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
return useMutation<
|
|
217
|
-
Awaited<ReturnType<typeof deleteAsset>>,
|
|
218
|
-
TError,
|
|
219
|
-
{ assetId: string },
|
|
220
|
-
TContext
|
|
221
|
-
>(mutationFn, mutationOptions);
|
|
222
|
-
};
|
|
223
|
-
/**
|
|
166
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {assetId: string}> = (props) => {
|
|
172
|
+
const {assetId} = props ?? {};
|
|
173
|
+
|
|
174
|
+
return deleteAsset(assetId,requestOptions)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return useMutation<Awaited<ReturnType<typeof deleteAsset>>, TError, {assetId: string}, TContext>(mutationFn, mutationOptions)
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
224
180
|
* Disables a known Asset
|
|
225
181
|
|
|
226
182
|
* @summary Disables an Asset
|
|
227
183
|
*/
|
|
228
184
|
export const disableAsset = (
|
|
229
|
-
|
|
230
|
-
|
|
185
|
+
assetId: string,
|
|
186
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
187
|
+
return customInstance<void>(
|
|
188
|
+
{url: `/asset/${assetId}/disable`, method: 'patch'
|
|
189
|
+
},
|
|
190
|
+
options);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
export type DisableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof disableAsset>>>
|
|
196
|
+
|
|
197
|
+
export type DisableAssetMutationError = ErrorType<AsError>
|
|
198
|
+
|
|
199
|
+
export const useDisableAsset = <TError = ErrorType<AsError>,
|
|
200
|
+
|
|
201
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof disableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
231
202
|
) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
TContext = unknown
|
|
247
|
-
>(options?: {
|
|
248
|
-
mutation?: UseMutationOptions<
|
|
249
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
250
|
-
TError,
|
|
251
|
-
{ assetId: string },
|
|
252
|
-
TContext
|
|
253
|
-
>;
|
|
254
|
-
request?: SecondParameter<typeof customInstance>;
|
|
255
|
-
}) => {
|
|
256
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
257
|
-
|
|
258
|
-
const mutationFn: MutationFunction<
|
|
259
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
260
|
-
{ assetId: string }
|
|
261
|
-
> = (props) => {
|
|
262
|
-
const { assetId } = props ?? {};
|
|
263
|
-
|
|
264
|
-
return disableAsset(assetId, requestOptions);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
return useMutation<
|
|
268
|
-
Awaited<ReturnType<typeof disableAsset>>,
|
|
269
|
-
TError,
|
|
270
|
-
{ assetId: string },
|
|
271
|
-
TContext
|
|
272
|
-
>(mutationFn, mutationOptions);
|
|
273
|
-
};
|
|
274
|
-
/**
|
|
203
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof disableAsset>>, {assetId: string}> = (props) => {
|
|
209
|
+
const {assetId} = props ?? {};
|
|
210
|
+
|
|
211
|
+
return disableAsset(assetId,requestOptions)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return useMutation<Awaited<ReturnType<typeof disableAsset>>, TError, {assetId: string}, TContext>(mutationFn, mutationOptions)
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
275
217
|
* Enables a known Asset
|
|
276
218
|
|
|
277
219
|
* @summary Enables an Asset
|
|
278
220
|
*/
|
|
279
221
|
export const enableAsset = (
|
|
280
|
-
|
|
281
|
-
|
|
222
|
+
assetId: string,
|
|
223
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
224
|
+
return customInstance<void>(
|
|
225
|
+
{url: `/asset/${assetId}/enable`, method: 'patch'
|
|
226
|
+
},
|
|
227
|
+
options);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
export type EnableAssetMutationResult = NonNullable<Awaited<ReturnType<typeof enableAsset>>>
|
|
233
|
+
|
|
234
|
+
export type EnableAssetMutationError = ErrorType<AsError>
|
|
235
|
+
|
|
236
|
+
export const useEnableAsset = <TError = ErrorType<AsError>,
|
|
237
|
+
|
|
238
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof enableAsset>>, TError,{assetId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
282
239
|
) => {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
TContext = unknown
|
|
298
|
-
>(options?: {
|
|
299
|
-
mutation?: UseMutationOptions<
|
|
300
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
301
|
-
TError,
|
|
302
|
-
{ assetId: string },
|
|
303
|
-
TContext
|
|
304
|
-
>;
|
|
305
|
-
request?: SecondParameter<typeof customInstance>;
|
|
306
|
-
}) => {
|
|
307
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
308
|
-
|
|
309
|
-
const mutationFn: MutationFunction<
|
|
310
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
311
|
-
{ assetId: string }
|
|
312
|
-
> = (props) => {
|
|
313
|
-
const { assetId } = props ?? {};
|
|
314
|
-
|
|
315
|
-
return enableAsset(assetId, requestOptions);
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
return useMutation<
|
|
319
|
-
Awaited<ReturnType<typeof enableAsset>>,
|
|
320
|
-
TError,
|
|
321
|
-
{ assetId: string },
|
|
322
|
-
TContext
|
|
323
|
-
>(mutationFn, mutationOptions);
|
|
324
|
-
};
|
|
325
|
-
/**
|
|
240
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof enableAsset>>, {assetId: string}> = (props) => {
|
|
246
|
+
const {assetId} = props ?? {};
|
|
247
|
+
|
|
248
|
+
return enableAsset(assetId,requestOptions)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return useMutation<Awaited<ReturnType<typeof enableAsset>>, TError, {assetId: string}, TContext>(mutationFn, mutationOptions)
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
326
254
|
* Attaches an Asset to a merchant
|
|
327
255
|
|
|
328
256
|
* @summary Attaches an Asset to a Merchant
|
|
329
257
|
*/
|
|
330
258
|
export const attachAsset = (
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
259
|
+
assetId: string,
|
|
260
|
+
params?: AttachAssetParams,
|
|
261
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
262
|
+
return customInstance<void>(
|
|
263
|
+
{url: `/asset/${assetId}/attach`, method: 'patch',
|
|
264
|
+
params
|
|
265
|
+
},
|
|
266
|
+
options);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
export type AttachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof attachAsset>>>
|
|
272
|
+
|
|
273
|
+
export type AttachAssetMutationError = ErrorType<AsError>
|
|
274
|
+
|
|
275
|
+
export const useAttachAsset = <TError = ErrorType<AsError>,
|
|
276
|
+
|
|
277
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachAsset>>, TError,{assetId: string;params?: AttachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
334
278
|
) => {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
TContext = unknown
|
|
350
|
-
>(options?: {
|
|
351
|
-
mutation?: UseMutationOptions<
|
|
352
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
353
|
-
TError,
|
|
354
|
-
{ assetId: string; params?: AttachAssetParams },
|
|
355
|
-
TContext
|
|
356
|
-
>;
|
|
357
|
-
request?: SecondParameter<typeof customInstance>;
|
|
358
|
-
}) => {
|
|
359
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
360
|
-
|
|
361
|
-
const mutationFn: MutationFunction<
|
|
362
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
363
|
-
{ assetId: string; params?: AttachAssetParams }
|
|
364
|
-
> = (props) => {
|
|
365
|
-
const { assetId, params } = props ?? {};
|
|
366
|
-
|
|
367
|
-
return attachAsset(assetId, params, requestOptions);
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
return useMutation<
|
|
371
|
-
Awaited<ReturnType<typeof attachAsset>>,
|
|
372
|
-
TError,
|
|
373
|
-
{ assetId: string; params?: AttachAssetParams },
|
|
374
|
-
TContext
|
|
375
|
-
>(mutationFn, mutationOptions);
|
|
376
|
-
};
|
|
377
|
-
/**
|
|
279
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachAsset>>, {assetId: string;params?: AttachAssetParams}> = (props) => {
|
|
285
|
+
const {assetId,params} = props ?? {};
|
|
286
|
+
|
|
287
|
+
return attachAsset(assetId,params,requestOptions)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return useMutation<Awaited<ReturnType<typeof attachAsset>>, TError, {assetId: string;params?: AttachAssetParams}, TContext>(mutationFn, mutationOptions)
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
378
293
|
* Detaches an Asset from a merchant
|
|
379
294
|
|
|
380
295
|
* @summary Detaches an Asset from a Merchant
|
|
381
296
|
*/
|
|
382
297
|
export const detachAsset = (
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
298
|
+
assetId: string,
|
|
299
|
+
params?: DetachAssetParams,
|
|
300
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
301
|
+
return customInstance<void>(
|
|
302
|
+
{url: `/asset/${assetId}/detach`, method: 'patch',
|
|
303
|
+
params
|
|
304
|
+
},
|
|
305
|
+
options);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
export type DetachAssetMutationResult = NonNullable<Awaited<ReturnType<typeof detachAsset>>>
|
|
311
|
+
|
|
312
|
+
export type DetachAssetMutationError = ErrorType<AsError>
|
|
313
|
+
|
|
314
|
+
export const useDetachAsset = <TError = ErrorType<AsError>,
|
|
315
|
+
|
|
316
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof detachAsset>>, TError,{assetId: string;params?: DetachAssetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
386
317
|
) => {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
TContext = unknown
|
|
402
|
-
>(options?: {
|
|
403
|
-
mutation?: UseMutationOptions<
|
|
404
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
405
|
-
TError,
|
|
406
|
-
{ assetId: string; params?: DetachAssetParams },
|
|
407
|
-
TContext
|
|
408
|
-
>;
|
|
409
|
-
request?: SecondParameter<typeof customInstance>;
|
|
410
|
-
}) => {
|
|
411
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
412
|
-
|
|
413
|
-
const mutationFn: MutationFunction<
|
|
414
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
415
|
-
{ assetId: string; params?: DetachAssetParams }
|
|
416
|
-
> = (props) => {
|
|
417
|
-
const { assetId, params } = props ?? {};
|
|
418
|
-
|
|
419
|
-
return detachAsset(assetId, params, requestOptions);
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
return useMutation<
|
|
423
|
-
Awaited<ReturnType<typeof detachAsset>>,
|
|
424
|
-
TError,
|
|
425
|
-
{ assetId: string; params?: DetachAssetParams },
|
|
426
|
-
TContext
|
|
427
|
-
>(mutationFn, mutationOptions);
|
|
428
|
-
};
|
|
318
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof detachAsset>>, {assetId: string;params?: DetachAssetParams}> = (props) => {
|
|
324
|
+
const {assetId,params} = props ?? {};
|
|
325
|
+
|
|
326
|
+
return detachAsset(assetId,params,requestOptions)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return useMutation<Awaited<ReturnType<typeof detachAsset>>, TError, {assetId: string;params?: DetachAssetParams}, TContext>(mutationFn, mutationOptions)
|
|
330
|
+
}
|
|
331
|
+
|