@wix/auto_sdk_metro_products 1.0.0
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/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.context.d.ts +14 -0
- package/build/cjs/src/metroinspector-v1-product-products.context.js +20 -0
- package/build/cjs/src/metroinspector-v1-product-products.context.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.http.d.ts +16 -0
- package/build/cjs/src/metroinspector-v1-product-products.http.js +728 -0
- package/build/cjs/src/metroinspector-v1-product-products.http.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.meta.d.ts +30 -0
- package/build/cjs/src/metroinspector-v1-product-products.meta.js +218 -0
- package/build/cjs/src/metroinspector-v1-product-products.meta.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.public.d.ts +68 -0
- package/build/cjs/src/metroinspector-v1-product-products.public.js +70 -0
- package/build/cjs/src/metroinspector-v1-product-products.public.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.types.d.ts +587 -0
- package/build/cjs/src/metroinspector-v1-product-products.types.js +43 -0
- package/build/cjs/src/metroinspector-v1-product-products.types.js.map +1 -0
- package/build/cjs/src/metroinspector-v1-product-products.universal.d.ts +626 -0
- package/build/cjs/src/metroinspector-v1-product-products.universal.js +721 -0
- package/build/cjs/src/metroinspector-v1-product-products.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/package.json +3 -0
- package/build/es/src/metroinspector-v1-product-products.context.d.ts +14 -0
- package/build/es/src/metroinspector-v1-product-products.context.js +14 -0
- package/build/es/src/metroinspector-v1-product-products.context.js.map +1 -0
- package/build/es/src/metroinspector-v1-product-products.http.d.ts +16 -0
- package/build/es/src/metroinspector-v1-product-products.http.js +715 -0
- package/build/es/src/metroinspector-v1-product-products.http.js.map +1 -0
- package/build/es/src/metroinspector-v1-product-products.meta.d.ts +30 -0
- package/build/es/src/metroinspector-v1-product-products.meta.js +182 -0
- package/build/es/src/metroinspector-v1-product-products.meta.js.map +1 -0
- package/build/es/src/metroinspector-v1-product-products.public.d.ts +68 -0
- package/build/es/src/metroinspector-v1-product-products.public.js +54 -0
- package/build/es/src/metroinspector-v1-product-products.public.js.map +1 -0
- package/build/es/src/metroinspector-v1-product-products.types.d.ts +587 -0
- package/build/es/src/metroinspector-v1-product-products.types.js +40 -0
- package/build/es/src/metroinspector-v1-product-products.types.js.map +1 -0
- package/build/es/src/metroinspector-v1-product-products.universal.d.ts +626 -0
- package/build/es/src/metroinspector-v1-product-products.universal.js +685 -0
- package/build/es/src/metroinspector-v1-product-products.universal.js.map +1 -0
- package/build/internal/cjs/index.d.ts +1 -0
- package/build/internal/cjs/index.js +18 -0
- package/build/internal/cjs/index.js.map +1 -0
- package/build/internal/cjs/index.typings.d.ts +1 -0
- package/build/internal/cjs/index.typings.js +18 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +1 -0
- package/build/internal/cjs/meta.js +18 -0
- package/build/internal/cjs/meta.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.context.d.ts +14 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.context.js +20 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.context.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.http.d.ts +16 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.http.js +728 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.http.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.meta.d.ts +30 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.meta.js +218 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.meta.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.public.d.ts +68 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.public.js +70 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.public.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.types.d.ts +587 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.types.js +43 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.types.js.map +1 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.universal.d.ts +626 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.universal.js +721 -0
- package/build/internal/cjs/src/metroinspector-v1-product-products.universal.js.map +1 -0
- package/build/internal/es/index.d.ts +1 -0
- package/build/internal/es/index.js +2 -0
- package/build/internal/es/index.js.map +1 -0
- package/build/internal/es/index.typings.d.ts +1 -0
- package/build/internal/es/index.typings.js +2 -0
- package/build/internal/es/index.typings.js.map +1 -0
- package/build/internal/es/meta.d.ts +1 -0
- package/build/internal/es/meta.js +2 -0
- package/build/internal/es/meta.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.context.d.ts +14 -0
- package/build/internal/es/src/metroinspector-v1-product-products.context.js +14 -0
- package/build/internal/es/src/metroinspector-v1-product-products.context.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.http.d.ts +16 -0
- package/build/internal/es/src/metroinspector-v1-product-products.http.js +715 -0
- package/build/internal/es/src/metroinspector-v1-product-products.http.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.meta.d.ts +30 -0
- package/build/internal/es/src/metroinspector-v1-product-products.meta.js +182 -0
- package/build/internal/es/src/metroinspector-v1-product-products.meta.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.public.d.ts +68 -0
- package/build/internal/es/src/metroinspector-v1-product-products.public.js +54 -0
- package/build/internal/es/src/metroinspector-v1-product-products.public.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.types.d.ts +587 -0
- package/build/internal/es/src/metroinspector-v1-product-products.types.js +40 -0
- package/build/internal/es/src/metroinspector-v1-product-products.types.js.map +1 -0
- package/build/internal/es/src/metroinspector-v1-product-products.universal.d.ts +626 -0
- package/build/internal/es/src/metroinspector-v1-product-products.universal.js +685 -0
- package/build/internal/es/src/metroinspector-v1-product-products.universal.js.map +1 -0
- package/meta/package.json +3 -0
- package/package.json +52 -0
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
+
import { queryBuilder } from '@wix/sdk-runtime/query-builder';
|
|
3
|
+
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
4
|
+
import * as ambassadorWixMetroinspectorV1Product from './metroinspector-v1-product-products.http.js';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { transformSDKAudioToRESTAudio } from '@wix/sdk-runtime/transformations/audio';
|
|
7
|
+
import { transformRESTAudioToSDKAudio } from '@wix/sdk-runtime/transformations/audio';
|
|
8
|
+
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
|
|
9
|
+
import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
|
|
10
|
+
import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
|
|
11
|
+
import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
|
|
12
|
+
import { transformSDKVideoV2ToRESTVideoV2 } from '@wix/sdk-runtime/transformations/video-v2';
|
|
13
|
+
import { transformRESTVideoV2ToSDKVideoV2 } from '@wix/sdk-runtime/transformations/video-v2';
|
|
14
|
+
import { transformSDKDocumentToRESTDocument } from '@wix/sdk-runtime/transformations/document';
|
|
15
|
+
import { transformRESTDocumentToSDKDocument } from '@wix/sdk-runtime/transformations/document';
|
|
16
|
+
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
17
|
+
export var SubdivisionType;
|
|
18
|
+
(function (SubdivisionType) {
|
|
19
|
+
SubdivisionType["UNKNOWN_SUBDIVISION_TYPE"] = "UNKNOWN_SUBDIVISION_TYPE";
|
|
20
|
+
/** State */
|
|
21
|
+
SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_1"] = "ADMINISTRATIVE_AREA_LEVEL_1";
|
|
22
|
+
/** County */
|
|
23
|
+
SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_2"] = "ADMINISTRATIVE_AREA_LEVEL_2";
|
|
24
|
+
/** City/town */
|
|
25
|
+
SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_3"] = "ADMINISTRATIVE_AREA_LEVEL_3";
|
|
26
|
+
/** Neighborhood/quarter */
|
|
27
|
+
SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_4"] = "ADMINISTRATIVE_AREA_LEVEL_4";
|
|
28
|
+
/** Street/block */
|
|
29
|
+
SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_5"] = "ADMINISTRATIVE_AREA_LEVEL_5";
|
|
30
|
+
/** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */
|
|
31
|
+
SubdivisionType["COUNTRY"] = "COUNTRY";
|
|
32
|
+
})(SubdivisionType || (SubdivisionType = {}));
|
|
33
|
+
/**
|
|
34
|
+
* The 'rel' attribute of the link. The rel attribute defines the relationship between a linked resource and the current document.
|
|
35
|
+
* Further reading (also about different possible rel types): https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
|
|
36
|
+
* Following are the accepted 'rel' types by Wix applications.
|
|
37
|
+
*/
|
|
38
|
+
export var LinkRel;
|
|
39
|
+
(function (LinkRel) {
|
|
40
|
+
/** default (not implemented) */
|
|
41
|
+
LinkRel["unknown_link_rel"] = "unknown_link_rel";
|
|
42
|
+
/** Indicates that the current document's original author or publisher does not endorse the referenced document. */
|
|
43
|
+
LinkRel["nofollow"] = "nofollow";
|
|
44
|
+
/** Instructs the browser to navigate to the target resource without granting the new browsing context access to the document that opened it. */
|
|
45
|
+
LinkRel["noopener"] = "noopener";
|
|
46
|
+
/** No Referer header will be included. Additionally, has the same effect as noopener. */
|
|
47
|
+
LinkRel["noreferrer"] = "noreferrer";
|
|
48
|
+
/** Indicates a link that resulted from advertisements or paid placements. */
|
|
49
|
+
LinkRel["sponsored"] = "sponsored";
|
|
50
|
+
})(LinkRel || (LinkRel = {}));
|
|
51
|
+
export var SortOrder;
|
|
52
|
+
(function (SortOrder) {
|
|
53
|
+
SortOrder["ASC"] = "ASC";
|
|
54
|
+
SortOrder["DESC"] = "DESC";
|
|
55
|
+
})(SortOrder || (SortOrder = {}));
|
|
56
|
+
/**
|
|
57
|
+
* Creating a product
|
|
58
|
+
* @public
|
|
59
|
+
* @requiredField options.product.title
|
|
60
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.CreateProduct
|
|
61
|
+
*/
|
|
62
|
+
export async function createProduct(options) {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
65
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({ product: options?.product }), [
|
|
66
|
+
{
|
|
67
|
+
transformFn: transformSDKImageToRESTImage,
|
|
68
|
+
paths: [
|
|
69
|
+
{ path: 'product.image' },
|
|
70
|
+
{ path: 'product.variants.image' },
|
|
71
|
+
{ path: 'product.mainVariant.image' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
76
|
+
paths: [{ path: 'product.address' }, { path: 'product.customAddress' }],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
transformFn: transformSDKDocumentToRESTDocument,
|
|
80
|
+
paths: [{ path: 'product.document' }],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
transformFn: transformSDKVideoV2ToRESTVideoV2,
|
|
84
|
+
paths: [{ path: 'product.video' }],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
transformFn: transformSDKAudioToRESTAudio,
|
|
88
|
+
paths: [{ path: 'product.audio' }],
|
|
89
|
+
},
|
|
90
|
+
]);
|
|
91
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.createProduct(payload);
|
|
92
|
+
sideEffects?.onSiteCall?.();
|
|
93
|
+
try {
|
|
94
|
+
const result = await httpClient.request(reqOpts);
|
|
95
|
+
sideEffects?.onSuccess?.(result);
|
|
96
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
97
|
+
{
|
|
98
|
+
transformFn: transformRESTImageToSDKImage,
|
|
99
|
+
paths: [
|
|
100
|
+
{ path: 'product.image' },
|
|
101
|
+
{ path: 'product.variants.image' },
|
|
102
|
+
{ path: 'product.mainVariant.image' },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
107
|
+
paths: [
|
|
108
|
+
{ path: 'product.address' },
|
|
109
|
+
{ path: 'product.customAddress' },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
114
|
+
paths: [{ path: 'product.document' }],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
118
|
+
paths: [{ path: 'product.video' }],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
122
|
+
paths: [{ path: 'product.audio' }],
|
|
123
|
+
},
|
|
124
|
+
]))?.product;
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
const transformedError = sdkTransformError(err, {
|
|
128
|
+
spreadPathsToArguments: {},
|
|
129
|
+
explicitPathsToArguments: { product: '$[0].product' },
|
|
130
|
+
singleArgumentUnchanged: false,
|
|
131
|
+
}, ['options']);
|
|
132
|
+
sideEffects?.onError?.(err);
|
|
133
|
+
throw transformedError;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** @public
|
|
137
|
+
* @requiredField productId
|
|
138
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.DeleteProduct
|
|
139
|
+
*/
|
|
140
|
+
export async function deleteProduct(productId) {
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
143
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
144
|
+
productId: productId,
|
|
145
|
+
});
|
|
146
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.deleteProduct(payload);
|
|
147
|
+
sideEffects?.onSiteCall?.();
|
|
148
|
+
try {
|
|
149
|
+
const result = await httpClient.request(reqOpts);
|
|
150
|
+
sideEffects?.onSuccess?.(result);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const transformedError = sdkTransformError(err, {
|
|
154
|
+
spreadPathsToArguments: {},
|
|
155
|
+
explicitPathsToArguments: { productId: '$[0]' },
|
|
156
|
+
singleArgumentUnchanged: false,
|
|
157
|
+
}, ['productId']);
|
|
158
|
+
sideEffects?.onError?.(err);
|
|
159
|
+
throw transformedError;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** @public
|
|
163
|
+
* @requiredField options.product._id
|
|
164
|
+
* @requiredField productId
|
|
165
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.UpdateProduct
|
|
166
|
+
*/
|
|
167
|
+
export async function updateProduct(productId, options) {
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
170
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
171
|
+
productId: productId,
|
|
172
|
+
product: options?.product,
|
|
173
|
+
mask: options?.mask,
|
|
174
|
+
}), [
|
|
175
|
+
{
|
|
176
|
+
transformFn: transformSDKImageToRESTImage,
|
|
177
|
+
paths: [
|
|
178
|
+
{ path: 'product.image' },
|
|
179
|
+
{ path: 'product.variants.image' },
|
|
180
|
+
{ path: 'product.mainVariant.image' },
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
185
|
+
paths: [{ path: 'product.address' }, { path: 'product.customAddress' }],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
transformFn: transformSDKDocumentToRESTDocument,
|
|
189
|
+
paths: [{ path: 'product.document' }],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
transformFn: transformSDKVideoV2ToRESTVideoV2,
|
|
193
|
+
paths: [{ path: 'product.video' }],
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
transformFn: transformSDKAudioToRESTAudio,
|
|
197
|
+
paths: [{ path: 'product.audio' }],
|
|
198
|
+
},
|
|
199
|
+
]);
|
|
200
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.updateProduct(payload);
|
|
201
|
+
sideEffects?.onSiteCall?.();
|
|
202
|
+
try {
|
|
203
|
+
const result = await httpClient.request(reqOpts);
|
|
204
|
+
sideEffects?.onSuccess?.(result);
|
|
205
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
206
|
+
{
|
|
207
|
+
transformFn: transformRESTImageToSDKImage,
|
|
208
|
+
paths: [
|
|
209
|
+
{ path: 'product.image' },
|
|
210
|
+
{ path: 'product.variants.image' },
|
|
211
|
+
{ path: 'product.mainVariant.image' },
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
216
|
+
paths: [
|
|
217
|
+
{ path: 'product.address' },
|
|
218
|
+
{ path: 'product.customAddress' },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
223
|
+
paths: [{ path: 'product.document' }],
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
227
|
+
paths: [{ path: 'product.video' }],
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
231
|
+
paths: [{ path: 'product.audio' }],
|
|
232
|
+
},
|
|
233
|
+
]))?.product;
|
|
234
|
+
}
|
|
235
|
+
catch (err) {
|
|
236
|
+
const transformedError = sdkTransformError(err, {
|
|
237
|
+
spreadPathsToArguments: {},
|
|
238
|
+
explicitPathsToArguments: {
|
|
239
|
+
productId: '$[0]',
|
|
240
|
+
product: '$[1].product',
|
|
241
|
+
mask: '$[1].mask',
|
|
242
|
+
},
|
|
243
|
+
singleArgumentUnchanged: false,
|
|
244
|
+
}, ['productId', 'options']);
|
|
245
|
+
sideEffects?.onError?.(err);
|
|
246
|
+
throw transformedError;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* override description
|
|
251
|
+
* @public
|
|
252
|
+
* @requiredField productId
|
|
253
|
+
* @param arg1 - ## new override param 1
|
|
254
|
+
* @returns ## override return
|
|
255
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.GetProduct
|
|
256
|
+
*/
|
|
257
|
+
export async function getProduct(productId) {
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
260
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
261
|
+
productId: productId,
|
|
262
|
+
});
|
|
263
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.getProduct(payload);
|
|
264
|
+
sideEffects?.onSiteCall?.();
|
|
265
|
+
try {
|
|
266
|
+
const result = await httpClient.request(reqOpts);
|
|
267
|
+
sideEffects?.onSuccess?.(result);
|
|
268
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
269
|
+
{
|
|
270
|
+
transformFn: transformRESTImageToSDKImage,
|
|
271
|
+
paths: [
|
|
272
|
+
{ path: 'product.image' },
|
|
273
|
+
{ path: 'product.variants.image' },
|
|
274
|
+
{ path: 'product.mainVariant.image' },
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
279
|
+
paths: [
|
|
280
|
+
{ path: 'product.address' },
|
|
281
|
+
{ path: 'product.customAddress' },
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
286
|
+
paths: [{ path: 'product.document' }],
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
290
|
+
paths: [{ path: 'product.video' }],
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
294
|
+
paths: [{ path: 'product.audio' }],
|
|
295
|
+
},
|
|
296
|
+
]))?.product;
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
const transformedError = sdkTransformError(err, {
|
|
300
|
+
spreadPathsToArguments: {},
|
|
301
|
+
explicitPathsToArguments: { productId: '$[0]' },
|
|
302
|
+
singleArgumentUnchanged: false,
|
|
303
|
+
}, ['productId']);
|
|
304
|
+
sideEffects?.onError?.(err);
|
|
305
|
+
throw transformedError;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/** @public
|
|
309
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.CountProducts
|
|
310
|
+
*/
|
|
311
|
+
export async function countProducts(options) {
|
|
312
|
+
// @ts-ignore
|
|
313
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
314
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
315
|
+
filter: options?.filter,
|
|
316
|
+
includeVariants: options?.includeVariants,
|
|
317
|
+
includeHiddenProducts: options?.includeHiddenProducts,
|
|
318
|
+
includeMerchantSpecificData: options?.includeMerchantSpecificData,
|
|
319
|
+
});
|
|
320
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.countProducts(payload);
|
|
321
|
+
sideEffects?.onSiteCall?.();
|
|
322
|
+
try {
|
|
323
|
+
const result = await httpClient.request(reqOpts);
|
|
324
|
+
sideEffects?.onSuccess?.(result);
|
|
325
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
326
|
+
}
|
|
327
|
+
catch (err) {
|
|
328
|
+
const transformedError = sdkTransformError(err, {
|
|
329
|
+
spreadPathsToArguments: {},
|
|
330
|
+
explicitPathsToArguments: {
|
|
331
|
+
filter: '$[0].filter',
|
|
332
|
+
includeVariants: '$[0].includeVariants',
|
|
333
|
+
includeHiddenProducts: '$[0].includeHiddenProducts',
|
|
334
|
+
includeMerchantSpecificData: '$[0].includeMerchantSpecificData',
|
|
335
|
+
},
|
|
336
|
+
singleArgumentUnchanged: false,
|
|
337
|
+
}, ['options']);
|
|
338
|
+
sideEffects?.onError?.(err);
|
|
339
|
+
throw transformedError;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/** @public
|
|
343
|
+
* @requiredField title
|
|
344
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.GetProductsStartWith
|
|
345
|
+
*/
|
|
346
|
+
export async function getProductsStartWith(title, options) {
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
349
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
350
|
+
title: title,
|
|
351
|
+
addressLine2: options?.addressLine2,
|
|
352
|
+
});
|
|
353
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.getProductsStartWith(payload);
|
|
354
|
+
sideEffects?.onSiteCall?.();
|
|
355
|
+
try {
|
|
356
|
+
const result = await httpClient.request(reqOpts);
|
|
357
|
+
sideEffects?.onSuccess?.(result);
|
|
358
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
359
|
+
{
|
|
360
|
+
transformFn: transformRESTImageToSDKImage,
|
|
361
|
+
paths: [
|
|
362
|
+
{ path: 'products.image' },
|
|
363
|
+
{ path: 'products.variants.image' },
|
|
364
|
+
{ path: 'products.mainVariant.image' },
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
369
|
+
paths: [
|
|
370
|
+
{ path: 'products.address' },
|
|
371
|
+
{ path: 'products.customAddress' },
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
376
|
+
paths: [{ path: 'products.document' }],
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
380
|
+
paths: [{ path: 'products.video' }],
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
384
|
+
paths: [{ path: 'products.audio' }],
|
|
385
|
+
},
|
|
386
|
+
]));
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
const transformedError = sdkTransformError(err, {
|
|
390
|
+
spreadPathsToArguments: {},
|
|
391
|
+
explicitPathsToArguments: {
|
|
392
|
+
title: '$[0]',
|
|
393
|
+
addressLine2: '$[1].addressLine2',
|
|
394
|
+
},
|
|
395
|
+
singleArgumentUnchanged: false,
|
|
396
|
+
}, ['title', 'options']);
|
|
397
|
+
sideEffects?.onError?.(err);
|
|
398
|
+
throw transformedError;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/** @public
|
|
402
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.QueryProducts
|
|
403
|
+
*/
|
|
404
|
+
export function queryProducts(options) {
|
|
405
|
+
// @ts-ignore
|
|
406
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
407
|
+
return queryBuilder({
|
|
408
|
+
func: async (payload) => {
|
|
409
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.queryProducts({
|
|
410
|
+
...payload,
|
|
411
|
+
...(options ?? {}),
|
|
412
|
+
});
|
|
413
|
+
sideEffects?.onSiteCall?.();
|
|
414
|
+
try {
|
|
415
|
+
const result = await httpClient.request(reqOpts);
|
|
416
|
+
sideEffects?.onSuccess?.(result);
|
|
417
|
+
return result;
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
sideEffects?.onError?.(err);
|
|
421
|
+
throw err;
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
requestTransformer: (query) => {
|
|
425
|
+
const args = [query, options];
|
|
426
|
+
return renameKeysFromSDKRequestToRESTRequest({
|
|
427
|
+
...args?.[1],
|
|
428
|
+
query: args?.[0],
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
responseTransformer: ({ data }) => {
|
|
432
|
+
const transformedData = renameKeysFromRESTResponseToSDKResponse(transformPaths(data, [
|
|
433
|
+
{
|
|
434
|
+
transformFn: transformRESTImageToSDKImage,
|
|
435
|
+
paths: [
|
|
436
|
+
{ path: 'products.image' },
|
|
437
|
+
{ path: 'products.variants.image' },
|
|
438
|
+
{ path: 'products.mainVariant.image' },
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
443
|
+
paths: [
|
|
444
|
+
{ path: 'products.address' },
|
|
445
|
+
{ path: 'products.customAddress' },
|
|
446
|
+
],
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
450
|
+
paths: [{ path: 'products.document' }],
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
454
|
+
paths: [{ path: 'products.video' }],
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
458
|
+
paths: [{ path: 'products.audio' }],
|
|
459
|
+
},
|
|
460
|
+
]));
|
|
461
|
+
return {
|
|
462
|
+
items: transformedData?.products,
|
|
463
|
+
pagingMetadata: transformedData?.metadata,
|
|
464
|
+
};
|
|
465
|
+
},
|
|
466
|
+
errorTransformer: (err) => {
|
|
467
|
+
const transformedError = sdkTransformError(err, {
|
|
468
|
+
spreadPathsToArguments: {},
|
|
469
|
+
explicitPathsToArguments: { query: '$[0]' },
|
|
470
|
+
singleArgumentUnchanged: false,
|
|
471
|
+
});
|
|
472
|
+
throw transformedError;
|
|
473
|
+
},
|
|
474
|
+
pagingMethod: 'CURSOR',
|
|
475
|
+
transformationPaths: {},
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* create multiple products in a single request. Works synchronously
|
|
480
|
+
* @public
|
|
481
|
+
* @requiredField products
|
|
482
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.BulkCreateProducts
|
|
483
|
+
*/
|
|
484
|
+
export async function bulkCreateProducts(products, options) {
|
|
485
|
+
// @ts-ignore
|
|
486
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
487
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
488
|
+
products: products,
|
|
489
|
+
returnEntity: options?.returnEntity,
|
|
490
|
+
}), [
|
|
491
|
+
{
|
|
492
|
+
transformFn: transformSDKImageToRESTImage,
|
|
493
|
+
paths: [
|
|
494
|
+
{ path: 'products.image' },
|
|
495
|
+
{ path: 'products.variants.image' },
|
|
496
|
+
{ path: 'products.mainVariant.image' },
|
|
497
|
+
],
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
501
|
+
paths: [
|
|
502
|
+
{ path: 'products.address' },
|
|
503
|
+
{ path: 'products.customAddress' },
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
transformFn: transformSDKDocumentToRESTDocument,
|
|
508
|
+
paths: [{ path: 'products.document' }],
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
transformFn: transformSDKVideoV2ToRESTVideoV2,
|
|
512
|
+
paths: [{ path: 'products.video' }],
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
transformFn: transformSDKAudioToRESTAudio,
|
|
516
|
+
paths: [{ path: 'products.audio' }],
|
|
517
|
+
},
|
|
518
|
+
]);
|
|
519
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.bulkCreateProducts(payload);
|
|
520
|
+
sideEffects?.onSiteCall?.();
|
|
521
|
+
try {
|
|
522
|
+
const result = await httpClient.request(reqOpts);
|
|
523
|
+
sideEffects?.onSuccess?.(result);
|
|
524
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
525
|
+
{
|
|
526
|
+
transformFn: transformRESTImageToSDKImage,
|
|
527
|
+
paths: [
|
|
528
|
+
{ path: 'results.item.image' },
|
|
529
|
+
{ path: 'results.item.variants.image' },
|
|
530
|
+
{ path: 'results.item.mainVariant.image' },
|
|
531
|
+
],
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
535
|
+
paths: [
|
|
536
|
+
{ path: 'results.item.address' },
|
|
537
|
+
{ path: 'results.item.customAddress' },
|
|
538
|
+
],
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
542
|
+
paths: [{ path: 'results.item.document' }],
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
546
|
+
paths: [{ path: 'results.item.video' }],
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
550
|
+
paths: [{ path: 'results.item.audio' }],
|
|
551
|
+
},
|
|
552
|
+
]));
|
|
553
|
+
}
|
|
554
|
+
catch (err) {
|
|
555
|
+
const transformedError = sdkTransformError(err, {
|
|
556
|
+
spreadPathsToArguments: {},
|
|
557
|
+
explicitPathsToArguments: {
|
|
558
|
+
products: '$[0]',
|
|
559
|
+
returnEntity: '$[1].returnEntity',
|
|
560
|
+
},
|
|
561
|
+
singleArgumentUnchanged: false,
|
|
562
|
+
}, ['products', 'options']);
|
|
563
|
+
sideEffects?.onError?.(err);
|
|
564
|
+
throw transformedError;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* update multiple products in a single request. Works synchronously.
|
|
569
|
+
* @public
|
|
570
|
+
* @requiredField products
|
|
571
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.BulkUpdateProducts
|
|
572
|
+
*/
|
|
573
|
+
export async function bulkUpdateProducts(products, options) {
|
|
574
|
+
// @ts-ignore
|
|
575
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
576
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
577
|
+
products: products,
|
|
578
|
+
returnEntity: options?.returnEntity,
|
|
579
|
+
}), [
|
|
580
|
+
{
|
|
581
|
+
transformFn: transformSDKImageToRESTImage,
|
|
582
|
+
paths: [
|
|
583
|
+
{ path: 'products.product.image' },
|
|
584
|
+
{ path: 'products.product.variants.image' },
|
|
585
|
+
{ path: 'products.product.mainVariant.image' },
|
|
586
|
+
],
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
590
|
+
paths: [
|
|
591
|
+
{ path: 'products.product.address' },
|
|
592
|
+
{ path: 'products.product.customAddress' },
|
|
593
|
+
],
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
transformFn: transformSDKDocumentToRESTDocument,
|
|
597
|
+
paths: [{ path: 'products.product.document' }],
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
transformFn: transformSDKVideoV2ToRESTVideoV2,
|
|
601
|
+
paths: [{ path: 'products.product.video' }],
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
transformFn: transformSDKAudioToRESTAudio,
|
|
605
|
+
paths: [{ path: 'products.product.audio' }],
|
|
606
|
+
},
|
|
607
|
+
]);
|
|
608
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.bulkUpdateProducts(payload);
|
|
609
|
+
sideEffects?.onSiteCall?.();
|
|
610
|
+
try {
|
|
611
|
+
const result = await httpClient.request(reqOpts);
|
|
612
|
+
sideEffects?.onSuccess?.(result);
|
|
613
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
614
|
+
{
|
|
615
|
+
transformFn: transformRESTImageToSDKImage,
|
|
616
|
+
paths: [
|
|
617
|
+
{ path: 'results.item.image' },
|
|
618
|
+
{ path: 'results.item.variants.image' },
|
|
619
|
+
{ path: 'results.item.mainVariant.image' },
|
|
620
|
+
],
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
624
|
+
paths: [
|
|
625
|
+
{ path: 'results.item.address' },
|
|
626
|
+
{ path: 'results.item.customAddress' },
|
|
627
|
+
],
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
transformFn: transformRESTDocumentToSDKDocument,
|
|
631
|
+
paths: [{ path: 'results.item.document' }],
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
transformFn: transformRESTVideoV2ToSDKVideoV2,
|
|
635
|
+
paths: [{ path: 'results.item.video' }],
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
transformFn: transformRESTAudioToSDKAudio,
|
|
639
|
+
paths: [{ path: 'results.item.audio' }],
|
|
640
|
+
},
|
|
641
|
+
]));
|
|
642
|
+
}
|
|
643
|
+
catch (err) {
|
|
644
|
+
const transformedError = sdkTransformError(err, {
|
|
645
|
+
spreadPathsToArguments: {},
|
|
646
|
+
explicitPathsToArguments: {
|
|
647
|
+
products: '$[0]',
|
|
648
|
+
returnEntity: '$[1].returnEntity',
|
|
649
|
+
},
|
|
650
|
+
singleArgumentUnchanged: false,
|
|
651
|
+
}, ['products', 'options']);
|
|
652
|
+
sideEffects?.onError?.(err);
|
|
653
|
+
throw transformedError;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* deletes multiple products in a single request. Works synchronously.
|
|
658
|
+
* @public
|
|
659
|
+
* @requiredField productIds
|
|
660
|
+
* @fqn wix.coreservices.metroinspector.v1.products.ProductsService.BulkDeleteProducts
|
|
661
|
+
*/
|
|
662
|
+
export async function bulkDeleteProducts(productIds) {
|
|
663
|
+
// @ts-ignore
|
|
664
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
665
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
666
|
+
productIds: productIds,
|
|
667
|
+
});
|
|
668
|
+
const reqOpts = ambassadorWixMetroinspectorV1Product.bulkDeleteProducts(payload);
|
|
669
|
+
sideEffects?.onSiteCall?.();
|
|
670
|
+
try {
|
|
671
|
+
const result = await httpClient.request(reqOpts);
|
|
672
|
+
sideEffects?.onSuccess?.(result);
|
|
673
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
674
|
+
}
|
|
675
|
+
catch (err) {
|
|
676
|
+
const transformedError = sdkTransformError(err, {
|
|
677
|
+
spreadPathsToArguments: {},
|
|
678
|
+
explicitPathsToArguments: { productIds: '$[0]' },
|
|
679
|
+
singleArgumentUnchanged: false,
|
|
680
|
+
}, ['productIds']);
|
|
681
|
+
sideEffects?.onError?.(err);
|
|
682
|
+
throw transformedError;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=metroinspector-v1-product-products.universal.js.map
|