@omni-commerce/sdk 0.4.0 → 0.6.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/dist/index.cjs +117 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +730 -14
- package/dist/index.d.ts +730 -14
- package/dist/index.js +117 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function normalizeClientOptions(options = {}) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// src/version.ts
|
|
27
|
-
var SDK_VERSION = "0.
|
|
27
|
+
var SDK_VERSION = "0.6.0";
|
|
28
28
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
29
29
|
|
|
30
30
|
// src/environments.ts
|
|
@@ -428,6 +428,18 @@ function sleep(ms) {
|
|
|
428
428
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
// src/core/multipart.ts
|
|
432
|
+
function toMultipartBody(fields) {
|
|
433
|
+
const form = new FormData();
|
|
434
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
435
|
+
if (value === void 0 || value === null) continue;
|
|
436
|
+
if (value instanceof Blob) form.append(key, value);
|
|
437
|
+
else if (typeof value === "object") form.append(key, JSON.stringify(value));
|
|
438
|
+
else form.append(key, String(value));
|
|
439
|
+
}
|
|
440
|
+
return form;
|
|
441
|
+
}
|
|
442
|
+
|
|
431
443
|
// src/core/path.ts
|
|
432
444
|
function encodePathParam(name, value) {
|
|
433
445
|
if (typeof value !== "string" || value.trim() === "") {
|
|
@@ -1086,6 +1098,35 @@ var AopClient = class {
|
|
|
1086
1098
|
});
|
|
1087
1099
|
}
|
|
1088
1100
|
};
|
|
1101
|
+
var BrandsgatewayClient = class {
|
|
1102
|
+
constructor(_http) {
|
|
1103
|
+
this._http = _http;
|
|
1104
|
+
}
|
|
1105
|
+
_http;
|
|
1106
|
+
/**
|
|
1107
|
+
* Import BrandsGateway Products
|
|
1108
|
+
*
|
|
1109
|
+
* Requires catalog:write and a connected BrandsGateway account. Uses the same parameters and import service as the import_brandsgateway_products tool.
|
|
1110
|
+
|
|
1111
|
+
### Selection
|
|
1112
|
+
|
|
1113
|
+
Choose catalogProductIds or importAllMatching with filters. maxProducts limits new imports to 1–50 across pages (default 50); already imported products are skipped. Numeric brandIds, vendorIds (supplier warehouses), categoryIds, and conditionIds arrays match any value within each field and all supplied fields together. Omit a field for no restriction; empty arrays and legacy singular/string filters are rejected. Brands accept at most 500 IDs; other filter arrays accept at most 50 each. Broad combinations may exceed the supplier request budget and return a failure asking you to narrow the filters.
|
|
1114
|
+
|
|
1115
|
+
### Updated dates and enrichme
|
|
1116
|
+
*
|
|
1117
|
+
* `POST /api/v1/brandsgateway/import`
|
|
1118
|
+
*/
|
|
1119
|
+
importProducts(request, requestOptions) {
|
|
1120
|
+
const { ...body } = request ?? {};
|
|
1121
|
+
return this._http.request({
|
|
1122
|
+
method: "POST",
|
|
1123
|
+
path: "/api/v1/brandsgateway/import",
|
|
1124
|
+
query: void 0,
|
|
1125
|
+
body,
|
|
1126
|
+
...mergeRequestOptions(requestOptions)
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1089
1130
|
var CampaignsClient = class {
|
|
1090
1131
|
constructor(_http) {
|
|
1091
1132
|
this._http = _http;
|
|
@@ -1406,6 +1447,48 @@ var DirectoryClient = class {
|
|
|
1406
1447
|
});
|
|
1407
1448
|
}
|
|
1408
1449
|
};
|
|
1450
|
+
var DocumentsClient = class {
|
|
1451
|
+
constructor(_http) {
|
|
1452
|
+
this._http = _http;
|
|
1453
|
+
}
|
|
1454
|
+
_http;
|
|
1455
|
+
/**
|
|
1456
|
+
* Upload Document
|
|
1457
|
+
*
|
|
1458
|
+
* Upload one file to the knowledge base as multipart/form-data. Requires `documents:write`.
|
|
1459
|
+
|
|
1460
|
+
Accepted: PDF up to 20 MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown up to 2 MB. PDFs, Markdown, and images are indexed in the background; poll `GET /api/v1/documents/{documentId}` until `status` is `completed`. CSV and Excel are stored for agents to read but are not indexed.
|
|
1461
|
+
*
|
|
1462
|
+
* `POST /api/v1/documents`
|
|
1463
|
+
*/
|
|
1464
|
+
upload(request, requestOptions) {
|
|
1465
|
+
const { ...body } = request ?? {};
|
|
1466
|
+
return this._http.request({
|
|
1467
|
+
method: "POST",
|
|
1468
|
+
path: "/api/v1/documents",
|
|
1469
|
+
query: void 0,
|
|
1470
|
+
body: toMultipartBody(body),
|
|
1471
|
+
...mergeRequestOptions(requestOptions)
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Get Document
|
|
1476
|
+
*
|
|
1477
|
+
* Read one knowledge base document and its indexing status. Requires `documents:read`.
|
|
1478
|
+
*
|
|
1479
|
+
* `GET /api/v1/documents/{documentId}`
|
|
1480
|
+
*/
|
|
1481
|
+
get(request, requestOptions) {
|
|
1482
|
+
const { documentId, organizationId } = request ?? {};
|
|
1483
|
+
return this._http.request({
|
|
1484
|
+
method: "GET",
|
|
1485
|
+
path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
|
|
1486
|
+
query: { organizationId },
|
|
1487
|
+
body: void 0,
|
|
1488
|
+
...mergeRequestOptions(requestOptions)
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1409
1492
|
var EvaluateClient = class {
|
|
1410
1493
|
constructor(_http) {
|
|
1411
1494
|
this._http = _http;
|
|
@@ -2307,6 +2390,25 @@ var ProductsClient = class {
|
|
|
2307
2390
|
...mergeRequestOptions(requestOptions)
|
|
2308
2391
|
});
|
|
2309
2392
|
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Upload Product Image
|
|
2395
|
+
*
|
|
2396
|
+
* Upload one image to a product's or variant's gallery as multipart/form-data. Requires `catalog:write`.
|
|
2397
|
+
|
|
2398
|
+
JPEG, PNG, WebP, AVIF, or HEIC up to 8 MB; WebP, AVIF, and HEIC are stored as JPEG. The image is added at `position`, or at the end. Publish the product to send the new gallery to marketplaces.
|
|
2399
|
+
*
|
|
2400
|
+
* `POST /api/v1/products/{productId}/images`
|
|
2401
|
+
*/
|
|
2402
|
+
uploadImage(request, requestOptions) {
|
|
2403
|
+
const { productId, ...body } = request ?? {};
|
|
2404
|
+
return this._http.request({
|
|
2405
|
+
method: "POST",
|
|
2406
|
+
path: `/api/v1/products/${encodePathParam("productId", productId)}/images`,
|
|
2407
|
+
query: void 0,
|
|
2408
|
+
body: toMultipartBody(body),
|
|
2409
|
+
...mergeRequestOptions(requestOptions)
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2310
2412
|
/**
|
|
2311
2413
|
* Update Product Inventory
|
|
2312
2414
|
*
|
|
@@ -2636,17 +2738,19 @@ var PromotionsClient = class {
|
|
|
2636
2738
|
});
|
|
2637
2739
|
}
|
|
2638
2740
|
/**
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2741
|
+
* Retry Marketplace Delivery
|
|
2742
|
+
*
|
|
2743
|
+
* Run marketplace delivery again after a failure, for example once a store is reconnected. Requires `promotions:write`.
|
|
2744
|
+
|
|
2745
|
+
You do not need this to publish a promotion: creating or activating it, editing it while active or scheduled, and assigning products already deliver it, and pausing, ending, or archiving removes it. A retry brings each marketplace back in line with the promotion's current status.
|
|
2746
|
+
*
|
|
2747
|
+
* `POST /api/v1/promotions/{promotionId}/retry`
|
|
2748
|
+
*/
|
|
2749
|
+
retry(request, requestOptions) {
|
|
2646
2750
|
const { promotionId, organizationId, ...body } = request ?? {};
|
|
2647
2751
|
return this._http.request({
|
|
2648
2752
|
method: "POST",
|
|
2649
|
-
path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/
|
|
2753
|
+
path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/retry`,
|
|
2650
2754
|
query: { organizationId },
|
|
2651
2755
|
body,
|
|
2652
2756
|
...mergeRequestOptions(requestOptions)
|
|
@@ -3312,11 +3416,13 @@ var OmniGeneratedClient = class {
|
|
|
3312
3416
|
this.agents = new AgentsClient(this._http);
|
|
3313
3417
|
this.analytics = new AnalyticsClient(this._http);
|
|
3314
3418
|
this.aop = new AopClient(this._http);
|
|
3419
|
+
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3315
3420
|
this.campaigns = new CampaignsClient(this._http);
|
|
3316
3421
|
this.catalog = new CatalogClient(this._http);
|
|
3317
3422
|
this.checkoutSessions = new CheckoutSessionsClient(this._http);
|
|
3318
3423
|
this.compare = new CompareClient(this._http);
|
|
3319
3424
|
this.directory = new DirectoryClient(this._http);
|
|
3425
|
+
this.documents = new DocumentsClient(this._http);
|
|
3320
3426
|
this.evaluate = new EvaluateClient(this._http);
|
|
3321
3427
|
this.feed = new FeedClient(this._http);
|
|
3322
3428
|
this.images = new ImagesClient(this._http);
|
|
@@ -3347,11 +3453,13 @@ var OmniGeneratedClient = class {
|
|
|
3347
3453
|
agents;
|
|
3348
3454
|
analytics;
|
|
3349
3455
|
aop;
|
|
3456
|
+
brandsgateway;
|
|
3350
3457
|
campaigns;
|
|
3351
3458
|
catalog;
|
|
3352
3459
|
checkoutSessions;
|
|
3353
3460
|
compare;
|
|
3354
3461
|
directory;
|
|
3462
|
+
documents;
|
|
3355
3463
|
evaluate;
|
|
3356
3464
|
feed;
|
|
3357
3465
|
images;
|