@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.js CHANGED
@@ -24,7 +24,7 @@ function normalizeClientOptions(options = {}) {
24
24
  }
25
25
 
26
26
  // src/version.ts
27
- var SDK_VERSION = "0.1.1";
27
+ var SDK_VERSION = "0.3.0";
28
28
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
29
29
 
30
30
  // src/environments.ts
@@ -507,6 +507,116 @@ async function waitForJob(http, request, options) {
507
507
  }
508
508
 
509
509
  // src/generated/resources.ts
510
+ var AgentsGeneralClient = class {
511
+ constructor(_http) {
512
+ this._http = _http;
513
+ }
514
+ _http;
515
+ /**
516
+ * Invoke the Omni agent
517
+ *
518
+ * Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.
519
+
520
+ 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.
521
+ *
522
+ * `POST /api/v1/agents/general/invoke`
523
+ */
524
+ invoke(request, requestOptions) {
525
+ const { ...body } = request ?? {};
526
+ return this._http.request({
527
+ method: "POST",
528
+ path: "/api/v1/agents/general/invoke",
529
+ query: void 0,
530
+ body,
531
+ ...mergeRequestOptions(requestOptions)
532
+ });
533
+ }
534
+ /**
535
+ * Start an Omni agent run
536
+ *
537
+ * 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.
538
+ *
539
+ * `POST /api/v1/agents/general/runs`
540
+ */
541
+ start(request, requestOptions) {
542
+ const { ...body } = request ?? {};
543
+ return this._http.request({
544
+ method: "POST",
545
+ path: "/api/v1/agents/general/runs",
546
+ query: void 0,
547
+ body,
548
+ ...mergeRequestOptions(requestOptions)
549
+ });
550
+ }
551
+ /**
552
+ * Get an Omni agent run
553
+ *
554
+ * Read a queued, running, completed, paused, or failed Omni agent run. Requires `agents:invoke`.
555
+ *
556
+ * `GET /api/v1/agents/general/runs/{runId}`
557
+ */
558
+ getRun(request, requestOptions) {
559
+ const { runId, organizationId } = request ?? {};
560
+ return this._http.request({
561
+ method: "GET",
562
+ path: `/api/v1/agents/general/runs/${encodePathParam("runId", runId)}`,
563
+ query: { organizationId },
564
+ body: void 0,
565
+ ...mergeRequestOptions(requestOptions)
566
+ });
567
+ }
568
+ };
569
+ var AgentsClient = class {
570
+ constructor(_http) {
571
+ this._http = _http;
572
+ this.general = new AgentsGeneralClient(this._http);
573
+ }
574
+ _http;
575
+ general;
576
+ };
577
+ var AnalyticsClient = class {
578
+ constructor(_http) {
579
+ this._http = _http;
580
+ }
581
+ _http;
582
+ /**
583
+ * Get Sales Analytics
584
+ *
585
+ * 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`.
586
+
587
+ Amounts are in `data.filters.currency`. Only orders in that currency are counted; nothing is converted. A range covers at most 366 days.
588
+ *
589
+ * `GET /api/v1/analytics/sales`
590
+ */
591
+ getSales(request = {}, requestOptions) {
592
+ const {
593
+ organizationId,
594
+ from,
595
+ to,
596
+ marketplace,
597
+ country,
598
+ store,
599
+ currency,
600
+ timeZone
601
+ } = request ?? {};
602
+ return this._http.request({
603
+ method: "GET",
604
+ path: "/api/v1/analytics/sales",
605
+ query: {
606
+ organizationId,
607
+ from,
608
+ to,
609
+ marketplace,
610
+ country,
611
+ store,
612
+ currency,
613
+ timeZone
614
+ },
615
+ body: void 0,
616
+ ...mergeRequestOptions(requestOptions)
617
+ });
618
+ }
619
+ };
510
620
  var AopClient = class {
511
621
  constructor(_http) {
512
622
  this._http = _http;
@@ -636,6 +746,148 @@ var ApiClient = class {
636
746
  });
637
747
  }
