@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 +231 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1660 -242
- package/dist/index.d.ts +1660 -242
- package/dist/index.js +231 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
27
|
+
var SDK_VERSION = "0.3.0";
|
|
28
28
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
29
29
|
|
|
30
30
|
// src/environments.ts
|
|
@@ -574,6 +574,49 @@ var AgentsClient = class {
|
|
|
574
574
|
_http;
|
|
575
575
|
general;
|
|
576
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
|
+
};
|
|
577
620
|
var AopClient = class {
|
|
578
621
|
constructor(_http) {
|
|
579
622
|
this._http = _http;
|
|
@@ -1534,6 +1577,63 @@ var OrdersClient = class {
|
|
|
1534
1577
|
...mergeRequestOptions(requestOptions)
|
|
1535
1578
|
});
|
|
1536
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
|
+
}
|
|
1537
1637
|
};
|
|
1538
1638
|
var OrganizationsClient = class {
|
|
1539
1639
|
constructor(_http) {
|
|
@@ -1701,7 +1801,9 @@ var ProductsClient = class {
|
|
|
1701
1801
|
*
|
|
1702
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`.
|
|
1703
1803
|
|
|
1704
|
-
|
|
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.
|
|
1705
1807
|
*
|
|
1706
1808
|
* `GET /api/v1/products`
|
|
1707
1809
|
*/
|
|
@@ -1795,6 +1897,8 @@ var ProductsClient = class {
|
|
|
1795
1897
|
- Localization content and cultural notes
|
|
1796
1898
|
- Intent queries and signals
|
|
1797
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.
|
|
1798
1902
|
*
|
|
1799
1903
|
* `GET /api/v1/products/{productId}`
|
|
1800
1904
|
*/
|
|
@@ -1888,6 +1992,25 @@ var ProductsClient = class {
|
|
|
1888
1992
|
...mergeRequestOptions(requestOptions)
|
|
1889
1993
|
});
|
|
1890
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
|
+
}
|
|
1891
2014
|
/**
|
|
1892
2015
|
* Update Product Price
|
|
1893
2016
|
*
|
|
@@ -2246,6 +2369,108 @@ var ReturnsClient = class {
|
|
|
2246
2369
|
});
|
|
2247
2370
|
}
|
|
2248
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
|
+
};
|
|
2249
2474
|
var SearchClient = class {
|
|
2250
2475
|
constructor(_http) {
|
|
2251
2476
|
this._http = _http;
|
|
@@ -2745,6 +2970,7 @@ var OmniGeneratedClient = class {
|
|
|
2745
2970
|
constructor(_http) {
|
|
2746
2971
|
this._http = _http;
|
|
2747
2972
|
this.agents = new AgentsClient(this._http);
|
|
2973
|
+
this.analytics = new AnalyticsClient(this._http);
|
|
2748
2974
|
this.aop = new AopClient(this._http);
|
|
2749
2975
|
this.api = new ApiClient(this._http);
|
|
2750
2976
|
this.campaigns = new CampaignsClient(this._http);
|
|
@@ -2768,6 +2994,7 @@ var OmniGeneratedClient = class {
|
|
|
2768
2994
|
this.products = new ProductsClient(this._http);
|
|
2769
2995
|
this.promotions = new PromotionsClient(this._http);
|
|
2770
2996
|
this.returns = new ReturnsClient(this._http);
|
|
2997
|
+
this.reviews = new ReviewsClient(this._http);
|
|
2771
2998
|
this.search = new SearchClient(this._http);
|
|
2772
2999
|
this.settlements = new SettlementsClient(this._http);
|
|
2773
3000
|
this.sync = new SyncClient(this._http);
|
|
@@ -2779,6 +3006,7 @@ var OmniGeneratedClient = class {
|
|
|
2779
3006
|
}
|
|
2780
3007
|
_http;
|
|
2781
3008
|
agents;
|
|
3009
|
+
analytics;
|
|
2782
3010
|
aop;
|
|
2783
3011
|
api;
|
|
2784
3012
|
campaigns;
|
|
@@ -2802,6 +3030,7 @@ var OmniGeneratedClient = class {
|
|
|
2802
3030
|
products;
|
|
2803
3031
|
promotions;
|
|
2804
3032
|
returns;
|
|
3033
|
+
reviews;
|
|
2805
3034
|
search;
|
|
2806
3035
|
settlements;
|
|
2807
3036
|
sync;
|