@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 CHANGED
@@ -26,7 +26,7 @@ function normalizeClientOptions(options = {}) {
26
26
  }
27
27
 
28
28
  // src/version.ts
29
- var SDK_VERSION = "0.4.0";
29
+ var SDK_VERSION = "0.6.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() === "") {
@@ -1088,6 +1100,35 @@ var AopClient = class {
1088
1100
  });
1089
1101
  }
1090
1102
  };
1103
+ var BrandsgatewayClient = class {
1104
+ constructor(_http) {
1105
+ this._http = _http;
1106
+ }
1107
+ _http;
1108
+ /**
1109
+ * Import BrandsGateway Products
1110
+ *
1111
+ * Requires catalog:write and a connected BrandsGateway account. Uses the same parameters and import service as the import_brandsgateway_products tool.
1112
+
1113
+ ### Selection
1114
+
1115
+ 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.
1116
+
1117
+ ### Updated dates and enrichme
1118
+ *
1119
+ * `POST /api/v1/brandsgateway/import`
1120
+ */
1121
+ importProducts(request, requestOptions) {
1122
+ const { ...body } = request ?? {};
1123
+ return this._http.request({
1124
+ method: "POST",
1125
+ path: "/api/v1/brandsgateway/import",
1126
+ query: void 0,
1127
+ body,
1128
+ ...mergeRequestOptions(requestOptions)
1129
+ });
1130
+ }
1131
+ };
1091
1132
  var CampaignsClient = class {
1092
1133
  constructor(_http) {
1093
1134
  this._http = _http;
@@ -1408,6 +1449,48 @@ var DirectoryClient = class {
1408
1449
  });
1409
1450
  }
1410
1451
  };
1452
+ var DocumentsClient = class {
1453
+ constructor(_http) {
1454
+ this._http = _http;
1455
+ }
1456
+ _http;
1457
+ /**
1458
+ * Upload Document
1459
+ *
1460
+ * Upload one file to the knowledge base as multipart/form-data. Requires `documents:write`.
1461
+
1462
+ 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.
1463
+ *
1464
+ * `POST /api/v1/documents`
1465
+ */
1466
+ upload(request, requestOptions) {
1467
+ const { ...body } = request ?? {};
1468
+ return this._http.request({
1469
+ method: "POST",
1470
+ path: "/api/v1/documents",
1471
+ query: void 0,
1472
+ body: toMultipartBody(body),
1473
+ ...mergeRequestOptions(requestOptions)
1474
+ });
1475
+ }
1476
+ /**
1477
+ * Get Document
1478
+ *
1479
+ * Read one knowledge base document and its indexing status. Requires `documents:read`.
1480
+ *
1481
+ * `GET /api/v1/documents/{documentId}`
1482
+ */
1483
+ get(request, requestOptions) {
1484
+ const { documentId, organizationId } = request ?? {};
1485
+ return this._http.request({
1486
+ method: "GET",
1487
+ path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
1488
+ query: { organizationId },
1489
+ body: void 0,
1490
+ ...mergeRequestOptions(requestOptions)
1491
+ });
1492
+ }
1493
+ };
1411
1494
  var EvaluateClient = class {
1412
1495
  constructor(_http) {
1413
1496
  this._http = _http;
@@ -2309,6 +2392,25 @@ var ProductsClient = class {
2309
2392
  ...mergeRequestOptions(requestOptions)
2310
2393
  });
2311
2394
  }
2395
+ /**
2396
+ * Upload Product Image
2397
+ *
2398
+ * Upload one image to a product's or variant's gallery as multipart/form-data. Requires `catalog:write`.
2399
+
2400
+ 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.
2401
+ *
2402
+ * `POST /api/v1/products/{productId}/images`
2403
+ */
2404
+ uploadImage(request, requestOptions) {
2405
+ const { productId, ...body } = request ?? {};
2406
+ return this._http.request({
2407
+ method: "POST",
2408
+ path: `/api/v1/products/${encodePathParam("productId", productId)}/images`,
2409
+ query: void 0,
2410
+ body: toMultipartBody(body),
2411
+ ...mergeRequestOptions(requestOptions)
2412
+ });
2413
+ }
2312
2414
  /**
2313
2415
  * Update Product Inventory
2314
2416
  *
@@ -2638,17 +2740,19 @@ var PromotionsClient = class {
2638
2740
  });
2639
2741
  }
2640
2742
  /**
2641
- * Sync Promotion to Marketplaces
2642
- *
2643
- * Queue marketplace push for assigned products (Shopee promotion, Lazada Store Flash Sale/voucher/Flexicombo, TikTok activity, or Shopify discount). Requires `promotions:write`.
2644
- *
2645
- * `POST /api/v1/promotions/{promotionId}/sync`
2646
- */
2647
- sync(request, requestOptions) {
2743
+ * Retry Marketplace Delivery
2744
+ *
2745
+ * Run marketplace delivery again after a failure, for example once a store is reconnected. Requires `promotions:write`.
2746
+
2747
+ 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.
2748
+ *
2749
+ * `POST /api/v1/promotions/{promotionId}/retry`
2750
+ */
2751
+ retry(request, requestOptions) {
2648
2752
  const { promotionId, organizationId, ...body } = request ?? {};
2649
2753
  return this._http.request({
2650
2754
  method: "POST",
2651
- path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/sync`,
2755
+ path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/retry`,
2652
2756
  query: { organizationId },
2653
2757
  body,
2654
2758
  ...mergeRequestOptions(requestOptions)
@@ -3314,11 +3418,13 @@ var OmniGeneratedClient = class {
3314
3418
  this.agents = new AgentsClient(this._http);
3315
3419
  this.analytics = new AnalyticsClient(this._http);
3316
3420
  this.aop = new AopClient(this._http);
3421
+ this.brandsgateway = new BrandsgatewayClient(this._http);
3317
3422
  this.campaigns = new CampaignsClient(this._http);
3318
3423
  this.catalog = new CatalogClient(this._http);
3319
3424
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
3320
3425
  this.compare = new CompareClient(this._http);
3321
3426
  this.directory = new DirectoryClient(this._http);
3427
+ this.documents = new DocumentsClient(this._http);
3322
3428
  this.evaluate = new EvaluateClient(this._http);
3323
3429
  this.feed = new FeedClient(this._http);
3324
3430
  this.images = new ImagesClient(this._http);
@@ -3349,11 +3455,13 @@ var OmniGeneratedClient = class {
3349
3455
  agents;
3350
3456
  analytics;
3351
3457
  aop;
3458
+ brandsgateway;
3352
3459
  campaigns;
3353
3460
  catalog;
3354
3461
  checkoutSessions;
3355
3462
  compare;
3356
3463
  directory;
3464
+ documents;
3357
3465
  evaluate;
3358
3466
  feed;
3359
3467
  images;