@omni-commerce/sdk 0.4.0 → 0.5.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 +86 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +521 -14
- package/dist/index.d.ts +521 -14
- package/dist/index.js +86 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ function normalizeClientOptions(options = {}) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// src/version.ts
|
|
29
|
-
var SDK_VERSION = "0.
|
|
29
|
+
var SDK_VERSION = "0.5.0";
|
|
30
30
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
31
31
|
|
|
32
32
|
// src/environments.ts
|
|
@@ -430,6 +430,18 @@ function sleep(ms) {
|
|
|
430
430
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
+
// src/core/multipart.ts
|
|
434
|
+
function toMultipartBody(fields) {
|
|
435
|
+
const form = new FormData();
|
|
436
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
437
|
+
if (value === void 0 || value === null) continue;
|
|
438
|
+
if (value instanceof Blob) form.append(key, value);
|
|
439
|
+
else if (typeof value === "object") form.append(key, JSON.stringify(value));
|
|
440
|
+
else form.append(key, String(value));
|
|
441
|
+
}
|
|
442
|
+
return form;
|
|
443
|
+
}
|
|
444
|
+
|
|
433
445
|
// src/core/path.ts
|
|
434
446
|
function encodePathParam(name, value) {
|
|
435
447
|
if (typeof value !== "string" || value.trim() === "") {
|
|
@@ -1408,6 +1420,48 @@ var DirectoryClient = class {
|
|
|
1408
1420
|
});
|
|
1409
1421
|
}
|
|
1410
1422
|
};
|
|
1423
|
+
var DocumentsClient = class {
|
|
1424
|
+
constructor(_http) {
|
|
1425
|
+
this._http = _http;
|
|
1426
|
+
}
|
|
1427
|
+
_http;
|
|
1428
|
+
/**
|
|
1429
|
+
* Upload Document
|
|
1430
|
+
*
|
|
1431
|
+
* Upload one file to the knowledge base as multipart/form-data. Requires `documents:write`.
|
|
1432
|
+
|
|
1433
|
+
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.
|
|
1434
|
+
*
|
|
1435
|
+
* `POST /api/v1/documents`
|
|
1436
|
+
*/
|
|
1437
|
+
upload(request, requestOptions) {
|
|
1438
|
+
const { ...body } = request ?? {};
|
|
1439
|
+
return this._http.request({
|
|
1440
|
+
method: "POST",
|
|
1441
|
+
path: "/api/v1/documents",
|
|
1442
|
+
query: void 0,
|
|
1443
|
+
body: toMultipartBody(body),
|
|
1444
|
+
...mergeRequestOptions(requestOptions)
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Get Document
|
|
1449
|
+
*
|
|
1450
|
+
* Read one knowledge base document and its indexing status. Requires `documents:read`.
|
|
1451
|
+
*
|
|
1452
|
+
* `GET /api/v1/documents/{documentId}`
|
|
1453
|
+
*/
|
|
1454
|
+
get(request, requestOptions) {
|
|
1455
|
+
const { documentId, organizationId } = request ?? {};
|
|
1456
|
+
return this._http.request({
|
|
1457
|
+
method: "GET",
|
|
1458
|
+
path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
|
|
1459
|
+
query: { organizationId },
|
|
1460
|
+
body: void 0,
|
|
1461
|
+
...mergeRequestOptions(requestOptions)
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1411
1465
|
var EvaluateClient = class {
|
|
1412
1466
|
constructor(_http) {
|
|
1413
1467
|
this._http = _http;
|
|
@@ -2309,6 +2363,25 @@ var ProductsClient = class {
|
|
|
2309
2363
|
...mergeRequestOptions(requestOptions)
|
|
2310
2364
|
});
|
|
2311
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Upload Product Image
|
|
2368
|
+
*
|
|
2369
|
+
* Upload one image to a product's or variant's gallery as multipart/form-data. Requires `catalog:write`.
|
|
2370
|
+
|
|
2371
|
+
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.
|
|
2372
|
+
*
|
|
2373
|
+
* `POST /api/v1/products/{productId}/images`
|
|
2374
|
+
*/
|
|
2375
|
+
uploadImage(request, requestOptions) {
|
|
2376
|
+
const { productId, ...body } = request ?? {};
|
|
2377
|
+
return this._http.request({
|
|
2378
|
+
method: "POST",
|
|
2379
|
+
path: `/api/v1/products/${encodePathParam("productId", productId)}/images`,
|
|
2380
|
+
query: void 0,
|
|
2381
|
+
body: toMultipartBody(body),
|
|
2382
|
+
...mergeRequestOptions(requestOptions)
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2312
2385
|
/**
|
|
2313
2386
|
* Update Product Inventory
|
|
2314
2387
|
*
|
|
@@ -2638,17 +2711,19 @@ var PromotionsClient = class {
|
|
|
2638
2711
|
});
|
|
2639
2712
|
}
|
|
2640
2713
|
/**
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2714
|
+
* Retry Marketplace Delivery
|
|
2715
|
+
*
|
|
2716
|
+
* Run marketplace delivery again after a failure, for example once a store is reconnected. Requires `promotions:write`.
|
|
2717
|
+
|
|
2718
|
+
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.
|
|
2719
|
+
*
|
|
2720
|
+
* `POST /api/v1/promotions/{promotionId}/retry`
|
|
2721
|
+
*/
|
|
2722
|
+
retry(request, requestOptions) {
|
|
2648
2723
|
const { promotionId, organizationId, ...body } = request ?? {};
|
|
2649
2724
|
return this._http.request({
|
|
2650
2725
|
method: "POST",
|
|
2651
|
-
path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/
|
|
2726
|
+
path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/retry`,
|
|
2652
2727
|
query: { organizationId },
|
|
2653
2728
|
body,
|
|
2654
2729
|
...mergeRequestOptions(requestOptions)
|
|
@@ -3319,6 +3394,7 @@ var OmniGeneratedClient = class {
|
|
|
3319
3394
|
this.checkoutSessions = new CheckoutSessionsClient(this._http);
|
|
3320
3395
|
this.compare = new CompareClient(this._http);
|
|
3321
3396
|
this.directory = new DirectoryClient(this._http);
|
|
3397
|
+
this.documents = new DocumentsClient(this._http);
|
|
3322
3398
|
this.evaluate = new EvaluateClient(this._http);
|
|
3323
3399
|
this.feed = new FeedClient(this._http);
|
|
3324
3400
|
this.images = new ImagesClient(this._http);
|
|
@@ -3354,6 +3430,7 @@ var OmniGeneratedClient = class {
|
|
|
3354
3430
|
checkoutSessions;
|
|
3355
3431
|
compare;
|
|
3356
3432
|
directory;
|
|
3433
|
+
documents;
|
|
3357
3434
|
evaluate;
|
|
3358
3435
|
feed;
|
|
3359
3436
|
images;
|