@flexops/sdk 3.3.0 → 3.4.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/README.md +22 -2
- package/dist/index.d.mts +201 -42
- package/dist/index.d.ts +201 -42
- package/dist/index.js +119 -41
- package/dist/index.mjs +119 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -197,7 +197,10 @@ Rates, labels, voids, pickups and scan forms go through `client.shipping`, `clie
|
|
|
197
197
|
carrier-specific endpoints through the Gateway's legacy pass-through, which is deprecated and
|
|
198
198
|
retired on 2027-06-30:
|
|
199
199
|
|
|
200
|
-
- **Lookups (GET)** work with API keys
|
|
200
|
+
- **Lookups (GET)** work with API keys that have the permission for the data: `shipping:read` for
|
|
201
|
+
address, ZIP, city, location, service point and reference lookups; `tracking:read` for tracking
|
|
202
|
+
and proof of delivery; `rates:read` for delivery standards, rates and products. Without it the
|
|
203
|
+
Gateway returns 403 `API_KEY_SCOPE_REQUIRED`.
|
|
201
204
|
- **Writes** (for example `carriers.usps.getDomesticRates`, `carriers.fedex.createPickup`) are marked
|
|
202
205
|
`@deprecated`. They need a user token (`auth.login`): the Gateway answers an API key with 403
|
|
203
206
|
`API_KEY_SCOPE_REQUIRED`. Move them to the native resources above.
|
|
@@ -232,8 +235,19 @@ await client.workspaces.inviteMember('newuser@company.com', WorkspaceRole.Member
|
|
|
232
235
|
|
|
233
236
|
## Webhooks
|
|
234
237
|
|
|
238
|
+
Managing webhooks needs a signed-in user's access token. The Gateway refuses API keys on every webhook
|
|
239
|
+
route, reads included (`list()` and `listDeliveryLogs()` as well as create, update, delete, `rotateSecret()`
|
|
240
|
+
and `test()`), with `403` `SIGNED_IN_USER_REQUIRED`, whatever the key's scopes. Reads are refused too because
|
|
241
|
+
webhook delivery logs carry each delivery's payload (order and customer data). A client with an API key
|
|
242
|
+
sends the key even when an access token is also set, so use a client configured without `apiKey`.
|
|
243
|
+
Verifying deliveries (below) makes no request and needs no credentials.
|
|
244
|
+
|
|
235
245
|
```typescript
|
|
236
|
-
import { WebhookEventType } from '@flexops/sdk';
|
|
246
|
+
import { FlexOps, WebhookEventType } from '@flexops/sdk';
|
|
247
|
+
|
|
248
|
+
// Sign in as a user (or pass `accessToken`); an API key gets 403 SIGNED_IN_USER_REQUIRED here.
|
|
249
|
+
const client = new FlexOps({ workspaceId: 'your-workspace-id' });
|
|
250
|
+
await client.auth.login({ email: 'user@company.com', password: 'your-password' });
|
|
237
251
|
|
|
238
252
|
// Create a subscription. Omit `events` to receive every event.
|
|
239
253
|
const webhook = await client.webhooks.create({
|
|
@@ -463,6 +477,12 @@ const returns = await client.analytics.returnsMetrics();
|
|
|
463
477
|
const performance = await client.analytics.deliveryPerformance();
|
|
464
478
|
```
|
|
465
479
|
|
|
480
|
+
`client.analytics`, `client.orders` and `client.inventory` read through the legacy pass-through. With
|
|
481
|
+
an API key they need the permission for the data they read: `orders:read` for `client.orders`,
|
|
482
|
+
`inventory:read` for `client.inventory`, and for `client.analytics` the permission named on each
|
|
483
|
+
method (`shipping:read`, `inventory:read`, `orders:read` or `returns:read`). A key without it gets
|
|
484
|
+
403 `API_KEY_SCOPE_REQUIRED`. Keys created with the default permissions have all of these.
|
|
485
|
+
|
|
466
486
|
## Automation Rules
|
|
467
487
|
|
|
468
488
|
```typescript
|
package/dist/index.d.mts
CHANGED
|
@@ -823,14 +823,79 @@ interface PickupConfirmation {
|
|
|
823
823
|
errorMessage?: string | null;
|
|
824
824
|
isSandbox: boolean;
|
|
825
825
|
}
|
|
826
|
+
/** Body of `POST /api/workspaces/{workspaceId}/scan-forms`. */
|
|
826
827
|
interface ScanFormRequest {
|
|
828
|
+
/** Tracking numbers of the labels to put on the form: 1 to 1,000. */
|
|
827
829
|
trackingNumbers: string[];
|
|
830
|
+
/**
|
|
831
|
+
* The labels' mailing date, `YYYY-MM-DD`. Live creation needs it: without it the Gateway answers
|
|
832
|
+
* 400 `Choose the label mailing date.` The sandbox defaults to today (UTC). Optional here so code
|
|
833
|
+
* written for the sandbox keeps compiling.
|
|
834
|
+
*/
|
|
835
|
+
manifestDate?: string;
|
|
836
|
+
/**
|
|
837
|
+
* Identifies the operation (a UUID). Repeating a request with the same `requestId` returns the same
|
|
838
|
+
* form instead of creating another; reusing it with different inputs is 409. Keep it with the request
|
|
839
|
+
* to retry it yourself. When omitted, `scanForms.create` generates one per call and sends it on every
|
|
840
|
+
* retry of that call.
|
|
841
|
+
*/
|
|
842
|
+
requestId?: string;
|
|
843
|
+
/** The origin ZIP group to manifest. Every selected package must ship from it. */
|
|
844
|
+
originPostalCode?: string;
|
|
845
|
+
/** Limits package selection to one warehouse. */
|
|
846
|
+
warehouseId?: number;
|
|
828
847
|
}
|
|
848
|
+
/**
|
|
849
|
+
* Where a SCAN form operation stands. `Created`: USPS returned the manifest, and the Gateway saved its number and
|
|
850
|
+
* PDF. `OutcomeUnknown`: the carrier's answer was lost or did not match, so the packages stay reserved and must not
|
|
851
|
+
* be submitted again until the outcome is resolved. Other values may be added; treat them like `OutcomeUnknown`.
|
|
852
|
+
*/
|
|
853
|
+
type ScanFormState = 'Created' | 'OutcomeUnknown' | (string & {});
|
|
854
|
+
/**
|
|
855
|
+
* A SCAN form (USPS PS Form 5630 manifest) as the Gateway returns it from `scanForms.create()`, `list()` and
|
|
856
|
+
* `get()`. `create()` resolves only for a created form: an operation that needs review, a `requestId` reused with
|
|
857
|
+
* different inputs, or packages already on another manifest reject with a 409 {@link FlexOpsError}.
|
|
858
|
+
*/
|
|
829
859
|
interface ScanForm {
|
|
860
|
+
/** The form's ID: 32 hexadecimal digits, no dashes. Pass it to `scanForms.get()`. */
|
|
830
861
|
scanFormId: string;
|
|
831
|
-
|
|
862
|
+
/** See {@link ScanFormState}. */
|
|
863
|
+
state: ScanFormState;
|
|
864
|
+
/** The origin ZIP the packages ship from, or null when none was recorded. */
|
|
865
|
+
originPostalCode: string | null;
|
|
866
|
+
/** The packages on the form, in ordinal order. */
|
|
832
867
|
trackingNumbers: string[];
|
|
833
|
-
|
|
868
|
+
/** When the operation was recorded, ISO 8601 in UTC (for example `2026-09-08T21:14:03.512Z`). */
|
|
869
|
+
createdAtUtc: string;
|
|
870
|
+
/**
|
|
871
|
+
* The PS Form 5630 PDF, base64-encoded. Null when no PDF was saved: sandbox forms are never sent to USPS, and an
|
|
872
|
+
* operation whose outcome is unknown has none.
|
|
873
|
+
*/
|
|
874
|
+
scanFormImage: string | null;
|
|
875
|
+
/** The USPS manifest number. `SBOX…` in the sandbox; empty while the outcome is unknown. */
|
|
876
|
+
manifestNumber: string | null;
|
|
877
|
+
/** The mailing date, as the Gateway writes a date without a zone (for example `2026-09-08T00:00:00`). */
|
|
878
|
+
manifestDate: string | null;
|
|
879
|
+
/** How many packages the form covers. */
|
|
880
|
+
packageCount: number;
|
|
881
|
+
/** A status line for people, for example `Created — USPS acceptance requires a carrier scan.` */
|
|
882
|
+
statusMessage: string | null;
|
|
883
|
+
/** True when `state` is `Created`. */
|
|
884
|
+
success: boolean;
|
|
885
|
+
/** Not set by the current Gateway; errors arrive as a rejected {@link FlexOpsError} instead. */
|
|
886
|
+
errorMessage: string | null;
|
|
887
|
+
/** True for a sandbox (test key) form, which is never transmitted to USPS. */
|
|
888
|
+
isSandbox: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* @deprecated The Gateway never sent `formData`. The SDK now copies `scanFormImage` into it so older code keeps
|
|
891
|
+
* working; read `scanFormImage` instead.
|
|
892
|
+
*/
|
|
893
|
+
formData?: string;
|
|
894
|
+
/**
|
|
895
|
+
* @deprecated The Gateway never sent `createdAt`. The SDK now copies `createdAtUtc` into it so older code keeps
|
|
896
|
+
* working; read `createdAtUtc` instead.
|
|
897
|
+
*/
|
|
898
|
+
createdAt?: string;
|
|
834
899
|
}
|
|
835
900
|
interface CarrierRecommendationRequest {
|
|
836
901
|
originPostalCode: string;
|
|
@@ -1159,7 +1224,7 @@ declare class HttpClient {
|
|
|
1159
1224
|
post<T>(path: string, body?: unknown, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
|
|
1160
1225
|
put<T>(path: string, body?: unknown): Promise<T>;
|
|
1161
1226
|
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
1162
|
-
delete<T>(path: string): Promise<T>;
|
|
1227
|
+
delete<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
|
|
1163
1228
|
private buildUrl;
|
|
1164
1229
|
private buildHeaders;
|
|
1165
1230
|
/**
|
|
@@ -1203,11 +1268,11 @@ declare class WorkspacesResource {
|
|
|
1203
1268
|
get(workspaceId?: string): Promise<ApiResponse<WorkspaceDetail>>;
|
|
1204
1269
|
/** List the current workspace's members and pending invites. */
|
|
1205
1270
|
listMembers(): Promise<ApiResponse<WorkspaceMemberList>>;
|
|
1206
|
-
/** Invite a user to the workspace. */
|
|
1271
|
+
/** Invite a user to the workspace. Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes. */
|
|
1207
1272
|
inviteMember(email: string, role?: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
1208
|
-
/** Remove a member from the workspace. */
|
|
1273
|
+
/** Remove a member from the workspace. Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes. */
|
|
1209
1274
|
removeMember(userId: string): Promise<ApiResponse<unknown>>;
|
|
1210
|
-
/** Change a member's role. */
|
|
1275
|
+
/** Change a member's role. Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes. */
|
|
1211
1276
|
updateMemberRole(userId: string, role: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
1212
1277
|
}
|
|
1213
1278
|
|
|
@@ -1285,8 +1350,12 @@ declare class ShippingResource {
|
|
|
1285
1350
|
* Direct carrier operations via the VisionSuite Core Services API proxy.
|
|
1286
1351
|
*
|
|
1287
1352
|
* Pass-throughs to carrier-specific endpoints (USPS, UPS, FedEx, DHL) via the Gateway's legacy
|
|
1288
|
-
* ApiProxy route, deprecated and sunset on 2027-06-30. The GET lookups work with API keys
|
|
1289
|
-
*
|
|
1353
|
+
* ApiProxy route, deprecated and sunset on 2027-06-30. The GET lookups work with API keys that
|
|
1354
|
+
* have the permission for the data they read: address, ZIP, city, location, service point and
|
|
1355
|
+
* reference lookups require `shipping:read`; tracking and proof of delivery require
|
|
1356
|
+
* `tracking:read`; delivery standards, rates and products require `rates:read`. A key without the
|
|
1357
|
+
* permission gets 403 `API_KEY_SCOPE_REQUIRED`; keys created with the default permissions have all
|
|
1358
|
+
* three. The writes are marked deprecated: they need a user token (`auth.login`), because the Gateway refuses
|
|
1290
1359
|
* API-key writes on the proxy with 403 `API_KEY_SCOPE_REQUIRED`. Label purchases through the proxy are
|
|
1291
1360
|
* closed (410); rates, labels, voids, pickups and scan forms go through `client.shipping`,
|
|
1292
1361
|
* `client.pickups` and `client.scanForms` for every carrier.
|
|
@@ -1347,19 +1416,21 @@ declare class CarriersResource {
|
|
|
1347
1416
|
/**
|
|
1348
1417
|
* Cancel a domestic label.
|
|
1349
1418
|
*
|
|
1419
|
+
* @param trackingNumber The label's tracking number.
|
|
1350
1420
|
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1351
1421
|
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1352
1422
|
* cover this.
|
|
1353
1423
|
*/
|
|
1354
|
-
cancelDomesticLabel: () => Promise<unknown>;
|
|
1424
|
+
cancelDomesticLabel: (trackingNumber: string) => Promise<unknown>;
|
|
1355
1425
|
/**
|
|
1356
1426
|
* Cancel an international label.
|
|
1357
1427
|
*
|
|
1428
|
+
* @param internationalTrackingNumber The label's international tracking number.
|
|
1358
1429
|
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1359
1430
|
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1360
1431
|
* cover this.
|
|
1361
1432
|
*/
|
|
1362
|
-
cancelInternationalLabel: () => Promise<unknown>;
|
|
1433
|
+
cancelInternationalLabel: (internationalTrackingNumber: string) => Promise<unknown>;
|
|
1363
1434
|
/** Get tracking summary. */
|
|
1364
1435
|
trackSummary: (params: Record<string, string>) => Promise<unknown>;
|
|
1365
1436
|
/** Get detailed tracking info. */
|
|
@@ -1375,11 +1446,12 @@ declare class CarriersResource {
|
|
|
1375
1446
|
/**
|
|
1376
1447
|
* Cancel a pickup.
|
|
1377
1448
|
*
|
|
1449
|
+
* @param confirmationNumber The pickup's confirmation number.
|
|
1378
1450
|
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1379
1451
|
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1380
1452
|
* cover this.
|
|
1381
1453
|
*/
|
|
1382
|
-
cancelPickup: () => Promise<unknown>;
|
|
1454
|
+
cancelPickup: (confirmationNumber: string) => Promise<unknown>;
|
|
1383
1455
|
/**
|
|
1384
1456
|
* Create a scan form.
|
|
1385
1457
|
*
|
|
@@ -1701,33 +1773,78 @@ declare class CarriersResource {
|
|
|
1701
1773
|
};
|
|
1702
1774
|
}
|
|
1703
1775
|
|
|
1776
|
+
/**
|
|
1777
|
+
* Webhook subscriptions for the workspace.
|
|
1778
|
+
*
|
|
1779
|
+
* Every method that calls the Gateway needs a signed-in user's access token (`accessToken`,
|
|
1780
|
+
* `setAccessToken()` or `auth.login()`). The Gateway refuses API keys on every webhook route, reads
|
|
1781
|
+
* included, with `403` `SIGNED_IN_USER_REQUIRED` (a {@link FlexOpsError} whose `code` is
|
|
1782
|
+
* `SIGNED_IN_USER_REQUIRED`), whatever the key's scopes. Reads are refused too because webhook delivery
|
|
1783
|
+
* logs carry each delivery's payload (order and customer data). A client with an API key sends the key
|
|
1784
|
+
* even when an access token is also set, so call these methods from a client configured without `apiKey`.
|
|
1785
|
+
*
|
|
1786
|
+
* {@link WebhooksResource.verifySignature} makes no request and needs no credentials.
|
|
1787
|
+
*/
|
|
1704
1788
|
declare class WebhooksResource {
|
|
1705
1789
|
private readonly http;
|
|
1706
1790
|
private readonly getWorkspaceId;
|
|
1707
1791
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1708
1792
|
private wsPath;
|
|
1709
|
-
/**
|
|
1793
|
+
/**
|
|
1794
|
+
* List all webhook subscriptions for the workspace.
|
|
1795
|
+
*
|
|
1796
|
+
* Needs a signed-in user's access token. Reads are signed-in only, like the writes, because webhook
|
|
1797
|
+
* delivery logs carry each delivery's payload (order and customer data).
|
|
1798
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1799
|
+
*/
|
|
1710
1800
|
list(): Promise<ApiResponse<WebhookSubscription[]>>;
|
|
1711
1801
|
/**
|
|
1712
1802
|
* Create a webhook subscription. `events` is sent as the Gateway's comma-separated `eventTypes`;
|
|
1713
1803
|
* omit it to receive every event. The result's `data.secret` is the signing secret, returned only here.
|
|
1804
|
+
*
|
|
1805
|
+
* Needs a signed-in user's access token.
|
|
1714
1806
|
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1807
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1715
1808
|
*/
|
|
1716
1809
|
create(request: CreateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
1717
1810
|
/**
|
|
1718
1811
|
* Update a webhook subscription. `events`, when given, replaces the subscribed events.
|
|
1812
|
+
*
|
|
1813
|
+
* Needs a signed-in user's access token.
|
|
1719
1814
|
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1815
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1720
1816
|
*/
|
|
1721
1817
|
update(webhookId: string, data: UpdateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
1722
|
-
/**
|
|
1818
|
+
/**
|
|
1819
|
+
* Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result.
|
|
1820
|
+
*
|
|
1821
|
+
* Needs a signed-in user's access token.
|
|
1822
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1823
|
+
*/
|
|
1723
1824
|
delete(webhookId: string): Promise<void>;
|
|
1724
|
-
/**
|
|
1825
|
+
/**
|
|
1826
|
+
* Rotate the signing secret for a webhook.
|
|
1827
|
+
*
|
|
1828
|
+
* Needs a signed-in user's access token.
|
|
1829
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1830
|
+
*/
|
|
1725
1831
|
rotateSecret(webhookId: string): Promise<ApiResponse<{
|
|
1726
1832
|
secret: string;
|
|
1727
1833
|
}>>;
|
|
1728
|
-
/**
|
|
1834
|
+
/**
|
|
1835
|
+
* List delivery logs for a webhook.
|
|
1836
|
+
*
|
|
1837
|
+
* Needs a signed-in user's access token. Reads are signed-in only, like the writes, because webhook
|
|
1838
|
+
* delivery logs carry each delivery's payload (order and customer data).
|
|
1839
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1840
|
+
*/
|
|
1729
1841
|
listDeliveryLogs(webhookId: string): Promise<ApiResponse<unknown[]>>;
|
|
1730
|
-
/**
|
|
1842
|
+
/**
|
|
1843
|
+
* Send a test event to a webhook's endpoint.
|
|
1844
|
+
*
|
|
1845
|
+
* Needs a signed-in user's access token.
|
|
1846
|
+
* @throws FlexOpsError (`403`, `SIGNED_IN_USER_REQUIRED`) when the client authenticates with an API key.
|
|
1847
|
+
*/
|
|
1731
1848
|
test(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
1732
1849
|
/**
|
|
1733
1850
|
* Verify that an incoming request is a genuine FlexOps webhook delivery.
|
|
@@ -1839,46 +1956,61 @@ type DateRange = {
|
|
|
1839
1956
|
endDate?: string;
|
|
1840
1957
|
period?: 'day' | 'week' | 'month';
|
|
1841
1958
|
};
|
|
1959
|
+
/**
|
|
1960
|
+
* Analytics through the legacy VisionSuite API proxy (`/api/ApiProxy/api/v4/Analytics/...`).
|
|
1961
|
+
*
|
|
1962
|
+
* With an API key, each method requires the permission for the data it reads, named on the method:
|
|
1963
|
+
* `shipping:read` for shipment, carrier and delivery metrics, `inventory:read` for inventory metrics,
|
|
1964
|
+
* `orders:read` for order metrics and `returns:read` for returns metrics. A key without it gets 403
|
|
1965
|
+
* `API_KEY_SCOPE_REQUIRED`. Keys created with the default permissions have all four.
|
|
1966
|
+
*/
|
|
1842
1967
|
declare class AnalyticsResource {
|
|
1843
1968
|
private readonly http;
|
|
1844
1969
|
constructor(http: HttpClient);
|
|
1845
1970
|
private path;
|
|
1846
|
-
/** Shipments trend over time. */
|
|
1971
|
+
/** Shipments trend over time. With an API key, requires `shipping:read`. */
|
|
1847
1972
|
shipmentsTrend(params?: DateRange): Promise<ApiResponse<ShipmentsTrend[]>>;
|
|
1848
|
-
/** Carrier usage summary. */
|
|
1973
|
+
/** Carrier usage summary. With an API key, requires `shipping:read`. */
|
|
1849
1974
|
carrierSummary(params?: DateRange): Promise<ApiResponse<CarrierSummary[]>>;
|
|
1850
|
-
/** Top shipping destinations. */
|
|
1975
|
+
/** Top shipping destinations. With an API key, requires `shipping:read`. */
|
|
1851
1976
|
topDestinations(params?: DateRange & {
|
|
1852
1977
|
limit?: number;
|
|
1853
1978
|
}): Promise<ApiResponse<unknown>>;
|
|
1854
|
-
/** Inventory metrics (stock levels, low-stock alerts). */
|
|
1979
|
+
/** Inventory metrics (stock levels, low-stock alerts). With an API key, requires `inventory:read`. */
|
|
1855
1980
|
inventoryMetrics(): Promise<ApiResponse<unknown>>;
|
|
1856
|
-
/** Stock levels by warehouse. */
|
|
1981
|
+
/** Stock levels by warehouse. With an API key, requires `inventory:read`. */
|
|
1857
1982
|
stockByWarehouse(): Promise<ApiResponse<unknown>>;
|
|
1858
|
-
/** Order metrics (volume, revenue). */
|
|
1983
|
+
/** Order metrics (volume, revenue). With an API key, requires `orders:read`. */
|
|
1859
1984
|
orderMetrics(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1860
|
-
/** Order trend over time. */
|
|
1985
|
+
/** Order trend over time. With an API key, requires `orders:read`. */
|
|
1861
1986
|
orderTrend(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1862
|
-
/** Top selling products. */
|
|
1987
|
+
/** Top selling products. With an API key, requires `orders:read`. */
|
|
1863
1988
|
topSellingProducts(params?: DateRange & {
|
|
1864
1989
|
limit?: number;
|
|
1865
1990
|
}): Promise<ApiResponse<unknown>>;
|
|
1866
|
-
/** Returns metrics. */
|
|
1991
|
+
/** Returns metrics. With an API key, requires `returns:read`. */
|
|
1867
1992
|
returnsMetrics(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1868
|
-
/** Returns trend over time. */
|
|
1993
|
+
/** Returns trend over time. With an API key, requires `returns:read`. */
|
|
1869
1994
|
returnsTrend(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1870
|
-
/** Return reasons breakdown. */
|
|
1995
|
+
/** Return reasons breakdown. With an API key, requires `returns:read`. */
|
|
1871
1996
|
returnReasons(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1872
|
-
/** Fulfillment performance metrics. */
|
|
1997
|
+
/** Fulfillment performance metrics. With an API key, requires `shipping:read`. */
|
|
1873
1998
|
performanceMetrics(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1874
|
-
/** Carrier delivery performance. */
|
|
1999
|
+
/** Carrier delivery performance. With an API key, requires `shipping:read`. */
|
|
1875
2000
|
carrierPerformance(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1876
|
-
/** Shipping cost analytics. */
|
|
2001
|
+
/** Shipping cost analytics. With an API key, requires `shipping:read`. */
|
|
1877
2002
|
shippingCostAnalytics(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1878
|
-
/** Delivery performance (on-time %). */
|
|
2003
|
+
/** Delivery performance (on-time %). With an API key, requires `shipping:read`. */
|
|
1879
2004
|
deliveryPerformance(params?: DateRange): Promise<ApiResponse<unknown>>;
|
|
1880
2005
|
}
|
|
1881
2006
|
|
|
2007
|
+
/**
|
|
2008
|
+
* Read-only order lookups through the legacy VisionSuite API proxy (`/api/ApiProxy/api/v1/Order/...`).
|
|
2009
|
+
*
|
|
2010
|
+
* With an API key, every method requires the `orders:read` permission; a key without it gets 403
|
|
2011
|
+
* `API_KEY_SCOPE_REQUIRED`. Keys created with the default permissions include `orders:read`. The
|
|
2012
|
+
* proxy refuses writes from API keys.
|
|
2013
|
+
*/
|
|
1882
2014
|
declare class OrdersResource {
|
|
1883
2015
|
private readonly http;
|
|
1884
2016
|
constructor(http: HttpClient);
|
|
@@ -1905,6 +2037,14 @@ declare class OrdersResource {
|
|
|
1905
2037
|
getStatusTypes(): Promise<ApiResponse<unknown>>;
|
|
1906
2038
|
}
|
|
1907
2039
|
|
|
2040
|
+
/**
|
|
2041
|
+
* Read-only inventory lookups through the legacy VisionSuite API proxy
|
|
2042
|
+
* (`/api/ApiProxy/api/v1/Inventory/...`).
|
|
2043
|
+
*
|
|
2044
|
+
* With an API key, every method requires the `inventory:read` permission; a key without it gets 403
|
|
2045
|
+
* `API_KEY_SCOPE_REQUIRED`. Keys created with the default permissions include `inventory:read`. The
|
|
2046
|
+
* proxy refuses writes from API keys.
|
|
2047
|
+
*/
|
|
1908
2048
|
declare class InventoryResource {
|
|
1909
2049
|
private readonly http;
|
|
1910
2050
|
constructor(http: HttpClient);
|
|
@@ -1921,13 +2061,13 @@ declare class PickupsResource {
|
|
|
1921
2061
|
private readonly getWorkspaceId;
|
|
1922
2062
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1923
2063
|
private wsPath;
|
|
1924
|
-
/** Schedule a carrier pickup. */
|
|
2064
|
+
/** Schedule a carrier pickup. API keys need `shipping:write`; the public demo keys are refused. */
|
|
1925
2065
|
schedule(request: PickupRequest): Promise<ApiResponse<PickupConfirmation>>;
|
|
1926
2066
|
/** List scheduled pickups. */
|
|
1927
2067
|
list(): Promise<ApiResponse<PickupConfirmation[]>>;
|
|
1928
2068
|
/** Get pickup details. The carrier defaults to `usps` on the Gateway. */
|
|
1929
2069
|
get(pickupId: string, carrierCode?: string): Promise<ApiResponse<PickupConfirmation>>;
|
|
1930
|
-
/** Cancel a scheduled pickup. */
|
|
2070
|
+
/** Cancel a scheduled pickup. API keys need `shipping:write`; the public demo keys are refused. */
|
|
1931
2071
|
cancel(pickupId: string): Promise<ApiResponse<unknown>>;
|
|
1932
2072
|
}
|
|
1933
2073
|
|
|
@@ -1936,11 +2076,20 @@ declare class ScanFormsResource {
|
|
|
1936
2076
|
private readonly getWorkspaceId;
|
|
1937
2077
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1938
2078
|
private wsPath;
|
|
1939
|
-
/**
|
|
2079
|
+
/**
|
|
2080
|
+
* Create a USPS scan form (SCAN/manifest). API keys need `shipping:write`; the public demo keys are refused.
|
|
2081
|
+
* Sends `request.requestId`, or a UUID generated for this call, on every attempt, so a retried call replays
|
|
2082
|
+
* the same operation instead of creating a second form.
|
|
2083
|
+
*
|
|
2084
|
+
* Resolves with the created form (200), also when the same `requestId` and inputs are sent again. Rejects with a
|
|
2085
|
+
* 409 {@link FlexOpsError} when the `requestId` was used with different inputs, when the packages already belong
|
|
2086
|
+
* to a manifest, or when this or an earlier operation needs review (its message names the operation; do not
|
|
2087
|
+
* resubmit those packages). 400 means the request or package selection was refused.
|
|
2088
|
+
*/
|
|
1940
2089
|
create(request: ScanFormRequest): Promise<ApiResponse<ScanForm>>;
|
|
1941
|
-
/** List scan forms. */
|
|
2090
|
+
/** List the workspace's saved scan forms, newest mailing date first, including any whose outcome is unknown. */
|
|
1942
2091
|
list(): Promise<ApiResponse<ScanForm[]>>;
|
|
1943
|
-
/** Get a scan form by
|
|
2092
|
+
/** Get a saved scan form by its `scanFormId`. A form that does not exist rejects with a 404 {@link FlexOpsError}. */
|
|
1944
2093
|
get(scanFormId: string): Promise<ApiResponse<ScanForm>>;
|
|
1945
2094
|
}
|
|
1946
2095
|
|
|
@@ -1953,15 +2102,24 @@ declare class RulesResource {
|
|
|
1953
2102
|
list(): Promise<ApiResponse<ShippingRule[]>>;
|
|
1954
2103
|
/** Get a rule by ID. */
|
|
1955
2104
|
get(ruleId: string): Promise<ApiResponse<ShippingRule>>;
|
|
1956
|
-
/** Create a shipping rule. */
|
|
2105
|
+
/** Create a shipping rule. Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes. */
|
|
1957
2106
|
create(rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1958
|
-
/** Replace a shipping rule. */
|
|
2107
|
+
/** Replace a shipping rule. Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes. */
|
|
1959
2108
|
update(ruleId: string, rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1960
|
-
/**
|
|
2109
|
+
/**
|
|
2110
|
+
* Delete a shipping rule. The Gateway answers 204 No Content, so there is no result.
|
|
2111
|
+
* Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes.
|
|
2112
|
+
*/
|
|
1961
2113
|
delete(ruleId: string): Promise<void>;
|
|
1962
|
-
/**
|
|
2114
|
+
/**
|
|
2115
|
+
* Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first).
|
|
2116
|
+
* Signed-in users only: API keys get 403 `SIGNED_IN_USER_REQUIRED`, whatever their scopes.
|
|
2117
|
+
*/
|
|
1963
2118
|
reorder(ruleIds: string[]): Promise<ApiResponse<ShippingRule[]>>;
|
|
1964
|
-
/**
|
|
2119
|
+
/**
|
|
2120
|
+
* Dry-run the workspace's rules against a sample shipment, without changing anything.
|
|
2121
|
+
* API keys need `shipping:read`; the public demo keys are refused.
|
|
2122
|
+
*/
|
|
1965
2123
|
test(request: ShippingRuleTestRequest): Promise<ApiResponse<unknown>>;
|
|
1966
2124
|
}
|
|
1967
2125
|
|
|
@@ -2147,6 +2305,7 @@ declare class FlexOps {
|
|
|
2147
2305
|
readonly workspaces: WorkspacesResource;
|
|
2148
2306
|
readonly shipping: ShippingResource;
|
|
2149
2307
|
readonly carriers: CarriersResource;
|
|
2308
|
+
/** Webhook subscriptions. Needs a signed-in user's access token; API keys get `403` `SIGNED_IN_USER_REQUIRED`. */
|
|
2150
2309
|
readonly webhooks: WebhooksResource;
|
|
2151
2310
|
readonly wallet: WalletResource;
|
|
2152
2311
|
readonly insurance: InsuranceResource;
|
|
@@ -2173,4 +2332,4 @@ declare class FlexOps {
|
|
|
2173
2332
|
}
|
|
2174
2333
|
|
|
2175
2334
|
export { AnalyticsResource, AuthResource, CarbonOffsetsResource, CarriersResource, EmailTemplatesResource, FlexOps, FlexOpsAuthError, FlexOpsError, FlexOpsRateLimitError, HazmatClassification, HsCodesResource, InsuranceResource, InventoryResource, OrdersResource, PickupsResource, RecurrenceInterval, RecurringShipmentsResource, ReportFormat, ReportFrequency, ReportSchedulesResource, ReturnsResource, RulesResource, ScanFormsResource, ShippingResource, TrackingEmailEvent, WalletResource, WebhookEventType, WebhooksResource, WorkspaceRole, WorkspacesResource };
|
|
2176
|
-
export type { Address, AddressValidationResult, ApiResponse, BatchLabelItem, BatchLabelItemResult, BatchLabelJob, BatchLabelRequest, CanonicalLabelRequest, CanonicalRateRequest, CarbonOffset, CarbonOffsetPurchaseRequest, CarbonOffsetQuote, CarbonOffsetQuoteRequest, CarbonOffsetSettings, CarbonOffsetSummary, CarrierRecommendation, CarrierRecommendationRequest, CarrierRecommendationResponse, CarrierSummary, CostSavingsSummary, CreateBatchLabelRequest, CreateLabelRequest, CreateRecurringShipmentRequest, CreateReportScheduleRequest, CreateWebhookRequest, CustomsItem, DeliveryPredictionRequest, DeliveryPredictionResponse, EmailTemplate, EmailTemplatePreview, EmailTemplatePreviewRequest, FileClaimRequest, FlexOpsConfig, HsCodeResult, InsuranceClaim, InsurancePolicy, InsuranceQuote, InsuranceQuoteRequest, Label, LabelPurchaseApproval, LabelPurchasePreview, LandedCostEstimate, LandedCostRequest, LaneSavingsOpportunity, LegacyRateRequest, LoginRequest, LoginResponse, MultiPackageDetail, MultiPackageLabelResult, MultiPackageShipmentRequest, MultiPackageShipmentResponse, Order, OrderItem, PaginatedResponse, Parcel, PendingInvite, PickupConfirmation, PickupRequest, PurchaseInsuranceRequest, RateRequest, ReceiveReturnRequest, RecurringShipment, ReportSchedule, RetryConfig, ReturnAuthorization, ReturnDetail, ReturnDisposition, ReturnItem, ReturnLabel, ReturnLabelRequest, ReturnRequest, ReturnSummary, Rma, RmaItem, RuleAction, RuleCondition, ScanForm, ScanFormRequest, ShipmentsTrend, ShippingAddress, ShippingPackage, ShippingRate, ShippingRule, ShippingRuleInput, ShippingRuleTestRequest, SuggestedAddress, TrackingEvent, TrackingInfo, UpdateRecurringShipmentRequest, UpdateReportScheduleRequest, UpdateWebhookRequest, UpsertEmailTemplateRequest, VerifySignatureOptions, WalletBalance, WebhookSubscription, Workspace, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList };
|
|
2335
|
+
export type { Address, AddressValidationResult, ApiResponse, BatchLabelItem, BatchLabelItemResult, BatchLabelJob, BatchLabelRequest, CanonicalLabelRequest, CanonicalRateRequest, CarbonOffset, CarbonOffsetPurchaseRequest, CarbonOffsetQuote, CarbonOffsetQuoteRequest, CarbonOffsetSettings, CarbonOffsetSummary, CarrierRecommendation, CarrierRecommendationRequest, CarrierRecommendationResponse, CarrierSummary, CostSavingsSummary, CreateBatchLabelRequest, CreateLabelRequest, CreateRecurringShipmentRequest, CreateReportScheduleRequest, CreateWebhookRequest, CustomsItem, DeliveryPredictionRequest, DeliveryPredictionResponse, EmailTemplate, EmailTemplatePreview, EmailTemplatePreviewRequest, FileClaimRequest, FlexOpsConfig, HsCodeResult, InsuranceClaim, InsurancePolicy, InsuranceQuote, InsuranceQuoteRequest, Label, LabelPurchaseApproval, LabelPurchasePreview, LandedCostEstimate, LandedCostRequest, LaneSavingsOpportunity, LegacyRateRequest, LoginRequest, LoginResponse, MultiPackageDetail, MultiPackageLabelResult, MultiPackageShipmentRequest, MultiPackageShipmentResponse, Order, OrderItem, PaginatedResponse, Parcel, PendingInvite, PickupConfirmation, PickupRequest, PurchaseInsuranceRequest, RateRequest, ReceiveReturnRequest, RecurringShipment, ReportSchedule, RetryConfig, ReturnAuthorization, ReturnDetail, ReturnDisposition, ReturnItem, ReturnLabel, ReturnLabelRequest, ReturnRequest, ReturnSummary, Rma, RmaItem, RuleAction, RuleCondition, ScanForm, ScanFormRequest, ScanFormState, ShipmentsTrend, ShippingAddress, ShippingPackage, ShippingRate, ShippingRule, ShippingRuleInput, ShippingRuleTestRequest, SuggestedAddress, TrackingEvent, TrackingInfo, UpdateRecurringShipmentRequest, UpdateReportScheduleRequest, UpdateWebhookRequest, UpsertEmailTemplateRequest, VerifySignatureOptions, WalletBalance, WebhookSubscription, Workspace, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList };
|