@flexops/sdk 2.0.0 → 3.1.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 +210 -119
- package/dist/index.d.mts +1123 -420
- package/dist/index.d.ts +1123 -420
- package/dist/index.js +827 -405
- package/dist/index.mjs +818 -402
- package/package.json +2 -2
package/dist/index.d.mts
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,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,22 +316,99 @@ 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;
|
|
337
|
+
}
|
|
338
|
+
/** One order in a batch: the Gateway `BatchLabelItemRequest`. Addresses come from the order. */
|
|
339
|
+
interface BatchLabelItem {
|
|
340
|
+
/** The order to ship. Required and positive. */
|
|
341
|
+
orderId: number;
|
|
342
|
+
orderNumber?: string;
|
|
343
|
+
/** Package weight in ounces. The order does not store it. */
|
|
344
|
+
packageWeightInOunces: number;
|
|
345
|
+
packageLengthInInches: number;
|
|
346
|
+
packageWidthInInches: number;
|
|
347
|
+
packageHeightInInches: number;
|
|
348
|
+
/** Leave out the carrier and service to let your shipping rules choose. */
|
|
349
|
+
carrierCode?: string;
|
|
350
|
+
serviceCode?: string;
|
|
351
|
+
deliveryConfirmationRequired?: boolean;
|
|
352
|
+
signatureConfirmationRequired?: boolean;
|
|
353
|
+
insuranceCoverageRequested?: boolean;
|
|
354
|
+
/** Coverage in USD. Needs `insuranceCoverageRequested: true`; left out, the order value is insured. */
|
|
355
|
+
insuredValue?: number;
|
|
356
|
+
labelFormat?: 'PDF' | 'PNG' | 'ZPL';
|
|
357
|
+
shipDate?: string;
|
|
358
|
+
/**
|
|
359
|
+
* What the parcel holds. Batch labels accept only `HazmatClassification.None`; buy HAZMAT
|
|
360
|
+
* labels one at a time with `createLabel`. The SDK never fills it in.
|
|
361
|
+
*/
|
|
362
|
+
hazmatClassification?: HazmatClassification;
|
|
363
|
+
}
|
|
364
|
+
/** The Gateway `CreateBatchLabelRequest` for `shipping.createBatch` and `shipping.previewBatch`. */
|
|
365
|
+
interface CreateBatchLabelRequest {
|
|
366
|
+
/** 1 to 2000 orders. */
|
|
367
|
+
items: BatchLabelItem[];
|
|
368
|
+
/** Called when the job finishes. */
|
|
369
|
+
callbackUrl?: string;
|
|
229
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* @deprecated The Gateway refuses this shape: batch items are orders, not labels. Use
|
|
373
|
+
* CreateBatchLabelRequest.
|
|
374
|
+
*/
|
|
230
375
|
interface BatchLabelRequest {
|
|
231
376
|
items: CreateLabelRequest[];
|
|
232
377
|
idempotencyKey?: string;
|
|
233
378
|
}
|
|
234
379
|
interface BatchLabelJob {
|
|
235
380
|
jobId: string;
|
|
236
|
-
status: '
|
|
381
|
+
status: 'Pending' | 'Processing' | 'Completed' | 'CompletedWithErrors' | 'Failed';
|
|
237
382
|
totalItems: number;
|
|
238
383
|
completedItems: number;
|
|
239
384
|
failedItems: number;
|
|
385
|
+
isDryRun?: boolean;
|
|
386
|
+
/** Total estimated cost; set on a preview. */
|
|
387
|
+
totalEstimatedCost?: number | null;
|
|
388
|
+
/** True when the job ran with a test key: no real labels and no wallet charge. */
|
|
389
|
+
isSandbox?: boolean;
|
|
240
390
|
createdAt: string;
|
|
391
|
+
completedAt?: string | null;
|
|
392
|
+
statusUrl?: string | null;
|
|
393
|
+
/** One row per order on a preview. */
|
|
394
|
+
previewItems?: BatchLabelItemResult[];
|
|
395
|
+
}
|
|
396
|
+
/** One order's outcome in a batch job. */
|
|
397
|
+
interface BatchLabelItemResult {
|
|
398
|
+
itemId: string;
|
|
399
|
+
orderId: number;
|
|
400
|
+
orderNumber?: string | null;
|
|
401
|
+
carrierCode?: string | null;
|
|
402
|
+
serviceCode?: string | null;
|
|
403
|
+
status: 'Pending' | 'Completed' | 'Failed';
|
|
404
|
+
trackingNumber?: string | null;
|
|
405
|
+
labelUrl?: string | null;
|
|
406
|
+
rate?: number | null;
|
|
407
|
+
errorMessage?: string | null;
|
|
408
|
+
/** Stable refusal code when the item failed, such as `SpendCapReached`. */
|
|
409
|
+
errorCode?: string | null;
|
|
410
|
+
/** True only when the label was clearly not bought, so sending the order again is safe. */
|
|
411
|
+
canRetry?: boolean;
|
|
241
412
|
}
|
|
242
413
|
interface Order {
|
|
243
414
|
orderNumber: string;
|
|
@@ -253,75 +424,177 @@ interface OrderItem {
|
|
|
253
424
|
quantity: number;
|
|
254
425
|
unitPrice: number;
|
|
255
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Event names FlexOps sends in the `X-FlexOps-Event` header and matches subscriptions against.
|
|
429
|
+
* Names are PascalCase and matched exactly: a dotted name such as `label.created` matches nothing.
|
|
430
|
+
* `TrackingUpdated` and `TrackingDelivered` are sent only to workspaces in the USPS push-tracking pilot.
|
|
431
|
+
*/
|
|
432
|
+
declare const WebhookEventType: {
|
|
433
|
+
readonly LabelCreated: "LabelCreated";
|
|
434
|
+
readonly LabelCanceled: "LabelCanceled";
|
|
435
|
+
readonly BatchCompleted: "BatchCompleted";
|
|
436
|
+
readonly TrackingUpdated: "TrackingUpdated";
|
|
437
|
+
readonly TrackingDelivered: "TrackingDelivered";
|
|
438
|
+
};
|
|
439
|
+
type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
440
|
+
/** A webhook subscription as the Gateway returns it. */
|
|
256
441
|
interface WebhookSubscription {
|
|
257
442
|
id: string;
|
|
258
443
|
url: string;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
444
|
+
description?: string | null;
|
|
445
|
+
/** Subscribed event names, comma-separated, or `*` for every event. */
|
|
446
|
+
eventTypes: string;
|
|
447
|
+
/** `Active`, `Paused` or `Disabled`. */
|
|
448
|
+
status: string;
|
|
449
|
+
consecutiveFailures: number;
|
|
262
450
|
createdAt: string;
|
|
451
|
+
updatedAt?: string | null;
|
|
452
|
+
/** The `whsec_...` signing secret. Returned only when the subscription is created. */
|
|
453
|
+
secret?: string;
|
|
263
454
|
}
|
|
264
455
|
interface CreateWebhookRequest {
|
|
265
456
|
url: string;
|
|
266
|
-
|
|
267
|
-
|
|
457
|
+
description?: string;
|
|
458
|
+
/** Events to receive. Omit it to receive every event. Sent as the Gateway's comma-separated `eventTypes`. */
|
|
459
|
+
events?: WebhookEventType[];
|
|
460
|
+
}
|
|
461
|
+
interface UpdateWebhookRequest {
|
|
462
|
+
url?: string;
|
|
463
|
+
description?: string;
|
|
464
|
+
/** Replaces the subscribed events. Sent as the Gateway's comma-separated `eventTypes`. */
|
|
465
|
+
events?: WebhookEventType[];
|
|
466
|
+
status?: 'Active' | 'Paused' | 'Disabled';
|
|
467
|
+
}
|
|
468
|
+
/** `GET /api/wallet/my-balance` for the configured workspace. */
|
|
268
469
|
interface WalletBalance {
|
|
470
|
+
hasWallet: boolean;
|
|
471
|
+
balanceCents: number;
|
|
269
472
|
balance: number;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
473
|
+
}
|
|
474
|
+
interface InsuranceQuoteRequest {
|
|
475
|
+
declaredValue: number;
|
|
476
|
+
carrierCode: string;
|
|
477
|
+
trackingNumber?: string;
|
|
478
|
+
provider?: string;
|
|
274
479
|
}
|
|
275
480
|
interface InsuranceQuote {
|
|
276
|
-
|
|
481
|
+
declaredValue: number;
|
|
482
|
+
coverageAmount: number;
|
|
277
483
|
premium: number;
|
|
278
|
-
|
|
279
|
-
|
|
484
|
+
coverageTier: string;
|
|
485
|
+
carrierCode: string;
|
|
486
|
+
coverageDays: number;
|
|
487
|
+
provider: string;
|
|
488
|
+
}
|
|
489
|
+
interface PurchaseInsuranceRequest {
|
|
490
|
+
trackingNumber: string;
|
|
491
|
+
carrierCode: string;
|
|
492
|
+
declaredValue: number;
|
|
493
|
+
coverageTier?: string;
|
|
494
|
+
provider?: string;
|
|
280
495
|
}
|
|
281
496
|
interface InsurancePolicy {
|
|
282
497
|
policyId: string;
|
|
283
|
-
provider: string;
|
|
284
498
|
trackingNumber: string;
|
|
285
|
-
|
|
499
|
+
carrierCode: string;
|
|
500
|
+
declaredValue: number;
|
|
501
|
+
coverageAmount: number;
|
|
286
502
|
premium: number;
|
|
287
503
|
status: string;
|
|
504
|
+
coverageTier?: string | null;
|
|
505
|
+
purchasedAt: string;
|
|
506
|
+
expiresAt: string;
|
|
507
|
+
cancelledAt?: string | null;
|
|
508
|
+
provider?: string | null;
|
|
509
|
+
providerReference?: string | null;
|
|
510
|
+
isSandbox: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface FileClaimRequest {
|
|
513
|
+
policyId: string;
|
|
514
|
+
claimReason: string;
|
|
515
|
+
claimAmount: number;
|
|
516
|
+
/** Optional evidence (photo URLs, notes) as a JSON string. */
|
|
517
|
+
evidenceJson?: string;
|
|
518
|
+
}
|
|
519
|
+
interface InsuranceClaim {
|
|
520
|
+
claimId: string;
|
|
521
|
+
policyId: string;
|
|
522
|
+
claimReason: string;
|
|
523
|
+
claimAmount: number;
|
|
524
|
+
status: string;
|
|
525
|
+
submittedAt: string;
|
|
526
|
+
resolvedAt?: string | null;
|
|
527
|
+
approvedAmount?: number | null;
|
|
528
|
+
resolutionNotes?: string | null;
|
|
529
|
+
isSandbox: boolean;
|
|
288
530
|
}
|
|
531
|
+
/** Body of `POST /api/workspaces/{workspaceId}/returns/rma`. */
|
|
289
532
|
interface ReturnRequest {
|
|
290
|
-
|
|
533
|
+
/** The order's numeric id. */
|
|
534
|
+
orderId: number;
|
|
535
|
+
orderNumber?: string;
|
|
291
536
|
reason: string;
|
|
292
537
|
items: ReturnItem[];
|
|
538
|
+
notes?: string;
|
|
539
|
+
customerEmail?: string;
|
|
540
|
+
reasonId?: number;
|
|
293
541
|
}
|
|
294
542
|
interface ReturnItem {
|
|
295
543
|
sku: string;
|
|
296
544
|
quantity: number;
|
|
297
545
|
reason?: string;
|
|
298
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Body of `POST /api/workspaces/{workspaceId}/returns/{rmaNumber}/label`.
|
|
549
|
+
*
|
|
550
|
+
* The carrier needs the package weight and all three dimensions. Send `weightOz`, `lengthIn`,
|
|
551
|
+
* `widthIn` and `heightIn`; any you leave out come from the workspace's default shipping preset.
|
|
552
|
+
* With no preset the Gateway refuses the call with a 400 (code `PackageMeasurementsRequired`)
|
|
553
|
+
* that names the missing fields.
|
|
554
|
+
*/
|
|
555
|
+
interface ReturnLabelRequest {
|
|
556
|
+
/** Carrier for the return label. Defaults to `usps` on the Gateway (the only carrier supported). */
|
|
557
|
+
carrierCode?: string;
|
|
558
|
+
/** Carrier service for the return label. */
|
|
559
|
+
serviceType?: string;
|
|
560
|
+
/** Package weight in ounces. */
|
|
561
|
+
weightOz?: number;
|
|
562
|
+
/** Package length in inches. */
|
|
563
|
+
lengthIn?: number;
|
|
564
|
+
/** Package width in inches. */
|
|
565
|
+
widthIn?: number;
|
|
566
|
+
/** Package height in inches. */
|
|
567
|
+
heightIn?: number;
|
|
568
|
+
/** Set when the workspace return-cost policy is CustomerPays and the customer has paid. */
|
|
569
|
+
paymentConfirmed?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Declared HAZMAT class. Omit it for no answer, or send `HazmatClassification.None` (0).
|
|
572
|
+
* Return labels cannot carry HAZMAT yet, so any other class is refused (400 `HazmatNotSupported`).
|
|
573
|
+
*/
|
|
574
|
+
hazmatClassification?: HazmatClassification;
|
|
575
|
+
/** USPS rate indicator for the return label's price tier. */
|
|
576
|
+
rateIndicator?: string;
|
|
577
|
+
}
|
|
578
|
+
/** How a received item is dispositioned: 0 restock, 1 refurbish, 2 dispose. */
|
|
579
|
+
type ReturnDisposition = 0 | 1 | 2;
|
|
580
|
+
/** Body of `POST /api/workspaces/{workspaceId}/returns/{rmaId}/receive`. */
|
|
581
|
+
interface ReceiveReturnRequest {
|
|
582
|
+
rmaNumber: string;
|
|
583
|
+
warehouseId: number;
|
|
584
|
+
inspectedItems: {
|
|
585
|
+
partNumber: string;
|
|
586
|
+
partDescription?: string;
|
|
587
|
+
quantity: number;
|
|
588
|
+
disposition: ReturnDisposition;
|
|
589
|
+
inspectionNotes?: string;
|
|
590
|
+
}[];
|
|
591
|
+
}
|
|
299
592
|
interface ReturnAuthorization {
|
|
300
593
|
rmaId: string;
|
|
301
594
|
status: string;
|
|
302
595
|
returnLabel?: Label;
|
|
303
596
|
createdAt: string;
|
|
304
597
|
}
|
|
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
598
|
interface ShipmentsTrend {
|
|
326
599
|
date: string;
|
|
327
600
|
count: number;
|
|
@@ -336,8 +609,20 @@ interface CarrierSummary {
|
|
|
336
609
|
interface ShippingRule {
|
|
337
610
|
id: string;
|
|
338
611
|
name: string;
|
|
339
|
-
isActive: boolean;
|
|
340
612
|
priority: number;
|
|
613
|
+
isEnabled: boolean;
|
|
614
|
+
warehouseId?: string | null;
|
|
615
|
+
conditions: RuleCondition[];
|
|
616
|
+
actions: RuleAction[];
|
|
617
|
+
createdAt: string;
|
|
618
|
+
updatedAt: string;
|
|
619
|
+
}
|
|
620
|
+
/** Body of a rule create or update. */
|
|
621
|
+
interface ShippingRuleInput {
|
|
622
|
+
name: string;
|
|
623
|
+
priority: number;
|
|
624
|
+
isEnabled: boolean;
|
|
625
|
+
warehouseId?: string;
|
|
341
626
|
conditions: RuleCondition[];
|
|
342
627
|
actions: RuleAction[];
|
|
343
628
|
}
|
|
@@ -351,20 +636,53 @@ interface RuleAction {
|
|
|
351
636
|
type: string;
|
|
352
637
|
value: string;
|
|
353
638
|
}
|
|
639
|
+
/** A sample shipment for `rules.test`. */
|
|
640
|
+
interface ShippingRuleTestRequest {
|
|
641
|
+
weightOz: number;
|
|
642
|
+
declaredValue: number;
|
|
643
|
+
destinationCountry: string;
|
|
644
|
+
destinationState?: string;
|
|
645
|
+
destinationPostalCode?: string;
|
|
646
|
+
orderSource?: string;
|
|
647
|
+
itemCount: number;
|
|
648
|
+
shipMethod?: string;
|
|
649
|
+
destinationZone?: string;
|
|
650
|
+
tags?: string[];
|
|
651
|
+
}
|
|
652
|
+
/** Body of `POST /api/workspaces/{workspaceId}/pickups`. Dates are ISO 8601. */
|
|
354
653
|
interface PickupRequest {
|
|
355
|
-
|
|
654
|
+
carrierCode: string;
|
|
356
655
|
pickupDate: string;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
656
|
+
street: string;
|
|
657
|
+
city: string;
|
|
658
|
+
state: string;
|
|
659
|
+
postalCode: string;
|
|
660
|
+
country?: string;
|
|
360
661
|
packageCount: number;
|
|
361
|
-
|
|
662
|
+
totalWeightOz?: number;
|
|
663
|
+
specialInstructions?: string;
|
|
664
|
+
readyTime?: string;
|
|
665
|
+
closeTime?: string;
|
|
666
|
+
contactName?: string;
|
|
667
|
+
contactPhone?: string;
|
|
362
668
|
}
|
|
363
669
|
interface PickupConfirmation {
|
|
364
|
-
|
|
365
|
-
|
|
670
|
+
pickupId?: string | null;
|
|
671
|
+
carrierCode: string;
|
|
366
672
|
pickupDate: string;
|
|
367
673
|
status: string;
|
|
674
|
+
confirmationNumber?: string | null;
|
|
675
|
+
windowStart?: string | null;
|
|
676
|
+
windowEnd?: string | null;
|
|
677
|
+
street?: string | null;
|
|
678
|
+
city?: string | null;
|
|
679
|
+
state?: string | null;
|
|
680
|
+
packageCount: number;
|
|
681
|
+
createdAt?: string | null;
|
|
682
|
+
message?: string | null;
|
|
683
|
+
success: boolean;
|
|
684
|
+
errorMessage?: string | null;
|
|
685
|
+
isSandbox: boolean;
|
|
368
686
|
}
|
|
369
687
|
interface ScanFormRequest {
|
|
370
688
|
trackingNumbers: string[];
|
|
@@ -384,6 +702,10 @@ interface CarrierRecommendationRequest {
|
|
|
384
702
|
}
|
|
385
703
|
interface CarrierRecommendationResponse {
|
|
386
704
|
lane: string;
|
|
705
|
+
/**
|
|
706
|
+
* Shipments analyzed: exact for the workspace's own data, a band floor
|
|
707
|
+
* (5, 10, 25, 50, 100, 250, 500, 1000) for each carrier scored on FlexOps network data.
|
|
708
|
+
*/
|
|
387
709
|
sampleSize: number;
|
|
388
710
|
recommendations: CarrierRecommendation[];
|
|
389
711
|
}
|
|
@@ -392,7 +714,13 @@ interface CarrierRecommendation {
|
|
|
392
714
|
score: number;
|
|
393
715
|
onTimePercent: number;
|
|
394
716
|
avgTransitDays: number;
|
|
717
|
+
/**
|
|
718
|
+
* The workspace's own average label cost in USD. `0` when the carrier was scored on
|
|
719
|
+
* FlexOps network data: network cost is not reported, so `0` does not mean free.
|
|
720
|
+
* The API's `dataSource` field (`workspace` or `network`) says which; this type does not include it yet.
|
|
721
|
+
*/
|
|
395
722
|
avgCost: number;
|
|
723
|
+
/** Shipments analyzed for this carrier: exact for workspace data, a band floor for network data. */
|
|
396
724
|
shipmentCount: number;
|
|
397
725
|
exceptionRate: number;
|
|
398
726
|
reason: string;
|
|
@@ -414,6 +742,7 @@ interface DeliveryPredictionResponse {
|
|
|
414
742
|
worstCaseDelivery: string;
|
|
415
743
|
predictedTransitDays: number;
|
|
416
744
|
confidence: number;
|
|
745
|
+
/** Shipments used: exact for the workspace's own data, a band floor for FlexOps network data. */
|
|
417
746
|
sampleSize: number;
|
|
418
747
|
onTimeRate: number;
|
|
419
748
|
}
|
|
@@ -434,24 +763,174 @@ interface LaneSavingsOpportunity {
|
|
|
434
763
|
currentOnTimeRate: number;
|
|
435
764
|
recommendedOnTimeRate: number;
|
|
436
765
|
}
|
|
437
|
-
interface
|
|
438
|
-
|
|
766
|
+
interface CarbonOffsetQuoteRequest {
|
|
767
|
+
weightLbs: number;
|
|
768
|
+
distanceMiles: number;
|
|
769
|
+
}
|
|
770
|
+
interface CarbonOffsetQuote {
|
|
771
|
+
carbonKg: number;
|
|
772
|
+
costUsd: number;
|
|
773
|
+
equivalentTreesPlanted: number;
|
|
774
|
+
provider: string;
|
|
775
|
+
}
|
|
776
|
+
interface CarbonOffsetPurchaseRequest extends CarbonOffsetQuoteRequest {
|
|
777
|
+
trackingNumber: string;
|
|
778
|
+
}
|
|
779
|
+
interface CarbonOffset {
|
|
439
780
|
offsetId: string;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
};
|
|
781
|
+
trackingNumber: string;
|
|
782
|
+
carbonKg: number;
|
|
783
|
+
costUsd: number;
|
|
784
|
+
status: string;
|
|
445
785
|
provider: string;
|
|
446
|
-
|
|
786
|
+
providerReference?: string | null;
|
|
787
|
+
isAutoOffset: boolean;
|
|
788
|
+
purchasedAt: string;
|
|
789
|
+
}
|
|
790
|
+
interface CarbonOffsetSummary {
|
|
791
|
+
totalCarbonKg: number;
|
|
792
|
+
totalCostUsd: number;
|
|
793
|
+
totalOffsets: number;
|
|
794
|
+
equivalentTreesPlanted: number;
|
|
795
|
+
}
|
|
796
|
+
interface CarbonOffsetSettings {
|
|
797
|
+
autoOffsetEnabled: boolean;
|
|
798
|
+
}
|
|
799
|
+
/** How often a recurring shipment runs, sent as a number. `Custom` uses `cronExpression`. */
|
|
800
|
+
declare const RecurrenceInterval: {
|
|
801
|
+
readonly Daily: 0;
|
|
802
|
+
readonly Weekly: 1;
|
|
803
|
+
readonly Biweekly: 2;
|
|
804
|
+
readonly Monthly: 3;
|
|
805
|
+
readonly Custom: 4;
|
|
806
|
+
};
|
|
807
|
+
type RecurrenceInterval = (typeof RecurrenceInterval)[keyof typeof RecurrenceInterval];
|
|
808
|
+
interface RecurringShipment {
|
|
809
|
+
id: string;
|
|
810
|
+
workspaceId: string;
|
|
811
|
+
presetId?: string | null;
|
|
812
|
+
presetName?: string | null;
|
|
813
|
+
addressId?: string | null;
|
|
814
|
+
addressSummary?: string | null;
|
|
815
|
+
name: string;
|
|
816
|
+
interval: RecurrenceInterval;
|
|
817
|
+
intervalName: string;
|
|
818
|
+
cronExpression?: string | null;
|
|
819
|
+
nextRunUtc: string;
|
|
820
|
+
lastRunUtc?: string | null;
|
|
821
|
+
isActive: boolean;
|
|
822
|
+
failureCount: number;
|
|
823
|
+
maxFailures: number;
|
|
824
|
+
lastError?: string | null;
|
|
825
|
+
createdAt: string;
|
|
447
826
|
}
|
|
448
|
-
interface
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
827
|
+
interface CreateRecurringShipmentRequest {
|
|
828
|
+
/** Up to 200 characters. */
|
|
829
|
+
name: string;
|
|
830
|
+
/** Shipping preset that supplies the package and service. */
|
|
831
|
+
presetId?: string;
|
|
832
|
+
/** Destination address; a run without one fails. */
|
|
833
|
+
addressId?: string;
|
|
834
|
+
interval: RecurrenceInterval;
|
|
835
|
+
/** Up to 100 characters; used with `RecurrenceInterval.Custom`. */
|
|
836
|
+
cronExpression?: string;
|
|
837
|
+
/** ISO 8601 date-time of the first run. */
|
|
838
|
+
firstRunUtc: string;
|
|
839
|
+
/** Failed runs (1-100, default 3) before the schedule is paused. */
|
|
840
|
+
maxFailures?: number;
|
|
841
|
+
}
|
|
842
|
+
type UpdateRecurringShipmentRequest = Partial<Omit<CreateRecurringShipmentRequest, 'firstRunUtc'>>;
|
|
843
|
+
/** Report file format, sent as a number. */
|
|
844
|
+
declare const ReportFormat: {
|
|
845
|
+
readonly Csv: 0;
|
|
846
|
+
readonly Json: 1;
|
|
847
|
+
};
|
|
848
|
+
type ReportFormat = (typeof ReportFormat)[keyof typeof ReportFormat];
|
|
849
|
+
/** How often a report is emailed, sent as a number. */
|
|
850
|
+
declare const ReportFrequency: {
|
|
851
|
+
readonly Daily: 0;
|
|
852
|
+
readonly Weekly: 1;
|
|
853
|
+
readonly Monthly: 2;
|
|
854
|
+
};
|
|
855
|
+
type ReportFrequency = (typeof ReportFrequency)[keyof typeof ReportFrequency];
|
|
856
|
+
interface ReportSchedule {
|
|
857
|
+
id: string;
|
|
858
|
+
workspaceId: string;
|
|
859
|
+
reportType: string;
|
|
860
|
+
format: ReportFormat;
|
|
861
|
+
filterParametersJson?: string | null;
|
|
862
|
+
frequencyType: ReportFrequency;
|
|
863
|
+
frequencyName: string;
|
|
864
|
+
/** 0 (Sunday) to 6, for weekly schedules. */
|
|
865
|
+
dayOfWeek?: number | null;
|
|
866
|
+
/** 1 to 28, for monthly schedules. */
|
|
867
|
+
dayOfMonth?: number | null;
|
|
868
|
+
/** UTC time of day, `"HH:mm:ss"`. */
|
|
869
|
+
timeOfDayUtc: string;
|
|
870
|
+
nextRunUtc: string;
|
|
871
|
+
lastRunUtc?: string | null;
|
|
872
|
+
isEnabled: boolean;
|
|
873
|
+
/** Comma-separated recipient addresses. */
|
|
874
|
+
recipientEmails: string;
|
|
875
|
+
failureCount: number;
|
|
876
|
+
maxFailures: number;
|
|
877
|
+
lastError?: string | null;
|
|
878
|
+
createdAt: string;
|
|
879
|
+
}
|
|
880
|
+
interface CreateReportScheduleRequest {
|
|
881
|
+
/** Report name, up to 50 characters, for example `"shipments"`. */
|
|
882
|
+
reportType: string;
|
|
883
|
+
format: ReportFormat;
|
|
884
|
+
filterParametersJson?: string;
|
|
885
|
+
frequencyType: ReportFrequency;
|
|
886
|
+
/** 0 (Sunday) to 6, for weekly schedules. */
|
|
887
|
+
dayOfWeek?: number;
|
|
888
|
+
/** 1 to 28, for monthly schedules. */
|
|
889
|
+
dayOfMonth?: number;
|
|
890
|
+
/** UTC time of day, `"HH:mm:ss"`. */
|
|
891
|
+
timeOfDayUtc: string;
|
|
892
|
+
/** Comma-separated recipient addresses, up to 2000 characters. */
|
|
893
|
+
recipientEmails: string;
|
|
894
|
+
/** Failed runs (1-100, default 3) before the schedule is disabled. */
|
|
895
|
+
maxFailures?: number;
|
|
896
|
+
}
|
|
897
|
+
type UpdateReportScheduleRequest = Partial<CreateReportScheduleRequest>;
|
|
898
|
+
/** The tracking event an email template is sent for, sent as a number. */
|
|
899
|
+
declare const TrackingEmailEvent: {
|
|
900
|
+
readonly LabelCreated: 0;
|
|
901
|
+
readonly InTransit: 1;
|
|
902
|
+
readonly OutForDelivery: 2;
|
|
903
|
+
readonly Delivered: 3;
|
|
904
|
+
readonly Exception: 4;
|
|
905
|
+
readonly ReturnToSender: 5;
|
|
906
|
+
};
|
|
907
|
+
type TrackingEmailEvent = (typeof TrackingEmailEvent)[keyof typeof TrackingEmailEvent];
|
|
908
|
+
interface EmailTemplate {
|
|
909
|
+
id: string;
|
|
910
|
+
workspaceId: string;
|
|
911
|
+
eventType: TrackingEmailEvent;
|
|
912
|
+
eventTypeName: string;
|
|
913
|
+
subjectTemplate: string;
|
|
914
|
+
htmlBodyTemplate: string;
|
|
915
|
+
isEnabled: boolean;
|
|
916
|
+
createdAt: string;
|
|
917
|
+
updatedAt: string;
|
|
918
|
+
}
|
|
919
|
+
interface UpsertEmailTemplateRequest {
|
|
920
|
+
eventType: TrackingEmailEvent;
|
|
921
|
+
/** Up to 500 characters. */
|
|
922
|
+
subjectTemplate: string;
|
|
923
|
+
htmlBodyTemplate: string;
|
|
924
|
+
/** Default true. */
|
|
925
|
+
isEnabled?: boolean;
|
|
926
|
+
}
|
|
927
|
+
interface EmailTemplatePreviewRequest {
|
|
928
|
+
subjectTemplate: string;
|
|
929
|
+
htmlBodyTemplate: string;
|
|
930
|
+
}
|
|
931
|
+
interface EmailTemplatePreview {
|
|
932
|
+
renderedSubject: string;
|
|
933
|
+
renderedHtmlBody: string;
|
|
455
934
|
}
|
|
456
935
|
interface HsCodeResult {
|
|
457
936
|
hsCode: string;
|
|
@@ -466,6 +945,21 @@ interface LandedCostRequest {
|
|
|
466
945
|
shippingCost?: number;
|
|
467
946
|
items: CustomsItem[];
|
|
468
947
|
}
|
|
948
|
+
/** USPS label declaration. Item value and weight are per unit; server availability is gated. */
|
|
949
|
+
interface CustomsDeclaration {
|
|
950
|
+
contentsType: 'merchandise' | 'documents' | 'gift' | 'sample' | 'returned_goods' | 'other';
|
|
951
|
+
contentsExplanation?: string;
|
|
952
|
+
nonDeliveryOption: 'return' | 'abandon';
|
|
953
|
+
currency: 'USD';
|
|
954
|
+
declaredValue: number;
|
|
955
|
+
aesItn: string;
|
|
956
|
+
invoiceNumber?: string;
|
|
957
|
+
licenseNumber?: string;
|
|
958
|
+
certificateNumber?: string;
|
|
959
|
+
restrictionType?: string;
|
|
960
|
+
restrictionComments?: string;
|
|
961
|
+
items: CustomsItem[];
|
|
962
|
+
}
|
|
469
963
|
interface CustomsItem {
|
|
470
964
|
description: string;
|
|
471
965
|
quantity: number;
|
|
@@ -485,72 +979,6 @@ interface LandedCostEstimate {
|
|
|
485
979
|
isEstimate: boolean;
|
|
486
980
|
disclaimer: string | null;
|
|
487
981
|
}
|
|
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
982
|
declare class FlexOpsError extends Error {
|
|
555
983
|
readonly status: number;
|
|
556
984
|
readonly code?: string | undefined;
|
|
@@ -575,6 +1003,8 @@ declare class HttpClient {
|
|
|
575
1003
|
private apiKey?;
|
|
576
1004
|
constructor(config: FlexOpsConfig);
|
|
577
1005
|
setAccessToken(token: string): void;
|
|
1006
|
+
/** The JWT access token in use, if any. */
|
|
1007
|
+
getAccessToken(): string | undefined;
|
|
578
1008
|
setApiKey(key: string): void;
|
|
579
1009
|
request<T>(method: string, path: string, options?: {
|
|
580
1010
|
body?: unknown;
|
|
@@ -589,32 +1019,34 @@ declare class HttpClient {
|
|
|
589
1019
|
delete<T>(path: string): Promise<T>;
|
|
590
1020
|
private buildUrl;
|
|
591
1021
|
private buildHeaders;
|
|
1022
|
+
/**
|
|
1023
|
+
* GETs retry on every configured status. A write retries only where the Gateway either did not
|
|
1024
|
+
* run it or will replay it for the same Idempotency-Key: never after a 500, whose response the
|
|
1025
|
+
* Gateway does not cache, so a retry would run the write again. A DELETE retries only on 429.
|
|
1026
|
+
*/
|
|
1027
|
+
private isRetryable;
|
|
592
1028
|
private calculateBackoff;
|
|
593
1029
|
}
|
|
594
1030
|
|
|
1031
|
+
/**
|
|
1032
|
+
* Token acquisition for user-token calls. Account management (sign-up, profile, passwords, email
|
|
1033
|
+
* verification) lives in the FlexOps portals; integrations normally use an API key instead.
|
|
1034
|
+
*/
|
|
595
1035
|
declare class AuthResource {
|
|
596
1036
|
private readonly http;
|
|
597
1037
|
constructor(http: HttpClient);
|
|
598
|
-
/**
|
|
1038
|
+
/**
|
|
1039
|
+
* Authenticate with email and password. On success the returned access token (`data.token`) is
|
|
1040
|
+
* used for later requests. When `data.requiresTwoFactor` is true no token is issued yet.
|
|
1041
|
+
*/
|
|
599
1042
|
login(request: LoginRequest): Promise<ApiResponse<LoginResponse>>;
|
|
600
|
-
/**
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
1043
|
+
/**
|
|
1044
|
+
* Exchange a refresh token for a new access token. The Gateway needs the expired access token
|
|
1045
|
+
* too; it defaults to the one this client holds.
|
|
1046
|
+
*/
|
|
1047
|
+
refreshToken(refreshToken: string, accessToken?: string | undefined): Promise<ApiResponse<LoginResponse>>;
|
|
604
1048
|
/** Log out and invalidate the current session. */
|
|
605
1049
|
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
1050
|
}
|
|
619
1051
|
|
|
620
1052
|
declare class WorkspacesResource {
|
|
@@ -625,19 +1057,15 @@ declare class WorkspacesResource {
|
|
|
625
1057
|
/** List all workspaces the current user belongs to. */
|
|
626
1058
|
list(): Promise<ApiResponse<Workspace[]>>;
|
|
627
1059
|
/** 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[]>>;
|
|
1060
|
+
get(workspaceId?: string): Promise<ApiResponse<WorkspaceDetail>>;
|
|
1061
|
+
/** List the current workspace's members and pending invites. */
|
|
1062
|
+
listMembers(): Promise<ApiResponse<WorkspaceMemberList>>;
|
|
635
1063
|
/** Invite a user to the workspace. */
|
|
636
|
-
inviteMember(email: string, role?:
|
|
1064
|
+
inviteMember(email: string, role?: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
637
1065
|
/** Remove a member from the workspace. */
|
|
638
1066
|
removeMember(userId: string): Promise<ApiResponse<unknown>>;
|
|
639
|
-
/**
|
|
640
|
-
updateMemberRole(userId: string, role:
|
|
1067
|
+
/** Change a member's role. */
|
|
1068
|
+
updateMemberRole(userId: string, role: WorkspaceRole): Promise<ApiResponse<unknown>>;
|
|
641
1069
|
}
|
|
642
1070
|
|
|
643
1071
|
declare class ShippingResource {
|
|
@@ -666,10 +1094,17 @@ declare class ShippingResource {
|
|
|
666
1094
|
/** Track a shipment by tracking number. */
|
|
667
1095
|
track(trackingNumber: string): Promise<TrackingInfo>;
|
|
668
1096
|
/** Validate and correct a shipping address. */
|
|
669
|
-
validateAddress(address: Address): Promise<AddressValidationResult>;
|
|
670
|
-
/**
|
|
1097
|
+
validateAddress(address: Address | ShippingAddress): Promise<AddressValidationResult>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Create labels for a batch of orders. The job runs in the background; poll `getBatchStatus`.
|
|
1100
|
+
* The request is sent as given; set `hazmatClassification` on an item only when you have a declaration.
|
|
1101
|
+
*/
|
|
1102
|
+
createBatch(request: CreateBatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1103
|
+
/** @deprecated The Gateway refuses label-shaped batch items. Pass a CreateBatchLabelRequest. */
|
|
671
1104
|
createBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
672
|
-
/** Preview a batch without
|
|
1105
|
+
/** Preview a batch of orders without buying labels (dry-run): per-order rates and the total cost. */
|
|
1106
|
+
previewBatch(request: CreateBatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1107
|
+
/** @deprecated The Gateway refuses label-shaped batch items. Pass a CreateBatchLabelRequest. */
|
|
673
1108
|
previewBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
674
1109
|
/** Get batch job status. */
|
|
675
1110
|
getBatchStatus(jobId: string): Promise<ApiResponse<BatchLabelJob>>;
|
|
@@ -688,10 +1123,12 @@ declare class ShippingResource {
|
|
|
688
1123
|
/**
|
|
689
1124
|
* Direct carrier operations via the VisionSuite Core Services API proxy.
|
|
690
1125
|
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
1126
|
+
* Pass-throughs to carrier-specific endpoints (USPS, UPS, FedEx, DHL) via the Gateway's legacy
|
|
1127
|
+
* ApiProxy route, deprecated and sunset on 2027-06-30. The GET lookups work with API keys. The
|
|
1128
|
+
* writes are marked deprecated: they need a user token (`auth.login`), because the Gateway refuses
|
|
1129
|
+
* API-key writes on the proxy with 403 `API_KEY_SCOPE_REQUIRED`. Label purchases through the proxy are
|
|
1130
|
+
* closed (410); rates, labels, voids, pickups and scan forms go through `client.shipping`,
|
|
1131
|
+
* `client.pickups` and `client.scanForms` for every carrier.
|
|
695
1132
|
*/
|
|
696
1133
|
declare class CarriersResource {
|
|
697
1134
|
private readonly http;
|
|
@@ -704,35 +1141,91 @@ declare class CarriersResource {
|
|
|
704
1141
|
cityStateLookup: (zipCode: string) => Promise<unknown>;
|
|
705
1142
|
/** ZIP code lookup by address. */
|
|
706
1143
|
zipCodeLookup: (params: Record<string, string>) => Promise<unknown>;
|
|
707
|
-
/**
|
|
1144
|
+
/**
|
|
1145
|
+
* Search domestic shipping rates.
|
|
1146
|
+
*
|
|
1147
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1148
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1149
|
+
* cover this.
|
|
1150
|
+
*/
|
|
708
1151
|
getDomesticRates: (body: unknown) => Promise<unknown>;
|
|
709
|
-
/**
|
|
1152
|
+
/**
|
|
1153
|
+
* Search domestic product eligibility.
|
|
1154
|
+
*
|
|
1155
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1156
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1157
|
+
* cover this.
|
|
1158
|
+
*/
|
|
710
1159
|
getDomesticProducts: (body: unknown) => Promise<unknown>;
|
|
711
|
-
/**
|
|
1160
|
+
/**
|
|
1161
|
+
* Search domestic prices.
|
|
1162
|
+
*
|
|
1163
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1164
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1165
|
+
* cover this.
|
|
1166
|
+
*/
|
|
712
1167
|
getDomesticPrices: (body: unknown) => Promise<unknown>;
|
|
713
|
-
/**
|
|
1168
|
+
/**
|
|
1169
|
+
* Search international rates.
|
|
1170
|
+
*
|
|
1171
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1172
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1173
|
+
* cover this.
|
|
1174
|
+
*/
|
|
714
1175
|
getInternationalRates: (body: unknown) => Promise<unknown>;
|
|
715
|
-
/**
|
|
1176
|
+
/**
|
|
1177
|
+
* Search international prices.
|
|
1178
|
+
*
|
|
1179
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1180
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1181
|
+
* cover this.
|
|
1182
|
+
*/
|
|
716
1183
|
getInternationalPrices: (body: unknown) => Promise<unknown>;
|
|
717
1184
|
/** Generate a domestic shipping label. */
|
|
718
1185
|
createDomesticLabel: (body: unknown) => Promise<Label>;
|
|
719
|
-
/**
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1186
|
+
/**
|
|
1187
|
+
* Cancel a domestic label.
|
|
1188
|
+
*
|
|
1189
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1190
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1191
|
+
* cover this.
|
|
1192
|
+
*/
|
|
724
1193
|
cancelDomesticLabel: () => Promise<unknown>;
|
|
725
|
-
/**
|
|
1194
|
+
/**
|
|
1195
|
+
* Cancel an international label.
|
|
1196
|
+
*
|
|
1197
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1198
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1199
|
+
* cover this.
|
|
1200
|
+
*/
|
|
726
1201
|
cancelInternationalLabel: () => Promise<unknown>;
|
|
727
1202
|
/** Get tracking summary. */
|
|
728
1203
|
trackSummary: (params: Record<string, string>) => Promise<unknown>;
|
|
729
1204
|
/** Get detailed tracking info. */
|
|
730
1205
|
trackDetail: (params: Record<string, string>) => Promise<unknown>;
|
|
731
|
-
/**
|
|
1206
|
+
/**
|
|
1207
|
+
* Schedule a carrier pickup.
|
|
1208
|
+
*
|
|
1209
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1210
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1211
|
+
* cover this.
|
|
1212
|
+
*/
|
|
732
1213
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
733
|
-
/**
|
|
1214
|
+
/**
|
|
1215
|
+
* Cancel a pickup.
|
|
1216
|
+
*
|
|
1217
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1218
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1219
|
+
* cover this.
|
|
1220
|
+
*/
|
|
734
1221
|
cancelPickup: () => Promise<unknown>;
|
|
735
|
-
/**
|
|
1222
|
+
/**
|
|
1223
|
+
* Create a scan form.
|
|
1224
|
+
*
|
|
1225
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1226
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1227
|
+
* cover this.
|
|
1228
|
+
*/
|
|
736
1229
|
createScanForm: (body: unknown) => Promise<unknown>;
|
|
737
1230
|
/** Get delivery standards estimates. */
|
|
738
1231
|
deliveryStandards: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -742,73 +1235,241 @@ declare class CarriersResource {
|
|
|
742
1235
|
findPostOffices: (params: Record<string, string>) => Promise<unknown>;
|
|
743
1236
|
};
|
|
744
1237
|
readonly ups: {
|
|
745
|
-
/**
|
|
1238
|
+
/**
|
|
1239
|
+
* Verify an address via UPS.
|
|
1240
|
+
*
|
|
1241
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1242
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1243
|
+
* cover this.
|
|
1244
|
+
*/
|
|
746
1245
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
747
|
-
/**
|
|
1246
|
+
/**
|
|
1247
|
+
* Get UPS rate quotes.
|
|
1248
|
+
*
|
|
1249
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1250
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1251
|
+
* cover this.
|
|
1252
|
+
*/
|
|
748
1253
|
getRates: (body: unknown) => Promise<unknown>;
|
|
749
|
-
/** Generate a UPS shipping label. */
|
|
750
|
-
createLabel: (body: unknown) => Promise<unknown>;
|
|
751
1254
|
/** Track a UPS shipment. */
|
|
752
1255
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
753
|
-
/**
|
|
1256
|
+
/**
|
|
1257
|
+
* Create a UPS pickup.
|
|
1258
|
+
*
|
|
1259
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1260
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1261
|
+
* cover this.
|
|
1262
|
+
*/
|
|
754
1263
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
755
|
-
/**
|
|
1264
|
+
/**
|
|
1265
|
+
* Cancel a UPS pickup.
|
|
1266
|
+
*
|
|
1267
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1268
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1269
|
+
* cover this.
|
|
1270
|
+
*/
|
|
756
1271
|
cancelPickup: () => Promise<unknown>;
|
|
757
|
-
/**
|
|
1272
|
+
/**
|
|
1273
|
+
* Get UPS transit times.
|
|
1274
|
+
*
|
|
1275
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1276
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1277
|
+
* cover this.
|
|
1278
|
+
*/
|
|
758
1279
|
getTransitTimes: (body: unknown) => Promise<unknown>;
|
|
759
|
-
/**
|
|
1280
|
+
/**
|
|
1281
|
+
* Get UPS landed cost quote (international).
|
|
1282
|
+
*
|
|
1283
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1284
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1285
|
+
* cover this.
|
|
1286
|
+
*/
|
|
760
1287
|
getLandedCost: (body: unknown) => Promise<unknown>;
|
|
761
|
-
/**
|
|
1288
|
+
/**
|
|
1289
|
+
* Search UPS locations.
|
|
1290
|
+
*
|
|
1291
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1292
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1293
|
+
* cover this.
|
|
1294
|
+
*/
|
|
762
1295
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
763
|
-
/**
|
|
1296
|
+
/**
|
|
1297
|
+
* Upload paperless trade document.
|
|
1298
|
+
*
|
|
1299
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1300
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1301
|
+
* cover this.
|
|
1302
|
+
*/
|
|
764
1303
|
uploadDocument: (body: unknown) => Promise<unknown>;
|
|
765
|
-
/**
|
|
1304
|
+
/**
|
|
1305
|
+
* Create UPS freight shipment.
|
|
1306
|
+
*
|
|
1307
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1308
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1309
|
+
* cover this.
|
|
1310
|
+
*/
|
|
766
1311
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
767
|
-
/**
|
|
1312
|
+
/**
|
|
1313
|
+
* Get UPS freight rate.
|
|
1314
|
+
*
|
|
1315
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1316
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1317
|
+
* cover this.
|
|
1318
|
+
*/
|
|
768
1319
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
769
1320
|
};
|
|
770
1321
|
readonly fedex: {
|
|
771
|
-
/**
|
|
1322
|
+
/**
|
|
1323
|
+
* Validate a domestic address via FedEx.
|
|
1324
|
+
*
|
|
1325
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1326
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1327
|
+
* cover this.
|
|
1328
|
+
*/
|
|
772
1329
|
validateAddress: (body: unknown) => Promise<unknown>;
|
|
773
|
-
/**
|
|
1330
|
+
/**
|
|
1331
|
+
* Validate a postal code.
|
|
1332
|
+
*
|
|
1333
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1334
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1335
|
+
* cover this.
|
|
1336
|
+
*/
|
|
774
1337
|
validatePostalCode: (body: unknown) => Promise<unknown>;
|
|
775
|
-
/**
|
|
1338
|
+
/**
|
|
1339
|
+
* Get FedEx rate and transit times.
|
|
1340
|
+
*
|
|
1341
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1342
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1343
|
+
* cover this.
|
|
1344
|
+
*/
|
|
776
1345
|
getRates: (body: unknown) => Promise<unknown>;
|
|
777
|
-
/**
|
|
778
|
-
|
|
779
|
-
|
|
1346
|
+
/**
|
|
1347
|
+
* Cancel a FedEx shipment.
|
|
1348
|
+
*
|
|
1349
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1350
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1351
|
+
* cover this.
|
|
1352
|
+
*/
|
|
780
1353
|
cancelShipment: (body: unknown) => Promise<unknown>;
|
|
781
|
-
/**
|
|
1354
|
+
/**
|
|
1355
|
+
* Validate a shipment (dry run).
|
|
1356
|
+
*
|
|
1357
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1358
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1359
|
+
* cover this.
|
|
1360
|
+
*/
|
|
782
1361
|
validateShipment: (body: unknown) => Promise<unknown>;
|
|
783
|
-
/**
|
|
784
|
-
|
|
785
|
-
|
|
1362
|
+
/**
|
|
1363
|
+
* Track by tracking number.
|
|
1364
|
+
*
|
|
1365
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1366
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1367
|
+
* cover this.
|
|
1368
|
+
*/
|
|
786
1369
|
track: (body: unknown) => Promise<unknown>;
|
|
787
|
-
/**
|
|
1370
|
+
/**
|
|
1371
|
+
* Track multi-piece shipment.
|
|
1372
|
+
*
|
|
1373
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1374
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1375
|
+
* cover this.
|
|
1376
|
+
*/
|
|
788
1377
|
trackMultiPiece: (body: unknown) => Promise<unknown>;
|
|
789
|
-
/**
|
|
1378
|
+
/**
|
|
1379
|
+
* Register for tracking notifications.
|
|
1380
|
+
*
|
|
1381
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1382
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1383
|
+
* cover this.
|
|
1384
|
+
*/
|
|
790
1385
|
registerTrackingNotification: (body: unknown) => Promise<unknown>;
|
|
791
|
-
/**
|
|
1386
|
+
/**
|
|
1387
|
+
* Create a carrier pickup.
|
|
1388
|
+
*
|
|
1389
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1390
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1391
|
+
* cover this.
|
|
1392
|
+
*/
|
|
792
1393
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
793
|
-
/**
|
|
1394
|
+
/**
|
|
1395
|
+
* Cancel a pickup.
|
|
1396
|
+
*
|
|
1397
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1398
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1399
|
+
* cover this.
|
|
1400
|
+
*/
|
|
794
1401
|
cancelPickup: (body: unknown) => Promise<unknown>;
|
|
795
|
-
/**
|
|
1402
|
+
/**
|
|
1403
|
+
* Search valid locations.
|
|
1404
|
+
*
|
|
1405
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1406
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1407
|
+
* cover this.
|
|
1408
|
+
*/
|
|
796
1409
|
searchLocations: (body: unknown) => Promise<unknown>;
|
|
797
|
-
/**
|
|
1410
|
+
/**
|
|
1411
|
+
* Get service standards and transit times.
|
|
1412
|
+
*
|
|
1413
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1414
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1415
|
+
* cover this.
|
|
1416
|
+
*/
|
|
798
1417
|
getServiceStandards: (body: unknown) => Promise<unknown>;
|
|
799
|
-
/**
|
|
1418
|
+
/**
|
|
1419
|
+
* Get freight rate quote.
|
|
1420
|
+
*
|
|
1421
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1422
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1423
|
+
* cover this.
|
|
1424
|
+
*/
|
|
800
1425
|
getFreightRate: (body: unknown) => Promise<unknown>;
|
|
801
|
-
/**
|
|
1426
|
+
/**
|
|
1427
|
+
* Create freight shipment.
|
|
1428
|
+
*
|
|
1429
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1430
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1431
|
+
* cover this.
|
|
1432
|
+
*/
|
|
802
1433
|
createFreightShipment: (body: unknown) => Promise<unknown>;
|
|
803
|
-
/**
|
|
1434
|
+
/**
|
|
1435
|
+
* Ground close with documents.
|
|
1436
|
+
*
|
|
1437
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1438
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1439
|
+
* cover this.
|
|
1440
|
+
*/
|
|
804
1441
|
groundClose: (body: unknown) => Promise<unknown>;
|
|
805
|
-
/**
|
|
1442
|
+
/**
|
|
1443
|
+
* Upload trade documents.
|
|
1444
|
+
*
|
|
1445
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1446
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1447
|
+
* cover this.
|
|
1448
|
+
*/
|
|
806
1449
|
uploadTradeDocuments: (body: unknown) => Promise<unknown>;
|
|
807
|
-
/**
|
|
1450
|
+
/**
|
|
1451
|
+
* Create an open shipment.
|
|
1452
|
+
*
|
|
1453
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1454
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1455
|
+
* cover this.
|
|
1456
|
+
*/
|
|
808
1457
|
createOpenShipment: (body: unknown) => Promise<unknown>;
|
|
809
|
-
/**
|
|
1458
|
+
/**
|
|
1459
|
+
* Add packages to an open shipment.
|
|
1460
|
+
*
|
|
1461
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1462
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1463
|
+
* cover this.
|
|
1464
|
+
*/
|
|
810
1465
|
addPackagesToOpenShipment: (body: unknown) => Promise<unknown>;
|
|
811
|
-
/**
|
|
1466
|
+
/**
|
|
1467
|
+
* Confirm and finalize an open shipment.
|
|
1468
|
+
*
|
|
1469
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1470
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1471
|
+
* cover this.
|
|
1472
|
+
*/
|
|
812
1473
|
confirmOpenShipment: (body: unknown) => Promise<unknown>;
|
|
813
1474
|
};
|
|
814
1475
|
readonly dhl: {
|
|
@@ -816,27 +1477,59 @@ declare class CarriersResource {
|
|
|
816
1477
|
validateAddress: (params: Record<string, string>) => Promise<unknown>;
|
|
817
1478
|
/** Get DHL shipping rates. */
|
|
818
1479
|
getRates: (params: Record<string, string>) => Promise<unknown>;
|
|
819
|
-
/**
|
|
1480
|
+
/**
|
|
1481
|
+
* Get multi-piece rates.
|
|
1482
|
+
*
|
|
1483
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1484
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1485
|
+
* cover this.
|
|
1486
|
+
*/
|
|
820
1487
|
getMultiPieceRates: (body: unknown) => Promise<unknown>;
|
|
821
1488
|
/** Get DHL products/services. */
|
|
822
1489
|
getProducts: (params: Record<string, string>) => Promise<unknown>;
|
|
823
|
-
/** Create a DHL shipment (label). */
|
|
824
|
-
createShipment: (body: unknown) => Promise<unknown>;
|
|
825
1490
|
/** Track a DHL shipment. */
|
|
826
1491
|
track: (params: Record<string, string>) => Promise<unknown>;
|
|
827
1492
|
/** Track multiple DHL shipments. */
|
|
828
1493
|
trackMultiple: (params: Record<string, string>) => Promise<unknown>;
|
|
829
|
-
/**
|
|
1494
|
+
/**
|
|
1495
|
+
* Create a DHL pickup.
|
|
1496
|
+
*
|
|
1497
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1498
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1499
|
+
* cover this.
|
|
1500
|
+
*/
|
|
830
1501
|
createPickup: (body: unknown) => Promise<unknown>;
|
|
831
|
-
/**
|
|
832
|
-
|
|
833
|
-
|
|
1502
|
+
/**
|
|
1503
|
+
* Cancel a DHL pickup.
|
|
1504
|
+
*
|
|
1505
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1506
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1507
|
+
* cover this.
|
|
1508
|
+
*/
|
|
834
1509
|
cancelPickup: () => Promise<unknown>;
|
|
835
|
-
/**
|
|
1510
|
+
/**
|
|
1511
|
+
* Calculate landed cost (duties/taxes).
|
|
1512
|
+
*
|
|
1513
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1514
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1515
|
+
* cover this.
|
|
1516
|
+
*/
|
|
836
1517
|
calculateLandedCost: (body: unknown) => Promise<unknown>;
|
|
837
|
-
/**
|
|
1518
|
+
/**
|
|
1519
|
+
* Screen a shipment for compliance.
|
|
1520
|
+
*
|
|
1521
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1522
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1523
|
+
* cover this.
|
|
1524
|
+
*/
|
|
838
1525
|
screenShipment: (body: unknown) => Promise<unknown>;
|
|
839
|
-
/**
|
|
1526
|
+
/**
|
|
1527
|
+
* Upload an invoice.
|
|
1528
|
+
*
|
|
1529
|
+
* @deprecated Legacy carrier proxy (sunset 2027-06-30). Needs a user token: API keys get 403
|
|
1530
|
+
* `API_KEY_SCOPE_REQUIRED`. Use `client.shipping` / `client.pickups` / `client.scanForms` where they
|
|
1531
|
+
* cover this.
|
|
1532
|
+
*/
|
|
840
1533
|
uploadInvoice: (body: unknown) => Promise<unknown>;
|
|
841
1534
|
/** Get electronic proof of delivery. */
|
|
842
1535
|
getProofOfDelivery: (params: Record<string, string>) => Promise<unknown>;
|
|
@@ -854,49 +1547,64 @@ declare class WebhooksResource {
|
|
|
854
1547
|
private wsPath;
|
|
855
1548
|
/** List all webhook subscriptions for the workspace. */
|
|
856
1549
|
list(): Promise<ApiResponse<WebhookSubscription[]>>;
|
|
857
|
-
/**
|
|
858
|
-
|
|
859
|
-
|
|
1550
|
+
/**
|
|
1551
|
+
* Create a webhook subscription. `events` is sent as the Gateway's comma-separated `eventTypes`;
|
|
1552
|
+
* omit it to receive every event. The result's `data.secret` is the signing secret, returned only here.
|
|
1553
|
+
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1554
|
+
*/
|
|
860
1555
|
create(request: CreateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
861
|
-
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1556
|
+
/**
|
|
1557
|
+
* Update a webhook subscription. `events`, when given, replaces the subscribed events.
|
|
1558
|
+
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1559
|
+
*/
|
|
1560
|
+
update(webhookId: string, data: UpdateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
1561
|
+
/** Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result. */
|
|
1562
|
+
delete(webhookId: string): Promise<void>;
|
|
865
1563
|
/** Rotate the signing secret for a webhook. */
|
|
866
1564
|
rotateSecret(webhookId: string): Promise<ApiResponse<{
|
|
867
1565
|
secret: string;
|
|
868
1566
|
}>>;
|
|
869
1567
|
/** List delivery logs for a webhook. */
|
|
870
1568
|
listDeliveryLogs(webhookId: string): Promise<ApiResponse<unknown[]>>;
|
|
1569
|
+
/** Send a test event to a webhook's endpoint. */
|
|
1570
|
+
test(webhookId: string): Promise<ApiResponse<unknown>>;
|
|
871
1571
|
/**
|
|
872
|
-
* Verify
|
|
873
|
-
*
|
|
1572
|
+
* Verify that an incoming request is a genuine FlexOps webhook delivery.
|
|
1573
|
+
*
|
|
1574
|
+
* FlexOps signs `{X-FlexOps-Timestamp}.{raw body}` with HMAC-SHA256, keyed with the
|
|
1575
|
+
* subscription secret (the whole `whsec_...` string), and sends
|
|
1576
|
+
* `X-FlexOps-Signature: sha256=<lowercase hex>`.
|
|
1577
|
+
*
|
|
1578
|
+
* @param payload The raw request body exactly as received (string or bytes). Do not pass
|
|
1579
|
+
* re-serialized JSON: `JSON.stringify(req.body)` will not reproduce the signed bytes.
|
|
1580
|
+
* @param signature The `X-FlexOps-Signature` header. `sha256=<hex>` and bare `<hex>` are accepted.
|
|
1581
|
+
* @param secret The subscription signing secret.
|
|
1582
|
+
* @param timestamp The `X-FlexOps-Timestamp` header (Unix seconds).
|
|
1583
|
+
* @param options `toleranceSeconds` (default 300) bounds how far the timestamp may be from now
|
|
1584
|
+
* in either direction; `now` (Unix seconds) overrides the clock, for tests.
|
|
1585
|
+
* @returns `true` only when the signature matches and the timestamp is within tolerance.
|
|
1586
|
+
* @throws TypeError when `secret` is empty or `payload` is not a string or bytes.
|
|
874
1587
|
*/
|
|
875
|
-
static verifySignature(payload: string, signature: string, secret: string): boolean;
|
|
1588
|
+
static verifySignature(payload: string | Uint8Array, signature: string | null | undefined, secret: string, timestamp: string | null | undefined, options?: VerifySignatureOptions): boolean;
|
|
1589
|
+
}
|
|
1590
|
+
/** Options for {@link WebhooksResource.verifySignature}. */
|
|
1591
|
+
interface VerifySignatureOptions {
|
|
1592
|
+
/** Maximum distance, in seconds, between `X-FlexOps-Timestamp` and now. Defaults to 300. */
|
|
1593
|
+
toleranceSeconds?: number;
|
|
1594
|
+
/** The current time in Unix seconds. Defaults to the system clock; set it in tests. */
|
|
1595
|
+
now?: number;
|
|
876
1596
|
}
|
|
877
1597
|
|
|
1598
|
+
/**
|
|
1599
|
+
* The workspace wallet, read-only. Funding, transactions and auto-reload are managed in the
|
|
1600
|
+
* FlexOps portals, not through the API.
|
|
1601
|
+
*/
|
|
878
1602
|
declare class WalletResource {
|
|
879
1603
|
private readonly http;
|
|
880
1604
|
private readonly getWorkspaceId;
|
|
881
1605
|
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>>;
|
|
1606
|
+
/** Get the configured workspace's wallet balance. */
|
|
1607
|
+
getBalance(): Promise<WalletBalance>;
|
|
900
1608
|
}
|
|
901
1609
|
|
|
902
1610
|
declare class InsuranceResource {
|
|
@@ -907,25 +1615,20 @@ declare class InsuranceResource {
|
|
|
907
1615
|
/** Get available insurance providers for this workspace. */
|
|
908
1616
|
getProviders(): Promise<ApiResponse<string[]>>;
|
|
909
1617
|
/** 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>>;
|
|
1618
|
+
getQuote(request: InsuranceQuoteRequest): Promise<ApiResponse<InsuranceQuote>>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Purchase insurance for a shipment. The premium is charged to the workspace wallet. A shipment
|
|
1621
|
+
* that already has a policy in force is refused with 409 `ALREADY_EXISTS`.
|
|
1622
|
+
*
|
|
1623
|
+
* Pass an `idempotencyKey` you store with the purchase to make your own retry safe: after an error or
|
|
1624
|
+
* a timeout, retry with the same key and the Gateway returns the first result instead of buying again.
|
|
1625
|
+
* Without one, the SDK's own retries still share a key, but a new call gets a new key.
|
|
1626
|
+
*/
|
|
1627
|
+
purchase(request: PurchaseInsuranceRequest, idempotencyKey?: string): Promise<ApiResponse<InsurancePolicy>>;
|
|
1628
|
+
/** Void (cancel) an insurance policy. */
|
|
1629
|
+
void(policyId: string): Promise<ApiResponse<InsurancePolicy>>;
|
|
1630
|
+
/** File a claim against a policy. */
|
|
1631
|
+
fileClaim(claim: FileClaimRequest): Promise<ApiResponse<InsuranceClaim>>;
|
|
929
1632
|
}
|
|
930
1633
|
|
|
931
1634
|
declare class ReturnsResource {
|
|
@@ -933,47 +1636,28 @@ declare class ReturnsResource {
|
|
|
933
1636
|
private readonly getWorkspaceId;
|
|
934
1637
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
935
1638
|
private wsPath;
|
|
936
|
-
/** List
|
|
1639
|
+
/** List return authorizations, optionally created between `startDate` and `endDate` (ISO 8601). */
|
|
937
1640
|
list(query?: {
|
|
1641
|
+
startDate?: string;
|
|
1642
|
+
endDate?: string;
|
|
938
1643
|
page?: number;
|
|
939
1644
|
pageSize?: number;
|
|
940
|
-
status?: string;
|
|
941
1645
|
}): Promise<ApiResponse<ReturnAuthorization[]>>;
|
|
942
1646
|
/** Get a return authorization by ID. */
|
|
943
1647
|
get(returnId: string): Promise<ApiResponse<ReturnAuthorization>>;
|
|
944
|
-
/** Create a return authorization (RMA). */
|
|
1648
|
+
/** Create a return authorization (RMA) for an order. */
|
|
945
1649
|
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>>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Generate a return label for an approved RMA.
|
|
1652
|
+
*
|
|
1653
|
+
* The Gateway binds a required request body, so one is always sent (`{}` when `request` is
|
|
1654
|
+
* omitted). Pass `weightOz`, `lengthIn`, `widthIn` and `heightIn`: a workspace with no default
|
|
1655
|
+
* shipping preset has nothing else to take the package from and the call fails with a 400 that
|
|
1656
|
+
* names the missing fields.
|
|
1657
|
+
*/
|
|
1658
|
+
generateLabel(rmaNumber: string, request?: ReturnLabelRequest): Promise<ApiResponse<unknown>>;
|
|
1659
|
+
/** Record the inspected items of a returned package at a warehouse. */
|
|
1660
|
+
markReceived(rmaId: string, request: ReceiveReturnRequest): Promise<ApiResponse<unknown>>;
|
|
977
1661
|
}
|
|
978
1662
|
|
|
979
1663
|
type DateRange = {
|
|
@@ -1025,8 +1709,6 @@ declare class OrdersResource {
|
|
|
1025
1709
|
private readonly http;
|
|
1026
1710
|
constructor(http: HttpClient);
|
|
1027
1711
|
private path;
|
|
1028
|
-
/** Create a new order. */
|
|
1029
|
-
create(order: unknown): Promise<ApiResponse<unknown>>;
|
|
1030
1712
|
/** Get new orders awaiting processing. */
|
|
1031
1713
|
getNewOrders(params?: Record<string, string>): Promise<ApiResponse<Order[]>>;
|
|
1032
1714
|
/** Get all orders filtered by status. */
|
|
@@ -1037,8 +1719,6 @@ declare class OrdersResource {
|
|
|
1037
1719
|
getExtendedDetails(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1038
1720
|
/** Get order status by order number. */
|
|
1039
1721
|
getStatus(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1040
|
-
/** Cancel an order. */
|
|
1041
|
-
cancel(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1042
1722
|
/** Get all items for an order. */
|
|
1043
1723
|
getItems(orderNumber: string): Promise<ApiResponse<unknown>>;
|
|
1044
1724
|
/** Get available ship methods. */
|
|
@@ -1054,16 +1734,12 @@ declare class OrdersResource {
|
|
|
1054
1734
|
declare class InventoryResource {
|
|
1055
1735
|
private readonly http;
|
|
1056
1736
|
constructor(http: HttpClient);
|
|
1057
|
-
/** Post a new ASN (Advance Shipment Notice) receipt. */
|
|
1058
|
-
postAsnReceipt(receipt: unknown): Promise<ApiResponse<unknown>>;
|
|
1059
1737
|
/** Get a warehouse inventory snapshot. */
|
|
1060
1738
|
getWarehouseSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1061
1739
|
/** Get a complete inventory snapshot across all warehouses. */
|
|
1062
1740
|
getCompleteSnapshot(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1063
1741
|
/** Get the list of all part numbers. */
|
|
1064
1742
|
getPartNumbers(params?: Record<string, string>): Promise<ApiResponse<unknown>>;
|
|
1065
|
-
/** Update customer inventory (V2). */
|
|
1066
|
-
updateInventory(data: unknown): Promise<ApiResponse<unknown>>;
|
|
1067
1743
|
}
|
|
1068
1744
|
|
|
1069
1745
|
declare class PickupsResource {
|
|
@@ -1075,8 +1751,8 @@ declare class PickupsResource {
|
|
|
1075
1751
|
schedule(request: PickupRequest): Promise<ApiResponse<PickupConfirmation>>;
|
|
1076
1752
|
/** List scheduled pickups. */
|
|
1077
1753
|
list(): Promise<ApiResponse<PickupConfirmation[]>>;
|
|
1078
|
-
/** Get pickup details. */
|
|
1079
|
-
get(pickupId: string): Promise<ApiResponse<PickupConfirmation>>;
|
|
1754
|
+
/** Get pickup details. The carrier defaults to `usps` on the Gateway. */
|
|
1755
|
+
get(pickupId: string, carrierCode?: string): Promise<ApiResponse<PickupConfirmation>>;
|
|
1080
1756
|
/** Cancel a scheduled pickup. */
|
|
1081
1757
|
cancel(pickupId: string): Promise<ApiResponse<unknown>>;
|
|
1082
1758
|
}
|
|
@@ -1104,108 +1780,145 @@ declare class RulesResource {
|
|
|
1104
1780
|
/** Get a rule by ID. */
|
|
1105
1781
|
get(ruleId: string): Promise<ApiResponse<ShippingRule>>;
|
|
1106
1782
|
/** Create a shipping rule. */
|
|
1107
|
-
create(rule:
|
|
1108
|
-
/**
|
|
1109
|
-
update(ruleId: string, rule:
|
|
1110
|
-
/** Delete a shipping rule. */
|
|
1111
|
-
delete(ruleId: string): Promise<
|
|
1112
|
-
/** Reorder rules (
|
|
1113
|
-
reorder(ruleIds: string[]): Promise<ApiResponse<
|
|
1783
|
+
create(rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1784
|
+
/** Replace a shipping rule. */
|
|
1785
|
+
update(ruleId: string, rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1786
|
+
/** Delete a shipping rule. The Gateway answers 204 No Content, so there is no result. */
|
|
1787
|
+
delete(ruleId: string): Promise<void>;
|
|
1788
|
+
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1789
|
+
reorder(ruleIds: string[]): Promise<ApiResponse<ShippingRule[]>>;
|
|
1790
|
+
/** Dry-run the workspace's rules against a sample shipment, without changing anything. */
|
|
1791
|
+
test(request: ShippingRuleTestRequest): Promise<ApiResponse<unknown>>;
|
|
1114
1792
|
}
|
|
1115
1793
|
|
|
1116
|
-
|
|
1794
|
+
/** Carbon offsets for shipments. Requires the Pro plan or above. */
|
|
1795
|
+
declare class CarbonOffsetsResource {
|
|
1117
1796
|
private readonly http;
|
|
1118
1797
|
private readonly getWorkspaceId;
|
|
1119
1798
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1120
1799
|
private wsPath;
|
|
1121
|
-
/**
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1800
|
+
/** Quote an offset for a shipment without buying it. */
|
|
1801
|
+
quote(request: CarbonOffsetQuoteRequest): Promise<ApiResponse<CarbonOffsetQuote>>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Buy an offset for a shipment. The cost is charged to the workspace wallet and refunded if the
|
|
1804
|
+
* offset provider fails.
|
|
1805
|
+
*
|
|
1806
|
+
* Pass an `idempotencyKey` you store with the purchase to make your own retry safe: after an error or
|
|
1807
|
+
* a timeout, retry with the same key and the Gateway returns the first result instead of buying again.
|
|
1808
|
+
* Without one, the SDK's own retries still share a key, but a new call gets a new key.
|
|
1809
|
+
*/
|
|
1810
|
+
purchase(request: CarbonOffsetPurchaseRequest, idempotencyKey?: string): Promise<ApiResponse<CarbonOffset>>;
|
|
1811
|
+
/** List the workspace's offsets, newest first. */
|
|
1812
|
+
list(query?: {
|
|
1813
|
+
page?: number;
|
|
1814
|
+
pageSize?: number;
|
|
1815
|
+
}): Promise<ApiResponse<CarbonOffset[]>>;
|
|
1816
|
+
/** Get one offset. */
|
|
1817
|
+
get(offsetId: string): Promise<ApiResponse<CarbonOffset>>;
|
|
1818
|
+
/** Totals across the workspace's offsets. */
|
|
1819
|
+
getSummary(): Promise<ApiResponse<CarbonOffsetSummary>>;
|
|
1820
|
+
/** Get the automatic-offset setting. */
|
|
1821
|
+
getSettings(): Promise<ApiResponse<CarbonOffsetSettings>>;
|
|
1822
|
+
/** Turn automatic offsets on or off. */
|
|
1823
|
+
updateSettings(settings: CarbonOffsetSettings): Promise<ApiResponse<CarbonOffsetSettings>>;
|
|
1127
1824
|
}
|
|
1128
1825
|
|
|
1129
|
-
|
|
1826
|
+
/**
|
|
1827
|
+
* Recurring shipments: a saved destination address and shipping preset that create an order on a
|
|
1828
|
+
* schedule. Requires the Pro plan or above.
|
|
1829
|
+
*
|
|
1830
|
+
* Reads work with any API key. Writes need a user token (`auth.login`) or an API key granted
|
|
1831
|
+
* `recurring-shipments:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`. Responses are the
|
|
1832
|
+
* bare objects, not the `{ success, data }` envelope.
|
|
1833
|
+
*/
|
|
1834
|
+
declare class RecurringShipmentsResource {
|
|
1130
1835
|
private readonly http;
|
|
1131
1836
|
private readonly getWorkspaceId;
|
|
1132
1837
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1133
1838
|
private wsPath;
|
|
1134
|
-
/**
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1839
|
+
/** List the workspace's recurring shipments. */
|
|
1840
|
+
list(): Promise<RecurringShipment[]>;
|
|
1841
|
+
/** Get one recurring shipment. */
|
|
1842
|
+
get(id: string): Promise<RecurringShipment>;
|
|
1843
|
+
/** Create a recurring shipment. The first run is at `firstRunUtc`. */
|
|
1844
|
+
create(request: CreateRecurringShipmentRequest): Promise<RecurringShipment>;
|
|
1845
|
+
/** Change a recurring shipment. Fields left out stay as they are. */
|
|
1846
|
+
update(id: string, request: UpdateRecurringShipmentRequest): Promise<RecurringShipment>;
|
|
1847
|
+
/** Delete a recurring shipment. */
|
|
1848
|
+
delete(id: string): Promise<void>;
|
|
1849
|
+
/** Stop scheduled runs until `resume` is called. */
|
|
1850
|
+
pause(id: string): Promise<void>;
|
|
1851
|
+
/** Restart scheduled runs. */
|
|
1852
|
+
resume(id: string): Promise<void>;
|
|
1853
|
+
/**
|
|
1854
|
+
* Run a recurring shipment now, which creates an order. Pass your own `idempotencyKey` to make a
|
|
1855
|
+
* retry from your side safe too; the SDK's own retries always reuse one key.
|
|
1856
|
+
*/
|
|
1857
|
+
trigger(id: string, idempotencyKey?: string): Promise<void>;
|
|
1143
1858
|
}
|
|
1144
1859
|
|
|
1145
|
-
|
|
1860
|
+
/**
|
|
1861
|
+
* Scheduled report emails (2.x called this resource `reports`).
|
|
1862
|
+
*
|
|
1863
|
+
* Reads work with any API key. Writes need a user token (`auth.login`) or an API key granted
|
|
1864
|
+
* `report-schedules:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`.
|
|
1865
|
+
*/
|
|
1866
|
+
declare class ReportSchedulesResource {
|
|
1146
1867
|
private readonly http;
|
|
1147
1868
|
private readonly getWorkspaceId;
|
|
1148
1869
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1149
1870
|
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>>;
|
|
1871
|
+
/** List the workspace's report schedules. */
|
|
1872
|
+
list(): Promise<ApiResponse<ReportSchedule[]>>;
|
|
1873
|
+
/** Get one report schedule. */
|
|
1874
|
+
get(id: string): Promise<ApiResponse<ReportSchedule>>;
|
|
1875
|
+
/** Create a report schedule. */
|
|
1876
|
+
create(request: CreateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1877
|
+
/** Change a report schedule. Fields left out stay as they are. */
|
|
1878
|
+
update(id: string, request: UpdateReportScheduleRequest): Promise<ApiResponse<ReportSchedule>>;
|
|
1879
|
+
/** Delete a report schedule. */
|
|
1880
|
+
delete(id: string): Promise<void>;
|
|
1881
|
+
/** Turn a schedule on or off (flips `isEnabled`). */
|
|
1882
|
+
toggle(id: string): Promise<ApiResponse<null>>;
|
|
1170
1883
|
}
|
|
1171
1884
|
|
|
1885
|
+
/**
|
|
1886
|
+
* Tracking email templates: one per tracking event (`TrackingEmailEvent`), sent to the recipient
|
|
1887
|
+
* when that event happens.
|
|
1888
|
+
*
|
|
1889
|
+
* Reads work with any API key. Writes, including `preview`, need a user token (`auth.login`) or an
|
|
1890
|
+
* API key granted `email-templates:write`; any other key gets 403 `API_KEY_SCOPE_REQUIRED`.
|
|
1891
|
+
* Responses are the bare objects, not the `{ success, data }` envelope.
|
|
1892
|
+
*/
|
|
1172
1893
|
declare class EmailTemplatesResource {
|
|
1173
1894
|
private readonly http;
|
|
1174
1895
|
private readonly getWorkspaceId;
|
|
1175
1896
|
constructor(http: HttpClient, getWorkspaceId: () => string | undefined);
|
|
1176
1897
|
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
|
-
}>>;
|
|
1898
|
+
/** List the workspace's templates. */
|
|
1899
|
+
list(): Promise<EmailTemplate[]>;
|
|
1900
|
+
/** Get one template. */
|
|
1901
|
+
get(templateId: string): Promise<EmailTemplate>;
|
|
1902
|
+
/** Create or replace the template for `request.eventType`. */
|
|
1903
|
+
upsert(request: UpsertEmailTemplateRequest): Promise<EmailTemplate>;
|
|
1904
|
+
/** Delete a template; that event then uses the FlexOps default email. */
|
|
1905
|
+
delete(templateId: string): Promise<void>;
|
|
1906
|
+
/** Render a subject and body with sample shipment data, without saving anything. */
|
|
1907
|
+
preview(request: EmailTemplatePreviewRequest): Promise<EmailTemplatePreview>;
|
|
1192
1908
|
}
|
|
1193
1909
|
|
|
1194
|
-
declare class
|
|
1910
|
+
declare class HsCodesResource {
|
|
1195
1911
|
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>>;
|
|
1912
|
+
constructor(http: HttpClient);
|
|
1913
|
+
/** Search for HS codes by product description. Requires Enterprise plan. */
|
|
1914
|
+
search(query: string, options?: {
|
|
1915
|
+
destinationCountry?: string;
|
|
1916
|
+
maxResults?: number;
|
|
1917
|
+
}): Promise<HsCodeResult[]>;
|
|
1918
|
+
/** Look up a specific HS code by its tariff number. Requires Enterprise plan. */
|
|
1919
|
+
lookup(code: string): Promise<HsCodeResult>;
|
|
1920
|
+
/** Estimate the total landed cost (duty + tax + shipping) for a shipment. Requires Enterprise plan. */
|
|
1921
|
+
estimateLandedCost(request: LandedCostRequest): Promise<LandedCostEstimate>;
|
|
1209
1922
|
}
|
|
1210
1923
|
|
|
1211
1924
|
/**
|
|
@@ -1247,20 +1960,10 @@ declare class ReportsResource {
|
|
|
1247
1960
|
* // Token is automatically stored and used for subsequent requests
|
|
1248
1961
|
* ```
|
|
1249
1962
|
*
|
|
1250
|
-
* @example
|
|
1963
|
+
* @example Carrier-specific reads
|
|
1251
1964
|
* ```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
|
-
* });
|
|
1965
|
+
* // USPS tracking detail through the read-only carrier pass-through
|
|
1966
|
+
* const tracking = await client.carriers.usps.trackDetail({ trackingNumber: '9400...' });
|
|
1264
1967
|
* ```
|
|
1265
1968
|
*/
|
|
1266
1969
|
declare class FlexOps {
|
|
@@ -1274,18 +1977,17 @@ declare class FlexOps {
|
|
|
1274
1977
|
readonly wallet: WalletResource;
|
|
1275
1978
|
readonly insurance: InsuranceResource;
|
|
1276
1979
|
readonly returns: ReturnsResource;
|
|
1277
|
-
readonly apiKeys: ApiKeysResource;
|
|
1278
1980
|
readonly analytics: AnalyticsResource;
|
|
1279
1981
|
readonly orders: OrdersResource;
|
|
1280
1982
|
readonly inventory: InventoryResource;
|
|
1281
1983
|
readonly pickups: PickupsResource;
|
|
1282
1984
|
readonly scanForms: ScanFormsResource;
|
|
1283
1985
|
readonly rules: RulesResource;
|
|
1284
|
-
readonly
|
|
1285
|
-
readonly hsCodes: HsCodesResource;
|
|
1986
|
+
readonly carbonOffsets: CarbonOffsetsResource;
|
|
1286
1987
|
readonly recurringShipments: RecurringShipmentsResource;
|
|
1988
|
+
readonly reportSchedules: ReportSchedulesResource;
|
|
1287
1989
|
readonly emailTemplates: EmailTemplatesResource;
|
|
1288
|
-
readonly
|
|
1990
|
+
readonly hsCodes: HsCodesResource;
|
|
1289
1991
|
constructor(config?: FlexOpsConfig);
|
|
1290
1992
|
/** Get or set the active workspace ID. */
|
|
1291
1993
|
get workspaceId(): string | undefined;
|
|
@@ -1296,4 +1998,5 @@ declare class FlexOps {
|
|
|
1296
1998
|
setApiKey(key: string): void;
|
|
1297
1999
|
}
|
|
1298
2000
|
|
|
1299
|
-
export {
|
|
2001
|
+
export { AnalyticsResource, AuthResource, CarbonOffsetsResource, CarriersResource, EmailTemplatesResource, FlexOps, FlexOpsAuthError, FlexOpsError, FlexOpsRateLimitError, HazmatClassification, HsCodesResource, InsuranceResource, InventoryResource, OrdersResource, PickupsResource, RecurrenceInterval, RecurringShipmentsResource, ReportFormat, ReportFrequency, ReportSchedulesResource, ReturnsResource, RulesResource, ScanFormsResource, ShippingResource, TrackingEmailEvent, WalletResource, WebhookEventType, WebhooksResource, WorkspaceRole, WorkspacesResource };
|
|
2002
|
+
export type { Address, AddressValidationResult, ApiResponse, BatchLabelItem, BatchLabelItemResult, BatchLabelJob, BatchLabelRequest, CanonicalLabelRequest, CanonicalRateRequest, CarbonOffset, CarbonOffsetPurchaseRequest, CarbonOffsetQuote, CarbonOffsetQuoteRequest, CarbonOffsetSettings, CarbonOffsetSummary, CarrierRecommendation, CarrierRecommendationRequest, CarrierRecommendationResponse, CarrierSummary, CostSavingsSummary, CreateBatchLabelRequest, CreateLabelRequest, CreateRecurringShipmentRequest, CreateReportScheduleRequest, CreateWebhookRequest, CustomsItem, DeliveryPredictionRequest, DeliveryPredictionResponse, EmailTemplate, EmailTemplatePreview, EmailTemplatePreviewRequest, FileClaimRequest, FlexOpsConfig, HsCodeResult, InsuranceClaim, InsurancePolicy, InsuranceQuote, InsuranceQuoteRequest, Label, LabelPurchaseApproval, LabelPurchasePreview, LandedCostEstimate, LandedCostRequest, LaneSavingsOpportunity, LegacyRateRequest, LoginRequest, LoginResponse, Order, OrderItem, PaginatedResponse, Parcel, PendingInvite, PickupConfirmation, PickupRequest, PurchaseInsuranceRequest, RateRequest, ReceiveReturnRequest, RecurringShipment, ReportSchedule, RetryConfig, ReturnAuthorization, ReturnDisposition, ReturnItem, ReturnLabelRequest, ReturnRequest, RuleAction, RuleCondition, ScanForm, ScanFormRequest, ShipmentsTrend, ShippingAddress, ShippingPackage, ShippingRate, ShippingRule, ShippingRuleInput, ShippingRuleTestRequest, SuggestedAddress, TrackingEvent, TrackingInfo, UpdateRecurringShipmentRequest, UpdateReportScheduleRequest, UpdateWebhookRequest, UpsertEmailTemplateRequest, VerifySignatureOptions, WalletBalance, WebhookSubscription, Workspace, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList };
|