@omni-commerce/sdk 0.2.0 → 0.3.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.2.0";
29
+ var SDK_VERSION = "0.3.0";
30
30
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
31
31
 
32
32
  // src/environments.ts
@@ -576,6 +576,49 @@ var AgentsClient = class {
576
576
  _http;
577
577
  general;
578
578
  };
579
+ var AnalyticsClient = class {
580
+ constructor(_http) {
581
+ this._http = _http;
582
+ }
583
+ _http;
584
+ /**
585
+ * Get Sales Analytics
586
+ *
587
+ * Sales KPIs for a date range with the change against the previous period of equal length, a daily trend, sales by order status and by marketplace, and the top products by net sales. Matches the Orders analysis page. Requires `analytics:read`.
588
+
589
+ Amounts are in `data.filters.currency`. Only orders in that currency are counted; nothing is converted. A range covers at most 366 days.
590
+ *
591
+ * `GET /api/v1/analytics/sales`
592
+ */
593
+ getSales(request = {}, requestOptions) {
594
+ const {
595
+ organizationId,
596
+ from,
597
+ to,
598
+ marketplace,
599
+ country,
600
+ store,
601
+ currency,
602
+ timeZone
603
+ } = request ?? {};
604
+ return this._http.request({
605
+ method: "GET",
606
+ path: "/api/v1/analytics/sales",
607
+ query: {
608
+ organizationId,
609
+ from,
610
+ to,
611
+ marketplace,
612
+ country,
613
+ store,
614
+ currency,
615
+ timeZone
616
+ },
617
+ body: void 0,
618
+ ...mergeRequestOptions(requestOptions)
619
+ });
620
+ }
621
+ };
579
622
  var AopClient = class {
580
623
  constructor(_http) {
581
624
  this._http = _http;
@@ -1536,6 +1579,63 @@ var OrdersClient = class {
1536
1579
  ...mergeRequestOptions(requestOptions)
1537
1580
  });
1538
1581
  }
