@flexops/sdk 2.0.0 → 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 +186 -111
- package/dist/index.d.mts +1034 -413
- package/dist/index.d.ts +1034 -413
- package/dist/index.js +787 -396
- package/dist/index.mjs +778 -393
- package/package.json +1 -1
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;
|
|
116
|
+
}
|
|
117
|
+
interface PendingInvite {
|
|
118
|
+
inviteId: string;
|
|
119
|
+
email: string;
|
|
120
|
+
role: WorkspaceRole;
|
|
121
|
+
expiresAt: string;
|
|
122
|
+
invitedByName: string;
|
|
78
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,9 +229,17 @@ interface CreateLabelRequest {
|
|
|
148
229
|
returnLabel?: boolean;
|
|
149
230
|
labelFormat?: 'PDF' | 'PNG' | 'ZPL';
|
|
150
231
|
idempotencyKey?: string;
|
|
232
|
+
orderId?: number;
|
|
233
|
+
hazmatClassification?: HazmatClassification;
|
|
151
234
|
}
|
|
152
235
|
/** Normalized Gateway label request. Additional shipment options are preserved in the approval snapshot. */
|
|
153
236
|
interface CanonicalLabelRequest {
|
|
237
|
+
shipDate?: string;
|
|
238
|
+
declaredValue?: number;
|
|
239
|
+
customsDeclaration?: CustomsDeclaration;
|
|
240
|
+
rateIndicator?: string;
|
|
241
|
+
maximumPostageAmount?: number;
|
|
242
|
+
confirmationToken?: string;
|
|
154
243
|
origin: ShippingAddress;
|
|
155
244
|
destination: ShippingAddress;
|
|
156
245
|
package: ShippingPackage;
|
|
@@ -158,6 +247,11 @@ interface CanonicalLabelRequest {
|
|
|
158
247
|
serviceCode: string;
|
|
159
248
|
orderId?: number;
|
|
160
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;
|
|
161
255
|
[option: string]: unknown;
|
|
162
256
|
}
|
|
163
257
|
interface LabelPurchasePreview {
|
|
@@ -222,10 +316,24 @@ interface TrackingEvent {
|
|
|
222
316
|
description: string;
|
|
223
317
|
location?: string;
|
|
224
318
|
}
|
|
319
|
+
/** `POST /api/addresses/validate`. */
|
|
225
320
|
interface AddressValidationResult {
|
|
226
321
|
isValid: boolean;
|
|
227
|
-
|
|
228
|
-
|
|
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;
|
|
229
337
|
}
|
|
230
338
|
interface BatchLabelRequest {
|
|
231
339
|
items: CreateLabelRequest[];
|
|
@@ -253,75 +361,177 @@ interface OrderItem {
|
|
|
253
361
|
quantity: number;
|
|
254
362
|
unitPrice: number;
|
|
255
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. */
|
|
256
378
|
interface WebhookSubscription {
|
|
257
379
|
id: string;
|
|
258
380
|
url: string;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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;
|
|
262
387
|
createdAt: string;
|
|
388
|
+
updatedAt?: string | null;
|
|
389
|
+
/** The `whsec_...` signing secret. Returned only when the subscription is created. */
|
|
390
|
+
secret?: string;
|
|
263
391
|
}
|
|
264
392
|
interface CreateWebhookRequest {
|
|
265
393
|
url: string;
|
|
266
|
-
|
|
267
|
-
|
|
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. */
|
|
268
406
|
interface WalletBalance {
|
|
407
|
+
hasWallet: boolean;
|
|
408
|
+
balanceCents: number;
|
|
269
409
|
balance: number;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
410
|
+
}
|
|
411
|
+
interface InsuranceQuoteRequest {
|
|
412
|
+
declaredValue: number;
|
|
413
|
+
carrierCode: string;
|
|
414
|
+
trackingNumber?: string;
|
|
415
|
+
provider?: string;
|
|
274
416
|
}
|
|
275
417
|
interface InsuranceQuote {
|
|
276
|
-
|
|
418
|
+
declaredValue: number;
|
|
419
|
+
coverageAmount: number;
|
|
277
420
|
premium: number;
|
|
278
|
-
|
|
279
|
-
|
|
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;
|
|
280
432
|
}
|
|
281
433
|
interface InsurancePolicy {
|
|
282
434
|
policyId: string;
|
|
283
|
-
provider: string;
|
|
284
435
|
trackingNumber: string;
|
|
285
|
-
|
|
436
|
+
carrierCode: string;
|
|
437
|
+
declaredValue: number;
|
|
438
|
+
coverageAmount: number;
|
|
286
439
|
premium: number;
|
|
287
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;
|
|
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;
|
|
288
467
|
}
|
|
468
|
+
/** Body of `POST /api/workspaces/{workspaceId}/returns/rma`. */
|
|
289
469
|
interface ReturnRequest {
|
|
290
|
-
|
|
470
|
+
/** The order's numeric id. */
|
|
471
|
+
orderId: number;
|
|
472
|
+
orderNumber?: string;
|
|
291
473
|
reason: string;
|
|
292
474
|
items: ReturnItem[];
|
|
475
|
+
notes?: string;
|
|
476
|
+
customerEmail?: string;
|
|
477
|
+
reasonId?: number;
|
|
293
478
|
}
|
|
294
479
|
interface ReturnItem {
|
|
295
480
|
sku: string;
|
|
296
481
|
quantity: number;
|
|
297
482
|
reason?: string;
|
|
298
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
|
+
}
|
|
299
529
|
interface ReturnAuthorization {
|
|
300
530
|
rmaId: string;
|
|
301
531
|
status: string;
|
|
302
532
|
returnLabel?: Label;
|
|
303
533
|
createdAt: string;
|
|
304
534
|
}
|
|
305
|
-
interface ApiKeyInfo {
|
|
306
|
-
id: string;
|
|
307
|
-
name: string;
|
|
308
|
-
prefix: string;
|
|
309
|
-
scopes: string[];
|
|
310
|
-
lastUsedAt?: string;
|
|
311
|
-
expiresAt?: string;
|
|
312
|
-
createdAt: string;
|
|
313
|
-
}
|
|
314
|
-
interface CreateApiKeyRequest {
|
|
315
|
-
name: string;
|
|
316
|
-
scopes?: string[];
|
|
317
|
-
expiresInDays?: number;
|
|
318
|
-
}
|
|
319
|
-
interface CreateApiKeyResponse {
|
|
320
|
-
id: string;
|
|
321
|
-
key: string;
|
|
322
|
-
name: string;
|
|
323
|
-
prefix: string;
|
|
324
|
-
}
|
|
325
535
|
interface ShipmentsTrend {
|
|
326
536
|
date: string;
|
|
327
537
|
count: number;
|
|
@@ -336,8 +546,20 @@ interface CarrierSummary {
|
|
|
336
546
|
interface ShippingRule {
|
|
337
547
|
id: string;
|
|
338
548
|
name: string;
|
|
339
|
-
isActive: boolean;
|
|
340
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;
|
|
341
563
|
conditions: RuleCondition[];
|
|
342
564
|
actions: RuleAction[];
|
|
343
565
|
}
|
|
@@ -351,20 +573,53 @@ interface RuleAction {
|
|
|
351
573
|
type: string;
|
|
352
574
|
value: string;
|
|
353
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. */
|
|
354
590
|
interface PickupRequest {
|
|
355
|
-
|
|
591
|
+
carrierCode: string;
|
|
356
592
|
pickupDate: string;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
593
|
+
street: string;
|
|
594
|
+
city: string;
|
|
595
|
+
state: string;
|
|
596
|
+
postalCode: string;
|
|
597
|
+
country?: string;
|
|
360
598
|
packageCount: number;
|
|
361
|
-
|
|
599
|
+
totalWeightOz?: number;
|
|
600
|
+
specialInstructions?: string;
|
|
601
|
+
readyTime?: string;
|
|
602
|
+
closeTime?: string;
|
|
603
|
+
contactName?: string;
|
|
604
|
+
contactPhone?: string;
|
|
362
605
|
}
|
|
363
606
|
interface PickupConfirmation {
|
|
364
|
-
|
|
365
|
-
|
|
607
|
+
pickupId?: string | null;
|
|
608
|
+
carrierCode: string;
|
|
366
609
|
pickupDate: string;
|
|
367
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;
|
|
368
623
|
}
|
|
369
624
|
interface ScanFormRequest {
|
|
370
625
|
trackingNumbers: string[];
|
|
@@ -434,24 +689,174 @@ interface LaneSavingsOpportunity {
|
|
|
434
689
|
currentOnTimeRate: number;
|
|
435
690
|
recommendedOnTimeRate: number;
|
|
436
691
|
}
|
|
437
|
-
interface
|
|
438
|
-
|
|
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 {
|
|
439
706
|
offsetId: string;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
};
|
|
707
|
+
trackingNumber: string;
|
|
708
|
+
carbonKg: number;
|
|
709
|
+
costUsd: number;
|
|
710
|
+
status: string;
|
|
445
711
|
provider: string;
|
|
446
|
-
|
|
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;
|
|
447
752
|
}
|
|
448
|
-
interface
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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;
|
|
455
860
|
}
|
|
456
861
|
interface HsCodeResult {
|
|
457
862
|
hsCode: string;
|
|
@@ -466,6 +871,21 @@ interface LandedCostRequest {
|
|
|
466
871
|
shippingCost?: number;
|
|
467
872
|
items: CustomsItem[];
|
|
468
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
|
+
}
|
|
469
889
|
interface CustomsItem {
|
|
470
890
|
description: string;
|
|
471
891
|
quantity: number;
|
|
@@ -485,72 +905,6 @@ interface LandedCostEstimate {
|
|
|
485
905
|
isEstimate: boolean;
|
|
486
906
|
disclaimer: string | null;
|
|
487
907
|
}
|
|
488
|
-
interface RecurringShipment {
|
|
489
|
-
id: string;
|
|
490
|
-
name: string;
|
|
491
|
-
isActive: boolean;
|
|
492
|
-
scheduleExpression: string;
|
|
493
|
-
nextRunAt: string | null;
|
|
494
|
-
lastRunAt: string | null;
|
|
495
|
-
createdAt: string;
|
|
496
|
-
}
|
|
497
|
-
interface CreateRecurringShipmentRequest {
|
|
498
|
-
name: string;
|
|
499
|
-
scheduleExpression: string;
|
|
500
|
-
labelRequest: CreateLabelRequest;
|
|
501
|
-
}
|
|
502
|
-
interface UpdateRecurringShipmentRequest {
|
|
503
|
-
name?: string;
|
|
504
|
-
scheduleExpression?: string;
|
|
505
|
-
labelRequest?: Partial<CreateLabelRequest>;
|
|
506
|
-
}
|
|
507
|
-
interface EmailTemplate {
|
|
508
|
-
id: string;
|
|
509
|
-
name: string;
|
|
510
|
-
subject: string;
|
|
511
|
-
triggerEvent: string;
|
|
512
|
-
isActive: boolean;
|
|
513
|
-
createdAt: string;
|
|
514
|
-
updatedAt: string;
|
|
515
|
-
}
|
|
516
|
-
interface CreateEmailTemplateRequest {
|
|
517
|
-
name: string;
|
|
518
|
-
subject: string;
|
|
519
|
-
bodyHtml: string;
|
|
520
|
-
triggerEvent: string;
|
|
521
|
-
isActive?: boolean;
|
|
522
|
-
}
|
|
523
|
-
interface UpdateEmailTemplateRequest {
|
|
524
|
-
name?: string;
|
|
525
|
-
subject?: string;
|
|
526
|
-
bodyHtml?: string;
|
|
527
|
-
triggerEvent?: string;
|
|
528
|
-
isActive?: boolean;
|
|
529
|
-
}
|
|
530
|
-
interface ReportSchedule {
|
|
531
|
-
id: string;
|
|
532
|
-
name: string;
|
|
533
|
-
reportType: string;
|
|
534
|
-
recipientEmail: string;
|
|
535
|
-
scheduleExpression: string;
|
|
536
|
-
isActive: boolean;
|
|
537
|
-
lastSentAt: string | null;
|
|
538
|
-
createdAt: string;
|
|
539
|
-
}
|
|
540
|
-
interface CreateReportScheduleRequest {
|
|
541
|
-
name: string;
|
|
542
|
-
reportType: string;
|
|
543
|
-
recipientEmail: string;
|
|
544
|
-
scheduleExpression: string;
|
|
545
|
-
isActive?: boolean;
|
|
546
|
-
}
|
|
547
|
-
interface UpdateReportScheduleRequest {
|
|
548
|
-
name?: string;
|
|
549
|
-
reportType?: string;
|
|
550
|
-
recipientEmail?: string;
|
|
551
|
-
scheduleExpression?: string;
|
|
552
|
-
isActive?: boolean;
|
|
553
|
-
}
|
|
554
908
|
declare class FlexOpsError extends Error {
|
|
555
909
|
readonly status: number;
|
|
556
910
|
readonly code?: string | undefined;
|
|
@@ -575,6 +929,8 @@ declare class HttpClient {
|
|
|
575
929
|
private apiKey?;
|
|
576
930
|
constructor(config: FlexOpsConfig);
|
|
577
931
|
setAccessToken(token: string): void;
|
|
932
|
+
/** The JWT access token in use, if any. */
|
|
933
|
+
getAccessToken(): string | undefined;
|
|
578
934
|
setApiKey(key: string): void;
|
|
579
935
|
request<T>(method: string, path: string, options?: {
|
|
580
936
|
body?: unknown;
|
|
@@ -589,32 +945,34 @@ declare class HttpClient {
|
|
|
589
945
|
delete<T>(path: string): Promise<T>;
|
|
590
946
|
private buildUrl;
|
|
591
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;
|
|
592
954
|
private calculateBackoff;
|
|
593
955
|
}
|
|
594
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
|
+
*/
|
|
595
961
|
declare class AuthResource {
|
|
596
962
|
private readonly http;
|
|
597
963
|
constructor(http: HttpClient);
|
|
598
|
-
/**
|
|
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
|
+
*/
|
|
599
968
|
login(request: LoginRequest): Promise<ApiResponse<LoginResponse>>;
|
|
600
|
-
/**
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
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>>;
|
|
604
974
|
/** Log out and invalidate the current session. */
|
|
605
975
|
logout(): Promise<ApiResponse<unknown>>;
|
|
606
|
-
/** Get the current user's profile. */
|
|
607
|
-
getProfile(): Promise<ApiResponse<unknown>>;
|
|
608
|
-
/** Update the current user's profile. */
|
|
609
|
-
updateProfile(data: Record<string, unknown>): Promise<ApiResponse<unknown>>;
|
|
610
|
-
/** Change the current user's password. */
|
|
611
|
-
changePassword(currentPassword: string, newPassword: string): Promise<ApiResponse<unknown>>;
|
|
612
|
-
/** Request a password reset email. */
|
|
613
|
-
forgotPassword(email: string): Promise<ApiResponse<unknown>>;
|
|
614
|
-
/** Reset password using a reset token. */
|
|
615
|
-
resetPassword(token: string, newPassword: string): Promise<ApiResponse<unknown>>;
|
|
616
|
-
/** Verify email with the verification token. */
|
|
617
|
-
verifyEmail(token: string): Promise<ApiResponse<unknown>>;
|
|
618
976
|
}
|
|
619
977
|
|
|
620
978
|
declare class WorkspacesResource {
|
|
@@ -625,19 +983,15 @@ declare class WorkspacesResource {
|
|
|
625
983
|
/** List all workspaces the current user belongs to. */
|
|
626
984
|
list(): Promise<ApiResponse<Workspace[]>>;
|
|
627
985
|
/** Get details for a specific workspace. */
|
|
628
|
-
get(workspaceId?: string): Promise<ApiResponse<
|
|
629
|
-
/**
|
|
630
|
-
|
|
631
|
-
/** Update workspace settings. */
|
|
632
|
-
update(data: Partial<Workspace>): Promise<ApiResponse<Workspace>>;
|
|
633
|
-
/** List members of the current workspace. */
|
|
634
|
-
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>>;
|
|
635
989
|
/** Invite a user to the workspace. */
|
|
636
|
-
inviteMember(email: string, role?:
|
|
990
|
+
inviteMember(email: string, role?: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
637
991
|
/** Remove a member from the workspace. */
|
|
638
992
|
removeMember(userId: string): Promise<ApiResponse<unknown>>;
|
|
639
|
-
/**
|
|
640
|
-
updateMemberRole(userId: string, role:
|
|
993
|
+
/** Change a member's role. */
|
|
994
|
+
updateMemberRole(userId: string, role: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
641
995
|
}
|
|
642
996
|
|
|
643
997
|
declare class ShippingResource {
|
|
@@ -666,7 +1020,7 @@ declare class ShippingResource {
|
|
|
666
1020
|
/** Track a shipment by tracking number. */
|
|
667
1021
|
track(trackingNumber: string): Promise<TrackingInfo>;
|
|
668
1022
|
/** Validate and correct a shipping address. */
|
|
669
|
-
validateAddress(address: Address): Promise<AddressValidationResult>;
|
|
1023
|
+
validateAddress(address: Address | ShippingAddress): Promise<AddressValidationResult>;
|
|
670
1024
|
/** Create labels in batch. */
|
|
671
1025
|
createBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
672
1026
|
/** Preview a batch without purchasing (dry-run). */
|
|
@@ -688,10 +1042,12 @@ declare class ShippingResource {
|
|
|
688
1042
|
/**
|
|
689
1043
|
* Direct carrier operations via the VisionSuite Core Services API proxy.
|
|
690
1044
|
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
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.
|
|
695
1051
|
*/
|
|
696
1052
|
declare class CarriersResource {
|
|
697
1053
|
private readonly http;
|
|
@@ -704,35 +1060,91 @@ declare class CarriersResource {
|
|
|
704
1060
|
cityStateLookup: (zipCode: string) => Promise<unknown>;
|
|
705
1061
|
/** ZIP code lookup by address. */
|
|
706
1062
|
zipCodeLookup: (params: Record<string, string>) => Promise<unknown>;
|
|
707
|
-
/**
|
|
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
|
+
*/
|
|
708
1070
|
getDomesticRates: (body: unknown) => Promise<unknown>;
|
|
709
|
-
/**
|
|
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
|
+
*/
|
|
710
1078
|
getDomesticProducts: (body: unknown) => Promise<unknown>;
|
|
711
|
-
/**
|
|
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
|
+
*/
|
|
712
1086
|
getDomesticPrices: (body: unknown) => Promise<unknown>;
|
|
713
|
-
/**
|
|
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
|
+
*/
|
|
714
1094
|
getInternationalRates: (body: unknown) => Promise<unknown>;
|
|
715
|
-
/**
|
|
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
|
+
*/
|
|
716
1102
|
getInternationalPrices: (body: unknown) => Promise<unknown>;
|
|
717
1103
|
/** Generate a domestic shipping label. */
|
|
718
1104
|
createDomesticLabel: (body: unknown) => Promise<Label>;
|
|
719
|
-
/**
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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
|
+
*/
|
|
724
1112
|
cancelDomesticLabel: () => Promise<unknown>;
|
|
725
|
-
/**
|
|
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
|
+
*/
|
|
726
1120
|
cancelInternationalLabel: () => Promise<unknown>;
|
|
727
1121
|
/** Get tracking summary. */
|
|
728
1122
|
trackSummary: (params: Record<string, string>) => Promise<unknown>;
|
|
729
1123
|
/** Get detailed tracking info. */
|
|
730
1124
|
trackDetail: (params: Record<string, string>) => Promise<unknown>;
|
|
731
|
-
/**
|
|
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
|
+
*/
|
|
732
1132
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
733
|
-
/**
|
|
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
|
+
*/
|
|
734
1140
|
cancelPickup: () => Promise<unknown>;
|
|
735
|
-
/**
|
|
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
|
+
*/
|
|
736
1148
|
createScanForm: (body: unknown) => Promise<unknown>;
|
|
737
1149
|
/** Get delivery standards estimates. */
|
|
738
1150
|
deliveryStandards: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -742,73 +1154,241 @@ declare class CarriersResource {
|
|
|
742
1154
|
findPostOffices: (params: Record<string, string>) => Promise<unknown>;
|
|
743
1155
|
};
|
|
744
1156
|
readonly ups: {
|
|
745
|
-
/**
|
|
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
|
+
*/
|
|
746
1164
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
747
|
-
/**
|
|
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
|
+
*/
|
|
748
1172
|
getRates: (body: unknown) => Promise<unknown>;
|
|
749
|
-
/** Generate a UPS shipping label. */
|
|
750
|
-
createLabel: (body: unknown) => Promise<unknown>;
|
|
751
1173
|
/** Track a UPS shipment. */
|
|
752
1174
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
753
|
-
/**
|
|
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
|
+
*/
|
|
754
1182
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
755
|
-
/**
|
|
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
|
+
*/
|
|
756
1190
|
cancelPickup: () => Promise<unknown>;
|
|
757
|
-
/**
|
|
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
|
+
*/
|
|
758
1198
|
getTransitTimes: (body: unknown) => Promise<unknown>;
|
|
759
|
-
/**
|
|
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
|
+
*/
|
|
760
1206
|
getLandedCost: (body: unknown) => Promise<unknown>;
|
|
761
|
-
/**
|
|
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
|
+
*/
|
|
762
1214
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
763
|
-
/**
|
|
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
|
+
*/
|
|
764
1222
|
uploadDocument: (body: unknown) => Promise<unknown>;
|
|
765
|
-
/**
|
|
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
|
+
*/
|
|
766
1230
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
767
|
-
/**
|
|
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
|
+
*/
|
|
768
1238
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
769
1239
|
};
|
|
770
1240
|
readonly fedex: {
|
|
771
|
-
/**
|
|
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
|
+
*/
|
|
772
1248
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
773
|
-
/**
|
|
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
|
+
*/
|
|
774
1256
|
validatePostalCode: (body: unknown) => Promise<unknown>;
|
|
775
|
-
/**
|
|
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
|
+
*/
|
|
776
1264
|
getRates: (body: unknown) => Promise<unknown>;
|
|
777
|
-
/**
|
|
778
|
-
|
|
779
|
-
|
|
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
|
+
*/
|
|
780
1272
|
cancelShipment: (body: unknown) => Promise<unknown>;
|
|
781
|
-
/**
|
|
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
|
+
*/
|
|
782
1280
|
validateShipment: (body: unknown) => Promise<unknown>;
|
|
783
|
-
/**
|
|
784
|
-
|
|
785
|
-
|
|
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
|
+
*/
|
|
786
1288
|
track: (body: unknown) => Promise<unknown>;
|
|
787
|
-
/**
|
|
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
|
+
*/
|
|
788
1296
|
trackMultiPiece: (body: unknown) => Promise<unknown>;
|
|
789
|
-
/**
|
|
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
|
+
*/
|
|
790
1304
|
registerTrackingNotification: (body: unknown) => Promise<unknown>;
|
|
791
|
-
/**
|
|
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
|
+
*/
|
|
792
1312
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
793
|
-
/**
|
|
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
|
+
*/
|
|
794
1320
|
cancelPickup: (body: unknown) => Promise<unknown>;
|
|
795
|
-
/**
|
|
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
|
+
*/
|
|
796
1328
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
797
|
-
/**
|
|
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
|
+
*/
|
|
798
1336
|
getServiceStandards: (body: unknown) => Promise<unknown>;
|
|
799
|
-
/**
|
|
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
|
+
*/
|
|
800
1344
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
801
|
-
/**
|
|
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
|
+
*/
|
|
802
1352
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
803
|
-
/**
|
|
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
|
+
*/
|
|
804
1360
|
groundClose: (body: unknown) => Promise<unknown>;
|
|
805
|
-
/**
|
|
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
|
+
*/
|
|
806
1368
|
uploadTradeDocuments: (body: unknown) => Promise<unknown>;
|
|
807
|
-
/**
|
|
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
|
+
*/
|
|
808
1376
|
createOpenShipment: (body: unknown) => Promise<unknown>;
|
|
809
|
-
/**
|
|
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
|
+
*/
|
|
810
1384
|
addPackagesToOpenShipment: (body: unknown) => Promise<unknown>;
|
|
811
|
-
/**
|
|
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
|
+
*/
|
|
812
1392
|
confirmOpenShipment: (body: unknown) => Promise<unknown>;
|
|
813
1393
|
};
|
|
814
1394
|
readonly dhl: {
|
|
@@ -816,27 +1396,59 @@ declare class CarriersResource {
|
|
|
816
1396
|
validateAddress: (params: Record<string, string>) => Promise<unknown>;
|
|
817
1397
|
/** Get DHL shipping rates. */
|
|
818
1398
|
getRates: (params: Record<string, string>) => Promise<unknown>;
|
|
819
|
-
/**
|
|
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
|
+
*/
|
|
820
1406
|
getMultiPieceRates: (body: unknown) => Promise<unknown>;
|
|
821
1407
|
/** Get DHL products/services. */
|
|
822
1408
|
getProducts: (params: Record<string, string>) => Promise<unknown>;
|
|
823
|
-
/** Create a DHL shipment (label). */
|
|
824
|
-
createShipment: (body: unknown) => Promise<unknown>;
|
|
825
1409
|
/** Track a DHL shipment. */
|
|
826
1410
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
827
1411
|
/** Track multiple DHL shipments. */
|
|
828
1412
|
trackMultiple: (params: Record<string, string>) => Promise<unknown>;
|
|
829
|
-
/**
|
|
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
|
+
*/
|
|
830
1420
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
831
|
-
/**
|
|
832
|
-
|
|
833
|
-
|
|
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
|
+
*/
|
|
834
1428
|
cancelPickup: () => Promise<unknown>;
|
|
835
|
-
/**
|
|
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
|
+
*/
|
|
836
1436
|
calculateLandedCost: (body: unknown) => Promise<unknown>;
|
|
837
|
-
/**
|
|
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
|
+
*/
|
|
838
1444
|
screenShipment: (body: unknown) => Promise<unknown>;
|
|
839
|
-
/**
|
|
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
|
+
*/
|
|
840
1452
|
uploadInvoice: (body: unknown) => Promise<unknown>;
|
|
841
1453
|
/** Get electronic proof of delivery. */
|
|
842
1454
|
getProofOfDelivery: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -854,12 +1466,17 @@ declare class WebhooksResource {
|
|
|
854
1466
|
private wsPath;
|
|
855
1467
|
/** List all webhook subscriptions for the workspace. */
|
|
856
1468
|
list(): Promise<ApiResponse<WebhookSubscription[]>>;
|
|
857
|
-
/**
|
|
858
|
-
|
|
859
|
-
|
|
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
|
+
*/
|
|
860
1474
|
create(request: CreateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
861
|
-
/**
|
|
862
|
-
|
|
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>>;
|
|
863
1480
|
/** Delete a webhook subscription. */
|
|
864
1481
|
delete(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
865
1482
|
/** Rotate the signing secret for a webhook. */
|
|
@@ -868,35 +1485,45 @@ declare class WebhooksResource {
|
|
|
868
1485
|
}>>;
|
|
869
1486
|
/** List delivery logs for a webhook. */
|
|
870
1487
|
listDeliveryLogs(webhookId: string): Promise<ApiResponse<unknown[]>>;
|
|
1488
|
+
/** Send a test event to a webhook's endpoint. */
|
|
1489
|
+
test(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
871
1490
|
/**
|
|
872
|
-
* Verify
|
|
873
|
-
*
|
|
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.
|
|
874
1506
|
*/
|
|
875
|
-
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;
|
|
876
1515
|
}
|
|
877
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
|
+
*/
|
|
878
1521
|
declare class WalletResource {
|
|
879
1522
|
private readonly http;
|
|
880
1523
|
private readonly getWorkspaceId;
|
|
881
1524
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
getBalance(): Promise<ApiResponse<WalletBalance>>;
|
|
885
|
-
/** Add funds to the wallet. */
|
|
886
|
-
addFunds(amount: number): Promise<ApiResponse<unknown>>;
|
|
887
|
-
/** List wallet transactions. */
|
|
888
|
-
listTransactions(query?: {
|
|
889
|
-
page?: number;
|
|
890
|
-
pageSize?: number;
|
|
891
|
-
startDate?: string;
|
|
892
|
-
endDate?: string;
|
|
893
|
-
}): Promise<ApiResponse<unknown>>;
|
|
894
|
-
/** Configure auto-reload settings. */
|
|
895
|
-
configureAutoReload(config: {
|
|
896
|
-
enabled: boolean;
|
|
897
|
-
threshold?: number;
|
|
898
|
-
amount?: number;
|
|
899
|
-
}): Promise<ApiResponse<unknown>>;
|
|
1525
|
+
/** Get the configured workspace's wallet balance. */
|
|
1526
|
+
getBalance(): Promise<WalletBalance>;
|
|
900
1527
|
}
|
|
901
1528
|
|
|
902
1529
|
declare class InsuranceResource {
|
|
@@ -907,25 +1534,20 @@ declare class InsuranceResource {
|
|
|
907
1534
|
/** Get available insurance providers for this workspace. */
|
|
908
1535
|
getProviders(): Promise<ApiResponse<string[]>>;
|
|
909
1536
|
/** Get an insurance quote. */
|
|
910
|
-
getQuote(request:
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
|
|
924
|
-
/** File an insurance claim. */
|
|
925
|
-
fileClaim(policyId: string, claim: {
|
|
926
|
-
description: string;
|
|
927
|
-
claimAmount: number;
|
|
928
|
-
}): 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>>;
|
|
929
1551
|
}
|
|
930
1552
|
|
|
931
1553
|
declare class ReturnsResource {
|
|
@@ -933,47 +1555,28 @@ declare class ReturnsResource {
|
|
|
933
1555
|
private readonly getWorkspaceId;
|
|
934
1556
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
935
1557
|
private wsPath;
|
|
936
|
-
/** List
|
|
1558
|
+
/** List return authorizations, optionally created between `startDate` and `endDate` (ISO 8601). */
|
|
937
1559
|
list(query?: {
|
|
1560
|
+
startDate?: string;
|
|
1561
|
+
endDate?: string;
|
|
938
1562
|
page?: number;
|
|
939
1563
|
pageSize?: number;
|
|
940
|
-
status?: string;
|
|
941
1564
|
}): Promise<ApiResponse<ReturnAuthorization[]>>;
|
|
942
1565
|
/** Get a return authorization by ID. */
|
|
943
1566
|
get(returnId: string): Promise<ApiResponse<ReturnAuthorization>>;
|
|
944
|
-
/** Create a return authorization (RMA). */
|
|
1567
|
+
/** Create a return authorization (RMA) for an order. */
|
|
945
1568
|
create(request: ReturnRequest): Promise<ApiResponse<ReturnAuthorization>>;
|
|
946
|
-
/**
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
quantity: number;
|
|
958
|
-
condition: string;
|
|
959
|
-
}[]): Promise<ApiResponse<unknown>>;
|
|
960
|
-
/** Process refund for a return. */
|
|
961
|
-
processRefund(returnId: string): Promise<ApiResponse<unknown>>;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
declare class ApiKeysResource {
|
|
965
|
-
private readonly http;
|
|
966
|
-
private readonly getWorkspaceId;
|
|
967
|
-
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
968
|
-
private wsPath;
|
|
969
|
-
/** List all API keys for the workspace. */
|
|
970
|
-
list(): Promise<ApiResponse<ApiKeyInfo[]>>;
|
|
971
|
-
/** Create a new API key. The full key is only returned once. */
|
|
972
|
-
create(request: CreateApiKeyRequest): Promise<ApiResponse<CreateApiKeyResponse>>;
|
|
973
|
-
/** Revoke an API key. */
|
|
974
|
-
revoke(keyId: string): Promise<ApiResponse<unknown>>;
|
|
975
|
-
/** Rotate an API key (revoke + create new). */
|
|
976
|
-
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>>;
|
|
977
1580
|
}
|
|
978
1581
|
|
|
979
1582
|
type DateRange = {
|
|
@@ -1025,8 +1628,6 @@ declare class OrdersResource {
|
|
|
1025
1628
|
private readonly http;
|
|
1026
1629
|
constructor(http: HttpClient);
|
|
1027
1630
|
private path;
|
|
1028
|
-
/** Create a new order. */
|
|
1029
|
-
create(order: unknown): Promise<ApiResponse<unknown>>;
|
|
1030
1631
|
/** Get new orders awaiting processing. */
|
|
1031
1632
|
getNewOrders(params?: Record<string, string>): Promise<ApiResponse<Order[]>>;
|
|
1032
1633
|
/** Get all orders filtered by status. */
|
|
@@ -1037,8 +1638,6 @@ declare class OrdersResource {
|
|
|
1037
1638
|
getExtendedDetails(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1038
1639
|
/** Get order status by order number. */
|
|
1039
1640
|
getStatus(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1040
|
-
/** Cancel an order. */
|
|
1041
|
-
cancel(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1042
1641
|
/** Get all items for an order. */
|
|
1043
1642
|
getItems(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1044
1643
|
/** Get available ship methods. */
|
|
@@ -1054,16 +1653,12 @@ declare class OrdersResource {
|
|
|
1054
1653
|
declare class InventoryResource {
|
|
1055
1654
|
private readonly http;
|
|
1056
1655
|
constructor(http: HttpClient);
|
|
1057
|
-
/** Post a new ASN (Advance Shipment Notice) receipt. */
|
|
1058
|
-
postAsnReceipt(receipt: unknown): Promise<ApiResponse<unknown>>;
|
|
1059
1656
|
/** Get a warehouse inventory snapshot. */
|
|
1060
1657
|
getWarehouseSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1061
1658
|
/** Get a complete inventory snapshot across all warehouses. */
|
|
1062
1659
|
getCompleteSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1063
1660
|
/** Get the list of all part numbers. */
|
|
1064
1661
|
getPartNumbers(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1065
|
-
/** Update customer inventory (V2). */
|
|
1066
|
-
updateInventory(data: unknown): Promise<ApiResponse<unknown>>;
|
|
1067
1662
|
}
|
|
1068
1663
|
|
|
1069
1664
|
declare class PickupsResource {
|
|
@@ -1075,8 +1670,8 @@ declare class PickupsResource {
|
|
|
1075
1670
|
schedule(request: PickupRequest): Promise<ApiResponse<PickupConfirmation>>;
|
|
1076
1671
|
/** List scheduled pickups. */
|
|
1077
1672
|
list(): Promise<ApiResponse<PickupConfirmation[]>>;
|
|
1078
|
-
/** Get pickup details. */
|
|
1079
|
-
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>>;
|
|
1080
1675
|
/** Cancel a scheduled pickup. */
|
|
1081
1676
|
cancel(pickupId: string): Promise<ApiResponse<unknown>>;
|
|
1082
1677
|
}
|
|
@@ -1104,108 +1699,145 @@ declare class RulesResource {
|
|
|
1104
1699
|
/** Get a rule by ID. */
|
|
1105
1700
|
get(ruleId: string): Promise<ApiResponse<ShippingRule>>;
|
|
1106
1701
|
/** Create a shipping rule. */
|
|
1107
|
-
create(rule:
|
|
1108
|
-
/**
|
|
1109
|
-
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>>;
|
|
1110
1705
|
/** Delete a shipping rule. */
|
|
1111
1706
|
delete(ruleId: string): Promise<ApiResponse<unknown>>;
|
|
1112
|
-
/** Reorder rules (
|
|
1113
|
-
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>>;
|
|
1114
1711
|
}
|
|
1115
1712
|
|
|
1116
|
-
|
|
1713
|
+
/** Carbon offsets for shipments. Requires the Pro plan or above. */
|
|
1714
|
+
declare class CarbonOffsetsResource {
|
|
1117
1715
|
private readonly http;
|
|
1118
1716
|
private readonly getWorkspaceId;
|
|
1119
1717
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1120
1718
|
private wsPath;
|
|
1121
|
-
/**
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
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>>;
|
|
1127
1743
|
}
|
|
1128
1744
|
|
|
1129
|
-
|
|
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 {
|
|
1130
1754
|
private readonly http;
|
|
1131
1755
|
private readonly getWorkspaceId;
|
|
1132
1756
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1133
1757
|
private wsPath;
|
|
1134
|
-
/**
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
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>;
|
|
1143
1777
|
}
|
|
1144
1778
|
|
|
1145
|
-
|
|
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 {
|
|
1146
1786
|
private readonly http;
|
|
1147
1787
|
private readonly getWorkspaceId;
|
|
1148
1788
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1149
1789
|
private wsPath;
|
|
1150
|
-
/** List
|
|
1151
|
-
list(
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
/**
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
|
|
1162
|
-
/** Delete a recurring shipment schedule. */
|
|
1163
|
-
delete(id: string): Promise<ApiResponse<unknown>>;
|
|
1164
|
-
/** Pause a recurring shipment (stops automatic execution without deleting). */
|
|
1165
|
-
pause(id: string): Promise<ApiResponse<RecurringShipment>>;
|
|
1166
|
-
/** Resume a paused recurring shipment. */
|
|
1167
|
-
resume(id: string): Promise<ApiResponse<RecurringShipment>>;
|
|
1168
|
-
/** Trigger an immediate execution outside the normal schedule. */
|
|
1169
|
-
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>>;
|
|
1170
1802
|
}
|
|
1171
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
|
+
*/
|
|
1172
1812
|
declare class EmailTemplatesResource {
|
|
1173
1813
|
private readonly http;
|
|
1174
1814
|
private readonly getWorkspaceId;
|
|
1175
1815
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1176
1816
|
private wsPath;
|
|
1177
|
-
/** List
|
|
1178
|
-
list(): Promise<
|
|
1179
|
-
/** Get
|
|
1180
|
-
get(
|
|
1181
|
-
/** Create
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
|
|
1185
|
-
/**
|
|
1186
|
-
|
|
1187
|
-
/** Preview a rendered email template with optional sample data. */
|
|
1188
|
-
preview(id: string, context?: Record<string, unknown>): Promise<ApiResponse<{
|
|
1189
|
-
html: string;
|
|
1190
|
-
subject: string;
|
|
1191
|
-
}>>;
|
|
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>;
|
|
1192
1827
|
}
|
|
1193
1828
|
|
|
1194
|
-
declare class
|
|
1829
|
+
declare class HsCodesResource {
|
|
1195
1830
|
private readonly http;
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
update(id: string, request: UpdateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1207
|
-
/** Delete a scheduled report. */
|
|
1208
|
-
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>;
|
|
1209
1841
|
}
|
|
1210
1842
|
|
|
1211
1843
|
/**
|
|
@@ -1247,20 +1879,10 @@ declare class ReportsResource {
|
|
|
1247
1879
|
* // Token is automatically stored and used for subsequent requests
|
|
1248
1880
|
* ```
|
|
1249
1881
|
*
|
|
1250
|
-
* @example
|
|
1882
|
+
* @example Carrier-specific reads
|
|
1251
1883
|
* ```typescript
|
|
1252
|
-
* // USPS
|
|
1253
|
-
* const
|
|
1254
|
-
* imageType: 'PDF',
|
|
1255
|
-
* mailClass: 'PRIORITY_MAIL',
|
|
1256
|
-
* weightInOunces: 16,
|
|
1257
|
-
* // ... full USPS payload
|
|
1258
|
-
* });
|
|
1259
|
-
*
|
|
1260
|
-
* // FedEx rate quote
|
|
1261
|
-
* const fedexRates = await client.carriers.fedex.getRates({
|
|
1262
|
-
* // ... full FedEx payload
|
|
1263
|
-
* });
|
|
1884
|
+
* // USPS tracking detail through the read-only carrier pass-through
|
|
1885
|
+
* const tracking = await client.carriers.usps.trackDetail({ trackingNumber: '9400...' });
|
|
1264
1886
|
* ```
|
|
1265
1887
|
*/
|
|
1266
1888
|
declare class FlexOps {
|
|
@@ -1274,18 +1896,17 @@ declare class FlexOps {
|
|
|
1274
1896
|
readonly wallet: WalletResource;
|
|
1275
1897
|
readonly insurance: InsuranceResource;
|
|
1276
1898
|
readonly returns: ReturnsResource;
|
|
1277
|
-
readonly apiKeys: ApiKeysResource;
|
|
1278
1899
|
readonly analytics: AnalyticsResource;
|
|
1279
1900
|
readonly orders: OrdersResource;
|
|
1280
1901
|
readonly inventory: InventoryResource;
|
|
1281
1902
|
readonly pickups: PickupsResource;
|
|
1282
1903
|
readonly scanForms: ScanFormsResource;
|
|
1283
1904
|
readonly rules: RulesResource;
|
|
1284
|
-
readonly
|
|
1285
|
-
readonly hsCodes: HsCodesResource;
|
|
1905
|
+
readonly carbonOffsets: CarbonOffsetsResource;
|
|
1286
1906
|
readonly recurringShipments: RecurringShipmentsResource;
|
|
1907
|
+
readonly reportSchedules: ReportSchedulesResource;
|
|
1287
1908
|
readonly emailTemplates: EmailTemplatesResource;
|
|
1288
|
-
readonly
|
|
1909
|
+
readonly hsCodes: HsCodesResource;
|
|
1289
1910
|
constructor(config?: FlexOpsConfig);
|
|
1290
1911
|
/** Get or set the active workspace ID. */
|
|
1291
1912
|
get workspaceId(): string | undefined;
|
|
@@ -1296,4 +1917,4 @@ declare class FlexOps {
|
|
|
1296
1917
|
setApiKey(key: string): void;
|
|
1297
1918
|
}
|
|
1298
1919
|
|
|
1299
|
-
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 };
|