@omni-commerce/sdk 0.1.1 → 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.1.1";
29
+ var SDK_VERSION = "0.3.0";
30
30
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
31
31
 
32
32
  // src/environments.ts
@@ -509,6 +509,116 @@ async function waitForJob(http, request, options) {
509
509
  }
510
510
 
511
511
  // src/generated/resources.ts
512
+ var AgentsGeneralClient = class {
513
+ constructor(_http) {
514
+ this._http = _http;
515
+ }
516
+ _http;
517
+ /**
518
+ * Invoke the Omni agent
519
+ *
520
+ * Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.
521
+
522
+ A waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run. Omit `config.enabled_tools` to use the organization's agent tools. Attach images on the latest user message as `{ type: "image", url }` HTTP(S) URLs.
523
+ *
524
+ * `POST /api/v1/agents/general/invoke`
525
+ */
526
+ invoke(request, requestOptions) {
527
+ const { ...body } = request ?? {};
528
+ return this._http.request({
529
+ method: "POST",
530
+ path: "/api/v1/agents/general/invoke",
531
+ query: void 0,
532
+ body,
533
+ ...mergeRequestOptions(requestOptions)
534
+ });
535
+ }
536
+ /**
537
+ * Start an Omni agent run
538
+ *
539
+ * Queue the general Omni agent and return immediately with the run in `queued` state. Poll the URL in the `Location` header (`GET /api/v1/agents/general/runs/{runId}`), honoring `Retry-After`. Requires `agents:invoke`. The request body matches invoke.
540
+ *
541
+ * `POST /api/v1/agents/general/runs`
542
+ */
543
+ start(request, requestOptions) {
544
+ const { ...body } = request ?? {};
545
+ return this._http.request({
546
+ method: "POST",
547
+ path: "/api/v1/agents/general/runs",
548
+ query: void 0,
549
+ body,
550
+ ...mergeRequestOptions(requestOptions)
551
+ });
552
+ }
553
+ /**
554
+ * Get an Omni agent run
555
+ *
556
+ * Read a queued, running, completed, paused, or failed Omni agent run. Requires `agents:invoke`.
557
+ *
558
+ * `GET /api/v1/agents/general/runs/{runId}`
559
+ */
560
+ getRun(request, requestOptions) {
561
+ const { runId, organizationId } = request ?? {};
562
+ return this._http.request({
563
+ method: "GET",
564
+ path: `/api/v1/agents/general/runs/${encodePathParam("runId", runId)}`,
565
+ query: { organizationId },
566
+ body: void 0,
567
+ ...mergeRequestOptions(requestOptions)
568
+ });
569
+ }
570
+ };
571
+ var AgentsClient = class {
572
+ constructor(_http) {
573
+ this._http = _http;
574
+ this.general = new AgentsGeneralClient(this._http);
575
+ }
576
+ _http;
577
+ general;
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
+ };
512
622
  var AopClient = class {
513
623
  constructor(_http) {
514
624
  this._http = _http;
@@ -638,6 +748,148 @@ var ApiClient = class {
638
748
  });
639
749
  }
640
750
  };
