@omni-commerce/sdk 0.1.0 → 0.2.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.0";
27
+ var SDK_VERSION = "0.2.0";
28
28
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
29
29
 
30
30
  // src/environments.ts
@@ -507,6 +507,73 @@ 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
+ };
510
577
  var AopClient = class {
511
578
  constructor(_http) {
512
579
  this._http = _http;
@@ -636,6 +703,148 @@ var ApiClient = class {
636
703
  });
637
704
  }
638
705
  };
706
+ var CampaignsClient = class {
707
+ constructor(_http) {
708
+ this._http = _http;
709
+ }
710
+ _http;
711
+ /**
712
+ * List Campaigns
713
+ *
714
+ * List campaigns for the authenticated organization. `stage=all` is the workspace working set: draft and running. Requires `promotions:read`.
715
+ *
716
+ * `GET /api/v1/campaigns`
717
+ */
718
+ list(request = {}, requestOptions) {
719
+ const { organizationId, q, stage, offset, limit } = request ?? {};
720
+ return this._http.request({
721
+ method: "GET",
722
+ path: "/api/v1/campaigns",
723
+ query: { organizationId, q, stage, offset, limit },
724
+ body: void 0,
725
+ ...mergeRequestOptions(requestOptions)
726
+ });
727
+ }
728
+ /**
729
+ * Create Campaign
730
+ *
731
+ * Create a draft campaign. `ownerId` and `approverId` must be members of the organization, and every store must already be connected. Requires `promotions:write`.
732
+ *
733
+ * `POST /api/v1/campaigns`
734
+ */
735
+ create(request, requestOptions) {
736
+ const { ...body } = request ?? {};
737
+ return this._http.request({
738
+ method: "POST",
739
+ path: "/api/v1/campaigns",
740
+ query: void 0,
741
+ body,
742
+ ...mergeRequestOptions(requestOptions)
743
+ });
744
+ }
745
+ /**
746
+ * Get Campaign
747
+ *
748
+ * Read one campaign, including its plan, executions, audit, schedule, and progress. Requires `promotions:read`.
749
+ *
750
+ * `GET /api/v1/campaigns/{campaignId}`
751
+ */
752
+ get(request, requestOptions) {
753
+ const { campaignId, organizationId } = request ?? {};
754
+ return this._http.request({
755
+ method: "GET",
756
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
757
+ query: { organizationId },
758
+ body: void 0,
759
+ ...mergeRequestOptions(requestOptions)
760
+ });
761
+ }
762
+ /**
763
+ * Update Campaign
764
+ *
765
+ * Replace a draft or approved plan, or propose one change to a running plan. Send `expectedRevision` from the last read. Requires `promotions:write`.
766
+ *
767
+ * `PUT /api/v1/campaigns/{campaignId}`
768
+ */
769
+ replace(request, requestOptions) {
770
+ const { campaignId, ...body } = request ?? {};
771
+ return this._http.request({
772
+ method: "PUT",
773
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
774
+ query: void 0,
775
+ body,
776
+ ...mergeRequestOptions(requestOptions)
777
+ });
778
+ }
779
+ /**
780
+ * Act on Campaign
781
+ *
782
+ * 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`.
783
+ *
784
+ * `POST /api/v1/campaigns/{campaignId}/actions`
785
+ */
786
+ actions(request, requestOptions) {
787
+ const { campaignId, ...body } = request ?? {};
788
+ return this._http.request({
789
+ method: "POST",
790
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/actions`,
791
+ query: void 0,
792
+ body,
793
+ ...mergeRequestOptions(requestOptions)
794
+ });
795
+ }
796
+ /**
797
+ * Archive Campaigns
798
+ *
799
+ * Archive campaigns, or restore archived campaigns by id or by the current archived list filters. Requires `promotions:write`.
800
+ *
801
+ * `POST /api/v1/campaigns/archive`
802
+ */
803
+ archive(request, requestOptions) {
804
+ const { ...body } = request ?? {};
805
+ return this._http.request({
806
+ method: "POST",
807
+ path: "/api/v1/campaigns/archive",
808
+ query: void 0,
809
+ body,
810
+ ...mergeRequestOptions(requestOptions)
811
+ });
812
+ }
813
+ /**
814
+ * Delete Campaigns
815
+ *
816
+ * Permanently delete archived campaigns by explicit id or by archived list filters. Requires `promotions:write`.
817
+ *
818
+ * `POST /api/v1/campaigns/delete`
819
+ */
820
+ delete(request, requestOptions) {
821
+ const { ...body } = request ?? {};
822
+ return this._http.request({
823
+ method: "POST",
824
+ path: "/api/v1/campaigns/delete",
825
+ query: void 0,
826
+ body,
827
+ ...mergeRequestOptions(requestOptions)
828
+ });
829
+ }
830
+ /**
831
+ * Get Campaign Options
832
+ *
833
+ * List the organization members and connected stores a campaign plan can name. Use a member `id` for `ownerId` and `approverId`. Requires `promotions:write`.
834
+ *
835
+ * `GET /api/v1/campaigns/options`
836
+ */
837
+ getOptions(request = {}, requestOptions) {
838
+ const { organizationId } = request ?? {};
839
+ return this._http.request({
840
+ method: "GET",
841
+ path: "/api/v1/campaigns/options",
842
+ query: { organizationId },
843
+ body: void 0,
844
+ ...mergeRequestOptions(requestOptions)
845
+ });
846
+ }
847
+ };
639
848
  var CatalogClient = class {
640
849
  constructor(_http) {
641
850
  this._http = _http;
@@ -1488,12 +1697,14 @@ var ProductsClient = class {
1488
1697
  }
1489
1698
  _http;
1490
1699
  /**
1491
- * List Products
1492
- *
1493
- * 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
- *
1495
- * `GET /api/v1/products`
1496
- */
1700
+ * List Products
1701
+ *
1702
+ * 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`.
1703
+
1704
+ 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.
1705
+ *
1706
+ * `GET /api/v1/products`
1707
+ */
1497
1708
  list(request = {}, requestOptions) {
1498
1709
  const {
1499
1710
  status,
@@ -1634,12 +1845,14 @@ var ProductsClient = class {
1634
1845
  });
1635
1846
  }
1636
1847
  /**
1637
- * Delist Product
1638
- *
1639
- * Queue delist for one product on the marketplaces you name. `marketplaces` accepts one or more of shopee, lazada, tiktok, shopify, whatsapp, zalora, amazon, and ebay. Each named marketplace must already have a listing; other channels are left untouched. Omit `marketplaces` to delist every existing listing. This does not delete the OmniCommerce product. Poll GET /api/v1/jobs/{jobId} until data.status is succeeded, partial, or failed. Accepted means the job was queued, not that the marketplace has removed the listing.
1640
- *
1641
- * `POST /api/v1/products/{productId}/delist`
1642
- */
1848
+ * Delist Product
1849
+ *
1850
+ * Queue delist for one product on the marketplaces you name. `marketplaces` accepts one or more of shopee, lazada, tiktok, shopify, whatsapp, zalora, amazon, and ebay. Each named marketplace must already have a listing; other channels are left untouched. Omit `marketplaces` to delist every existing listing. This does not delete the OmniCommerce product.
1851
+
1852
+ Poll GET /api/v1/jobs/{jobId} until data.status is succeeded, partial, or failed. Accepted means the job was queued, not that the marketplace has removed the listing.
1853
+ *
1854
+ * `POST /api/v1/products/{productId}/delist`
1855
+ */
1643
1856
  delist(request, requestOptions) {
1644
1857
  const { productId, ...body } = request ?? {};
1645
1858
  return this._http.request({
@@ -2531,8 +2744,10 @@ var ZaloraClient = class {
2531
2744
  var OmniGeneratedClient = class {
2532
2745
  constructor(_http) {
2533
2746
  this._http = _http;
2747
+ this.agents = new AgentsClient(this._http);
2534
2748
  this.aop = new AopClient(this._http);
2535
2749
  this.api = new ApiClient(this._http);
2750
+ this.campaigns = new CampaignsClient(this._http);
2536
2751
  this.catalog = new CatalogClient(this._http);
2537
2752
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
2538
2753
  this.compare = new CompareClient(this._http);
@@ -2563,8 +2778,10 @@ var OmniGeneratedClient = class {
2563
2778
  this.zalora = new ZaloraClient(this._http);
2564
2779
  }
2565
2780
  _http;
2781
+ agents;
2566
2782
  aop;
2567
2783
  api;
2784
+ campaigns;
2568
2785
  catalog;
2569
2786
  checkoutSessions;
2570
2787
  compare;