@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.cjs +230 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3248 -337
- package/dist/index.d.ts +3248 -337
- package/dist/index.js +230 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
29
|
+
var SDK_VERSION = "0.2.0";
|
|
30
30
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
31
31
|
|
|
32
32
|
// src/environments.ts
|
|
@@ -509,6 +509,73 @@ 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
|
+
};
|
|
512
579
|
var AopClient = class {
|
|
513
580
|
constructor(_http) {
|
|
514
581
|
this._http = _http;
|
|
@@ -638,6 +705,148 @@ var ApiClient = class {
|
|
|
638
705
|
});
|
|
639
706
|
}
|
|
640
707
|
};
|
|
708
|
+
var CampaignsClient = class {
|
|
709
|
+
constructor(_http) {
|
|
710
|
+
this._http = _http;
|
|
711
|
+
}
|
|
712
|
+
_http;
|
|
713
|
+
/**
|
|
714
|
+
* List Campaigns
|
|
715
|
+
*
|
|
716
|
+
* List campaigns for the authenticated organization. `stage=all` is the workspace working set: draft and running. Requires `promotions:read`.
|
|
717
|
+
*
|
|
718
|
+
* `GET /api/v1/campaigns`
|
|
719
|
+
*/
|
|
720
|
+
list(request = {}, requestOptions) {
|
|
721
|
+
const { organizationId, q, stage, offset, limit } = request ?? {};
|
|
722
|
+
return this._http.request({
|
|
723
|
+
method: "GET",
|
|
724
|
+
path: "/api/v1/campaigns",
|
|
725
|
+
query: { organizationId, q, stage, offset, limit },
|
|
726
|
+
body: void 0,
|
|
727
|
+
...mergeRequestOptions(requestOptions)
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Create Campaign
|
|
732
|
+
*
|
|
733
|
+
* Create a draft campaign. `ownerId` and `approverId` must be members of the organization, and every store must already be connected. Requires `promotions:write`.
|
|
734
|
+
*
|
|
735
|
+
* `POST /api/v1/campaigns`
|
|
736
|
+
*/
|
|
737
|
+
create(request, requestOptions) {
|
|
738
|
+
const { ...body } = request ?? {};
|
|
739
|
+
return this._http.request({
|
|
740
|
+
method: "POST",
|
|
741
|
+
path: "/api/v1/campaigns",
|
|
742
|
+
query: void 0,
|
|
743
|
+
body,
|
|
744
|
+
...mergeRequestOptions(requestOptions)
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Get Campaign
|
|
749
|
+
*
|
|
750
|
+
* Read one campaign, including its plan, executions, audit, schedule, and progress. Requires `promotions:read`.
|
|
751
|
+
*
|
|
752
|
+
* `GET /api/v1/campaigns/{campaignId}`
|
|
753
|
+
*/
|
|
754
|
+
get(request, requestOptions) {
|
|
755
|
+
const { campaignId, organizationId } = request ?? {};
|
|
756
|
+
return this._http.request({
|
|
757
|
+
method: "GET",
|
|
758
|
+
path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
|
|
759
|
+
query: { organizationId },
|
|
760
|
+
body: void 0,
|
|
761
|
+
...mergeRequestOptions(requestOptions)
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Update Campaign
|
|
766
|
+
*
|
|
767
|
+
* Replace a draft or approved plan, or propose one change to a running plan. Send `expectedRevision` from the last read. Requires `promotions:write`.
|
|
768
|
+
*
|
|
769
|
+
* `PUT /api/v1/campaigns/{campaignId}`
|
|
770
|
+
*/
|
|
771
|
+
replace(request, requestOptions) {
|
|
772
|
+
const { campaignId, ...body } = request ?? {};
|
|
773
|
+
return this._http.request({
|
|
774
|
+
method: "PUT",
|
|
775
|
+
path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
|
|
776
|
+
query: void 0,
|
|
777
|
+
body,
|
|
778
|
+
...mergeRequestOptions(requestOptions)
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Act on Campaign
|
|
783
|
+
*
|
|
784
|
+
* 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`.
|
|
785
|
+
*
|
|
786
|
+
* `POST /api/v1/campaigns/{campaignId}/actions`
|
|
787
|
+
*/
|
|
788
|
+
actions(request, requestOptions) {
|
|
789
|
+
const { campaignId, ...body } = request ?? {};
|
|
790
|
+
return this._http.request({
|
|
791
|
+
method: "POST",
|
|
792
|
+
path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/actions`,
|
|
793
|
+
query: void 0,
|
|
794
|
+
body,
|
|
795
|
+
...mergeRequestOptions(requestOptions)
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Archive Campaigns
|
|
800
|
+
*
|
|
801
|
+
* Archive campaigns, or restore archived campaigns by id or by the current archived list filters. Requires `promotions:write`.
|
|
802
|
+
*
|
|
803
|
+
* `POST /api/v1/campaigns/archive`
|
|
804
|
+
*/
|
|
805
|
+
archive(request, requestOptions) {
|
|
806
|
+
const { ...body } = request ?? {};
|
|
807
|
+
return this._http.request({
|
|
808
|
+
method: "POST",
|
|
809
|
+
path: "/api/v1/campaigns/archive",
|
|
810
|
+
query: void 0,
|
|
811
|
+
body,
|
|
812
|
+
...mergeRequestOptions(requestOptions)
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Delete Campaigns
|
|
817
|
+
*
|
|
818
|
+
* Permanently delete archived campaigns by explicit id or by archived list filters. Requires `promotions:write`.
|
|
819
|
+
*
|
|
820
|
+
* `POST /api/v1/campaigns/delete`
|
|
821
|
+
*/
|
|
822
|
+
delete(request, requestOptions) {
|
|
823
|
+
const { ...body } = request ?? {};
|
|
824
|
+
return this._http.request({
|
|
825
|
+
method: "POST",
|
|
826
|
+
path: "/api/v1/campaigns/delete",
|
|
827
|
+
query: void 0,
|
|
828
|
+
body,
|
|
829
|
+
...mergeRequestOptions(requestOptions)
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Get Campaign Options
|
|
834
|
+
*
|
|
835
|
+
* List the organization members and connected stores a campaign plan can name. Use a member `id` for `ownerId` and `approverId`. Requires `promotions:write`.
|
|
836
|
+
*
|
|
837
|
+
* `GET /api/v1/campaigns/options`
|
|
838
|
+
*/
|
|
839
|
+
getOptions(request = {}, requestOptions) {
|
|
840
|
+
const { organizationId } = request ?? {};
|
|
841
|
+
return this._http.request({
|
|
842
|
+
method: "GET",
|
|
843
|
+
path: "/api/v1/campaigns/options",
|
|
844
|
+
query: { organizationId },
|
|
845
|
+
body: void 0,
|
|
846
|
+
...mergeRequestOptions(requestOptions)
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
};
|
|
641
850
|
var CatalogClient = class {
|
|
642
851
|
constructor(_http) {
|
|
643
852
|
this._http = _http;
|
|
@@ -1490,12 +1699,14 @@ var ProductsClient = class {
|
|
|
1490
1699
|
}
|
|
1491
1700
|
_http;
|
|
1492
1701
|
/**
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1702
|
+
* List Products
|
|
1703
|
+
*
|
|
1704
|
+
* 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
|
+
|
|
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.
|
|
1707
|
+
*
|
|
1708
|
+
* `GET /api/v1/products`
|
|
1709
|
+
*/
|
|
1499
1710
|
list(request = {}, requestOptions) {
|
|
1500
1711
|
const {
|
|
1501
1712
|
status,
|
|
@@ -1636,12 +1847,14 @@ var ProductsClient = class {
|
|
|
1636
1847
|
});
|
|
1637
1848
|
}
|
|
1638
1849
|
/**
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1850
|
+
* Delist Product
|
|
1851
|
+
*
|
|
1852
|
+
* 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.
|
|
1853
|
+
|
|
1854
|
+
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.
|
|
1855
|
+
*
|
|
1856
|
+
* `POST /api/v1/products/{productId}/delist`
|
|
1857
|
+
*/
|
|
1645
1858
|
delist(request, requestOptions) {
|
|
1646
1859
|
const { productId, ...body } = request ?? {};
|
|
1647
1860
|
return this._http.request({
|
|
@@ -2533,8 +2746,10 @@ var ZaloraClient = class {
|
|
|
2533
2746
|
var OmniGeneratedClient = class {
|
|
2534
2747
|
constructor(_http) {
|
|
2535
2748
|
this._http = _http;
|
|
2749
|
+
this.agents = new AgentsClient(this._http);
|
|
2536
2750
|
this.aop = new AopClient(this._http);
|
|
2537
2751
|
this.api = new ApiClient(this._http);
|
|
2752
|
+
this.campaigns = new CampaignsClient(this._http);
|
|
2538
2753
|
this.catalog = new CatalogClient(this._http);
|
|
2539
2754
|
this.checkoutSessions = new CheckoutSessionsClient(this._http);
|
|
2540
2755
|
this.compare = new CompareClient(this._http);
|
|
@@ -2565,8 +2780,10 @@ var OmniGeneratedClient = class {
|
|
|
2565
2780
|
this.zalora = new ZaloraClient(this._http);
|
|
2566
2781
|
}
|
|
2567
2782
|
_http;
|
|
2783
|
+
agents;
|
|
2568
2784
|
aop;
|
|
2569
2785
|
api;
|
|
2786
|
+
campaigns;
|
|
2570
2787
|
catalog;
|
|
2571
2788
|
checkoutSessions;
|
|
2572
2789
|
compare;
|