751
+ var CampaignsClient = class {
752
+ constructor(_http) {
753
+ this._http = _http;
754
+ }
755
+ _http;
756
+ /**
757
+ * List Campaigns
758
+ *
759
+ * List campaigns for the authenticated organization. `stage=all` is the workspace working set: draft and running. Requires `promotions:read`.
760
+ *
761
+ * `GET /api/v1/campaigns`
762
+ */
763
+ list(request = {}, requestOptions) {
764
+ const { organizationId, q, stage, offset, limit } = request ?? {};
765
+ return this._http.request({
766
+ method: "GET",
767
+ path: "/api/v1/campaigns",
768
+ query: { organizationId, q, stage, offset, limit },
769
+ body: void 0,
770
+ ...mergeRequestOptions(requestOptions)
771
+ });
772
+ }
773
+ /**
774
+ * Create Campaign
775
+ *
776
+ * Create a draft campaign. `ownerId` and `approverId` must be members of the organization, and every store must already be connected. Requires `promotions:write`.
777
+ *
778
+ * `POST /api/v1/campaigns`
779
+ */
780
+ create(request, requestOptions) {
781
+ const { ...body } = request ?? {};
782
+ return this._http.request({
783
+ method: "POST",
784
+ path: "/api/v1/campaigns",
785
+ query: void 0,
786
+ body,
787
+ ...mergeRequestOptions(requestOptions)
788
+ });
789
+ }
790
+ /**
791
+ * Get Campaign
792
+ *
793
+ * Read one campaign, including its plan, executions, audit, schedule, and progress. Requires `promotions:read`.
794
+ *
795
+ * `GET /api/v1/campaigns/{campaignId}`
796
+ */
797
+ get(request, requestOptions) {
798
+ const { campaignId, organizationId } = request ?? {};
799
+ return this._http.request({
800
+ method: "GET",
801
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
802
+ query: { organizationId },
803
+ body: void 0,
804
+ ...mergeRequestOptions(requestOptions)
805
+ });
806
+ }
807
+ /**
808
+ * Update Campaign
809
+ *
810
+ * Replace a draft or approved plan, or propose one change to a running plan. Send `expectedRevision` from the last read. Requires `promotions:write`.
811
+ *
812
+ * `PUT /api/v1/campaigns/{campaignId}`
813
+ */
814
+ replace(request, requestOptions) {
815
+ const { campaignId, ...body } = request ?? {};
816
+ return this._http.request({
817
+ method: "PUT",
818
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
819
+ query: void 0,
820
+ body,
821
+ ...mergeRequestOptions(requestOptions)
822
+ });
823
+ }
824
+ /**
825
+ * Act on Campaign
826
+ *
827
+ * Approve, start, end, resume, retry, or decide a proposed live change. Approve, run, resume, and approving a change must be called by the named approver. Requires `promotions:write`.
828
+ *
829
+ * `POST /api/v1/campaigns/{campaignId}/actions`
830
+ */
831
+ actions(request, requestOptions) {
832
+ const { campaignId, ...body } = request ?? {};
833
+ return this._http.request({
834
+ method: "POST",
835
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/actions`,
836
+ query: void 0,
837
+ body,
838
+ ...mergeRequestOptions(requestOptions)
839
+ });
840
+ }
841
+ /**
842
+ * Archive Campaigns
843
+ *
844
+ * Archive campaigns, or restore archived campaigns by id or by the current archived list filters. Requires `promotions:write`.
845
+ *
846
+ * `POST /api/v1/campaigns/archive`
847
+ */
848
+ archive(request, requestOptions) {
849
+ const { ...body } = request ?? {};
850
+ return this._http.request({
851
+ method: "POST",
852
+ path: "/api/v1/campaigns/archive",
853
+ query: void 0,
854
+ body,
855
+ ...mergeRequestOptions(requestOptions)
856
+ });
857
+ }
858
+ /**
859
+ * Delete Campaigns
860
+ *
861
+ * Permanently delete archived campaigns by explicit id or by archived list filters. Requires `promotions:write`.
862
+ *
863
+ * `POST /api/v1/campaigns/delete`
864
+ */
865
+ delete(request, requestOptions) {
866
+ const { ...body } = request ?? {};
867
+ return this._http.request({
868
+ method: "POST",
869
+ path: "/api/v1/campaigns/delete",
870
+ query: void 0,
871
+ body,
872
+ ...mergeRequestOptions(requestOptions)
873
+ });
874
+ }
875
+ /**
876
+ * Get Campaign Options
877
+ *
878
+ * List the organization members and connected stores a campaign plan can name. Use a member `id` for `ownerId` and `approverId`. Requires `promotions:write`.
879
+ *
880
+ * `GET /api/v1/campaigns/options`
881
+ */
882
+ getOptions(request = {}, requestOptions) {
883
+ const { organizationId } = request ?? {};
884
+ return this._http.request({
885
+ method: "GET",
886
+ path: "/api/v1/campaigns/options",
887
+ query: { organizationId },
888
+ body: void 0,
889
+ ...mergeRequestOptions(requestOptions)
890
+ });
891
+ }
892
+ };
641
893
  var CatalogClient = class {
642
894
  constructor(_http) {
643
895
  this._http = _http;
@@ -1327,6 +1579,63 @@ var OrdersClient = class {
1327
1579
  ...mergeRequestOptions(requestOptions)
1328
1580
  });
1329
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
+ }
1330
1639
  };
1331
1640
  var OrganizationsClient = class {
1332
1641
  constructor(_http) {
@@ -1494,7 +1803,9 @@ var ProductsClient = class {
1494
1803
  *
1495
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`.
1496
1805
 
1497
- 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.
1498
1809
  *
1499
1810
  * `GET /api/v1/products`
1500
1811
  */
@@ -1588,6 +1899,8 @@ var ProductsClient = class {
1588
1899
  - Localization content and cultural notes
1589
1900
  - Intent queries and signals
1590
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.
1591
1904
  *
1592
1905
  * `GET /api/v1/products/{productId}`
1593
1906
  */
@@ -1681,6 +1994,25 @@ var ProductsClient = class {
1681
1994
  ...mergeRequestOptions(requestOptions)
1682
1995
  });
1683
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
+ }
1684
2016
  /**
1685
2017
  * Update Product Price
1686
2018
  *
@@ -2039,6 +2371,108 @@ var ReturnsClient = class {
2039
2371
  });
2040
2372
  }
2041
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
+ };
2042
2476
  var SearchClient = class {
2043
2477
  constructor(_http) {
2044
2478
  this._http = _http;
@@ -2537,8 +2971,11 @@ var ZaloraClient = class {
2537
2971
  var OmniGeneratedClient = class {
2538
2972
  constructor(_http) {
2539
2973
  this._http = _http;
2974
+ this.agents = new AgentsClient(this._http);
2975
+ this.analytics = new AnalyticsClient(this._http);
2540
2976
  this.aop = new AopClient(this._http);
2541
2977
  this.api = new ApiClient(this._http);
2978
+ this.campaigns = new CampaignsClient(this._http);
2542
2979
  this.catalog = new CatalogClient(this._http);
2543
2980
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
2544
2981
  this.compare = new CompareClient(this._http);
@@ -2559,6 +2996,7 @@ var OmniGeneratedClient = class {
2559
2996
  this.products = new ProductsClient(this._http);
2560
2997
  this.promotions = new PromotionsClient(this._http);
2561
2998
  this.returns = new ReturnsClient(this._http);
2999
+ this.reviews = new ReviewsClient(this._http);
2562
3000
  this.search = new SearchClient(this._http);
2563
3001
  this.settlements = new SettlementsClient(this._http);
2564
3002
  this.sync = new SyncClient(this._http);
@@ -2569,8 +3007,11 @@ var OmniGeneratedClient = class {
2569
3007
  this.zalora = new ZaloraClient(this._http);
2570
3008
  }
2571
3009
  _http;
3010
+ agents;
3011
+ analytics;
2572
3012
  aop;
2573
3013
  api;
3014
+ campaigns;
2574
3015
  catalog;
2575
3016
  checkoutSessions;
2576
3017
  compare;
@@ -2591,6 +3032,7 @@ var OmniGeneratedClient = class {
2591
3032
  products;
2592
3033
  promotions;
2593
3034
  returns;
3035
+ reviews;
2594
3036
  search;
2595
3037
  settlements;
2596
3038
  sync;