638
748
  };
749
+ var CampaignsClient = class {
750
+ constructor(_http) {
751
+ this._http = _http;
752
+ }
753
+ _http;
754
+ /**
755
+ * List Campaigns
756
+ *
757
+ * List campaigns for the authenticated organization. `stage=all` is the workspace working set: draft and running. Requires `promotions:read`.
758
+ *
759
+ * `GET /api/v1/campaigns`
760
+ */
761
+ list(request = {}, requestOptions) {
762
+ const { organizationId, q, stage, offset, limit } = request ?? {};
763
+ return this._http.request({
764
+ method: "GET",
765
+ path: "/api/v1/campaigns",
766
+ query: { organizationId, q, stage, offset, limit },
767
+ body: void 0,
768
+ ...mergeRequestOptions(requestOptions)
769
+ });
770
+ }
771
+ /**
772
+ * Create Campaign
773
+ *
774
+ * Create a draft campaign. `ownerId` and `approverId` must be members of the organization, and every store must already be connected. Requires `promotions:write`.
775
+ *
776
+ * `POST /api/v1/campaigns`
777
+ */
778
+ create(request, requestOptions) {
779
+ const { ...body } = request ?? {};
780
+ return this._http.request({
781
+ method: "POST",
782
+ path: "/api/v1/campaigns",
783
+ query: void 0,
784
+ body,
785
+ ...mergeRequestOptions(requestOptions)
786
+ });
787
+ }
788
+ /**
789
+ * Get Campaign
790
+ *
791
+ * Read one campaign, including its plan, executions, audit, schedule, and progress. Requires `promotions:read`.
792
+ *
793
+ * `GET /api/v1/campaigns/{campaignId}`
794
+ */
795
+ get(request, requestOptions) {
796
+ const { campaignId, organizationId } = request ?? {};
797
+ return this._http.request({
798
+ method: "GET",
799
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
800
+ query: { organizationId },
801
+ body: void 0,
802
+ ...mergeRequestOptions(requestOptions)
803
+ });
804
+ }
805
+ /**
806
+ * Update Campaign
807
+ *
808
+ * Replace a draft or approved plan, or propose one change to a running plan. Send `expectedRevision` from the last read. Requires `promotions:write`.
809
+ *
810
+ * `PUT /api/v1/campaigns/{campaignId}`
811
+ */
812
+ replace(request, requestOptions) {
813
+ const { campaignId, ...body } = request ?? {};
814
+ return this._http.request({
815
+ method: "PUT",
816
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
817
+ query: void 0,
818
+ body,
819
+ ...mergeRequestOptions(requestOptions)
820
+ });
821
+ }
822
+ /**
823
+ * Act on Campaign
824
+ *
825
+ * 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`.
826
+ *
827
+ * `POST /api/v1/campaigns/{campaignId}/actions`
828
+ */
829
+ actions(request, requestOptions) {
830
+ const { campaignId, ...body } = request ?? {};
831
+ return this._http.request({
832
+ method: "POST",
833
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/actions`,
834
+ query: void 0,
835
+ body,
836
+ ...mergeRequestOptions(requestOptions)
837
+ });
838
+ }
839
+ /**
840
+ * Archive Campaigns
841
+ *
842
+ * Archive campaigns, or restore archived campaigns by id or by the current archived list filters. Requires `promotions:write`.
843
+ *
844
+ * `POST /api/v1/campaigns/archive`
845
+ */
846
+ archive(request, requestOptions) {
847
+ const { ...body } = request ?? {};
848
+ return this._http.request({
849
+ method: "POST",
850
+ path: "/api/v1/campaigns/archive",
851
+ query: void 0,
852
+ body,
853
+ ...mergeRequestOptions(requestOptions)
854
+ });
855
+ }
856
+ /**
857
+ * Delete Campaigns
858
+ *
859
+ * Permanently delete archived campaigns by explicit id or by archived list filters. Requires `promotions:write`.
860
+ *
861
+ * `POST /api/v1/campaigns/delete`
862
+ */
863
+ delete(request, requestOptions) {
864
+ const { ...body } = request ?? {};
865
+ return this._http.request({
866
+ method: "POST",
867
+ path: "/api/v1/campaigns/delete",
868
+ query: void 0,
869
+ body,
870
+ ...mergeRequestOptions(requestOptions)
871
+ });
872
+ }
873
+ /**
874
+ * Get Campaign Options
875
+ *
876
+ * List the organization members and connected stores a campaign plan can name. Use a member `id` for `ownerId` and `approverId`. Requires `promotions:write`.
877
+ *
878
+ * `GET /api/v1/campaigns/options`
879
+ */
880
+ getOptions(request = {}, requestOptions) {
881
+ const { organizationId } = request ?? {};
882
+ return this._http.request({
883
+ method: "GET",
884
+ path: "/api/v1/campaigns/options",
885
+ query: { organizationId },
886
+ body: void 0,
887
+ ...mergeRequestOptions(requestOptions)
888
+ });
889
+ }
890
+ };
639
891
  var CatalogClient = class {
640
892
  constructor(_http) {
641
893
  this._http = _http;
@@ -1325,6 +1577,63 @@ var OrdersClient = class {
1325
1577
  ...mergeRequestOptions(requestOptions)
1326
1578
  });
1327
1579
  }
1580
+ /**
1581
+ * Get Order Action Options
1582
+ *
1583
+ * Ask the marketplace which choices an action needs, such as pickup or drop-off for `ship`. Requires `orders:write`.
1584
+
1585
+ Send the chosen choice's `payload` with `POST /api/v1/orders/{orderId}/actions`.
1586
+ *
1587
+ * `GET /api/v1/orders/{orderId}/action-options`
1588
+ */
1589
+ getActionOptions(request, requestOptions) {
1590
+ const { orderId, organizationId, action } = request ?? {};
1591
+ return this._http.request({
1592
+ method: "GET",
1593
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/action-options`,
1594
+ query: { organizationId, action },
1595
+ body: void 0,
1596
+ ...mergeRequestOptions(requestOptions)
1597
+ });
1598
+ }
1599
+ /**
1600
+ * List Order Actions
1601
+ *
1602
+ * The order's 20 most recent action jobs, newest first, plus its latest successful label job. Requires `orders:read`.
1603
+
1604
+ Poll this after queueing an action. A succeeded `labels` job lists its label files in `labels`.
1605
+ *
1606
+ * `GET /api/v1/orders/{orderId}/actions`
1607
+ */
1608
+ listActions(request, requestOptions) {
1609
+ const { orderId, organizationId } = request ?? {};
1610
+ return this._http.request({
1611
+ method: "GET",
1612
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/actions`,
1613
+ query: { organizationId },
1614
+ body: void 0,
1615
+ ...mergeRequestOptions(requestOptions)
1616
+ });
1617
+ }
1618
+ /**
1619
+ * Queue Order Action
1620
+ *
1621
+ * Ship, cancel, generate shipping labels for, or update tracking on a marketplace order. Requires `orders:write`.
1622
+
1623
+ 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.
1624
+ *
1625
+ * `POST /api/v1/orders/{orderId}/actions`
1626
+ */
1627
+ queueAction(request, requestOptions) {
1628
+ const { orderId, ...body } = request ?? {};
1629
+ return this._http.request({
1630
+ method: "POST",
1631
+ path: `/api/v1/orders/${encodePathParam("orderId", orderId)}/actions`,
1632
+ query: void 0,
1633
+ body,
1634
+ ...mergeRequestOptions(requestOptions)
1635
+ });
1636
+ }
1328
1637
  };
1329
1638
  var OrganizationsClient = class {
1330
1639
  constructor(_http) {
@@ -1492,7 +1801,9 @@ var ProductsClient = class {
1492
1801
  *
1493
1802
  * 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`.
1494
1803
 
1495
- 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.
1804
+ ### Stock and variants
1805
+
1806
+ 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.
1496
1807
  *
1497
1808
  * `GET /api/v1/products`
1498
1809
  */
@@ -1586,6 +1897,8 @@ var ProductsClient = class {
1586
1897
  - Localization content and cultural notes
1587
1898
  - Intent queries and signals
1588
1899
  - Sources and claims
1900
+
1901
+ A parent product returns its variants in `variants`, with each variant's option values, price, stock, image, and marketplace listings.
1589
1902
  *
1590
1903
  * `GET /api/v1/products/{productId}`
1591
1904
  */
@@ -1679,6 +1992,25 @@ var ProductsClient = class {
1679
1992
  ...mergeRequestOptions(requestOptions)
1680
1993
  });
1681
1994
  }
1995
+ /**
1996
+ * Get Product Listings
1997
+ *
1998
+ * 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`.
1999
+
2000
+ Poll after `POST /api/v1/products/{productId}/publish`.
2001
+ *
2002
+ * `GET /api/v1/products/{productId}/listings`
2003
+ */
2004
+ getListings(request, requestOptions) {
2005
+ const { productId, organizationId } = request ?? {};
2006
+ return this._http.request({
2007
+ method: "GET",
2008
+ path: `/api/v1/products/${encodePathParam("productId", productId)}/listings`,
2009
+ query: { organizationId },
2010
+ body: void 0,
2011
+ ...mergeRequestOptions(requestOptions)
2012
+ });
2013
+ }
1682
2014
  /**
1683
2015
  * Update Product Price
1684
2016
  *
@@ -2037,6 +2369,108 @@ var ReturnsClient = class {
2037
2369
  });
2038
2370
  }
2039
2371
  };
2372
+ var ReviewsClient = class {
2373
+ constructor(_http) {
2374
+ this._http = _http;
2375
+ }
2376
+ _http;
2377
+ /**
2378
+ * List Reviews
2379
+ *
2380
+ * List marketplace product reviews, newest first unless `sortBy` says otherwise. Requires `reviews:read`.
2381
+
2382
+ Use `priority=unreplied` for a reply queue. `replyRestriction` is null when a reply will be accepted.
2383
+ *
2384
+ * `GET /api/v1/reviews`
2385
+ */
2386
+ list(request = {}, requestOptions) {
2387
+ const {
2388
+ organizationId,
2389
+ q,
2390
+ marketplace,
2391
+ status,
2392
+ priority,
2393
+ store,
2394
+ productId,
2395
+ sortBy,
2396
+ limit,
2397
+ offset
2398
+ } = request ?? {};
2399
+ return this._http.request({
2400
+ method: "GET",
2401
+ path: "/api/v1/reviews",
2402
+ query: {
2403
+ organizationId,
2404
+ q,
2405
+ marketplace,
2406
+ status,
2407
+ priority,
2408
+ store,
2409
+ productId,
2410
+ sortBy,
2411
+ limit,
2412
+ offset
2413
+ },
2414
+ body: void 0,
2415
+ ...mergeRequestOptions(requestOptions)
2416
+ });
2417
+ }
2418
+ /**
2419
+ * Get Review
2420
+ *
2421
+ * Read one review by its OmniCommerce UUID. Requires `reviews:read`.
2422
+ *
2423
+ * `GET /api/v1/reviews/{reviewId}`
2424
+ */
2425
+ get(request, requestOptions) {
2426
+ const { reviewId, organizationId } = request ?? {};
2427
+ return this._http.request({
2428
+ method: "GET",
2429
+ path: `/api/v1/reviews/${encodePathParam("reviewId", reviewId)}`,
2430
+ query: { organizationId },
2431
+ body: void 0,
2432
+ ...mergeRequestOptions(requestOptions)
2433
+ });
2434
+ }
2435
+ /**
2436
+ * Draft Review Reply
2437
+ *
2438
+ * Draft a reply with AI from the review, the product, recent replies, and the brand kit. Uses AI credits. Requires `reviews:write`.
2439
+
2440
+ Nothing is posted; send the text with `POST /api/v1/reviews/actions`.
2441
+ *
2442
+ * `POST /api/v1/reviews/{reviewId}/draft-reply`
2443
+ */
2444
+ draftReply(request, requestOptions) {
2445
+ const { reviewId, organizationId, ...body } = request ?? {};
2446
+ return this._http.request({
2447
+ method: "POST",
2448
+ path: `/api/v1/reviews/${encodePathParam("reviewId", reviewId)}/draft-reply`,
2449
+ query: { organizationId },
2450
+ body,
2451
+ ...mergeRequestOptions(requestOptions)
2452
+ });
2453
+ }
2454
+ /**
2455
+ * Act on Reviews
2456
+ *
2457
+ * Reply to up to 50 reviews, or send Amazon review requests for solicitation rows. Requires `reviews:write`.
2458
+
2459
+ Each target succeeds or fails on its own; read `data.results`. `ok` is true only when every target succeeds.
2460
+ *
2461
+ * `POST /api/v1/reviews/actions`
2462
+ */
2463
+ actions(request, requestOptions) {
2464
+ const { ...body } = request ?? {};
2465
+ return this._http.request({
2466
+ method: "POST",
2467
+ path: "/api/v1/reviews/actions",
2468
+ query: void 0,
2469
+ body,
2470
+ ...mergeRequestOptions(requestOptions)
2471
+ });
2472
+ }
2473
+ };
2040
2474
  var SearchClient = class {
2041
2475
  constructor(_http) {
2042
2476
  this._http = _http;
@@ -2535,8 +2969,11 @@ var ZaloraClient = class {
2535
2969
  var OmniGeneratedClient = class {
2536
2970
  constructor(_http) {
2537
2971
  this._http = _http;
2972
+ this.agents = new AgentsClient(this._http);
2973
+ this.analytics = new AnalyticsClient(this._http);
2538
2974
  this.aop = new AopClient(this._http);
2539
2975
  this.api = new ApiClient(this._http);
2976
+ this.campaigns = new CampaignsClient(this._http);
2540
2977
  this.catalog = new CatalogClient(this._http);
2541
2978
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
2542
2979
  this.compare = new CompareClient(this._http);
@@ -2557,6 +2994,7 @@ var OmniGeneratedClient = class {
2557
2994
  this.products = new ProductsClient(this._http);
2558
2995
  this.promotions = new PromotionsClient(this._http);
2559
2996
  this.returns = new ReturnsClient(this._http);
2997
+ this.reviews = new ReviewsClient(this._http);
2560
2998
  this.search = new SearchClient(this._http);
2561
2999
  this.settlements = new SettlementsClient(this._http);
2562
3000
  this.sync = new SyncClient(this._http);
@@ -2567,8 +3005,11 @@ var OmniGeneratedClient = class {
2567
3005
  this.zalora = new ZaloraClient(this._http);
2568
3006
  }
2569
3007
  _http;
3008
+ agents;
3009
+ analytics;
2570
3010
  aop;
2571
3011
  api;
3012
+ campaigns;
2572
3013
  catalog;
2573
3014
  checkoutSessions;
2574
3015
  compare;
@@ -2589,6 +3030,7 @@ var OmniGeneratedClient = class {
2589
3030
  products;
2590
3031
  promotions;
2591
3032
  returns;
3033
+ reviews;
2592
3034
  search;
2593
3035
  settlements;
2594
3036
  sync;