@flexops/sdk 3.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 +25 -9
- package/dist/index.d.mts +90 -8
- package/dist/index.d.ts +90 -8
- package/dist/index.js +40 -9
- package/dist/index.mjs +40 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -124,19 +124,35 @@ if (result.validationUnavailable) {
|
|
|
124
124
|
|
|
125
125
|
### Batch Labels
|
|
126
126
|
|
|
127
|
+
Each item is an order you already have in FlexOps; the addresses come from the order. Leave out
|
|
128
|
+
`carrierCode` and `serviceCode` to let your shipping rules choose.
|
|
129
|
+
|
|
127
130
|
```typescript
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
import { HazmatClassification, type CreateBatchLabelRequest } from '@flexops/sdk';
|
|
132
|
+
|
|
133
|
+
const request: CreateBatchLabelRequest = {
|
|
134
|
+
items: [
|
|
135
|
+
{
|
|
136
|
+
orderId: 12345,
|
|
137
|
+
packageWeightInOunces: 12,
|
|
138
|
+
packageLengthInInches: 10,
|
|
139
|
+
packageWidthInInches: 8,
|
|
140
|
+
packageHeightInInches: 4,
|
|
141
|
+
carrierCode: 'USPS',
|
|
142
|
+
serviceCode: 'PRIORITY',
|
|
143
|
+
hazmatClassification: HazmatClassification.None,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
132
147
|
|
|
133
|
-
//
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
148
|
+
// Preview (dry-run): per-order rates and the total, nothing bought
|
|
149
|
+
const preview = await client.shipping.previewBatch(request);
|
|
150
|
+
|
|
151
|
+
// Create the batch; it runs in the background
|
|
152
|
+
const batch = await client.shipping.createBatch(request);
|
|
137
153
|
|
|
138
154
|
// Check status
|
|
139
|
-
const status = await client.shipping.getBatchStatus(batch.data
|
|
155
|
+
const status = await client.shipping.getBatchStatus(batch.data!.jobId);
|
|
140
156
|
```
|
|
141
157
|
|
|
142
158
|
## Carrier-Specific Calls
|
package/dist/index.d.mts
CHANGED
|
@@ -335,17 +335,80 @@ interface SuggestedAddress {
|
|
|
335
335
|
postalCode: string;
|
|
336
336
|
country: string;
|
|
337
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;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @deprecated The Gateway refuses this shape: batch items are orders, not labels. Use
|
|
373
|
+
* CreateBatchLabelRequest.
|
|
374
|
+
*/
|
|
338
375
|
interface BatchLabelRequest {
|
|
339
376
|
items: CreateLabelRequest[];
|
|
340
377
|
idempotencyKey?: string;
|
|
341
378
|
}
|
|
342
379
|
interface BatchLabelJob {
|
|
343
380
|
jobId: string;
|
|
344
|
-
status: '
|
|
381
|
+
status: 'Pending' | 'Processing' | 'Completed' | 'CompletedWithErrors' | 'Failed';
|
|
345
382
|
totalItems: number;
|
|
346
383
|
completedItems: number;
|
|
347
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;
|
|
348
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;
|
|
349
412
|
}
|
|
350
413
|
interface Order {
|
|
351
414
|
orderNumber: string;
|
|
@@ -639,6 +702,10 @@ interface CarrierRecommendationRequest {
|
|
|
639
702
|
}
|
|
640
703
|
interface CarrierRecommendationResponse {
|
|
641
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
|
+
*/
|
|
642
709
|
sampleSize: number;
|
|
643
710
|
recommendations: CarrierRecommendation[];
|
|
644
711
|
}
|
|
@@ -647,7 +714,13 @@ interface CarrierRecommendation {
|
|
|
647
714
|
score: number;
|
|
648
715
|
onTimePercent: number;
|
|
649
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
|
+
*/
|
|
650
722
|
avgCost: number;
|
|
723
|
+
/** Shipments analyzed for this carrier: exact for workspace data, a band floor for network data. */
|
|
651
724
|
shipmentCount: number;
|
|
652
725
|
exceptionRate: number;
|
|
653
726
|
reason: string;
|
|
@@ -669,6 +742,7 @@ interface DeliveryPredictionResponse {
|
|
|
669
742
|
worstCaseDelivery: string;
|
|
670
743
|
predictedTransitDays: number;
|
|
671
744
|
confidence: number;
|
|
745
|
+
/** Shipments used: exact for the workspace's own data, a band floor for FlexOps network data. */
|
|
672
746
|
sampleSize: number;
|
|
673
747
|
onTimeRate: number;
|
|
674
748
|
}
|
|
@@ -1021,9 +1095,16 @@ declare class ShippingResource {
|
|
|
1021
1095
|
track(trackingNumber: string): Promise<TrackingInfo>;
|
|
1022
1096
|
/** Validate and correct a shipping address. */
|
|
1023
1097
|
validateAddress(address: Address | ShippingAddress): Promise<AddressValidationResult>;
|
|
1024
|
-
/**
|
|
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. */
|
|
1025
1104
|
createBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1026
|
-
/** 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. */
|
|
1027
1108
|
previewBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1028
1109
|
/** Get batch job status. */
|
|
1029
1110
|
getBatchStatus(jobId: string): Promise<ApiResponse<BatchLabelJob>>;
|
|
@@ -1477,8 +1558,8 @@ declare class WebhooksResource {
|
|
|
1477
1558
|
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1478
1559
|
*/
|
|
1479
1560
|
update(webhookId: string, data: UpdateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
1480
|
-
/** Delete a webhook subscription. */
|
|
1481
|
-
delete(webhookId: string): Promise<
|
|
1561
|
+
/** Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result. */
|
|
1562
|
+
delete(webhookId: string): Promise<void>;
|
|
1482
1563
|
/** Rotate the signing secret for a webhook. */
|
|
1483
1564
|
rotateSecret(webhookId: string): Promise<ApiResponse<{
|
|
1484
1565
|
secret: string;
|
|
@@ -1702,8 +1783,8 @@ declare class RulesResource {
|
|
|
1702
1783
|
create(rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1703
1784
|
/** Replace a shipping rule. */
|
|
1704
1785
|
update(ruleId: string, rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1705
|
-
/** Delete a shipping rule. */
|
|
1706
|
-
delete(ruleId: string): Promise<
|
|
1786
|
+
/** Delete a shipping rule. The Gateway answers 204 No Content, so there is no result. */
|
|
1787
|
+
delete(ruleId: string): Promise<void>;
|
|
1707
1788
|
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1708
1789
|
reorder(ruleIds: string[]): Promise<ApiResponse<ShippingRule[]>>;
|
|
1709
1790
|
/** Dry-run the workspace's rules against a sample shipment, without changing anything. */
|
|
@@ -1917,4 +1998,5 @@ declare class FlexOps {
|
|
|
1917
1998
|
setApiKey(key: string): void;
|
|
1918
1999
|
}
|
|
1919
2000
|
|
|
1920
|
-
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -335,17 +335,80 @@ interface SuggestedAddress {
|
|
|
335
335
|
postalCode: string;
|
|
336
336
|
country: string;
|
|
337
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;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @deprecated The Gateway refuses this shape: batch items are orders, not labels. Use
|
|
373
|
+
* CreateBatchLabelRequest.
|
|
374
|
+
*/
|
|
338
375
|
interface BatchLabelRequest {
|
|
339
376
|
items: CreateLabelRequest[];
|
|
340
377
|
idempotencyKey?: string;
|
|
341
378
|
}
|
|
342
379
|
interface BatchLabelJob {
|
|
343
380
|
jobId: string;
|
|
344
|
-
status: '
|
|
381
|
+
status: 'Pending' | 'Processing' | 'Completed' | 'CompletedWithErrors' | 'Failed';
|
|
345
382
|
totalItems: number;
|
|
346
383
|
completedItems: number;
|
|
347
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;
|
|
348
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;
|
|
349
412
|
}
|
|
350
413
|
interface Order {
|
|
351
414
|
orderNumber: string;
|
|
@@ -639,6 +702,10 @@ interface CarrierRecommendationRequest {
|
|
|
639
702
|
}
|
|
640
703
|
interface CarrierRecommendationResponse {
|
|
641
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
|
+
*/
|
|
642
709
|
sampleSize: number;
|
|
643
710
|
recommendations: CarrierRecommendation[];
|
|
644
711
|
}
|
|
@@ -647,7 +714,13 @@ interface CarrierRecommendation {
|
|
|
647
714
|
score: number;
|
|
648
715
|
onTimePercent: number;
|
|
649
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
|
+
*/
|
|
650
722
|
avgCost: number;
|
|
723
|
+
/** Shipments analyzed for this carrier: exact for workspace data, a band floor for network data. */
|
|
651
724
|
shipmentCount: number;
|
|
652
725
|
exceptionRate: number;
|
|
653
726
|
reason: string;
|
|
@@ -669,6 +742,7 @@ interface DeliveryPredictionResponse {
|
|
|
669
742
|
worstCaseDelivery: string;
|
|
670
743
|
predictedTransitDays: number;
|
|
671
744
|
confidence: number;
|
|
745
|
+
/** Shipments used: exact for the workspace's own data, a band floor for FlexOps network data. */
|
|
672
746
|
sampleSize: number;
|
|
673
747
|
onTimeRate: number;
|
|
674
748
|
}
|
|
@@ -1021,9 +1095,16 @@ declare class ShippingResource {
|
|
|
1021
1095
|
track(trackingNumber: string): Promise<TrackingInfo>;
|
|
1022
1096
|
/** Validate and correct a shipping address. */
|
|
1023
1097
|
validateAddress(address: Address | ShippingAddress): Promise<AddressValidationResult>;
|
|
1024
|
-
/**
|
|
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. */
|
|
1025
1104
|
createBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1026
|
-
/** 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. */
|
|
1027
1108
|
previewBatch(request: BatchLabelRequest): Promise<ApiResponse<BatchLabelJob>>;
|
|
1028
1109
|
/** Get batch job status. */
|
|
1029
1110
|
getBatchStatus(jobId: string): Promise<ApiResponse<BatchLabelJob>>;
|
|
@@ -1477,8 +1558,8 @@ declare class WebhooksResource {
|
|
|
1477
1558
|
* @throws FlexOpsError (`UnknownWebhookEvent`) when `events` is empty or names an event FlexOps does not send.
|
|
1478
1559
|
*/
|
|
1479
1560
|
update(webhookId: string, data: UpdateWebhookRequest): Promise<ApiResponse<WebhookSubscription>>;
|
|
1480
|
-
/** Delete a webhook subscription. */
|
|
1481
|
-
delete(webhookId: string): Promise<
|
|
1561
|
+
/** Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result. */
|
|
1562
|
+
delete(webhookId: string): Promise<void>;
|
|
1482
1563
|
/** Rotate the signing secret for a webhook. */
|
|
1483
1564
|
rotateSecret(webhookId: string): Promise<ApiResponse<{
|
|
1484
1565
|
secret: string;
|
|
@@ -1702,8 +1783,8 @@ declare class RulesResource {
|
|
|
1702
1783
|
create(rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1703
1784
|
/** Replace a shipping rule. */
|
|
1704
1785
|
update(ruleId: string, rule: ShippingRuleInput): Promise<ApiResponse<ShippingRule>>;
|
|
1705
|
-
/** Delete a shipping rule. */
|
|
1706
|
-
delete(ruleId: string): Promise<
|
|
1786
|
+
/** Delete a shipping rule. The Gateway answers 204 No Content, so there is no result. */
|
|
1787
|
+
delete(ruleId: string): Promise<void>;
|
|
1707
1788
|
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1708
1789
|
reorder(ruleIds: string[]): Promise<ApiResponse<ShippingRule[]>>;
|
|
1709
1790
|
/** Dry-run the workspace's rules against a sample shipment, without changing anything. */
|
|
@@ -1917,4 +1998,5 @@ declare class FlexOps {
|
|
|
1917
1998
|
setApiKey(key: string): void;
|
|
1918
1999
|
}
|
|
1919
2000
|
|
|
1920
|
-
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 };
|
package/dist/index.js
CHANGED
|
@@ -108,6 +108,9 @@ var FlexOpsError = class extends Error {
|
|
|
108
108
|
this.errors = errors;
|
|
109
109
|
this.name = "FlexOpsError";
|
|
110
110
|
}
|
|
111
|
+
status;
|
|
112
|
+
code;
|
|
113
|
+
errors;
|
|
111
114
|
};
|
|
112
115
|
var FlexOpsRateLimitError = class extends FlexOpsError {
|
|
113
116
|
constructor(message, retryAfter) {
|
|
@@ -115,6 +118,7 @@ var FlexOpsRateLimitError = class extends FlexOpsError {
|
|
|
115
118
|
this.retryAfter = retryAfter;
|
|
116
119
|
this.name = "FlexOpsRateLimitError";
|
|
117
120
|
}
|
|
121
|
+
retryAfter;
|
|
118
122
|
};
|
|
119
123
|
var FlexOpsAuthError = class extends FlexOpsError {
|
|
120
124
|
constructor(message) {
|
|
@@ -314,6 +318,7 @@ var AuthResource = class {
|
|
|
314
318
|
constructor(http) {
|
|
315
319
|
this.http = http;
|
|
316
320
|
}
|
|
321
|
+
http;
|
|
317
322
|
/**
|
|
318
323
|
* Authenticate with email and password. On success the returned access token (`data.token`) is
|
|
319
324
|
* used for later requests. When `data.requiresTwoFactor` is true no token is issued yet.
|
|
@@ -357,6 +362,8 @@ var WorkspacesResource = class {
|
|
|
357
362
|
this.http = http;
|
|
358
363
|
this.getWorkspaceId = getWorkspaceId;
|
|
359
364
|
}
|
|
365
|
+
http;
|
|
366
|
+
getWorkspaceId;
|
|
360
367
|
wsPath(suffix) {
|
|
361
368
|
const id = this.getWorkspaceId();
|
|
362
369
|
if (!id) throw new Error("workspaceId is required. Set it via client.workspaceId or config.");
|
|
@@ -395,6 +402,8 @@ var ShippingResource = class {
|
|
|
395
402
|
this.http = http;
|
|
396
403
|
this.getWorkspaceId = getWorkspaceId;
|
|
397
404
|
}
|
|
405
|
+
http;
|
|
406
|
+
getWorkspaceId;
|
|
398
407
|
wsPath(suffix) {
|
|
399
408
|
const id = this.getWorkspaceId();
|
|
400
409
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -489,14 +498,9 @@ var ShippingResource = class {
|
|
|
489
498
|
country: a.countryCode ?? "US"
|
|
490
499
|
});
|
|
491
500
|
}
|
|
492
|
-
// -----------------------------------------------------------------------
|
|
493
|
-
// Batch Labels
|
|
494
|
-
// -----------------------------------------------------------------------
|
|
495
|
-
/** Create labels in batch. */
|
|
496
501
|
async createBatch(request) {
|
|
497
502
|
return this.http.post(this.wsPath("labels/batch"), request);
|
|
498
503
|
}
|
|
499
|
-
/** Preview a batch without purchasing (dry-run). */
|
|
500
504
|
async previewBatch(request) {
|
|
501
505
|
return this.http.post(this.wsPath("labels/batch/preview"), request);
|
|
502
506
|
}
|
|
@@ -579,6 +583,7 @@ var CarriersResource = class {
|
|
|
579
583
|
constructor(http) {
|
|
580
584
|
this.http = http;
|
|
581
585
|
}
|
|
586
|
+
http;
|
|
582
587
|
proxy(path) {
|
|
583
588
|
return `/api/ApiProxy/${path.replace(/^\//, "")}`;
|
|
584
589
|
}
|
|
@@ -1010,6 +1015,8 @@ var WebhooksResource = class {
|
|
|
1010
1015
|
this.http = http;
|
|
1011
1016
|
this.getWorkspaceId = getWorkspaceId;
|
|
1012
1017
|
}
|
|
1018
|
+
http;
|
|
1019
|
+
getWorkspaceId;
|
|
1013
1020
|
wsPath(suffix) {
|
|
1014
1021
|
const id = this.getWorkspaceId();
|
|
1015
1022
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1035,9 +1042,9 @@ var WebhooksResource = class {
|
|
|
1035
1042
|
async update(webhookId, data) {
|
|
1036
1043
|
return this.http.put(this.wsPath(webhookId), toWireRequest(data));
|
|
1037
1044
|
}
|
|
1038
|
-
/** Delete a webhook subscription. */
|
|
1045
|
+
/** Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result. */
|
|
1039
1046
|
async delete(webhookId) {
|
|
1040
|
-
|
|
1047
|
+
await this.http.delete(this.wsPath(webhookId));
|
|
1041
1048
|
}
|
|
1042
1049
|
/** Rotate the signing secret for a webhook. */
|
|
1043
1050
|
async rotateSecret(webhookId) {
|
|
@@ -1128,6 +1135,8 @@ var WalletResource = class {
|
|
|
1128
1135
|
this.http = http;
|
|
1129
1136
|
this.getWorkspaceId = getWorkspaceId;
|
|
1130
1137
|
}
|
|
1138
|
+
http;
|
|
1139
|
+
getWorkspaceId;
|
|
1131
1140
|
/** Get the configured workspace's wallet balance. */
|
|
1132
1141
|
async getBalance() {
|
|
1133
1142
|
const id = this.getWorkspaceId();
|
|
@@ -1142,6 +1151,8 @@ var InsuranceResource = class {
|
|
|
1142
1151
|
this.http = http;
|
|
1143
1152
|
this.getWorkspaceId = getWorkspaceId;
|
|
1144
1153
|
}
|
|
1154
|
+
http;
|
|
1155
|
+
getWorkspaceId;
|
|
1145
1156
|
wsPath(suffix) {
|
|
1146
1157
|
const id = this.getWorkspaceId();
|
|
1147
1158
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1185,6 +1196,8 @@ var ReturnsResource = class {
|
|
|
1185
1196
|
this.http = http;
|
|
1186
1197
|
this.getWorkspaceId = getWorkspaceId;
|
|
1187
1198
|
}
|
|
1199
|
+
http;
|
|
1200
|
+
getWorkspaceId;
|
|
1188
1201
|
wsPath(suffix) {
|
|
1189
1202
|
const id = this.getWorkspaceId();
|
|
1190
1203
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1227,6 +1240,7 @@ var AnalyticsResource = class {
|
|
|
1227
1240
|
constructor(http) {
|
|
1228
1241
|
this.http = http;
|
|
1229
1242
|
}
|
|
1243
|
+
http;
|
|
1230
1244
|
path(endpoint) {
|
|
1231
1245
|
return `/api/ApiProxy/api/v4/Analytics/${endpoint}`;
|
|
1232
1246
|
}
|
|
@@ -1297,6 +1311,7 @@ var OrdersResource = class {
|
|
|
1297
1311
|
constructor(http) {
|
|
1298
1312
|
this.http = http;
|
|
1299
1313
|
}
|
|
1314
|
+
http;
|
|
1300
1315
|
path(endpoint) {
|
|
1301
1316
|
return `/api/ApiProxy/api/v1/Order/${endpoint}`;
|
|
1302
1317
|
}
|
|
@@ -1347,6 +1362,7 @@ var InventoryResource = class {
|
|
|
1347
1362
|
constructor(http) {
|
|
1348
1363
|
this.http = http;
|
|
1349
1364
|
}
|
|
1365
|
+
http;
|
|
1350
1366
|
/** Get a warehouse inventory snapshot. */
|
|
1351
1367
|
async getWarehouseSnapshot(params) {
|
|
1352
1368
|
return this.http.get("/api/ApiProxy/api/v1/Inventory/getWarehouseInventorySnapshot", params);
|
|
@@ -1367,6 +1383,8 @@ var PickupsResource = class {
|
|
|
1367
1383
|
this.http = http;
|
|
1368
1384
|
this.getWorkspaceId = getWorkspaceId;
|
|
1369
1385
|
}
|
|
1386
|
+
http;
|
|
1387
|
+
getWorkspaceId;
|
|
1370
1388
|
wsPath(suffix) {
|
|
1371
1389
|
const id = this.getWorkspaceId();
|
|
1372
1390
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1396,6 +1414,8 @@ var ScanFormsResource = class {
|
|
|
1396
1414
|
this.http = http;
|
|
1397
1415
|
this.getWorkspaceId = getWorkspaceId;
|
|
1398
1416
|
}
|
|
1417
|
+
http;
|
|
1418
|
+
getWorkspaceId;
|
|
1399
1419
|
wsPath(suffix) {
|
|
1400
1420
|
const id = this.getWorkspaceId();
|
|
1401
1421
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1421,6 +1441,8 @@ var RulesResource = class {
|
|
|
1421
1441
|
this.http = http;
|
|
1422
1442
|
this.getWorkspaceId = getWorkspaceId;
|
|
1423
1443
|
}
|
|
1444
|
+
http;
|
|
1445
|
+
getWorkspaceId;
|
|
1424
1446
|
wsPath(suffix) {
|
|
1425
1447
|
const id = this.getWorkspaceId();
|
|
1426
1448
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1442,9 +1464,9 @@ var RulesResource = class {
|
|
|
1442
1464
|
async update(ruleId, rule) {
|
|
1443
1465
|
return this.http.put(this.wsPath(ruleId), rule);
|
|
1444
1466
|
}
|
|
1445
|
-
/** Delete a shipping rule. */
|
|
1467
|
+
/** Delete a shipping rule. The Gateway answers 204 No Content, so there is no result. */
|
|
1446
1468
|
async delete(ruleId) {
|
|
1447
|
-
|
|
1469
|
+
await this.http.delete(this.wsPath(ruleId));
|
|
1448
1470
|
}
|
|
1449
1471
|
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1450
1472
|
async reorder(ruleIds) {
|
|
@@ -1464,6 +1486,8 @@ var CarbonOffsetsResource = class {
|
|
|
1464
1486
|
this.http = http;
|
|
1465
1487
|
this.getWorkspaceId = getWorkspaceId;
|
|
1466
1488
|
}
|
|
1489
|
+
http;
|
|
1490
|
+
getWorkspaceId;
|
|
1467
1491
|
wsPath(suffix = "") {
|
|
1468
1492
|
const id = this.getWorkspaceId();
|
|
1469
1493
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1515,6 +1539,8 @@ var RecurringShipmentsResource = class {
|
|
|
1515
1539
|
this.http = http;
|
|
1516
1540
|
this.getWorkspaceId = getWorkspaceId;
|
|
1517
1541
|
}
|
|
1542
|
+
http;
|
|
1543
|
+
getWorkspaceId;
|
|
1518
1544
|
wsPath(suffix = "") {
|
|
1519
1545
|
const id = this.getWorkspaceId();
|
|
1520
1546
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1565,6 +1591,8 @@ var ReportSchedulesResource = class {
|
|
|
1565
1591
|
this.http = http;
|
|
1566
1592
|
this.getWorkspaceId = getWorkspaceId;
|
|
1567
1593
|
}
|
|
1594
|
+
http;
|
|
1595
|
+
getWorkspaceId;
|
|
1568
1596
|
wsPath(suffix = "") {
|
|
1569
1597
|
const id = this.getWorkspaceId();
|
|
1570
1598
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1602,6 +1630,8 @@ var EmailTemplatesResource = class {
|
|
|
1602
1630
|
this.http = http;
|
|
1603
1631
|
this.getWorkspaceId = getWorkspaceId;
|
|
1604
1632
|
}
|
|
1633
|
+
http;
|
|
1634
|
+
getWorkspaceId;
|
|
1605
1635
|
wsPath(suffix = "") {
|
|
1606
1636
|
const id = this.getWorkspaceId();
|
|
1607
1637
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1634,6 +1664,7 @@ var HsCodesResource = class {
|
|
|
1634
1664
|
constructor(http) {
|
|
1635
1665
|
this.http = http;
|
|
1636
1666
|
}
|
|
1667
|
+
http;
|
|
1637
1668
|
/** Search for HS codes by product description. Requires Enterprise plan. */
|
|
1638
1669
|
async search(query, options) {
|
|
1639
1670
|
return this.http.get("/api/shipping/hs-codes/search", { query, ...options });
|
package/dist/index.mjs
CHANGED
|
@@ -60,6 +60,9 @@ var FlexOpsError = class extends Error {
|
|
|
60
60
|
this.errors = errors;
|
|
61
61
|
this.name = "FlexOpsError";
|
|
62
62
|
}
|
|
63
|
+
status;
|
|
64
|
+
code;
|
|
65
|
+
errors;
|
|
63
66
|
};
|
|
64
67
|
var FlexOpsRateLimitError = class extends FlexOpsError {
|
|
65
68
|
constructor(message, retryAfter) {
|
|
@@ -67,6 +70,7 @@ var FlexOpsRateLimitError = class extends FlexOpsError {
|
|
|
67
70
|
this.retryAfter = retryAfter;
|
|
68
71
|
this.name = "FlexOpsRateLimitError";
|
|
69
72
|
}
|
|
73
|
+
retryAfter;
|
|
70
74
|
};
|
|
71
75
|
var FlexOpsAuthError = class extends FlexOpsError {
|
|
72
76
|
constructor(message) {
|
|
@@ -266,6 +270,7 @@ var AuthResource = class {
|
|
|
266
270
|
constructor(http) {
|
|
267
271
|
this.http = http;
|
|
268
272
|
}
|
|
273
|
+
http;
|
|
269
274
|
/**
|
|
270
275
|
* Authenticate with email and password. On success the returned access token (`data.token`) is
|
|
271
276
|
* used for later requests. When `data.requiresTwoFactor` is true no token is issued yet.
|
|
@@ -309,6 +314,8 @@ var WorkspacesResource = class {
|
|
|
309
314
|
this.http = http;
|
|
310
315
|
this.getWorkspaceId = getWorkspaceId;
|
|
311
316
|
}
|
|
317
|
+
http;
|
|
318
|
+
getWorkspaceId;
|
|
312
319
|
wsPath(suffix) {
|
|
313
320
|
const id = this.getWorkspaceId();
|
|
314
321
|
if (!id) throw new Error("workspaceId is required. Set it via client.workspaceId or config.");
|
|
@@ -347,6 +354,8 @@ var ShippingResource = class {
|
|
|
347
354
|
this.http = http;
|
|
348
355
|
this.getWorkspaceId = getWorkspaceId;
|
|
349
356
|
}
|
|
357
|
+
http;
|
|
358
|
+
getWorkspaceId;
|
|
350
359
|
wsPath(suffix) {
|
|
351
360
|
const id = this.getWorkspaceId();
|
|
352
361
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -441,14 +450,9 @@ var ShippingResource = class {
|
|
|
441
450
|
country: a.countryCode ?? "US"
|
|
442
451
|
});
|
|
443
452
|
}
|
|
444
|
-
// -----------------------------------------------------------------------
|
|
445
|
-
// Batch Labels
|
|
446
|
-
// -----------------------------------------------------------------------
|
|
447
|
-
/** Create labels in batch. */
|
|
448
453
|
async createBatch(request) {
|
|
449
454
|
return this.http.post(this.wsPath("labels/batch"), request);
|
|
450
455
|
}
|
|
451
|
-
/** Preview a batch without purchasing (dry-run). */
|
|
452
456
|
async previewBatch(request) {
|
|
453
457
|
return this.http.post(this.wsPath("labels/batch/preview"), request);
|
|
454
458
|
}
|
|
@@ -531,6 +535,7 @@ var CarriersResource = class {
|
|
|
531
535
|
constructor(http) {
|
|
532
536
|
this.http = http;
|
|
533
537
|
}
|
|
538
|
+
http;
|
|
534
539
|
proxy(path) {
|
|
535
540
|
return `/api/ApiProxy/${path.replace(/^\//, "")}`;
|
|
536
541
|
}
|
|
@@ -962,6 +967,8 @@ var WebhooksResource = class {
|
|
|
962
967
|
this.http = http;
|
|
963
968
|
this.getWorkspaceId = getWorkspaceId;
|
|
964
969
|
}
|
|
970
|
+
http;
|
|
971
|
+
getWorkspaceId;
|
|
965
972
|
wsPath(suffix) {
|
|
966
973
|
const id = this.getWorkspaceId();
|
|
967
974
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -987,9 +994,9 @@ var WebhooksResource = class {
|
|
|
987
994
|
async update(webhookId, data) {
|
|
988
995
|
return this.http.put(this.wsPath(webhookId), toWireRequest(data));
|
|
989
996
|
}
|
|
990
|
-
/** Delete a webhook subscription. */
|
|
997
|
+
/** Delete a webhook subscription. The Gateway answers 204 No Content, so there is no result. */
|
|
991
998
|
async delete(webhookId) {
|
|
992
|
-
|
|
999
|
+
await this.http.delete(this.wsPath(webhookId));
|
|
993
1000
|
}
|
|
994
1001
|
/** Rotate the signing secret for a webhook. */
|
|
995
1002
|
async rotateSecret(webhookId) {
|
|
@@ -1080,6 +1087,8 @@ var WalletResource = class {
|
|
|
1080
1087
|
this.http = http;
|
|
1081
1088
|
this.getWorkspaceId = getWorkspaceId;
|
|
1082
1089
|
}
|
|
1090
|
+
http;
|
|
1091
|
+
getWorkspaceId;
|
|
1083
1092
|
/** Get the configured workspace's wallet balance. */
|
|
1084
1093
|
async getBalance() {
|
|
1085
1094
|
const id = this.getWorkspaceId();
|
|
@@ -1094,6 +1103,8 @@ var InsuranceResource = class {
|
|
|
1094
1103
|
this.http = http;
|
|
1095
1104
|
this.getWorkspaceId = getWorkspaceId;
|
|
1096
1105
|
}
|
|
1106
|
+
http;
|
|
1107
|
+
getWorkspaceId;
|
|
1097
1108
|
wsPath(suffix) {
|
|
1098
1109
|
const id = this.getWorkspaceId();
|
|
1099
1110
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1137,6 +1148,8 @@ var ReturnsResource = class {
|
|
|
1137
1148
|
this.http = http;
|
|
1138
1149
|
this.getWorkspaceId = getWorkspaceId;
|
|
1139
1150
|
}
|
|
1151
|
+
http;
|
|
1152
|
+
getWorkspaceId;
|
|
1140
1153
|
wsPath(suffix) {
|
|
1141
1154
|
const id = this.getWorkspaceId();
|
|
1142
1155
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1179,6 +1192,7 @@ var AnalyticsResource = class {
|
|
|
1179
1192
|
constructor(http) {
|
|
1180
1193
|
this.http = http;
|
|
1181
1194
|
}
|
|
1195
|
+
http;
|
|
1182
1196
|
path(endpoint) {
|
|
1183
1197
|
return `/api/ApiProxy/api/v4/Analytics/${endpoint}`;
|
|
1184
1198
|
}
|
|
@@ -1249,6 +1263,7 @@ var OrdersResource = class {
|
|
|
1249
1263
|
constructor(http) {
|
|
1250
1264
|
this.http = http;
|
|
1251
1265
|
}
|
|
1266
|
+
http;
|
|
1252
1267
|
path(endpoint) {
|
|
1253
1268
|
return `/api/ApiProxy/api/v1/Order/${endpoint}`;
|
|
1254
1269
|
}
|
|
@@ -1299,6 +1314,7 @@ var InventoryResource = class {
|
|
|
1299
1314
|
constructor(http) {
|
|
1300
1315
|
this.http = http;
|
|
1301
1316
|
}
|
|
1317
|
+
http;
|
|
1302
1318
|
/** Get a warehouse inventory snapshot. */
|
|
1303
1319
|
async getWarehouseSnapshot(params) {
|
|
1304
1320
|
return this.http.get("/api/ApiProxy/api/v1/Inventory/getWarehouseInventorySnapshot", params);
|
|
@@ -1319,6 +1335,8 @@ var PickupsResource = class {
|
|
|
1319
1335
|
this.http = http;
|
|
1320
1336
|
this.getWorkspaceId = getWorkspaceId;
|
|
1321
1337
|
}
|
|
1338
|
+
http;
|
|
1339
|
+
getWorkspaceId;
|
|
1322
1340
|
wsPath(suffix) {
|
|
1323
1341
|
const id = this.getWorkspaceId();
|
|
1324
1342
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1348,6 +1366,8 @@ var ScanFormsResource = class {
|
|
|
1348
1366
|
this.http = http;
|
|
1349
1367
|
this.getWorkspaceId = getWorkspaceId;
|
|
1350
1368
|
}
|
|
1369
|
+
http;
|
|
1370
|
+
getWorkspaceId;
|
|
1351
1371
|
wsPath(suffix) {
|
|
1352
1372
|
const id = this.getWorkspaceId();
|
|
1353
1373
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1373,6 +1393,8 @@ var RulesResource = class {
|
|
|
1373
1393
|
this.http = http;
|
|
1374
1394
|
this.getWorkspaceId = getWorkspaceId;
|
|
1375
1395
|
}
|
|
1396
|
+
http;
|
|
1397
|
+
getWorkspaceId;
|
|
1376
1398
|
wsPath(suffix) {
|
|
1377
1399
|
const id = this.getWorkspaceId();
|
|
1378
1400
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1394,9 +1416,9 @@ var RulesResource = class {
|
|
|
1394
1416
|
async update(ruleId, rule) {
|
|
1395
1417
|
return this.http.put(this.wsPath(ruleId), rule);
|
|
1396
1418
|
}
|
|
1397
|
-
/** Delete a shipping rule. */
|
|
1419
|
+
/** Delete a shipping rule. The Gateway answers 204 No Content, so there is no result. */
|
|
1398
1420
|
async delete(ruleId) {
|
|
1399
|
-
|
|
1421
|
+
await this.http.delete(this.wsPath(ruleId));
|
|
1400
1422
|
}
|
|
1401
1423
|
/** Reorder rules: each listed rule gets its position in `ruleIds` as its priority (0 first). */
|
|
1402
1424
|
async reorder(ruleIds) {
|
|
@@ -1416,6 +1438,8 @@ var CarbonOffsetsResource = class {
|
|
|
1416
1438
|
this.http = http;
|
|
1417
1439
|
this.getWorkspaceId = getWorkspaceId;
|
|
1418
1440
|
}
|
|
1441
|
+
http;
|
|
1442
|
+
getWorkspaceId;
|
|
1419
1443
|
wsPath(suffix = "") {
|
|
1420
1444
|
const id = this.getWorkspaceId();
|
|
1421
1445
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1467,6 +1491,8 @@ var RecurringShipmentsResource = class {
|
|
|
1467
1491
|
this.http = http;
|
|
1468
1492
|
this.getWorkspaceId = getWorkspaceId;
|
|
1469
1493
|
}
|
|
1494
|
+
http;
|
|
1495
|
+
getWorkspaceId;
|
|
1470
1496
|
wsPath(suffix = "") {
|
|
1471
1497
|
const id = this.getWorkspaceId();
|
|
1472
1498
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1517,6 +1543,8 @@ var ReportSchedulesResource = class {
|
|
|
1517
1543
|
this.http = http;
|
|
1518
1544
|
this.getWorkspaceId = getWorkspaceId;
|
|
1519
1545
|
}
|
|
1546
|
+
http;
|
|
1547
|
+
getWorkspaceId;
|
|
1520
1548
|
wsPath(suffix = "") {
|
|
1521
1549
|
const id = this.getWorkspaceId();
|
|
1522
1550
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1554,6 +1582,8 @@ var EmailTemplatesResource = class {
|
|
|
1554
1582
|
this.http = http;
|
|
1555
1583
|
this.getWorkspaceId = getWorkspaceId;
|
|
1556
1584
|
}
|
|
1585
|
+
http;
|
|
1586
|
+
getWorkspaceId;
|
|
1557
1587
|
wsPath(suffix = "") {
|
|
1558
1588
|
const id = this.getWorkspaceId();
|
|
1559
1589
|
if (!id) throw new Error("workspaceId is required.");
|
|
@@ -1586,6 +1616,7 @@ var HsCodesResource = class {
|
|
|
1586
1616
|
constructor(http) {
|
|
1587
1617
|
this.http = http;
|
|
1588
1618
|
}
|
|
1619
|
+
http;
|
|
1589
1620
|
/** Search for HS codes by product description. Requires Enterprise plan. */
|
|
1590
1621
|
async search(query, options) {
|
|
1591
1622
|
return this.http.get("/api/shipping/hs-codes/search", { query, ...options });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexops/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Official FlexOps Platform Node.js/TypeScript SDK — multi-carrier shipping, order management, and logistics API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@openapitools/openapi-generator-cli": "^2.16.3",
|
|
58
58
|
"@types/node": "^26.1.2",
|
|
59
59
|
"eslint": "^10.8.0",
|
|
60
|
-
"tsup": "^
|
|
60
|
+
"tsup": "^9.0.0",
|
|
61
61
|
"typescript": "^5.8.0",
|
|
62
62
|
"typescript-eslint": "^8.65.0",
|
|
63
63
|
"vitest": "^5.0.0"
|