@flexops/sdk 1.1.1 → 3.0.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 +214 -142
- package/dist/index.d.mts +1065 -414
- package/dist/index.d.ts +1065 -414
- package/dist/index.js +818 -397
- package/dist/index.mjs +809 -394
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,12 @@ interface RetryConfig {
|
|
|
21
21
|
maxRetries?: number;
|
|
22
22
|
/** Base delay in ms for exponential backoff. Default: 1000 */
|
|
23
23
|
baseDelay?: number;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* HTTP status codes to retry on. Default: [429, 500, 502, 503, 504]. GETs use the whole list.
|
|
26
|
+
* POST, PUT and PATCH always send an `Idempotency-Key` (yours, or one generated per call and
|
|
27
|
+
* reused on every retry) and retry only on 429, 502, 503, 504, a dropped or timed-out request,
|
|
28
|
+
* and a 409 `IDEMPOTENCY_CONFLICT`; never on 500. DELETE retries only on 429.
|
|
29
|
+
*/
|
|
25
30
|
retryableStatusCodes?: number[];
|
|
26
31
|
}
|
|
27
32
|
interface ApiResponse<T> {
|
|
@@ -42,40 +47,103 @@ interface LoginRequest {
|
|
|
42
47
|
password: string;
|
|
43
48
|
}
|
|
44
49
|
interface LoginResponse {
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
/** The JWT access token. Absent while `requiresTwoFactor` is true. */
|
|
51
|
+
token?: string;
|
|
52
|
+
refreshToken?: string;
|
|
47
53
|
expiresAt: string;
|
|
48
54
|
userId: string;
|
|
49
|
-
}
|
|
50
|
-
interface RegisterRequest {
|
|
51
55
|
email: string;
|
|
52
|
-
password: string;
|
|
53
56
|
firstName: string;
|
|
54
57
|
lastName: string;
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
roles: string[];
|
|
59
|
+
customerId?: number;
|
|
60
|
+
requiresTwoFactor: boolean;
|
|
61
|
+
twoFactorToken?: string;
|
|
62
|
+
twoFactorMethod?: string;
|
|
63
|
+
requiresTermsAcceptance: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** A workspace member's role, sent and returned as a number. */
|
|
66
|
+
declare const WorkspaceRole: {
|
|
67
|
+
readonly Owner: 0;
|
|
68
|
+
readonly Admin: 1;
|
|
69
|
+
readonly Member: 2;
|
|
70
|
+
readonly Merchant: 3;
|
|
71
|
+
};
|
|
72
|
+
type WorkspaceRole = (typeof WorkspaceRole)[keyof typeof WorkspaceRole];
|
|
73
|
+
/** An entry of `GET /api/workspaces`: a workspace the caller belongs to. */
|
|
57
74
|
interface Workspace {
|
|
58
75
|
id: string;
|
|
59
76
|
name: string;
|
|
60
77
|
slug: string;
|
|
78
|
+
myRole: WorkspaceRole;
|
|
61
79
|
planId: string;
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
memberCount: number;
|
|
81
|
+
isCreator: boolean;
|
|
82
|
+
productType?: string | null;
|
|
83
|
+
entitlements: unknown[];
|
|
84
|
+
}
|
|
85
|
+
/** `GET /api/workspaces/{id}`. */
|
|
86
|
+
interface WorkspaceDetail {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
slug: string;
|
|
90
|
+
domain?: string | null;
|
|
91
|
+
planId: string;
|
|
92
|
+
status: number;
|
|
93
|
+
subscriptionStatus: string;
|
|
94
|
+
userLimit: number;
|
|
95
|
+
currentUserCount: number;
|
|
64
96
|
monthlyLabelLimit: number;
|
|
65
97
|
labelsUsedThisMonth: number;
|
|
66
|
-
|
|
98
|
+
isTrialing: boolean;
|
|
99
|
+
trialExpiresAt?: string | null;
|
|
100
|
+
myRole: WorkspaceRole;
|
|
101
|
+
canManageMembers: boolean;
|
|
102
|
+
canManageBilling: boolean;
|
|
67
103
|
createdAt: string;
|
|
68
|
-
|
|
69
|
-
interface CreateWorkspaceRequest {
|
|
70
|
-
name: string;
|
|
71
|
-
planId?: string;
|
|
104
|
+
entitlements: unknown[];
|
|
72
105
|
}
|
|
73
106
|
interface WorkspaceMember {
|
|
107
|
+
membershipId: string;
|
|
74
108
|
userId: string;
|
|
75
109
|
email: string;
|
|
76
|
-
|
|
110
|
+
name?: string | null;
|
|
111
|
+
role: WorkspaceRole;
|
|
112
|
+
status: number;
|
|
77
113
|
joinedAt: string;
|
|
114
|
+
isCreator: boolean;
|
|
115
|
+
isDeactivated: boolean;
|
|
78
116
|
}
|
|
117
|
+
interface PendingInvite {
|
|
118
|
+
inviteId: string;
|
|
119
|
+
email: string;
|
|
120
|
+
role: WorkspaceRole;
|
|
121
|
+
expiresAt: string;
|
|
122
|
+
invitedByName: string;
|
|
123
|
+
}
|
|
124
|
+
/** `GET /api/workspaces/{id}/members`. */
|
|
125
|
+
interface WorkspaceMemberList {
|
|
126
|
+
members: WorkspaceMember[];
|
|
127
|
+
pendingInvites: PendingInvite[];
|
|
128
|
+
userLimit: number;
|
|
129
|
+
activeCount: number;
|
|
130
|
+
canInviteMore: boolean;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* USPS HAZMAT classification, sent as the Gateway `HazmatClassification` number.
|
|
134
|
+
* There is no default: omit it when you have no answer, send `HazmatClassification.None` (0)
|
|
135
|
+
* to declare the parcel not hazardous.
|
|
136
|
+
*/
|
|
137
|
+
declare const HazmatClassification: {
|
|
138
|
+
readonly None: 0;
|
|
139
|
+
readonly LimitedQuantity: 1;
|
|
140
|
+
readonly LithiumBatteryContainedInEquipment: 2;
|
|
141
|
+
readonly LithiumBatteryPackedWithEquipment: 3;
|
|
142
|
+
readonly LithiumBatteryStandalone: 4;
|
|
143
|
+
readonly OtherRestricted: 5;
|
|
144
|
+
readonly LithiumBatteryUsedDevice: 6;
|
|
145
|
+
};
|
|
146
|
+
type HazmatClassification = (typeof HazmatClassification)[keyof typeof HazmatClassification];
|
|
79
147
|
type RateRequest = CanonicalRateRequest | LegacyRateRequest;
|
|
80
148
|
interface CanonicalRateRequest {
|
|
81
149
|
origin: ShippingAddress;
|
|
@@ -87,8 +155,13 @@ interface CanonicalRateRequest {
|
|
|
87
155
|
includeInsurance?: boolean;
|
|
88
156
|
declaredValue?: number;
|
|
89
157
|
currency?: string;
|
|
158
|
+
/** Declared HAZMAT class, so quotes match what the label route will accept. */
|
|
159
|
+
hazmatClassification?: HazmatClassification;
|
|
90
160
|
}
|
|
91
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated The Gateway needs full origin and destination addresses; this zip-only shape is
|
|
163
|
+
* refused client-side with `UnsupportedRequestShape`. Use CanonicalRateRequest.
|
|
164
|
+
*/
|
|
92
165
|
interface LegacyRateRequest {
|
|
93
166
|
fromZip: string;
|
|
94
167
|
toZip: string;
|
|
@@ -124,6 +197,9 @@ interface ShippingPackage {
|
|
|
124
197
|
predefinedPackage?: string;
|
|
125
198
|
}
|
|
126
199
|
interface ShippingRate {
|
|
200
|
+
rateIndicator?: string;
|
|
201
|
+
uspsMailClass?: string;
|
|
202
|
+
isInternational?: boolean;
|
|
127
203
|
carrierCode: string;
|
|
128
204
|
carrierName: string;
|
|
129
205
|
serviceCode: string;
|
|
@@ -139,6 +215,11 @@ interface RateShoppingResponse {
|
|
|
139
215
|
rates: ShippingRate[];
|
|
140
216
|
currency: string;
|
|
141
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* @deprecated Use CanonicalLabelRequest. This shape is translated to the Gateway wire format
|
|
220
|
+
* (`carrierCode`, `serviceCode`, `origin`, `destination`, `package`); `idempotencyKey` is sent
|
|
221
|
+
* as the `Idempotency-Key` header. `returnLabel: true` is refused; use the returns API.
|
|
222
|
+
*/
|
|
142
223
|
interface CreateLabelRequest {
|
|
143
224
|
carrier: string;
|
|
144
225
|
service: string;
|
|
@@ -148,6 +229,45 @@ interface CreateLabelRequest {
|
|
|
148
229
|
returnLabel?: boolean;
|
|
149
230
|
labelFormat?: 'PDF' | 'PNG' | 'ZPL';
|
|
150
231
|
idempotencyKey?: string;
|
|
232
|
+
orderId?: number;
|
|
233
|
+
hazmatClassification?: HazmatClassification;
|
|
234
|
+
}
|
|
235
|
+
/** Normalized Gateway label request. Additional shipment options are preserved in the approval snapshot. */
|
|
236
|
+
interface CanonicalLabelRequest {
|
|
237
|
+
shipDate?: string;
|
|
238
|
+
declaredValue?: number;
|
|
239
|
+
customsDeclaration?: CustomsDeclaration;
|
|
240
|
+
rateIndicator?: string;
|
|
241
|
+
maximumPostageAmount?: number;
|
|
242
|
+
confirmationToken?: string;
|
|
243
|
+
origin: ShippingAddress;
|
|
244
|
+
destination: ShippingAddress;
|
|
245
|
+
package: ShippingPackage;
|
|
246
|
+
carrierCode: string;
|
|
247
|
+
serviceCode: string;
|
|
248
|
+
orderId?: number;
|
|
249
|
+
labelFormat?: 'PDF' | 'PNG' | 'ZPL';
|
|
250
|
+
/**
|
|
251
|
+
* Declared HAZMAT class. Labels without an `orderId` must declare one (send
|
|
252
|
+
* `HazmatClassification.None` for an ordinary parcel); the SDK never fills it in.
|
|
253
|
+
*/
|
|
254
|
+
hazmatClassification?: HazmatClassification;
|
|
255
|
+
[option: string]: unknown;
|
|
256
|
+
}
|
|
257
|
+
interface LabelPurchasePreview {
|
|
258
|
+
status: 'Preview';
|
|
259
|
+
quotedPostageAmount: number;
|
|
260
|
+
maximumPostageAmount: number;
|
|
261
|
+
currency: 'USD';
|
|
262
|
+
expiresAt: string;
|
|
263
|
+
confirmationToken: string;
|
|
264
|
+
}
|
|
265
|
+
/** Retain securely for retries; requestJson contains private shipment data and the approval token. */
|
|
266
|
+
interface LabelPurchaseApproval {
|
|
267
|
+
readonly idempotencyKey: string;
|
|
268
|
+
readonly requestJson: string;
|
|
269
|
+
readonly preview: LabelPurchasePreview | null;
|
|
270
|
+
readonly sandboxLabel?: Label;
|
|
151
271
|
}
|
|
152
272
|
interface Label {
|
|
153
273
|
labelId: string;
|
|
@@ -196,10 +316,24 @@ interface TrackingEvent {
|
|
|
196
316
|
description: string;
|
|
197
317
|
location?: string;
|
|
198
318
|
}
|
|
319
|
+
/** `POST /api/addresses/validate`. */
|
|
199
320
|
interface AddressValidationResult {
|
|
200
321
|
isValid: boolean;
|
|
201
|
-
|
|
202
|
-
|
|
322
|
+
suggestedAddress?: SuggestedAddress | null;
|
|
323
|
+
isResidential?: boolean | null;
|
|
324
|
+
warnings: string[];
|
|
325
|
+
validatedBy?: string | null;
|
|
326
|
+
/** True when the validation service could not complete the check; `isValid` is then not a verdict. */
|
|
327
|
+
validationUnavailable: boolean;
|
|
328
|
+
checkedAt?: string | null;
|
|
329
|
+
}
|
|
330
|
+
interface SuggestedAddress {
|
|
331
|
+
line1: string;
|
|
332
|
+
line2?: string | null;
|
|
333
|
+
city: string;
|
|
334
|
+
state: string;
|
|
335
|
+
postalCode: string;
|
|
336
|
+
country: string;
|
|
203
337
|
}
|
|
204
338
|
interface BatchLabelRequest {
|
|
205
339
|
items: CreateLabelRequest[];
|
|
@@ -227,75 +361,177 @@ interface OrderItem {
|
|
|
227
361
|
quantity: number;
|
|
228
362
|
unitPrice: number;
|
|
229
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Event names FlexOps sends in the `X-FlexOps-Event` header and matches subscriptions against.
|
|
366
|
+
* Names are PascalCase and matched exactly: a dotted name such as `label.created` matches nothing.
|
|
367
|
+
* `TrackingUpdated` and `TrackingDelivered` are sent only to workspaces in the USPS push-tracking pilot.
|
|
368
|
+
*/
|
|
369
|
+
declare const WebhookEventType: {
|
|
370
|
+
readonly LabelCreated: "LabelCreated";
|
|
371
|
+
readonly LabelCanceled: "LabelCanceled";
|
|
372
|
+
readonly BatchCompleted: "BatchCompleted";
|
|
373
|
+
readonly TrackingUpdated: "TrackingUpdated";
|
|
374
|
+
readonly TrackingDelivered: "TrackingDelivered";
|
|
375
|
+
};
|
|
376
|
+
type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
377
|
+
/** A webhook subscription as the Gateway returns it. */
|
|
230
378
|
interface WebhookSubscription {
|
|
231
379
|
id: string;
|
|
232
380
|
url: string;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
381
|
+
description?: string | null;
|
|
382
|
+
/** Subscribed event names, comma-separated, or `*` for every event. */
|
|
383
|
+
eventTypes: string;
|
|
384
|
+
/** `Active`, `Paused` or `Disabled`. */
|
|
385
|
+
status: string;
|
|
386
|
+
consecutiveFailures: number;
|
|
236
387
|
createdAt: string;
|
|
388
|
+
updatedAt?: string | null;
|
|
389
|
+
/** The `whsec_...` signing secret. Returned only when the subscription is created. */
|
|
390
|
+
secret?: string;
|
|
237
391
|
}
|
|
238
392
|
interface CreateWebhookRequest {
|
|
239
393
|
url: string;
|
|
240
|
-
|
|
241
|
-
|
|
394
|
+
description?: string;
|
|
395
|
+
/** Events to receive. Omit it to receive every event. Sent as the Gateway's comma-separated `eventTypes`. */
|
|
396
|
+
events?: WebhookEventType[];
|
|
397
|
+
}
|
|
398
|
+
interface UpdateWebhookRequest {
|
|
399
|
+
url?: string;
|
|
400
|
+
description?: string;
|
|
401
|
+
/** Replaces the subscribed events. Sent as the Gateway's comma-separated `eventTypes`. */
|
|
402
|
+
events?: WebhookEventType[];
|
|
403
|
+
status?: 'Active' | 'Paused' | 'Disabled';
|
|
404
|
+
}
|
|
405
|
+
/** `GET /api/wallet/my-balance` for the configured workspace. */
|
|
242
406
|
interface WalletBalance {
|
|
407
|
+
hasWallet: boolean;
|
|
408
|
+
balanceCents: number;
|
|
243
409
|
balance: number;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
410
|
+
}
|
|
411
|
+
interface InsuranceQuoteRequest {
|
|
412
|
+
declaredValue: number;
|
|
413
|
+
carrierCode: string;
|
|
414
|
+
trackingNumber?: string;
|
|
415
|
+
provider?: string;
|
|
248
416
|
}
|
|
249
417
|
interface InsuranceQuote {
|
|
250
|
-
|
|
418
|
+
declaredValue: number;
|
|
419
|
+
coverageAmount: number;
|
|
251
420
|
premium: number;
|
|
252
|
-
|
|
253
|
-
|
|
421
|
+
coverageTier: string;
|
|
422
|
+
carrierCode: string;
|
|
423
|
+
coverageDays: number;
|
|
424
|
+
provider: string;
|
|
425
|
+
}
|
|
426
|
+
interface PurchaseInsuranceRequest {
|
|
427
|
+
trackingNumber: string;
|
|
428
|
+
carrierCode: string;
|
|
429
|
+
declaredValue: number;
|
|
430
|
+
coverageTier?: string;
|
|
431
|
+
provider?: string;
|
|
254
432
|
}
|
|
255
433
|
interface InsurancePolicy {
|
|
256
434
|
policyId: string;
|
|
257
|
-
provider: string;
|
|
258
435
|
trackingNumber: string;
|
|
259
|
-
|
|
436
|
+
carrierCode: string;
|
|
437
|
+
declaredValue: number;
|
|
438
|
+
coverageAmount: number;
|
|
260
439
|
premium: number;
|
|
261
440
|
status: string;
|
|
441
|
+
coverageTier?: string | null;
|
|
442
|
+
purchasedAt: string;
|
|
443
|
+
expiresAt: string;
|
|
444
|
+
cancelledAt?: string | null;
|
|
445
|
+
provider?: string | null;
|
|
446
|
+
providerReference?: string | null;
|
|
447
|
+
isSandbox: boolean;
|
|
448
|
+
}
|
|
449
|
+
interface FileClaimRequest {
|
|
450
|
+
policyId: string;
|
|
451
|
+
claimReason: string;
|
|
452
|
+
claimAmount: number;
|
|
453
|
+
/** Optional evidence (photo URLs, notes) as a JSON string. */
|
|
454
|
+
evidenceJson?: string;
|
|
262
455
|
}
|
|
456
|
+
interface InsuranceClaim {
|
|
457
|
+
claimId: string;
|
|
458
|
+
policyId: string;
|
|
459
|
+
claimReason: string;
|
|
460
|
+
claimAmount: number;
|
|
461
|
+
status: string;
|
|
462
|
+
submittedAt: string;
|
|
463
|
+
resolvedAt?: string | null;
|
|
464
|
+
approvedAmount?: number | null;
|
|
465
|
+
resolutionNotes?: string | null;
|
|
466
|
+
isSandbox: boolean;
|
|
467
|
+
}
|
|
468
|
+
/** Body of `POST /api/workspaces/{workspaceId}/returns/rma`. */
|
|
263
469
|
interface ReturnRequest {
|
|
264
|
-
|
|
470
|
+
/** The order's numeric id. */
|
|
471
|
+
orderId: number;
|
|
472
|
+
orderNumber?: string;
|
|
265
473
|
reason: string;
|
|
266
474
|
items: ReturnItem[];
|
|
475
|
+
notes?: string;
|
|
476
|
+
customerEmail?: string;
|
|
477
|
+
reasonId?: number;
|
|
267
478
|
}
|
|
268
479
|
interface ReturnItem {
|
|
269
480
|
sku: string;
|
|
270
481
|
quantity: number;
|
|
271
482
|
reason?: string;
|
|
272
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Body of `POST /api/workspaces/{workspaceId}/returns/{rmaNumber}/label`.
|
|
486
|
+
*
|
|
487
|
+
* The carrier needs the package weight and all three dimensions. Send `weightOz`, `lengthIn`,
|
|
488
|
+
* `widthIn` and `heightIn`; any you leave out come from the workspace's default shipping preset.
|
|
489
|
+
* With no preset the Gateway refuses the call with a 400 (code `PackageMeasurementsRequired`)
|
|
490
|
+
* that names the missing fields.
|
|
491
|
+
*/
|
|
492
|
+
interface ReturnLabelRequest {
|
|
493
|
+
/** Carrier for the return label. Defaults to `usps` on the Gateway (the only carrier supported). */
|
|
494
|
+
carrierCode?: string;
|
|
495
|
+
/** Carrier service for the return label. */
|
|
496
|
+
serviceType?: string;
|
|
497
|
+
/** Package weight in ounces. */
|
|
498
|
+
weightOz?: number;
|
|
499
|
+
/** Package length in inches. */
|
|
500
|
+
lengthIn?: number;
|
|
501
|
+
/** Package width in inches. */
|
|
502
|
+
widthIn?: number;
|
|
503
|
+
/** Package height in inches. */
|
|
504
|
+
heightIn?: number;
|
|
505
|
+
/** Set when the workspace return-cost policy is CustomerPays and the customer has paid. */
|
|
506
|
+
paymentConfirmed?: boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Declared HAZMAT class. Omit it for no answer, or send `HazmatClassification.None` (0).
|
|
509
|
+
* Return labels cannot carry HAZMAT yet, so any other class is refused (400 `HazmatNotSupported`).
|
|
510
|
+
*/
|
|
511
|
+
hazmatClassification?: HazmatClassification;
|
|
512
|
+
/** USPS rate indicator for the return label's price tier. */
|
|
513
|
+
rateIndicator?: string;
|
|
514
|
+
}
|
|
515
|
+
/** How a received item is dispositioned: 0 restock, 1 refurbish, 2 dispose. */
|
|
516
|
+
type ReturnDisposition = 0 | 1 | 2;
|
|
517
|
+
/** Body of `POST /api/workspaces/{workspaceId}/returns/{rmaId}/receive`. */
|
|
518
|
+
interface ReceiveReturnRequest {
|
|
519
|
+
rmaNumber: string;
|
|
520
|
+
warehouseId: number;
|
|
521
|
+
inspectedItems: {
|
|
522
|
+
partNumber: string;
|
|
523
|
+
partDescription?: string;
|
|
524
|
+
quantity: number;
|
|
525
|
+
disposition: ReturnDisposition;
|
|
526
|
+
inspectionNotes?: string;
|
|
527
|
+
}[];
|
|
528
|
+
}
|
|
273
529
|
interface ReturnAuthorization {
|
|
274
530
|
rmaId: string;
|
|
275
531
|
status: string;
|
|
276
532
|
returnLabel?: Label;
|
|
277
533
|
createdAt: string;
|
|
278
534
|
}
|
|
279
|
-
interface ApiKeyInfo {
|
|
280
|
-
id: string;
|
|
281
|
-
name: string;
|
|
282
|
-
prefix: string;
|
|
283
|
-
scopes: string[];
|
|
284
|
-
lastUsedAt?: string;
|
|
285
|
-
expiresAt?: string;
|
|
286
|
-
createdAt: string;
|
|
287
|
-
}
|
|
288
|
-
interface CreateApiKeyRequest {
|
|
289
|
-
name: string;
|
|
290
|
-
scopes?: string[];
|
|
291
|
-
expiresInDays?: number;
|
|
292
|
-
}
|
|
293
|
-
interface CreateApiKeyResponse {
|
|
294
|
-
id: string;
|
|
295
|
-
key: string;
|
|
296
|
-
name: string;
|
|
297
|
-
prefix: string;
|
|
298
|
-
}
|
|
299
535
|
interface ShipmentsTrend {
|
|
300
536
|
date: string;
|
|
301
537
|
count: number;
|
|
@@ -310,8 +546,20 @@ interface CarrierSummary {
|
|
|
310
546
|
interface ShippingRule {
|
|
311
547
|
id: string;
|
|
312
548
|
name: string;
|
|
313
|
-
isActive: boolean;
|
|
314
549
|
priority: number;
|
|
550
|
+
isEnabled: boolean;
|
|
551
|
+
warehouseId?: string | null;
|
|
552
|
+
conditions: RuleCondition[];
|
|
553
|
+
actions: RuleAction[];
|
|
554
|
+
createdAt: string;
|
|
555
|
+
updatedAt: string;
|
|
556
|
+
}
|
|
557
|
+
/** Body of a rule create or update. */
|
|
558
|
+
interface ShippingRuleInput {
|
|
559
|
+
name: string;
|
|
560
|
+
priority: number;
|
|
561
|
+
isEnabled: boolean;
|
|
562
|
+
warehouseId?: string;
|
|
315
563
|
conditions: RuleCondition[];
|
|
316
564
|
actions: RuleAction[];
|
|
317
565
|
}
|
|
@@ -325,20 +573,53 @@ interface RuleAction {
|
|
|
325
573
|
type: string;
|
|
326
574
|
value: string;
|
|
327
575
|
}
|
|
576
|
+
/** A sample shipment for `rules.test`. */
|
|
577
|
+
interface ShippingRuleTestRequest {
|
|
578
|
+
weightOz: number;
|
|
579
|
+
declaredValue: number;
|
|
580
|
+
destinationCountry: string;
|
|
581
|
+
destinationState?: string;
|
|
582
|
+
destinationPostalCode?: string;
|
|
583
|
+
orderSource?: string;
|
|
584
|
+
itemCount: number;
|
|
585
|
+
shipMethod?: string;
|
|
586
|
+
destinationZone?: string;
|
|
587
|
+
tags?: string[];
|
|
588
|
+
}
|
|
589
|
+
/** Body of `POST /api/workspaces/{workspaceId}/pickups`. Dates are ISO 8601. */
|
|
328
590
|
interface PickupRequest {
|
|
329
|
-
|
|
591
|
+
carrierCode: string;
|
|
330
592
|
pickupDate: string;
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
593
|
+
street: string;
|
|
594
|
+
city: string;
|
|
595
|
+
state: string;
|
|
596
|
+
postalCode: string;
|
|
597
|
+
country?: string;
|
|
334
598
|
packageCount: number;
|
|
335
|
-
|
|
599
|
+
totalWeightOz?: number;
|
|
600
|
+
specialInstructions?: string;
|
|
601
|
+
readyTime?: string;
|
|
602
|
+
closeTime?: string;
|
|
603
|
+
contactName?: string;
|
|
604
|
+
contactPhone?: string;
|
|
336
605
|
}
|
|
337
606
|
interface PickupConfirmation {
|
|
338
|
-
|
|
339
|
-
|
|
607
|
+
pickupId?: string | null;
|
|
608
|
+
carrierCode: string;
|
|
340
609
|
pickupDate: string;
|
|
341
610
|
status: string;
|
|
611
|
+
confirmationNumber?: string | null;
|
|
612
|
+
windowStart?: string | null;
|
|
613
|
+
windowEnd?: string | null;
|
|
614
|
+
street?: string | null;
|
|
615
|
+
city?: string | null;
|
|
616
|
+
state?: string | null;
|
|
617
|
+
packageCount: number;
|
|
618
|
+
createdAt?: string | null;
|
|
619
|
+
message?: string | null;
|
|
620
|
+
success: boolean;
|
|
621
|
+
errorMessage?: string | null;
|
|
622
|
+
isSandbox: boolean;
|
|
342
623
|
}
|
|
343
624
|
interface ScanFormRequest {
|
|
344
625
|
trackingNumbers: string[];
|
|
@@ -408,24 +689,174 @@ interface LaneSavingsOpportunity {
|
|
|
408
689
|
currentOnTimeRate: number;
|
|
409
690
|
recommendedOnTimeRate: number;
|
|
410
691
|
}
|
|
411
|
-
interface
|
|
412
|
-
|
|
692
|
+
interface CarbonOffsetQuoteRequest {
|
|
693
|
+
weightLbs: number;
|
|
694
|
+
distanceMiles: number;
|
|
695
|
+
}
|
|
696
|
+
interface CarbonOffsetQuote {
|
|
697
|
+
carbonKg: number;
|
|
698
|
+
costUsd: number;
|
|
699
|
+
equivalentTreesPlanted: number;
|
|
700
|
+
provider: string;
|
|
701
|
+
}
|
|
702
|
+
interface CarbonOffsetPurchaseRequest extends CarbonOffsetQuoteRequest {
|
|
703
|
+
trackingNumber: string;
|
|
704
|
+
}
|
|
705
|
+
interface CarbonOffset {
|
|
413
706
|
offsetId: string;
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
};
|
|
707
|
+
trackingNumber: string;
|
|
708
|
+
carbonKg: number;
|
|
709
|
+
costUsd: number;
|
|
710
|
+
status: string;
|
|
419
711
|
provider: string;
|
|
420
|
-
|
|
712
|
+
providerReference?: string | null;
|
|
713
|
+
isAutoOffset: boolean;
|
|
714
|
+
purchasedAt: string;
|
|
715
|
+
}
|
|
716
|
+
interface CarbonOffsetSummary {
|
|
717
|
+
totalCarbonKg: number;
|
|
718
|
+
totalCostUsd: number;
|
|
719
|
+
totalOffsets: number;
|
|
720
|
+
equivalentTreesPlanted: number;
|
|
721
|
+
}
|
|
722
|
+
interface CarbonOffsetSettings {
|
|
723
|
+
autoOffsetEnabled: boolean;
|
|
724
|
+
}
|
|
725
|
+
/** How often a recurring shipment runs, sent as a number. `Custom` uses `cronExpression`. */
|
|
726
|
+
declare const RecurrenceInterval: {
|
|
727
|
+
readonly Daily: 0;
|
|
728
|
+
readonly Weekly: 1;
|
|
729
|
+
readonly Biweekly: 2;
|
|
730
|
+
readonly Monthly: 3;
|
|
731
|
+
readonly Custom: 4;
|
|
732
|
+
};
|
|
733
|
+
type RecurrenceInterval = (typeof RecurrenceInterval)[keyof typeof RecurrenceInterval];
|
|
734
|
+
interface RecurringShipment {
|
|
735
|
+
id: string;
|
|
736
|
+
workspaceId: string;
|
|
737
|
+
presetId?: string | null;
|
|
738
|
+
presetName?: string | null;
|
|
739
|
+
addressId?: string | null;
|
|
740
|
+
addressSummary?: string | null;
|
|
741
|
+
name: string;
|
|
742
|
+
interval: RecurrenceInterval;
|
|
743
|
+
intervalName: string;
|
|
744
|
+
cronExpression?: string | null;
|
|
745
|
+
nextRunUtc: string;
|
|
746
|
+
lastRunUtc?: string | null;
|
|
747
|
+
isActive: boolean;
|
|
748
|
+
failureCount: number;
|
|
749
|
+
maxFailures: number;
|
|
750
|
+
lastError?: string | null;
|
|
751
|
+
createdAt: string;
|
|
421
752
|
}
|
|
422
|
-
interface
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
753
|
+
interface CreateRecurringShipmentRequest {
|
|
754
|
+
/** Up to 200 characters. */
|
|
755
|
+
name: string;
|
|
756
|
+
/** Shipping preset that supplies the package and service. */
|
|
757
|
+
presetId?: string;
|
|
758
|
+
/** Destination address; a run without one fails. */
|
|
759
|
+
addressId?: string;
|
|
760
|
+
interval: RecurrenceInterval;
|
|
761
|
+
/** Up to 100 characters; used with `RecurrenceInterval.Custom`. */
|
|
762
|
+
cronExpression?: string;
|
|
763
|
+
/** ISO 8601 date-time of the first run. */
|
|
764
|
+
firstRunUtc: string;
|
|
765
|
+
/** Failed runs (1-100, default 3) before the schedule is paused. */
|
|
766
|
+
maxFailures?: number;
|
|
767
|
+
}
|
|
768
|
+
type UpdateRecurringShipmentRequest = Partial<Omit<CreateRecurringShipmentRequest, 'firstRunUtc'>>;
|
|
769
|
+
/** Report file format, sent as a number. */
|
|
770
|
+
declare const ReportFormat: {
|
|
771
|
+
readonly Csv: 0;
|
|
772
|
+
readonly Json: 1;
|
|
773
|
+
};
|
|
774
|
+
type ReportFormat = (typeof ReportFormat)[keyof typeof ReportFormat];
|
|
775
|
+
/** How often a report is emailed, sent as a number. */
|
|
776
|
+
declare const ReportFrequency: {
|
|
777
|
+
readonly Daily: 0;
|
|
778
|
+
readonly Weekly: 1;
|
|
779
|
+
readonly Monthly: 2;
|
|
780
|
+
};
|
|
781
|
+
type ReportFrequency = (typeof ReportFrequency)[keyof typeof ReportFrequency];
|
|
782
|
+
interface ReportSchedule {
|
|
783
|
+
id: string;
|
|
784
|
+
workspaceId: string;
|
|
785
|
+
reportType: string;
|
|
786
|
+
format: ReportFormat;
|
|
787
|
+
filterParametersJson?: string | null;
|
|
788
|
+
frequencyType: ReportFrequency;
|
|
789
|
+
frequencyName: string;
|
|
790
|
+
/** 0 (Sunday) to 6, for weekly schedules. */
|
|
791
|
+
dayOfWeek?: number | null;
|
|
792
|
+
/** 1 to 28, for monthly schedules. */
|
|
793
|
+
dayOfMonth?: number | null;
|
|
794
|
+
/** UTC time of day, `"HH:mm:ss"`. */
|
|
795
|
+
timeOfDayUtc: string;
|
|
796
|
+
nextRunUtc: string;
|
|
797
|
+
lastRunUtc?: string | null;
|
|
798
|
+
isEnabled: boolean;
|
|
799
|
+
/** Comma-separated recipient addresses. */
|
|
800
|
+
recipientEmails: string;
|
|
801
|
+
failureCount: number;
|
|
802
|
+
maxFailures: number;
|
|
803
|
+
lastError?: string | null;
|
|
804
|
+
createdAt: string;
|
|
805
|
+
}
|
|
806
|
+
interface CreateReportScheduleRequest {
|
|
807
|
+
/** Report name, up to 50 characters, for example `"shipments"`. */
|
|
808
|
+
reportType: string;
|
|
809
|
+
format: ReportFormat;
|
|
810
|
+
filterParametersJson?: string;
|
|
811
|
+
frequencyType: ReportFrequency;
|
|
812
|
+
/** 0 (Sunday) to 6, for weekly schedules. */
|
|
813
|
+
dayOfWeek?: number;
|
|
814
|
+
/** 1 to 28, for monthly schedules. */
|
|
815
|
+
dayOfMonth?: number;
|
|
816
|
+
/** UTC time of day, `"HH:mm:ss"`. */
|
|
817
|
+
timeOfDayUtc: string;
|
|
818
|
+
/** Comma-separated recipient addresses, up to 2000 characters. */
|
|
819
|
+
recipientEmails: string;
|
|
820
|
+
/** Failed runs (1-100, default 3) before the schedule is disabled. */
|
|
821
|
+
maxFailures?: number;
|
|
822
|
+
}
|
|
823
|
+
type UpdateReportScheduleRequest = Partial<CreateReportScheduleRequest>;
|
|
824
|
+
/** The tracking event an email template is sent for, sent as a number. */
|
|
825
|
+
declare const TrackingEmailEvent: {
|
|
826
|
+
readonly LabelCreated: 0;
|
|
827
|
+
readonly InTransit: 1;
|
|
828
|
+
readonly OutForDelivery: 2;
|
|
829
|
+
readonly Delivered: 3;
|
|
830
|
+
readonly Exception: 4;
|
|
831
|
+
readonly ReturnToSender: 5;
|
|
832
|
+
};
|
|
833
|
+
type TrackingEmailEvent = (typeof TrackingEmailEvent)[keyof typeof TrackingEmailEvent];
|
|
834
|
+
interface EmailTemplate {
|
|
835
|
+
id: string;
|
|
836
|
+
workspaceId: string;
|
|
837
|
+
eventType: TrackingEmailEvent;
|
|
838
|
+
eventTypeName: string;
|
|
839
|
+
subjectTemplate: string;
|
|
840
|
+
htmlBodyTemplate: string;
|
|
841
|
+
isEnabled: boolean;
|
|
842
|
+
createdAt: string;
|
|
843
|
+
updatedAt: string;
|
|
844
|
+
}
|
|
845
|
+
interface UpsertEmailTemplateRequest {
|
|
846
|
+
eventType: TrackingEmailEvent;
|
|
847
|
+
/** Up to 500 characters. */
|
|
848
|
+
subjectTemplate: string;
|
|
849
|
+
htmlBodyTemplate: string;
|
|
850
|
+
/** Default true. */
|
|
851
|
+
isEnabled?: boolean;
|
|
852
|
+
}
|
|
853
|
+
interface EmailTemplatePreviewRequest {
|
|
854
|
+
subjectTemplate: string;
|
|
855
|
+
htmlBodyTemplate: string;
|
|
856
|
+
}
|
|
857
|
+
interface EmailTemplatePreview {
|
|
858
|
+
renderedSubject: string;
|
|
859
|
+
renderedHtmlBody: string;
|
|
429
860
|
}
|
|
430
861
|
interface HsCodeResult {
|
|
431
862
|
hsCode: string;
|
|
@@ -440,6 +871,21 @@ interface LandedCostRequest {
|
|
|
440
871
|
shippingCost?: number;
|
|
441
872
|
items: CustomsItem[];
|
|
442
873
|
}
|
|
874
|
+
/** USPS label declaration. Item value and weight are per unit; server availability is gated. */
|
|
875
|
+
interface CustomsDeclaration {
|
|
876
|
+
contentsType: 'merchandise' | 'documents' | 'gift' | 'sample' | 'returned_goods' | 'other';
|
|
877
|
+
contentsExplanation?: string;
|
|
878
|
+
nonDeliveryOption: 'return' | 'abandon';
|
|
879
|
+
currency: 'USD';
|
|
880
|
+
declaredValue: number;
|
|
881
|
+
aesItn: string;
|
|
882
|
+
invoiceNumber?: string;
|
|
883
|
+
licenseNumber?: string;
|
|
884
|
+
certificateNumber?: string;
|
|
885
|
+
restrictionType?: string;
|
|
886
|
+
restrictionComments?: string;
|
|
887
|
+
items: CustomsItem[];
|
|
888
|
+
}
|
|
443
889
|
interface CustomsItem {
|
|
444
890
|
description: string;
|
|
445
891
|
quantity: number;
|
|
@@ -459,72 +905,6 @@ interface LandedCostEstimate {
|
|
|
459
905
|
isEstimate: boolean;
|
|
460
906
|
disclaimer: string | null;
|
|
461
907
|
}
|
|
462
|
-
interface RecurringShipment {
|
|
463
|
-
id: string;
|
|
464
|
-
name: string;
|
|
465
|
-
isActive: boolean;
|
|
466
|
-
scheduleExpression: string;
|
|
467
|
-
nextRunAt: string | null;
|
|
468
|
-
lastRunAt: string | null;
|
|
469
|
-
createdAt: string;
|
|
470
|
-
}
|
|
471
|
-
interface CreateRecurringShipmentRequest {
|
|
472
|
-
name: string;
|
|
473
|
-
scheduleExpression: string;
|
|
474
|
-
labelRequest: CreateLabelRequest;
|
|
475
|
-
}
|
|
476
|
-
interface UpdateRecurringShipmentRequest {
|
|
477
|
-
name?: string;
|
|
478
|
-
scheduleExpression?: string;
|
|
479
|
-
labelRequest?: Partial<CreateLabelRequest>;
|
|
480
|
-
}
|
|
481
|
-
interface EmailTemplate {
|
|
482
|
-
id: string;
|
|
483
|
-
name: string;
|
|
484
|
-
subject: string;
|
|
485
|
-
triggerEvent: string;
|
|
486
|
-
isActive: boolean;
|
|
487
|
-
createdAt: string;
|
|
488
|
-
updatedAt: string;
|
|
489
|
-
}
|
|
490
|
-
interface CreateEmailTemplateRequest {
|
|
491
|
-
name: string;
|
|
492
|
-
subject: string;
|
|
493
|
-
bodyHtml: string;
|
|
494
|
-
triggerEvent: string;
|
|
495
|
-
isActive?: boolean;
|
|
496
|
-
}
|
|
497
|
-
interface UpdateEmailTemplateRequest {
|
|
498
|
-
name?: string;
|
|
499
|
-
subject?: string;
|
|
500
|
-
bodyHtml?: string;
|
|
501
|
-
triggerEvent?: string;
|
|
502
|
-
isActive?: boolean;
|
|
503
|
-
}
|
|
504
|
-
interface ReportSchedule {
|
|
505
|
-
id: string;
|
|
506
|
-
name: string;
|
|
507
|
-
reportType: string;
|
|
508
|
-
recipientEmail: string;
|
|
509
|
-
scheduleExpression: string;
|
|
510
|
-
isActive: boolean;
|
|
511
|
-
lastSentAt: string | null;
|
|
512
|
-
createdAt: string;
|
|
513
|
-
}
|
|
514
|
-
interface CreateReportScheduleRequest {
|
|
515
|
-
name: string;
|
|
516
|
-
reportType: string;
|
|
517
|
-
recipientEmail: string;
|
|
518
|
-
scheduleExpression: string;
|
|
519
|
-
isActive?: boolean;
|
|
520
|
-
}
|
|
521
|
-
interface UpdateReportScheduleRequest {
|
|
522
|
-
name?: string;
|
|
523
|
-
reportType?: string;
|
|
524
|
-
recipientEmail?: string;
|
|
525
|
-
scheduleExpression?: string;
|
|
526
|
-
isActive?: boolean;
|
|
527
|
-
}
|
|
528
908
|
declare class FlexOpsError extends Error {
|
|
529
909
|
readonly status: number;
|
|
530
910
|
readonly code?: string | undefined;
|
|
@@ -549,6 +929,8 @@ declare class HttpClient {
|
|
|
549
929
|
private apiKey?;
|
|
550
930
|
constructor(config: FlexOpsConfig);
|
|
551
931
|
setAccessToken(token: string): void;
|
|
932
|
+
/** The JWT access token in use, if any. */
|
|
933
|
+
getAccessToken(): string | undefined;
|
|
552
934
|
setApiKey(key: string): void;
|
|
553
935
|
request<T>(method: string, path: string, options?: {
|
|
554
936
|
body?: unknown;
|
|
@@ -563,32 +945,34 @@ declare class HttpClient {
|
|
|
563
945
|
delete<T>(path: string): Promise<T>;
|
|
564
946
|
private buildUrl;
|
|
565
947
|
private buildHeaders;
|
|
948
|
+
/**
|
|
949
|
+
* GETs retry on every configured status. A write retries only where the Gateway either did not
|
|
950
|
+
* run it or will replay it for the same Idempotency-Key: never after a 500, whose response the
|
|
951
|
+
* Gateway does not cache, so a retry would run the write again. A DELETE retries only on 429.
|
|
952
|
+
*/
|
|
953
|
+
private isRetryable;
|
|
566
954
|
private calculateBackoff;
|
|
567
955
|
}
|
|
568
956
|
|
|
957
|
+
/**
|
|
958
|
+
* Token acquisition for user-token calls. Account management (sign-up, profile, passwords, email
|
|
959
|
+
* verification) lives in the FlexOps portals; integrations normally use an API key instead.
|
|
960
|
+
*/
|
|
569
961
|
declare class AuthResource {
|
|
570
962
|
private readonly http;
|
|
571
963
|
constructor(http: HttpClient);
|
|
572
|
-
/**
|
|
964
|
+
/**
|
|
965
|
+
* Authenticate with email and password. On success the returned access token (`data.token`) is
|
|
966
|
+
* used for later requests. When `data.requiresTwoFactor` is true no token is issued yet.
|
|
967
|
+
*/
|
|
573
968
|
login(request: LoginRequest): Promise<ApiResponse<LoginResponse>>;
|
|
574
|
-
/**
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
969
|
+
/**
|
|
970
|
+
* Exchange a refresh token for a new access token. The Gateway needs the expired access token
|
|
971
|
+
* too; it defaults to the one this client holds.
|
|
972
|
+
*/
|
|
973
|
+
refreshToken(refreshToken: string, accessToken?: string | undefined): Promise<ApiResponse<LoginResponse>>;
|
|
578
974
|
/** Log out and invalidate the current session. */
|
|
579
975
|
logout(): Promise<ApiResponse<unknown>>;
|
|
580
|
-
/** Get the current user's profile. */
|
|
581
|
-
getProfile(): Promise<ApiResponse<unknown>>;
|
|
582
|
-
/** Update the current user's profile. */
|
|
583
|
-
updateProfile(data: Record<string, unknown>): Promise<ApiResponse<unknown>>;
|
|
584
|
-
/** Change the current user's password. */
|
|
585
|
-
changePassword(currentPassword: string, newPassword: string): Promise<ApiResponse<unknown>>;
|
|
586
|
-
/** Request a password reset email. */
|
|
587
|
-
forgotPassword(email: string): Promise<ApiResponse<unknown>>;
|
|
588
|
-
/** Reset password using a reset token. */
|
|
589
|
-
resetPassword(token: string, newPassword: string): Promise<ApiResponse<unknown>>;
|
|
590
|
-
/** Verify email with the verification token. */
|
|
591
|
-
verifyEmail(token: string): Promise<ApiResponse<unknown>>;
|
|
592
976
|
}
|
|
593
977
|
|
|
594
978
|
declare class WorkspacesResource {
|
|
@@ -599,19 +983,15 @@ declare class WorkspacesResource {
|
|
|
599
983
|
/** List all workspaces the current user belongs to. */
|
|
600
984
|
list(): Promise<ApiResponse<Workspace[]>>;
|
|
601
985
|
/** Get details for a specific workspace. */
|
|
602
|
-
get(workspaceId?: string): Promise<ApiResponse<
|
|
603
|
-
/**
|
|
604
|
-
|
|
605
|
-
/** Update workspace settings. */
|
|
606
|
-
update(data: Partial<Workspace>): Promise<ApiResponse<Workspace>>;
|
|
607
|
-
/** List members of the current workspace. */
|
|
608
|
-
listMembers(): Promise<ApiResponse<WorkspaceMember[]>>;
|
|
986
|
+
get(workspaceId?: string): Promise<ApiResponse<WorkspaceDetail>>;
|
|
987
|
+
/** List the current workspace's members and pending invites. */
|
|
988
|
+
listMembers(): Promise<ApiResponse<WorkspaceMemberList>>;
|
|
609
989
|
/** Invite a user to the workspace. */
|
|
610
|
-
inviteMember(email: string, role?:
|
|
990
|
+
inviteMember(email: string, role?: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
611
991
|
/** Remove a member from the workspace. */
|
|
612
992
|
removeMember(userId: string): Promise<ApiResponse<unknown>>;
|
|
613
|
-
/**
|
|
614
|
-
updateMemberRole(userId: string, role:
|
|
993
|
+
/** Change a member's role. */
|
|
994
|
+
updateMemberRole(userId: string, role: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
615
995
|
}
|
|
616
996
|
|
|
617
997
|
declare class ShippingResource {
|
|
@@ -630,13 +1010,17 @@ declare class ShippingResource {
|
|
|
630
1010
|
* existing order — the order's ownership, status, ship-method and addresses are validated
|
|
631
1011
|
* server-side and postage is settled atomically. Returns the raw label (HTTP 201).
|
|
632
1012
|
*/
|
|
633
|
-
createLabel(request: CreateLabelRequest): Promise<Label>;
|
|
1013
|
+
createLabel(request: CreateLabelRequest | CanonicalLabelRequest): Promise<Label>;
|
|
1014
|
+
/** Preview without approval. Keep the returned immutable operation for every purchase attempt. */
|
|
1015
|
+
prepareLabel(request: CanonicalLabelRequest, maximumPostageAmount: number, idempotencyKey: string): Promise<LabelPurchaseApproval>;
|
|
1016
|
+
/** Call only after explicit approval. Same-key replay remains valid after token expiry. */
|
|
1017
|
+
purchaseLabel(approval: LabelPurchaseApproval): Promise<Label>;
|
|
634
1018
|
/** Cancel (void) a shipping label. `carrierCode` is required. */
|
|
635
1019
|
cancelLabel(labelId: string, carrierCode: string): Promise<unknown>;
|
|
636
1020
|
/** Track a shipment by tracking number. */
|
|
637
1021
|
track(trackingNumber: string): Promise<TrackingInfo>;
|
|
638
1022
|
/** Validate and correct a shipping address. */
|
|
639
|
-
validateAddress(address: Address): Promise<AddressValidationResult>;
|
|
1023
|
+
validateAddress(address: Address | ShippingAddress): Promise<AddressValidationResult>;
|
|
640
1024
|
/** Create labels in batch. */
|
|
641
1025
|
createBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
642
1026
|
/** Preview a batch without purchasing (dry-run). */
|
|
@@ -658,10 +1042,12 @@ declare class ShippingResource {
|
|
|
658
1042
|
/**
|
|
659
1043
|
* Direct carrier operations via the VisionSuite Core Services API proxy.
|
|
660
1044
|
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
1045
|
+
* Pass-throughs to carrier-specific endpoints (USPS, UPS, FedEx, DHL) via the Gateway's legacy
|
|
1046
|
+
* ApiProxy route, deprecated and sunset on 2027-06-30. The GET lookups work with API keys. The
|
|
1047
|
+
* writes are marked deprecated: they need a user token (`auth.login`), because the Gateway refuses
|
|
1048
|
+
* API-key writes on the proxy with 403 `API_KEY_SCOPE_REQUIRED`. Label purchases through the proxy are
|
|
1049
|
+
* closed (410); rates, labels, voids, pickups and scan forms go through `client.shipping`,
|
|
1050
|
+
* `client.pickups` and `client.scanForms` for every carrier.
|
|
665
1051
|
*/
|
|
666
1052
|
declare class CarriersResource {
|
|
667
1053
|
private readonly http;
|
|
@@ -674,35 +1060,91 @@ declare class CarriersResource {
|
|
|
674
1060
|
cityStateLookup: (zipCode: string) => Promise<unknown>;
|
|
675
1061
|
/** ZIP code lookup by address. */
|
|
676
1062
|
zipCodeLookup: (params: Record<string, string>) => Promise<unknown>;
|
|
677
|
-
/**
|
|
1063
|
+
/**
|
|
1064
|
+
* Search domestic shipping rates.
|
|
1065
|
+
*
|
|
1066
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1067
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1068
|
+
* cover this.
|
|
1069
|
+
*/
|
|
678
1070
|
getDomesticRates: (body: unknown) => Promise<unknown>;
|
|
679
|
-
/**
|
|
1071
|
+
/**
|
|
1072
|
+
* Search domestic product eligibility.
|
|
1073
|
+
*
|
|
1074
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1075
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1076
|
+
* cover this.
|
|
1077
|
+
*/
|
|
680
1078
|
getDomesticProducts: (body: unknown) => Promise<unknown>;
|
|
681
|
-
/**
|
|
1079
|
+
/**
|
|
1080
|
+
* Search domestic prices.
|
|
1081
|
+
*
|
|
1082
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1083
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1084
|
+
* cover this.
|
|
1085
|
+
*/
|
|
682
1086
|
getDomesticPrices: (body: unknown) => Promise<unknown>;
|
|
683
|
-
/**
|
|
1087
|
+
/**
|
|
1088
|
+
* Search international rates.
|
|
1089
|
+
*
|
|
1090
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1091
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1092
|
+
* cover this.
|
|
1093
|
+
*/
|
|
684
1094
|
getInternationalRates: (body: unknown) => Promise<unknown>;
|
|
685
|
-
/**
|
|
1095
|
+
/**
|
|
1096
|
+
* Search international prices.
|
|
1097
|
+
*
|
|
1098
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1099
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1100
|
+
* cover this.
|
|
1101
|
+
*/
|
|
686
1102
|
getInternationalPrices: (body: unknown) => Promise<unknown>;
|
|
687
1103
|
/** Generate a domestic shipping label. */
|
|
688
1104
|
createDomesticLabel: (body: unknown) => Promise<Label>;
|
|
689
|
-
/**
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
1105
|
+
/**
|
|
1106
|
+
* Cancel a domestic label.
|
|
1107
|
+
*
|
|
1108
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1109
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1110
|
+
* cover this.
|
|
1111
|
+
*/
|
|
694
1112
|
cancelDomesticLabel: () => Promise<unknown>;
|
|
695
|
-
/**
|
|
1113
|
+
/**
|
|
1114
|
+
* Cancel an international label.
|
|
1115
|
+
*
|
|
1116
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1117
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1118
|
+
* cover this.
|
|
1119
|
+
*/
|
|
696
1120
|
cancelInternationalLabel: () => Promise<unknown>;
|
|
697
1121
|
/** Get tracking summary. */
|
|
698
1122
|
trackSummary: (params: Record<string, string>) => Promise<unknown>;
|
|
699
1123
|
/** Get detailed tracking info. */
|
|
700
1124
|
trackDetail: (params: Record<string, string>) => Promise<unknown>;
|
|
701
|
-
/**
|
|
1125
|
+
/**
|
|
1126
|
+
* Schedule a carrier pickup.
|
|
1127
|
+
*
|
|
1128
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1129
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1130
|
+
* cover this.
|
|
1131
|
+
*/
|
|
702
1132
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
703
|
-
/**
|
|
1133
|
+
/**
|
|
1134
|
+
* Cancel a pickup.
|
|
1135
|
+
*
|
|
1136
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1137
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1138
|
+
* cover this.
|
|
1139
|
+
*/
|
|
704
1140
|
cancelPickup: () => Promise<unknown>;
|
|
705
|
-
/**
|
|
1141
|
+
/**
|
|
1142
|
+
* Create a scan form.
|
|
1143
|
+
*
|
|
1144
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1145
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1146
|
+
* cover this.
|
|
1147
|
+
*/
|
|
706
1148
|
createScanForm: (body: unknown) => Promise<unknown>;
|
|
707
1149
|
/** Get delivery standards estimates. */
|
|
708
1150
|
deliveryStandards: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -712,73 +1154,241 @@ declare class CarriersResource {
|
|
|
712
1154
|
findPostOffices: (params: Record<string, string>) => Promise<unknown>;
|
|
713
1155
|
};
|
|
714
1156
|
readonly ups: {
|
|
715
|
-
/**
|
|
1157
|
+
/**
|
|
1158
|
+
* Verify an address via UPS.
|
|
1159
|
+
*
|
|
1160
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1161
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1162
|
+
* cover this.
|
|
1163
|
+
*/
|
|
716
1164
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
717
|
-
/**
|
|
1165
|
+
/**
|
|
1166
|
+
* Get UPS rate quotes.
|
|
1167
|
+
*
|
|
1168
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1169
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1170
|
+
* cover this.
|
|
1171
|
+
*/
|
|
718
1172
|
getRates: (body: unknown) => Promise<unknown>;
|
|
719
|
-
/** Generate a UPS shipping label. */
|
|
720
|
-
createLabel: (body: unknown) => Promise<unknown>;
|
|
721
1173
|
/** Track a UPS shipment. */
|
|
722
1174
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
723
|
-
/**
|
|
1175
|
+
/**
|
|
1176
|
+
* Create a UPS pickup.
|
|
1177
|
+
*
|
|
1178
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1179
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1180
|
+
* cover this.
|
|
1181
|
+
*/
|
|
724
1182
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
725
|
-
/**
|
|
1183
|
+
/**
|
|
1184
|
+
* Cancel a UPS pickup.
|
|
1185
|
+
*
|
|
1186
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1187
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1188
|
+
* cover this.
|
|
1189
|
+
*/
|
|
726
1190
|
cancelPickup: () => Promise<unknown>;
|
|
727
|
-
/**
|
|
1191
|
+
/**
|
|
1192
|
+
* Get UPS transit times.
|
|
1193
|
+
*
|
|
1194
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1195
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1196
|
+
* cover this.
|
|
1197
|
+
*/
|
|
728
1198
|
getTransitTimes: (body: unknown) => Promise<unknown>;
|
|
729
|
-
/**
|
|
1199
|
+
/**
|
|
1200
|
+
* Get UPS landed cost quote (international).
|
|
1201
|
+
*
|
|
1202
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1203
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1204
|
+
* cover this.
|
|
1205
|
+
*/
|
|
730
1206
|
getLandedCost: (body: unknown) => Promise<unknown>;
|
|
731
|
-
/**
|
|
1207
|
+
/**
|
|
1208
|
+
* Search UPS locations.
|
|
1209
|
+
*
|
|
1210
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1211
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1212
|
+
* cover this.
|
|
1213
|
+
*/
|
|
732
1214
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
733
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* Upload paperless trade document.
|
|
1217
|
+
*
|
|
1218
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1219
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1220
|
+
* cover this.
|
|
1221
|
+
*/
|
|
734
1222
|
uploadDocument: (body: unknown) => Promise<unknown>;
|
|
735
|
-
/**
|
|
1223
|
+
/**
|
|
1224
|
+
* Create UPS freight shipment.
|
|
1225
|
+
*
|
|
1226
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1227
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1228
|
+
* cover this.
|
|
1229
|
+
*/
|
|
736
1230
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
737
|
-
/**
|
|
1231
|
+
/**
|
|
1232
|
+
* Get UPS freight rate.
|
|
1233
|
+
*
|
|
1234
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1235
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1236
|
+
* cover this.
|
|
1237
|
+
*/
|
|
738
1238
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
739
1239
|
};
|
|
740
1240
|
readonly fedex: {
|
|
741
|
-
/**
|
|
1241
|
+
/**
|
|
1242
|
+
* Validate a domestic address via FedEx.
|
|
1243
|
+
*
|
|
1244
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1245
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1246
|
+
* cover this.
|
|
1247
|
+
*/
|
|
742
1248
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
743
|
-
/**
|
|
1249
|
+
/**
|
|
1250
|
+
* Validate a postal code.
|
|
1251
|
+
*
|
|
1252
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1253
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1254
|
+
* cover this.
|
|
1255
|
+
*/
|
|
744
1256
|
validatePostalCode: (body: unknown) => Promise<unknown>;
|
|
745
|
-
/**
|
|
1257
|
+
/**
|
|
1258
|
+
* Get FedEx rate and transit times.
|
|
1259
|
+
*
|
|
1260
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1261
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1262
|
+
* cover this.
|
|
1263
|
+
*/
|
|
746
1264
|
getRates: (body: unknown) => Promise<unknown>;
|
|
747
|
-
/**
|
|
748
|
-
|
|
749
|
-
|
|
1265
|
+
/**
|
|
1266
|
+
* Cancel a FedEx shipment.
|
|
1267
|
+
*
|
|
1268
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1269
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1270
|
+
* cover this.
|
|
1271
|
+
*/
|
|
750
1272
|
cancelShipment: (body: unknown) => Promise<unknown>;
|
|
751
|
-
/**
|
|
1273
|
+
/**
|
|
1274
|
+
* Validate a shipment (dry run).
|
|
1275
|
+
*
|
|
1276
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1277
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1278
|
+
* cover this.
|
|
1279
|
+
*/
|
|
752
1280
|
validateShipment: (body: unknown) => Promise<unknown>;
|
|
753
|
-
/**
|
|
754
|
-
|
|
755
|
-
|
|
1281
|
+
/**
|
|
1282
|
+
* Track by tracking number.
|
|
1283
|
+
*
|
|
1284
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1285
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1286
|
+
* cover this.
|
|
1287
|
+
*/
|
|
756
1288
|
track: (body: unknown) => Promise<unknown>;
|
|
757
|
-
/**
|
|
1289
|
+
/**
|
|
1290
|
+
* Track multi-piece shipment.
|
|
1291
|
+
*
|
|
1292
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1293
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1294
|
+
* cover this.
|
|
1295
|
+
*/
|
|
758
1296
|
trackMultiPiece: (body: unknown) => Promise<unknown>;
|
|
759
|
-
/**
|
|
1297
|
+
/**
|
|
1298
|
+
* Register for tracking notifications.
|
|
1299
|
+
*
|
|
1300
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1301
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1302
|
+
* cover this.
|
|
1303
|
+
*/
|
|
760
1304
|
registerTrackingNotification: (body: unknown) => Promise<unknown>;
|
|
761
|
-
/**
|
|
1305
|
+
/**
|
|
1306
|
+
* Create a carrier pickup.
|
|
1307
|
+
*
|
|
1308
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1309
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1310
|
+
* cover this.
|
|
1311
|
+
*/
|
|
762
1312
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
763
|
-
/**
|
|
1313
|
+
/**
|
|
1314
|
+
* Cancel a pickup.
|
|
1315
|
+
*
|
|
1316
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1317
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1318
|
+
* cover this.
|
|
1319
|
+
*/
|
|
764
1320
|
cancelPickup: (body: unknown) => Promise<unknown>;
|
|
765
|
-
/**
|
|
1321
|
+
/**
|
|
1322
|
+
* Search valid locations.
|
|
1323
|
+
*
|
|
1324
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1325
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1326
|
+
* cover this.
|
|
1327
|
+
*/
|
|
766
1328
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
767
|
-
/**
|
|
1329
|
+
/**
|
|
1330
|
+
* Get service standards and transit times.
|
|
1331
|
+
*
|
|
1332
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1333
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1334
|
+
* cover this.
|
|
1335
|
+
*/
|
|
768
1336
|
getServiceStandards: (body: unknown) => Promise<unknown>;
|
|
769
|
-
/**
|
|
1337
|
+
/**
|
|
1338
|
+
* Get freight rate quote.
|
|
1339
|
+
*
|
|
1340
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1341
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1342
|
+
* cover this.
|
|
1343
|
+
*/
|
|
770
1344
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
771
|
-
/**
|
|
1345
|
+
/**
|
|
1346
|
+
* Create freight shipment.
|
|
1347
|
+
*
|
|
1348
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1349
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1350
|
+
* cover this.
|
|
1351
|
+
*/
|
|
772
1352
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
773
|
-
/**
|
|
1353
|
+
/**
|
|
1354
|
+
* Ground close with documents.
|
|
1355
|
+
*
|
|
1356
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1357
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1358
|
+
* cover this.
|
|
1359
|
+
*/
|
|
774
1360
|
groundClose: (body: unknown) => Promise<unknown>;
|
|
775
|
-
/**
|
|
1361
|
+
/**
|
|
1362
|
+
* Upload trade documents.
|
|
1363
|
+
*
|
|
1364
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1365
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1366
|
+
* cover this.
|
|
1367
|
+
*/
|
|
776
1368
|
uploadTradeDocuments: (body: unknown) => Promise<unknown>;
|
|
777
|
-
/**
|
|
1369
|
+
/**
|
|
1370
|
+
* Create an open shipment.
|
|
1371
|
+
*
|
|
1372
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1373
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1374
|
+
* cover this.
|
|
1375
|
+
*/
|
|
778
1376
|
createOpenShipment: (body: unknown) => Promise<unknown>;
|
|
779
|
-
/**
|
|
1377
|
+
/**
|
|
1378
|
+
* Add packages to an open shipment.
|
|
1379
|
+
*
|
|
1380
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1381
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1382
|
+
* cover this.
|
|
1383
|
+
*/
|
|
780
1384
|
addPackagesToOpenShipment: (body: unknown) => Promise<unknown>;
|
|
781
|
-
/**
|
|
1385
|
+
/**
|
|
1386
|
+
* Confirm and finalize an open shipment.
|
|
1387
|
+
*
|
|
1388
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1389
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1390
|
+
* cover this.
|
|
1391
|
+
*/
|
|
782
1392
|
confirmOpenShipment: (body: unknown) => Promise<unknown>;
|
|
783
1393
|
};
|
|
784
1394
|
readonly dhl: {
|
|
@@ -786,27 +1396,59 @@ declare class CarriersResource {
|
|
|
786
1396
|
validateAddress: (params: Record<string, string>) => Promise<unknown>;
|
|
787
1397
|
/** Get DHL shipping rates. */
|
|
788
1398
|
getRates: (params: Record<string, string>) => Promise<unknown>;
|
|
789
|
-
/**
|
|
1399
|
+
/**
|
|
1400
|
+
* Get multi-piece rates.
|
|
1401
|
+
*
|
|
1402
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1403
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1404
|
+
* cover this.
|
|
1405
|
+
*/
|
|
790
1406
|
getMultiPieceRates: (body: unknown) => Promise<unknown>;
|
|
791
1407
|
/** Get DHL products/services. */
|
|
792
1408
|
getProducts: (params: Record<string, string>) => Promise<unknown>;
|
|
793
|
-
/** Create a DHL shipment (label). */
|
|
794
|
-
createShipment: (body: unknown) => Promise<unknown>;
|
|
795
1409
|
/** Track a DHL shipment. */
|
|
796
1410
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
797
1411
|
/** Track multiple DHL shipments. */
|
|
798
1412
|
trackMultiple: (params: Record<string, string>) => Promise<unknown>;
|
|
799
|
-
/**
|
|
1413
|
+
/**
|
|
1414
|
+
* Create a DHL pickup.
|
|
1415
|
+
*
|
|
1416
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1417
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1418
|
+
* cover this.
|
|
1419
|
+
*/
|
|
800
1420
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
801
|
-
/**
|
|
802
|
-
|
|
803
|
-
|
|
1421
|
+
/**
|
|
1422
|
+
* Cancel a DHL pickup.
|
|
1423
|
+
*
|
|
1424
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1425
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1426
|
+
* cover this.
|
|
1427
|
+
*/
|
|
804
1428
|
cancelPickup: () => Promise<unknown>;
|
|
805
|
-
/**
|
|
1429
|
+
/**
|
|
1430
|
+
* Calculate landed cost (duties/taxes).
|
|
1431
|
+
*
|
|
1432
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1433
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1434
|
+
* cover this.
|
|
1435
|
+
*/
|
|
806
1436
|
calculateLandedCost: (body: unknown) => Promise<unknown>;
|
|
807
|
-
/**
|
|
1437
|
+
/**
|
|
1438
|
+
* Screen a shipment for compliance.
|
|
1439
|
+
*
|
|
1440
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1441
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1442
|
+
* cover this.
|
|
1443
|
+
*/
|
|
808
1444
|
screenShipment: (body: unknown) => Promise<unknown>;
|
|
809
|
-
/**
|
|
1445
|
+
/**
|
|
1446
|
+
* Upload an invoice.
|
|
1447
|
+
*
|
|
1448
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1449
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1450
|
+
* cover this.
|
|
1451
|
+
*/
|
|
810
1452
|
uploadInvoice: (body: unknown) => Promise<unknown>;
|
|
811
1453
|
/** Get electronic proof of delivery. */
|
|
812
1454
|
getProofOfDelivery: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -824,12 +1466,17 @@ declare class WebhooksResource {
|
|
|
824
1466
|
private wsPath;
|
|
825
1467
|
/** List all webhook subscriptions for the workspace. */
|
|
826
1468
|
list(): Promise<ApiResponse<WebhookSubscription[]>>;
|
|
827
|
-
/**
|
|
828
|
-
|
|
829
|
-
|
|
1469
|
+
/**
|
|
1470
|
+
* Create a webhook subscription. `events` is sent as the Gateway's comma-separated `eventTypes`;
|
|
1471
|
+
* omit it to receive every event. The result's `data.secret` is the signing secret, returned only here.
|
|
1472
|
+
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1473
|
+
*/
|
|
830
1474
|
create(request: CreateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
831
|
-
/**
|
|
832
|
-
|
|
1475
|
+
/**
|
|
1476
|
+
* Update a webhook subscription. `events`, when given, replaces the subscribed events.
|
|
1477
|
+
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1478
|
+
*/
|
|
1479
|
+
update(webhookId: string, data: UpdateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
833
1480
|
/** Delete a webhook subscription. */
|
|
834
1481
|
delete(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
835
1482
|
/** Rotate the signing secret for a webhook. */
|
|
@@ -838,35 +1485,45 @@ declare class WebhooksResource {
|
|
|
838
1485
|
}>>;
|
|
839
1486
|
/** List delivery logs for a webhook. */
|
|
840
1487
|
listDeliveryLogs(webhookId: string): Promise<ApiResponse<unknown[]>>;
|
|
1488
|
+
/** Send a test event to a webhook's endpoint. */
|
|
1489
|
+
test(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
841
1490
|
/**
|
|
842
|
-
* Verify
|
|
843
|
-
*
|
|
1491
|
+
* Verify that an incoming request is a genuine FlexOps webhook delivery.
|
|
1492
|
+
*
|
|
1493
|
+
* FlexOps signs `{X-FlexOps-Timestamp}.{raw body}` with HMAC-SHA256, keyed with the
|
|
1494
|
+
* subscription secret (the whole `whsec_...` string), and sends
|
|
1495
|
+
* `X-FlexOps-Signature: sha256=<lowercase hex>`.
|
|
1496
|
+
*
|
|
1497
|
+
* @param payload The raw request body exactly as received (string or bytes). Do not pass
|
|
1498
|
+
* re-serialized JSON: `JSON.stringify(req.body)` will not reproduce the signed bytes.
|
|
1499
|
+
* @param signature The `X-FlexOps-Signature` header. `sha256=<hex>` and bare `<hex>` are accepted.
|
|
1500
|
+
* @param secret The subscription signing secret.
|
|
1501
|
+
* @param timestamp The `X-FlexOps-Timestamp` header (Unix seconds).
|
|
1502
|
+
* @param options `toleranceSeconds` (default 300) bounds how far the timestamp may be from now
|
|
1503
|
+
* in either direction; `now` (Unix seconds) overrides the clock, for tests.
|
|
1504
|
+
* @returns `true` only when the signature matches and the timestamp is within tolerance.
|
|
1505
|
+
* @throws TypeError when `secret` is empty or `payload` is not a string or bytes.
|
|
844
1506
|
*/
|
|
845
|
-
static verifySignature(payload: string, signature: string, secret: string): boolean;
|
|
1507
|
+
static verifySignature(payload: string | Uint8Array, signature: string | null | undefined, secret: string, timestamp: string | null | undefined, options?: VerifySignatureOptions): boolean;
|
|
1508
|
+
}
|
|
1509
|
+
/** Options for {@link WebhooksResource.verifySignature}. */
|
|
1510
|
+
interface VerifySignatureOptions {
|
|
1511
|
+
/** Maximum distance, in seconds, between `X-FlexOps-Timestamp` and now. Defaults to 300. */
|
|
1512
|
+
toleranceSeconds?: number;
|
|
1513
|
+
/** The current time in Unix seconds. Defaults to the system clock; set it in tests. */
|
|
1514
|
+
now?: number;
|
|
846
1515
|
}
|
|
847
1516
|
|
|
1517
|
+
/**
|
|
1518
|
+
* The workspace wallet, read-only. Funding, transactions and auto-reload are managed in the
|
|
1519
|
+
* FlexOps portals, not through the API.
|
|
1520
|
+
*/
|
|
848
1521
|
declare class WalletResource {
|
|
849
1522
|
private readonly http;
|
|
850
1523
|
private readonly getWorkspaceId;
|
|
851
1524
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
getBalance(): Promise<ApiResponse<WalletBalance>>;
|
|
855
|
-
/** Add funds to the wallet. */
|
|
856
|
-
addFunds(amount: number): Promise<ApiResponse<unknown>>;
|
|
857
|
-
/** List wallet transactions. */
|
|
858
|
-
listTransactions(query?: {
|
|
859
|
-
page?: number;
|
|
860
|
-
pageSize?: number;
|
|
861
|
-
startDate?: string;
|
|
862
|
-
endDate?: string;
|
|
863
|
-
}): Promise<ApiResponse<unknown>>;
|
|
864
|
-
/** Configure auto-reload settings. */
|
|
865
|
-
configureAutoReload(config: {
|
|
866
|
-
enabled: boolean;
|
|
867
|
-
threshold?: number;
|
|
868
|
-
amount?: number;
|
|
869
|
-
}): Promise<ApiResponse<unknown>>;
|
|
1525
|
+
/** Get the configured workspace's wallet balance. */
|
|
1526
|
+
getBalance(): Promise<WalletBalance>;
|
|
870
1527
|
}
|
|
871
1528
|
|
|
872
1529
|
declare class InsuranceResource {
|
|
@@ -877,25 +1534,20 @@ declare class InsuranceResource {
|
|
|
877
1534
|
/** Get available insurance providers for this workspace. */
|
|
878
1535
|
getProviders(): Promise<ApiResponse<string[]>>;
|
|
879
1536
|
/** Get an insurance quote. */
|
|
880
|
-
getQuote(request:
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
|
|
894
|
-
/** File an insurance claim. */
|
|
895
|
-
fileClaim(policyId: string, claim: {
|
|
896
|
-
description: string;
|
|
897
|
-
claimAmount: number;
|
|
898
|
-
}): Promise<ApiResponse<unknown>>;
|
|
1537
|
+
getQuote(request: InsuranceQuoteRequest): Promise<ApiResponse<InsuranceQuote>>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Purchase insurance for a shipment. The premium is charged to the workspace wallet. A shipment
|
|
1540
|
+
* that already has a policy in force is refused with 409 `ALREADY_EXISTS`.
|
|
1541
|
+
*
|
|
1542
|
+
* Pass an `idempotencyKey` you store with the purchase to make your own retry safe: after an error or
|
|
1543
|
+
* a timeout, retry with the same key and the Gateway returns the first result instead of buying again.
|
|
1544
|
+
* Without one, the SDK's own retries still share a key, but a new call gets a new key.
|
|
1545
|
+
*/
|
|
1546
|
+
purchase(request: PurchaseInsuranceRequest, idempotencyKey?: string): Promise<ApiResponse<InsurancePolicy>>;
|
|
1547
|
+
/** Void (cancel) an insurance policy. */
|
|
1548
|
+
void(policyId: string): Promise<ApiResponse<InsurancePolicy>>;
|
|
1549
|
+
/** File a claim against a policy. */
|
|
1550
|
+
fileClaim(claim: FileClaimRequest): Promise<ApiResponse<InsuranceClaim>>;
|
|
899
1551
|
}
|
|
900
1552
|
|
|
901
1553
|
declare class ReturnsResource {
|
|
@@ -903,47 +1555,28 @@ declare class ReturnsResource {
|
|
|
903
1555
|
private readonly getWorkspaceId;
|
|
904
1556
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
905
1557
|
private wsPath;
|
|
906
|
-
/** List
|
|
1558
|
+
/** List return authorizations, optionally created between `startDate` and `endDate` (ISO 8601). */
|
|
907
1559
|
list(query?: {
|
|
1560
|
+
startDate?: string;
|
|
1561
|
+
endDate?: string;
|
|
908
1562
|
page?: number;
|
|
909
1563
|
pageSize?: number;
|
|
910
|
-
status?: string;
|
|
911
1564
|
}): Promise<ApiResponse<ReturnAuthorization[]>>;
|
|
912
1565
|
/** Get a return authorization by ID. */
|
|
913
1566
|
get(returnId: string): Promise<ApiResponse<ReturnAuthorization>>;
|
|
914
|
-
/** Create a return authorization (RMA). */
|
|
1567
|
+
/** Create a return authorization (RMA) for an order. */
|
|
915
1568
|
create(request: ReturnRequest): Promise<ApiResponse<ReturnAuthorization>>;
|
|
916
|
-
/**
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
quantity: number;
|
|
928
|
-
condition: string;
|
|
929
|
-
}[]): Promise<ApiResponse<unknown>>;
|
|
930
|
-
/** Process refund for a return. */
|
|
931
|
-
processRefund(returnId: string): Promise<ApiResponse<unknown>>;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
declare class ApiKeysResource {
|
|
935
|
-
private readonly http;
|
|
936
|
-
private readonly getWorkspaceId;
|
|
937
|
-
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
938
|
-
private wsPath;
|
|
939
|
-
/** List all API keys for the workspace. */
|
|
940
|
-
list(): Promise<ApiResponse<ApiKeyInfo[]>>;
|
|
941
|
-
/** Create a new API key. The full key is only returned once. */
|
|
942
|
-
create(request: CreateApiKeyRequest): Promise<ApiResponse<CreateApiKeyResponse>>;
|
|
943
|
-
/** Revoke an API key. */
|
|
944
|
-
revoke(keyId: string): Promise<ApiResponse<unknown>>;
|
|
945
|
-
/** Rotate an API key (revoke + create new). */
|
|
946
|
-
rotate(keyId: string): Promise<ApiResponse<CreateApiKeyResponse>>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Generate a return label for an approved RMA.
|
|
1571
|
+
*
|
|
1572
|
+
* The Gateway binds a required request body, so one is always sent (`{}` when `request` is
|
|
1573
|
+
* omitted). Pass `weightOz`, `lengthIn`, `widthIn` and `heightIn`: a workspace with no default
|
|
1574
|
+
* shipping preset has nothing else to take the package from and the call fails with a 400 that
|
|
1575
|
+
* names the missing fields.
|
|
1576
|
+
*/
|
|
1577
|
+
generateLabel(rmaNumber: string, request?: ReturnLabelRequest): Promise<ApiResponse<unknown>>;
|
|
1578
|
+
/** Record the inspected items of a returned package at a warehouse. */
|
|
1579
|
+
markReceived(rmaId: string, request: ReceiveReturnRequest): Promise<ApiResponse<unknown>>;
|
|
947
1580
|
}
|
|
948
1581
|
|
|
949
1582
|
type DateRange = {
|
|
@@ -995,8 +1628,6 @@ declare class OrdersResource {
|
|
|
995
1628
|
private readonly http;
|
|
996
1629
|
constructor(http: HttpClient);
|
|
997
1630
|
private path;
|
|
998
|
-
/** Create a new order. */
|
|
999
|
-
create(order: unknown): Promise<ApiResponse<unknown>>;
|
|
1000
1631
|
/** Get new orders awaiting processing. */
|
|
1001
1632
|
getNewOrders(params?: Record<string, string>): Promise<ApiResponse<Order[]>>;
|
|
1002
1633
|
/** Get all orders filtered by status. */
|
|
@@ -1007,8 +1638,6 @@ declare class OrdersResource {
|
|
|
1007
1638
|
getExtendedDetails(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1008
1639
|
/** Get order status by order number. */
|
|
1009
1640
|
getStatus(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1010
|
-
/** Cancel an order. */
|
|
1011
|
-
cancel(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1012
1641
|
/** Get all items for an order. */
|
|
1013
1642
|
getItems(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1014
1643
|
/** Get available ship methods. */
|
|
@@ -1024,16 +1653,12 @@ declare class OrdersResource {
|
|
|
1024
1653
|
declare class InventoryResource {
|
|
1025
1654
|
private readonly http;
|
|
1026
1655
|
constructor(http: HttpClient);
|
|
1027
|
-
/** Post a new ASN (Advance Shipment Notice) receipt. */
|
|
1028
|
-
postAsnReceipt(receipt: unknown): Promise<ApiResponse<unknown>>;
|
|
1029
1656
|
/** Get a warehouse inventory snapshot. */
|
|
1030
1657
|
getWarehouseSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1031
1658
|
/** Get a complete inventory snapshot across all warehouses. */
|
|
1032
1659
|
getCompleteSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1033
1660
|
/** Get the list of all part numbers. */
|
|
1034
1661
|
getPartNumbers(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1035
|
-
/** Update customer inventory (V2). */
|
|
1036
|
-
updateInventory(data: unknown): Promise<ApiResponse<unknown>>;
|
|
1037
1662
|
}
|
|
1038
1663
|
|
|
1039
1664
|
declare class PickupsResource {
|
|
@@ -1045,8 +1670,8 @@ declare class PickupsResource {
|
|
|
1045
1670
|
schedule(request: PickupRequest): Promise<ApiResponse<PickupConfirmation>>;
|
|
1046
1671
|
/** List scheduled pickups. */
|
|
1047
1672
|
list(): Promise<ApiResponse<PickupConfirmation[]>>;
|
|
1048
|
-
/** Get pickup details. */
|
|
1049
|
-
get(pickupId: string): Promise<ApiResponse<PickupConfirmation>>;
|
|
1673
|
+
/** Get pickup details. The carrier defaults to `usps` on the Gateway. */
|
|
1674
|
+
get(pickupId: string, carrierCode?: string): Promise<ApiResponse<PickupConfirmation>>;
|
|
1050
1675
|
/** Cancel a scheduled pickup. */
|
|
1051
1676
|
cancel(pickupId: string): Promise<ApiResponse<unknown>>;
|
|
1052
1677
|
}
|
|
@@ -1074,108 +1699,145 @@ declare class RulesResource {
|
|
|
1074
1699
|
/** Get a rule by ID. */
|
|
1075
1700
|
get(ruleId: string): Promise<ApiResponse<ShippingRule>>;
|
|
1076
1701
|
/** Create a shipping rule. */
|
|
1077
|
-
create(rule:
|
|
1078
|
-
/**
|
|
1079
|
-
update(ruleId: string, rule:
|
|
1702
|
+
create(rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1703
|
+
/** Replace a shipping rule. */
|
|
1704
|
+
update(ruleId: string, rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1080
1705
|
/** Delete a shipping rule. */
|
|
1081
1706
|
delete(ruleId: string): Promise<ApiResponse<unknown>>;
|
|
1082
|
-
/** Reorder rules (
|
|
1083
|
-
reorder(ruleIds: string[]): Promise<ApiResponse<
|
|
1707
|
+
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1708
|
+
reorder(ruleIds: string[]): Promise<ApiResponse<ShippingRule[]>>;
|
|
1709
|
+
/** Dry-run the workspace's rules against a sample shipment, without changing anything. */
|
|
1710
|
+
test(request: ShippingRuleTestRequest): Promise<ApiResponse<unknown>>;
|
|
1084
1711
|
}
|
|
1085
1712
|
|
|
1086
|
-
|
|
1713
|
+
/** Carbon offsets for shipments. Requires the Pro plan or above. */
|
|
1714
|
+
declare class CarbonOffsetsResource {
|
|
1087
1715
|
private readonly http;
|
|
1088
1716
|
private readonly getWorkspaceId;
|
|
1089
1717
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1090
1718
|
private wsPath;
|
|
1091
|
-
/**
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1719
|
+
/** Quote an offset for a shipment without buying it. */
|
|
1720
|
+
quote(request: CarbonOffsetQuoteRequest): Promise<ApiResponse<CarbonOffsetQuote>>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Buy an offset for a shipment. The cost is charged to the workspace wallet and refunded if the
|
|
1723
|
+
* offset provider fails.
|
|
1724
|
+
*
|
|
1725
|
+
* Pass an `idempotencyKey` you store with the purchase to make your own retry safe: after an error or
|
|
1726
|
+
* a timeout, retry with the same key and the Gateway returns the first result instead of buying again.
|
|
1727
|
+
* Without one, the SDK's own retries still share a key, but a new call gets a new key.
|
|
1728
|
+
*/
|
|
1729
|
+
purchase(request: CarbonOffsetPurchaseRequest, idempotencyKey?: string): Promise<ApiResponse<CarbonOffset>>;
|
|
1730
|
+
/** List the workspace's offsets, newest first. */
|
|
1731
|
+
list(query?: {
|
|
1732
|
+
page?: number;
|
|
1733
|
+
pageSize?: number;
|
|
1734
|
+
}): Promise<ApiResponse<CarbonOffset[]>>;
|
|
1735
|
+
/** Get one offset. */
|
|
1736
|
+
get(offsetId: string): Promise<ApiResponse<CarbonOffset>>;
|
|
1737
|
+
/** Totals across the workspace's offsets. */
|
|
1738
|
+
getSummary(): Promise<ApiResponse<CarbonOffsetSummary>>;
|
|
1739
|
+
/** Get the automatic-offset setting. */
|
|
1740
|
+
getSettings(): Promise<ApiResponse<CarbonOffsetSettings>>;
|
|
1741
|
+
/** Turn automatic offsets on or off. */
|
|
1742
|
+
updateSettings(settings: CarbonOffsetSettings): Promise<ApiResponse<CarbonOffsetSettings>>;
|
|
1097
1743
|
}
|
|
1098
1744
|
|
|
1099
|
-
|
|
1745
|
+
/**
|
|
1746
|
+
* Recurring shipments: a saved destination address and shipping preset that create an order on a
|
|
1747
|
+
* schedule. Requires the Pro plan or above.
|
|
1748
|
+
*
|
|
1749
|
+
* Reads work with any API key. Writes need a user token (`auth.login`) or an API key granted
|
|
1750
|
+
* `recurring-shipments:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`. Responses are the
|
|
1751
|
+
* bare objects, not the `{ success, data }` envelope.
|
|
1752
|
+
*/
|
|
1753
|
+
declare class RecurringShipmentsResource {
|
|
1100
1754
|
private readonly http;
|
|
1101
1755
|
private readonly getWorkspaceId;
|
|
1102
1756
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1103
1757
|
private wsPath;
|
|
1104
|
-
/**
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1758
|
+
/** List the workspace's recurring shipments. */
|
|
1759
|
+
list(): Promise<RecurringShipment[]>;
|
|
1760
|
+
/** Get one recurring shipment. */
|
|
1761
|
+
get(id: string): Promise<RecurringShipment>;
|
|
1762
|
+
/** Create a recurring shipment. The first run is at `firstRunUtc`. */
|
|
1763
|
+
create(request: CreateRecurringShipmentRequest): Promise<RecurringShipment>;
|
|
1764
|
+
/** Change a recurring shipment. Fields left out stay as they are. */
|
|
1765
|
+
update(id: string, request: UpdateRecurringShipmentRequest): Promise<RecurringShipment>;
|
|
1766
|
+
/** Delete a recurring shipment. */
|
|
1767
|
+
delete(id: string): Promise<void>;
|
|
1768
|
+
/** Stop scheduled runs until `resume` is called. */
|
|
1769
|
+
pause(id: string): Promise<void>;
|
|
1770
|
+
/** Restart scheduled runs. */
|
|
1771
|
+
resume(id: string): Promise<void>;
|
|
1772
|
+
/**
|
|
1773
|
+
* Run a recurring shipment now, which creates an order. Pass your own `idempotencyKey` to make a
|
|
1774
|
+
* retry from your side safe too; the SDK's own retries always reuse one key.
|
|
1775
|
+
*/
|
|
1776
|
+
trigger(id: string, idempotencyKey?: string): Promise<void>;
|
|
1113
1777
|
}
|
|
1114
1778
|
|
|
1115
|
-
|
|
1779
|
+
/**
|
|
1780
|
+
* Scheduled report emails (2.x called this resource `reports`).
|
|
1781
|
+
*
|
|
1782
|
+
* Reads work with any API key. Writes need a user token (`auth.login`) or an API key granted
|
|
1783
|
+
* `report-schedules:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`.
|
|
1784
|
+
*/
|
|
1785
|
+
declare class ReportSchedulesResource {
|
|
1116
1786
|
private readonly http;
|
|
1117
1787
|
private readonly getWorkspaceId;
|
|
1118
1788
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1119
1789
|
private wsPath;
|
|
1120
|
-
/** List
|
|
1121
|
-
list(
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
|
|
1128
|
-
/**
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
|
|
1132
|
-
/** Delete a recurring shipment schedule. */
|
|
1133
|
-
delete(id: string): Promise<ApiResponse<unknown>>;
|
|
1134
|
-
/** Pause a recurring shipment (stops automatic execution without deleting). */
|
|
1135
|
-
pause(id: string): Promise<ApiResponse<RecurringShipment>>;
|
|
1136
|
-
/** Resume a paused recurring shipment. */
|
|
1137
|
-
resume(id: string): Promise<ApiResponse<RecurringShipment>>;
|
|
1138
|
-
/** Trigger an immediate execution outside the normal schedule. */
|
|
1139
|
-
trigger(id: string): Promise<ApiResponse<unknown>>;
|
|
1790
|
+
/** List the workspace's report schedules. */
|
|
1791
|
+
list(): Promise<ApiResponse<ReportSchedule[]>>;
|
|
1792
|
+
/** Get one report schedule. */
|
|
1793
|
+
get(id: string): Promise<ApiResponse<ReportSchedule>>;
|
|
1794
|
+
/** Create a report schedule. */
|
|
1795
|
+
create(request: CreateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1796
|
+
/** Change a report schedule. Fields left out stay as they are. */
|
|
1797
|
+
update(id: string, request: UpdateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1798
|
+
/** Delete a report schedule. */
|
|
1799
|
+
delete(id: string): Promise<void>;
|
|
1800
|
+
/** Turn a schedule on or off (flips `isEnabled`). */
|
|
1801
|
+
toggle(id: string): Promise<ApiResponse<null>>;
|
|
1140
1802
|
}
|
|
1141
1803
|
|
|
1804
|
+
/**
|
|
1805
|
+
* Tracking email templates: one per tracking event (`TrackingEmailEvent`), sent to the recipient
|
|
1806
|
+
* when that event happens.
|
|
1807
|
+
*
|
|
1808
|
+
* Reads work with any API key. Writes, including `preview`, need a user token (`auth.login`) or an
|
|
1809
|
+
* API key granted `email-templates:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`.
|
|
1810
|
+
* Responses are the bare objects, not the `{ success, data }` envelope.
|
|
1811
|
+
*/
|
|
1142
1812
|
declare class EmailTemplatesResource {
|
|
1143
1813
|
private readonly http;
|
|
1144
1814
|
private readonly getWorkspaceId;
|
|
1145
1815
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1146
1816
|
private wsPath;
|
|
1147
|
-
/** List
|
|
1148
|
-
list(): Promise<
|
|
1149
|
-
/** Get
|
|
1150
|
-
get(
|
|
1151
|
-
/** Create
|
|
1152
|
-
|
|
1153
|
-
/**
|
|
1154
|
-
|
|
1155
|
-
/**
|
|
1156
|
-
|
|
1157
|
-
/** Preview a rendered email template with optional sample data. */
|
|
1158
|
-
preview(id: string, context?: Record<string, unknown>): Promise<ApiResponse<{
|
|
1159
|
-
html: string;
|
|
1160
|
-
subject: string;
|
|
1161
|
-
}>>;
|
|
1817
|
+
/** List the workspace's templates. */
|
|
1818
|
+
list(): Promise<EmailTemplate[]>;
|
|
1819
|
+
/** Get one template. */
|
|
1820
|
+
get(templateId: string): Promise<EmailTemplate>;
|
|
1821
|
+
/** Create or replace the template for `request.eventType`. */
|
|
1822
|
+
upsert(request: UpsertEmailTemplateRequest): Promise<EmailTemplate>;
|
|
1823
|
+
/** Delete a template; that event then uses the FlexOps default email. */
|
|
1824
|
+
delete(templateId: string): Promise<void>;
|
|
1825
|
+
/** Render a subject and body with sample shipment data, without saving anything. */
|
|
1826
|
+
preview(request: EmailTemplatePreviewRequest): Promise<EmailTemplatePreview>;
|
|
1162
1827
|
}
|
|
1163
1828
|
|
|
1164
|
-
declare class
|
|
1829
|
+
declare class HsCodesResource {
|
|
1165
1830
|
private readonly http;
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
update(id: string, request: UpdateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1177
|
-
/** Delete a scheduled report. */
|
|
1178
|
-
delete(id: string): Promise<ApiResponse<unknown>>;
|
|
1831
|
+
constructor(http: HttpClient);
|
|
1832
|
+
/** Search for HS codes by product description. Requires Enterprise plan. */
|
|
1833
|
+
search(query: string, options?: {
|
|
1834
|
+
destinationCountry?: string;
|
|
1835
|
+
maxResults?: number;
|
|
1836
|
+
}): Promise<HsCodeResult[]>;
|
|
1837
|
+
/** Look up a specific HS code by its tariff number. Requires Enterprise plan. */
|
|
1838
|
+
lookup(code: string): Promise<HsCodeResult>;
|
|
1839
|
+
/** Estimate the total landed cost (duty + tax + shipping) for a shipment. Requires Enterprise plan. */
|
|
1840
|
+
estimateLandedCost(request: LandedCostRequest): Promise<LandedCostEstimate>;
|
|
1179
1841
|
}
|
|
1180
1842
|
|
|
1181
1843
|
/**
|
|
@@ -1217,20 +1879,10 @@ declare class ReportsResource {
|
|
|
1217
1879
|
* // Token is automatically stored and used for subsequent requests
|
|
1218
1880
|
* ```
|
|
1219
1881
|
*
|
|
1220
|
-
* @example
|
|
1882
|
+
* @example Carrier-specific reads
|
|
1221
1883
|
* ```typescript
|
|
1222
|
-
* // USPS
|
|
1223
|
-
* const
|
|
1224
|
-
* imageType: 'PDF',
|
|
1225
|
-
* mailClass: 'PRIORITY_MAIL',
|
|
1226
|
-
* weightInOunces: 16,
|
|
1227
|
-
* // ... full USPS payload
|
|
1228
|
-
* });
|
|
1229
|
-
*
|
|
1230
|
-
* // FedEx rate quote
|
|
1231
|
-
* const fedexRates = await client.carriers.fedex.getRates({
|
|
1232
|
-
* // ... full FedEx payload
|
|
1233
|
-
* });
|
|
1884
|
+
* // USPS tracking detail through the read-only carrier pass-through
|
|
1885
|
+
* const tracking = await client.carriers.usps.trackDetail({ trackingNumber: '9400...' });
|
|
1234
1886
|
* ```
|
|
1235
1887
|
*/
|
|
1236
1888
|
declare class FlexOps {
|
|
@@ -1244,18 +1896,17 @@ declare class FlexOps {
|
|
|
1244
1896
|
readonly wallet: WalletResource;
|
|
1245
1897
|
readonly insurance: InsuranceResource;
|
|
1246
1898
|
readonly returns: ReturnsResource;
|
|
1247
|
-
readonly apiKeys: ApiKeysResource;
|
|
1248
1899
|
readonly analytics: AnalyticsResource;
|
|
1249
1900
|
readonly orders: OrdersResource;
|
|
1250
1901
|
readonly inventory: InventoryResource;
|
|
1251
1902
|
readonly pickups: PickupsResource;
|
|
1252
1903
|
readonly scanForms: ScanFormsResource;
|
|
1253
1904
|
readonly rules: RulesResource;
|
|
1254
|
-
readonly
|
|
1255
|
-
readonly hsCodes: HsCodesResource;
|
|
1905
|
+
readonly carbonOffsets: CarbonOffsetsResource;
|
|
1256
1906
|
readonly recurringShipments: RecurringShipmentsResource;
|
|
1907
|
+
readonly reportSchedules: ReportSchedulesResource;
|
|
1257
1908
|
readonly emailTemplates: EmailTemplatesResource;
|
|
1258
|
-
readonly
|
|
1909
|
+
readonly hsCodes: HsCodesResource;
|
|
1259
1910
|
constructor(config?: FlexOpsConfig);
|
|
1260
1911
|
/** Get or set the active workspace ID. */
|
|
1261
1912
|
get workspaceId(): string | undefined;
|
|
@@ -1266,4 +1917,4 @@ declare class FlexOps {
|
|
|
1266
1917
|
setApiKey(key: string): void;
|
|
1267
1918
|
}
|
|
1268
1919
|
|
|
1269
|
-
export { type Address, type AddressValidationResult, AnalyticsResource, type
|
|
1920
|
+
export { type Address, type AddressValidationResult, AnalyticsResource, type ApiResponse, AuthResource, type BatchLabelJob, type BatchLabelRequest, type CanonicalLabelRequest, type CanonicalRateRequest, type CarbonOffset, type CarbonOffsetPurchaseRequest, type CarbonOffsetQuote, type CarbonOffsetQuoteRequest, type CarbonOffsetSettings, type CarbonOffsetSummary, CarbonOffsetsResource, type CarrierRecommendation, type CarrierRecommendationRequest, type CarrierRecommendationResponse, type CarrierSummary, CarriersResource, type CostSavingsSummary, type CreateLabelRequest, type CreateRecurringShipmentRequest, type CreateReportScheduleRequest, type CreateWebhookRequest, type CustomsItem, type DeliveryPredictionRequest, type DeliveryPredictionResponse, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatePreviewRequest, EmailTemplatesResource, type FileClaimRequest, FlexOps, FlexOpsAuthError, type FlexOpsConfig, FlexOpsError, FlexOpsRateLimitError, HazmatClassification, type HsCodeResult, HsCodesResource, type InsuranceClaim, type InsurancePolicy, type InsuranceQuote, type InsuranceQuoteRequest, InsuranceResource, InventoryResource, type Label, type LabelPurchaseApproval, type LabelPurchasePreview, type LandedCostEstimate, type LandedCostRequest, type LaneSavingsOpportunity, type LegacyRateRequest, type LoginRequest, type LoginResponse, type Order, type OrderItem, OrdersResource, type PaginatedResponse, type Parcel, type PendingInvite, type PickupConfirmation, type PickupRequest, PickupsResource, type PurchaseInsuranceRequest, type RateRequest, type ReceiveReturnRequest, RecurrenceInterval, type RecurringShipment, RecurringShipmentsResource, ReportFormat, ReportFrequency, type ReportSchedule, ReportSchedulesResource, type RetryConfig, type ReturnAuthorization, type ReturnDisposition, type ReturnItem, type ReturnLabelRequest, type ReturnRequest, ReturnsResource, type RuleAction, type RuleCondition, RulesResource, type ScanForm, type ScanFormRequest, ScanFormsResource, type ShipmentsTrend, type ShippingAddress, type ShippingPackage, type ShippingRate, ShippingResource, type ShippingRule, type ShippingRuleInput, type ShippingRuleTestRequest, type SuggestedAddress, TrackingEmailEvent, type TrackingEvent, type TrackingInfo, type UpdateRecurringShipmentRequest, type UpdateReportScheduleRequest, type UpdateWebhookRequest, type UpsertEmailTemplateRequest, type VerifySignatureOptions, type WalletBalance, WalletResource, WebhookEventType, type WebhookSubscription, WebhooksResource, type Workspace, type WorkspaceDetail, type WorkspaceMember, type WorkspaceMemberList, WorkspaceRole, WorkspacesResource };
|