1582
+ /**
1583
+ * Get Order Action Options
1584
+ *
1585
+ * Ask the marketplace which choices an action needs, such as pickup or drop-off for `ship`. Requires `orders:write`.
1586
+
1587
+ Send the chosen choice's `payload` with `POST /api/v1/orders/{orderId}/actions`.
1588
+ *
1589
+ * `GET /api/v1/orders/{orderId}/action-options`
1590
+ */
1591
+ getActionOptions(request, requestOptions) {
1592
+ const { orderId, organizationId, action } = request ?? {};
1593
+ return this._http.request({
1594
+ method: "GET",
1595
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/action-options`,
1596
+ query: { organizationId, action },
1597
+ body: void 0,
1598
+ ...mergeRequestOptions(requestOptions)
1599
+ });
1600
+ }
1601
+ /**
1602
+ * List Order Actions
1603
+ *
1604
+ * The order's 20 most recent action jobs, newest first, plus its latest successful label job. Requires `orders:read`.
1605
+
1606
+ Poll this after queueing an action. A succeeded `labels` job lists its label files in `labels`.
1607
+ *
1608
+ * `GET /api/v1/orders/{orderId}/actions`
1609
+ */
1610
+ listActions(request, requestOptions) {
1611
+ const { orderId, organizationId } = request ?? {};
1612
+ return this._http.request({
1613
+ method: "GET",
1614
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/actions`,
1615
+ query: { organizationId },
1616
+ body: void 0,
1617
+ ...mergeRequestOptions(requestOptions)
1618
+ });
1619
+ }
1620
+ /**
1621
+ * Queue Order Action
1622
+ *
1623
+ * Ship, cancel, generate shipping labels for, or update tracking on a marketplace order. Requires `orders:write`.
1624
+
1625
+ The marketplace call runs in the background: the response is `202` with `jobId`; poll `GET /api/v1/orders/{orderId}/actions`. A repeated `idempotencyKey` returns `200` with the original job.
1626
+ *
1627
+ * `POST /api/v1/orders/{orderId}/actions`
1628
+ */
1629
+ queueAction(request, requestOptions) {
1630
+ const { orderId, ...body } = request ?? {};
1631
+ return this._http.request({
1632
+ method: "POST",
1633
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/actions`,
1634
+ query: void 0,
1635
+ body,
1636
+ ...mergeRequestOptions(requestOptions)
1637
+ });
1638
+ }
1539
1639
  };
1540
1640
  var OrganizationsClient = class {
1541
1641
  constructor(_http) {
@@ -1703,7 +1803,9 @@ var ProductsClient = class {
1703
1803
  *
1704
1804
  * List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
1705
1805
 
1706
- Rows are in `items`. Read catalog stock from `items[].stockQuantity`: parent rows already aggregate their non-deleted variants, and virtual bundles use component availability with any manual cap. Null means unknown, not zero. List rows do not contain `inventoryQuantity`, `inventory.quantity`, or an embedded `variants` array.
1806
+ ### Stock and variants
1807
+
1808
+ Rows are in `items`. Read catalog stock from `items[].stockQuantity`: parent rows already aggregate their non-deleted variants, and virtual bundles use component availability with any manual cap. Null means unknown, not zero. A row with `variantCount` above 0 has variants; fetch them from `GET /api/v1/products/{productId}`. List rows do not contain `inventoryQuantity`, `inventory.quantity`, or an embedded `variants` array.
1707
1809
  *
1708
1810
  * `GET /api/v1/products`
1709
1811
  */
@@ -1797,6 +1899,8 @@ var ProductsClient = class {
1797
1899
  - Localization content and cultural notes
1798
1900
  - Intent queries and signals
1799
1901
  - Sources and claims
1902
+
1903
+ A parent product returns its variants in `variants`, with each variant's option values, price, stock, image, and marketplace listings.
1800
1904
  *
1801
1905
  * `GET /api/v1/products/{productId}`
1802
1906
  */
@@ -1890,6 +1994,25 @@ var ProductsClient = class {
1890
1994
  ...mergeRequestOptions(requestOptions)
1891
1995
  });
1892
1996
  }
1997
+ /**
1998
+ * Get Product Listings
1999
+ *
2000
+ * Where a product is listed: each marketplace's store, live or delisted state, item id, buyer-facing URL, and the latest publish attempt with any rejection details. Requires `catalog:read`.
2001
+
2002
+ Poll after `POST /api/v1/products/{productId}/publish`.
2003
+ *
2004
+ * `GET /api/v1/products/{productId}/listings`
2005
+ */
2006
+ getListings(request, requestOptions) {
2007
+ const { productId, organizationId } = request ?? {};
2008
+ return this._http.request({
2009
+ method: "GET",
2010
+ path: `/api/v1/products/${encodePathParam("productId", productId)}/listings`,
2011
+ query: { organizationId },
2012
+ body: void 0,
2013
+ ...mergeRequestOptions(requestOptions)
2014
+ });
2015
+ }
1893
2016
  /**
1894
2017
  * Update Product Price
1895
2018
  *
@@ -2248,6 +2371,108 @@ var ReturnsClient = class {
2248
2371
  });
2249
2372
  }
2250
2373
  };
2374
+ var ReviewsClient = class {
2375
+ constructor(_http) {
2376
+ this._http = _http;
2377
+ }
2378
+ _http;
2379
+ /**
2380
+ * List Reviews
2381
+ *
2382
+ * List marketplace product reviews, newest first unless `sortBy` says otherwise. Requires `reviews:read`.
2383
+
2384
+ Use `priority=unreplied` for a reply queue. `replyRestriction` is null when a reply will be accepted.
2385
+ *
2386
+ * `GET /api/v1/reviews`
2387
+ */
2388
+ list(request = {}, requestOptions) {
2389
+ const {
2390
+ organizationId,
2391
+ q,
2392
+ marketplace,
2393
+ status,
2394
+ priority,
2395
+ store,
2396
+ productId,
2397
+ sortBy,
2398
+ limit,
2399
+ offset
2400
+ } = request ?? {};
2401
+ return this._http.request({
2402
+ method: "GET",
2403
+ path: "/api/v1/reviews",
2404
+ query: {
2405
+ organizationId,
2406
+ q,
2407
+ marketplace,
2408
+ status,
2409
+ priority,
2410
+ store,
2411
+ productId,
2412
+ sortBy,
2413
+ limit,
2414
+ offset
2415
+ },
2416
+ body: void 0,
2417
+ ...mergeRequestOptions(requestOptions)
2418
+ });
2419
+ }
2420
+ /**
2421
+ * Get Review
2422
+ *
2423
+ * Read one review by its OmniCommerce UUID. Requires `reviews:read`.
2424
+ *
2425
+ * `GET /api/v1/reviews/{reviewId}`
2426
+ */
2427
+ get(request, requestOptions) {
2428
+ const { reviewId, organizationId } = request ?? {};
2429
+ return this._http.request({
2430
+ method: "GET",
2431
+ path: `/api/v1/reviews/${encodePathParam("reviewId", reviewId)}`,
2432
+ query: { organizationId },
2433
+ body: void 0,
2434
+ ...mergeRequestOptions(requestOptions)
2435
+ });
2436
+ }
2437
+ /**
2438
+ * Draft Review Reply
2439
+ *
2440
+ * Draft a reply with AI from the review, the product, recent replies, and the brand kit. Uses AI credits. Requires `reviews:write`.
2441
+
2442
+ Nothing is posted; send the text with `POST /api/v1/reviews/actions`.
2443
+ *
2444
+ * `POST /api/v1/reviews/{reviewId}/draft-reply`
2445
+ */
2446
+ draftReply(request, requestOptions) {
2447
+ const { reviewId, organizationId, ...body } = request ?? {};
2448
+ return this._http.request({
2449
+ method: "POST",
2450
+ path: `/api/v1/reviews/${encodePathParam("reviewId", reviewId)}/draft-reply`,
2451
+ query: { organizationId },
2452
+ body,
2453
+ ...mergeRequestOptions(requestOptions)
2454
+ });
2455
+ }
2456
+ /**
2457
+ * Act on Reviews
2458
+ *
2459
+ * Reply to up to 50 reviews, or send Amazon review requests for solicitation rows. Requires `reviews:write`.
2460
+
2461
+ Each target succeeds or fails on its own; read `data.results`. `ok` is true only when every target succeeds.
2462
+ *
2463
+ * `POST /api/v1/reviews/actions`
2464
+ */
2465
+ actions(request, requestOptions) {
2466
+ const { ...body } = request ?? {};
2467
+ return this._http.request({
2468
+ method: "POST",
2469
+ path: "/api/v1/reviews/actions",
2470
+ query: void 0,
2471
+ body,
2472
+ ...mergeRequestOptions(requestOptions)
2473
+ });
2474
+ }
2475
+ };
2251
2476
  var SearchClient = class {
2252
2477
  constructor(_http) {
2253
2478
  this._http = _http;
@@ -2747,6 +2972,7 @@ var OmniGeneratedClient = class {
2747
2972
  constructor(_http) {
2748
2973
  this._http = _http;
2749
2974
  this.agents = new AgentsClient(this._http);
2975
+ this.analytics = new AnalyticsClient(this._http);
2750
2976
  this.aop = new AopClient(this._http);
2751
2977
  this.api = new ApiClient(this._http);
2752
2978
  this.campaigns = new CampaignsClient(this._http);
@@ -2770,6 +2996,7 @@ var OmniGeneratedClient = class {
2770
2996
  this.products = new ProductsClient(this._http);
2771
2997
  this.promotions = new PromotionsClient(this._http);
2772
2998
  this.returns = new ReturnsClient(this._http);
2999
+ this.reviews = new ReviewsClient(this._http);
2773
3000
  this.search = new SearchClient(this._http);
2774
3001
  this.settlements = new SettlementsClient(this._http);
2775
3002
  this.sync = new SyncClient(this._http);
@@ -2781,6 +3008,7 @@ var OmniGeneratedClient = class {
2781
3008
  }
2782
3009
  _http;
2783
3010
  agents;
3011
+ analytics;
2784
3012
  aop;
2785
3013
  api;
2786
3014
  campaigns;
@@ -2804,6 +3032,7 @@ var OmniGeneratedClient = class {
2804
3032
  products;
2805
3033
  promotions;
2806
3034
  returns;
3035
+ reviews;
2807
3036
  search;
2808
3037
  settlements;
2809
3038
  sync;