@shipengine/js-api 0.17.0 → 0.19.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/carriers/api.d.ts +7 -1
- package/carriers/types.d.ts +15 -0
- package/dimensions/types.d.ts +5 -0
- package/index.js +15 -2
- package/index.mjs +15 -2
- package/package.json +1 -1
- package/rate-cards/types.d.ts +21 -0
- package/resources/types.d.ts +34 -0
- package/sales-order-shipments/api.d.ts +20 -5
- package/shipments/api.d.ts +15 -5
- package/types.d.ts +1 -0
- package/utilities/types.d.ts +0 -1
- package/weight-band/index.d.ts +1 -0
- package/weight-band/types.d.ts +17 -0
package/carriers/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { Currency, Money } from "../payments";
|
|
3
|
-
import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, WalletTransactionHistory } from "./types";
|
|
3
|
+
import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, CarrierRatePackageFormat, CarrierService, WalletTransactionHistory } from "./types";
|
|
4
4
|
export declare class CarriersAPI {
|
|
5
5
|
private client;
|
|
6
6
|
constructor(client: AxiosInstance);
|
|
@@ -15,6 +15,12 @@ export declare class CarriersAPI {
|
|
|
15
15
|
updateAutoFunding: (carrierId: string, options: CarrierAutoFundingSettings) => Promise<import("axios").AxiosResponse<CarrierAutoFundingSettingsResponse, any>>;
|
|
16
16
|
getAutoFunding: (carrierId: string) => Promise<import("axios").AxiosResponse<CarrierAutoFundingSettingsResponse, any>>;
|
|
17
17
|
getWalletHistory: (startDate: Date, endDate: Date, page: number) => Promise<import("axios").AxiosResponse<WalletTransactionHistory, any>>;
|
|
18
|
+
getServices: (carrierId: string) => Promise<import("axios").AxiosResponse<{
|
|
19
|
+
services: CarrierService[];
|
|
20
|
+
}, any>>;
|
|
21
|
+
getRatePackageFormats: (carrierId: string) => Promise<import("axios").AxiosResponse<{
|
|
22
|
+
ratePackageFormats: CarrierRatePackageFormat[];
|
|
23
|
+
}, any>>;
|
|
18
24
|
getCountries: (carrierId: string) => Promise<import("axios").AxiosResponse<{
|
|
19
25
|
countries: string[];
|
|
20
26
|
}, any>>;
|
package/carriers/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Address } from "../addresses";
|
|
2
2
|
import { DimensionsWithUnit } from "../dimensions";
|
|
3
3
|
import { CreditCard, Money } from "../payments";
|
|
4
|
+
import { WeightWithUnit } from "../weight";
|
|
4
5
|
/**
|
|
5
6
|
* @category Entities
|
|
6
7
|
*/
|
|
@@ -47,6 +48,20 @@ export interface CarrierPackage {
|
|
|
47
48
|
packageCode: string;
|
|
48
49
|
packageId?: string;
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @category Entities
|
|
53
|
+
*/
|
|
54
|
+
export interface CarrierRatePackageFormat {
|
|
55
|
+
apiCode: string;
|
|
56
|
+
carrierPackageTypeCode: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
dimensions?: DimensionsWithUnit;
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
packageTypeId?: string;
|
|
62
|
+
status: string;
|
|
63
|
+
weight: WeightWithUnit;
|
|
64
|
+
}
|
|
50
65
|
/**
|
|
51
66
|
* @category Entities
|
|
52
67
|
*/
|
package/dimensions/types.d.ts
CHANGED
|
@@ -6,8 +6,13 @@ export type DimensionUnit = "inch" | "centimeter";
|
|
|
6
6
|
* @category Entities
|
|
7
7
|
*/
|
|
8
8
|
export interface Dimensions {
|
|
9
|
+
girth?: number;
|
|
9
10
|
height: number;
|
|
10
11
|
length: number;
|
|
12
|
+
lengthPlusGirth?: number;
|
|
13
|
+
noThreeSidesExceed?: number;
|
|
14
|
+
noTwoSidesExceed?: number;
|
|
15
|
+
volume?: number;
|
|
11
16
|
width: number;
|
|
12
17
|
}
|
|
13
18
|
/**
|
package/index.js
CHANGED
|
@@ -952,6 +952,14 @@ class CarriersAPI {
|
|
|
952
952
|
}
|
|
953
953
|
});
|
|
954
954
|
};
|
|
955
|
+
this.getServices = (carrierId) => {
|
|
956
|
+
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
957
|
+
};
|
|
958
|
+
this.getRatePackageFormats = (carrierId) => {
|
|
959
|
+
return this.client.get(
|
|
960
|
+
`/v1/carriers/${carrierId}/rate_package_formats`
|
|
961
|
+
);
|
|
962
|
+
};
|
|
955
963
|
this.getCountries = (carrierId) => {
|
|
956
964
|
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
957
965
|
};
|
|
@@ -3303,8 +3311,10 @@ class RatesAPI {
|
|
|
3303
3311
|
class SalesOrderShipmentsAPI {
|
|
3304
3312
|
constructor(client) {
|
|
3305
3313
|
this.client = client;
|
|
3306
|
-
this.list = (
|
|
3307
|
-
return this.client.post("/v-beta/shipments/list",
|
|
3314
|
+
this.list = (body = {}, params) => {
|
|
3315
|
+
return this.client.post("/v-beta/shipments/list", body, {
|
|
3316
|
+
params
|
|
3317
|
+
});
|
|
3308
3318
|
};
|
|
3309
3319
|
this.get = (shipmentId) => {
|
|
3310
3320
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
@@ -3367,6 +3377,9 @@ class ShipmentsAPI {
|
|
|
3367
3377
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
3368
3378
|
);
|
|
3369
3379
|
};
|
|
3380
|
+
this.list = (options) => {
|
|
3381
|
+
return this.client.get("/v1/shipments", { params: options });
|
|
3382
|
+
};
|
|
3370
3383
|
this.create = (...shipments) => __async$1(this, null, function* () {
|
|
3371
3384
|
return this.client.post("/v1/shipments", {
|
|
3372
3385
|
shipments
|
package/index.mjs
CHANGED
|
@@ -948,6 +948,14 @@ class CarriersAPI {
|
|
|
948
948
|
}
|
|
949
949
|
});
|
|
950
950
|
};
|
|
951
|
+
this.getServices = (carrierId) => {
|
|
952
|
+
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
953
|
+
};
|
|
954
|
+
this.getRatePackageFormats = (carrierId) => {
|
|
955
|
+
return this.client.get(
|
|
956
|
+
`/v1/carriers/${carrierId}/rate_package_formats`
|
|
957
|
+
);
|
|
958
|
+
};
|
|
951
959
|
this.getCountries = (carrierId) => {
|
|
952
960
|
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
953
961
|
};
|
|
@@ -3299,8 +3307,10 @@ class RatesAPI {
|
|
|
3299
3307
|
class SalesOrderShipmentsAPI {
|
|
3300
3308
|
constructor(client) {
|
|
3301
3309
|
this.client = client;
|
|
3302
|
-
this.list = (
|
|
3303
|
-
return this.client.post("/v-beta/shipments/list",
|
|
3310
|
+
this.list = (body = {}, params) => {
|
|
3311
|
+
return this.client.post("/v-beta/shipments/list", body, {
|
|
3312
|
+
params
|
|
3313
|
+
});
|
|
3304
3314
|
};
|
|
3305
3315
|
this.get = (shipmentId) => {
|
|
3306
3316
|
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
@@ -3363,6 +3373,9 @@ class ShipmentsAPI {
|
|
|
3363
3373
|
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
3364
3374
|
);
|
|
3365
3375
|
};
|
|
3376
|
+
this.list = (options) => {
|
|
3377
|
+
return this.client.get("/v1/shipments", { params: options });
|
|
3378
|
+
};
|
|
3366
3379
|
this.create = (...shipments) => __async$1(this, null, function* () {
|
|
3367
3380
|
return this.client.post("/v1/shipments", {
|
|
3368
3381
|
shipments
|
package/package.json
CHANGED
package/rate-cards/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { CarrierRatePackageFormat, CarrierService } from "../carriers";
|
|
1
2
|
import { Currency } from "../payments";
|
|
3
|
+
import { WeightBandIncremental, WeightBandMinMax } from "../weight-band";
|
|
2
4
|
/**
|
|
3
5
|
* @category Entities
|
|
4
6
|
*/
|
|
@@ -6,6 +8,21 @@ export interface ShipFromLocation {
|
|
|
6
8
|
countryCode: string;
|
|
7
9
|
postalCode?: string;
|
|
8
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @category Entities
|
|
13
|
+
*/
|
|
14
|
+
export type RateService = Pick<CarrierService, "serviceCode"> & {
|
|
15
|
+
packageTypes: RatePackageType[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @category Entities
|
|
19
|
+
*/
|
|
20
|
+
export type RatePackageType = CarrierRatePackageFormat & {
|
|
21
|
+
weightBands: {
|
|
22
|
+
incrementalBands: WeightBandIncremental[];
|
|
23
|
+
minMaxBands: WeightBandMinMax[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
9
26
|
/**
|
|
10
27
|
* @category Entities
|
|
11
28
|
*/
|
|
@@ -15,8 +32,12 @@ export interface RateCard {
|
|
|
15
32
|
endDate?: string;
|
|
16
33
|
id: string;
|
|
17
34
|
name: string;
|
|
35
|
+
services?: RateService[];
|
|
18
36
|
shipFrom?: ShipFromLocation;
|
|
19
37
|
startDate?: string;
|
|
20
38
|
status?: string;
|
|
21
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @category Entities
|
|
42
|
+
*/
|
|
22
43
|
export type RateCardInput = Partial<RateCard> & Pick<RateCard, "carrierId" | "name">;
|
package/resources/types.d.ts
CHANGED
|
@@ -14,3 +14,37 @@ export interface LinkedResource {
|
|
|
14
14
|
href: string;
|
|
15
15
|
type: string;
|
|
16
16
|
}
|
|
17
|
+
export type ISOString = string;
|
|
18
|
+
export type PageableQuery = {
|
|
19
|
+
page?: number;
|
|
20
|
+
pageSize?: number;
|
|
21
|
+
};
|
|
22
|
+
export type PageableResult = {
|
|
23
|
+
links: {
|
|
24
|
+
first: LinkedResource;
|
|
25
|
+
last: LinkedResource;
|
|
26
|
+
next: LinkedResource;
|
|
27
|
+
prev: LinkedResource;
|
|
28
|
+
};
|
|
29
|
+
page: number;
|
|
30
|
+
pages: number;
|
|
31
|
+
total: number;
|
|
32
|
+
};
|
|
33
|
+
export type BatchableQuery = {
|
|
34
|
+
batchId?: string;
|
|
35
|
+
};
|
|
36
|
+
export type TaggableQuery = {
|
|
37
|
+
tag?: string;
|
|
38
|
+
};
|
|
39
|
+
export type CreationRangeQuery = {
|
|
40
|
+
createdAtEnd?: ISOString;
|
|
41
|
+
createdAtStart?: ISOString;
|
|
42
|
+
};
|
|
43
|
+
export type ModificationRangeQuery = {
|
|
44
|
+
modifiedAtEnd?: ISOString;
|
|
45
|
+
modifiedAtStart?: ISOString;
|
|
46
|
+
};
|
|
47
|
+
export type SortableQuery<TSortKeys = "created_at" | "modified_at"> = {
|
|
48
|
+
sortBy?: TSortKeys;
|
|
49
|
+
sortDir?: "asc" | "desc";
|
|
50
|
+
};
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
+
import { CreationRangeQuery, ISOString, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery } from "../resources";
|
|
3
|
+
import { FulfillmentStatus, PaymentStatus } from "../sales-orders";
|
|
2
4
|
import { SalesOrderShipment } from "./types";
|
|
3
|
-
export
|
|
5
|
+
export type ListSalesOrderShipmentsParams = {
|
|
6
|
+
cancelled?: boolean;
|
|
7
|
+
externalOrderId?: string;
|
|
8
|
+
externalOrderNumber?: string;
|
|
9
|
+
fulfillmentStatus?: FulfillmentStatus;
|
|
10
|
+
orderDateEnd?: ISOString;
|
|
11
|
+
orderDateStart?: ISOString;
|
|
12
|
+
orderSourceId?: string;
|
|
13
|
+
paymentStatus?: PaymentStatus;
|
|
4
14
|
salesOrderIds?: string[];
|
|
5
|
-
}
|
|
15
|
+
} & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery<"created_at" | "modified_at" | "order_date">;
|
|
16
|
+
export type ListSalesOrderShipmentBody = {
|
|
17
|
+
salesOrderIds?: string[];
|
|
18
|
+
shipments?: SalesOrderShipment[];
|
|
19
|
+
};
|
|
20
|
+
export type ListSalesOrderShipmentsResult = {
|
|
21
|
+
shipments: SalesOrderShipment[];
|
|
22
|
+
} & PageableResult;
|
|
6
23
|
export declare class SalesOrderShipmentsAPI {
|
|
7
24
|
private client;
|
|
8
25
|
constructor(client: AxiosInstance);
|
|
9
|
-
list: (params?: ListSalesOrderShipmentsParams) => Promise<import("axios").AxiosResponse<
|
|
10
|
-
shipments: SalesOrderShipment[];
|
|
11
|
-
}, any>>;
|
|
26
|
+
list: (body?: ListSalesOrderShipmentBody | undefined, params?: ListSalesOrderShipmentsParams) => Promise<import("axios").AxiosResponse<ListSalesOrderShipmentsResult, any>>;
|
|
12
27
|
get: (shipmentId: string) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
|
13
28
|
create: (salesOrderId: string, shipment: Partial<SalesOrderShipment>) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
|
14
29
|
update: (shipmentId: string, shipment: Partial<SalesOrderShipment>) => Promise<import("axios").AxiosResponse<SalesOrderShipment, any>>;
|
package/shipments/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import {
|
|
2
|
+
import { BatchableQuery, CreationRangeQuery, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery, TaggableQuery } from "../resources";
|
|
3
|
+
import { Shipment, ShipmentRateResponse, ShipmentStatus } from "./types";
|
|
3
4
|
export type GetShipmentRatesOptions = {
|
|
4
5
|
/**
|
|
5
6
|
* Date to filter rates by (they must be more recent than this date if passed)
|
|
@@ -8,12 +9,21 @@ export type GetShipmentRatesOptions = {
|
|
|
8
9
|
createdAtStart?: string;
|
|
9
10
|
shipmentId: string;
|
|
10
11
|
};
|
|
12
|
+
export type ListShipmentOptions = {
|
|
13
|
+
salesOrderId?: string;
|
|
14
|
+
shipmentStatus?: ShipmentStatus;
|
|
15
|
+
} & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
|
|
16
|
+
export type ListShipmentResult = {
|
|
17
|
+
shipments: Shipment[];
|
|
18
|
+
} & PageableResult;
|
|
19
|
+
export type CreateShipmentResult = {
|
|
20
|
+
hasErrors: boolean;
|
|
21
|
+
shipments: Shipment[];
|
|
22
|
+
};
|
|
11
23
|
export declare class ShipmentsAPI {
|
|
12
24
|
private client;
|
|
13
25
|
constructor(client: AxiosInstance);
|
|
14
26
|
getShipmentRates: ({ shipmentId, createdAtStart }: GetShipmentRatesOptions) => Promise<import("axios").AxiosResponse<ShipmentRateResponse, any>>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
shipments: Shipment[];
|
|
18
|
-
}, any>>;
|
|
27
|
+
list: (options?: ListShipmentOptions) => Promise<import("axios").AxiosResponse<ListShipmentResult, any>>;
|
|
28
|
+
create: (...shipments: Partial<Omit<Shipment, "items">>[]) => Promise<import("axios").AxiosResponse<CreateShipmentResult, any>>;
|
|
19
29
|
}
|
package/types.d.ts
CHANGED
package/utilities/types.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type RequireField<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WeightUnit } from "../weight";
|
|
2
|
+
/**
|
|
3
|
+
* @category Entities
|
|
4
|
+
*/
|
|
5
|
+
export type WeightBandIncremental = {
|
|
6
|
+
increment: number;
|
|
7
|
+
minimum: number;
|
|
8
|
+
unit: WeightUnit;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @category Entities
|
|
12
|
+
*/
|
|
13
|
+
export type WeightBandMinMax = {
|
|
14
|
+
maximum: number;
|
|
15
|
+
minimum: number;
|
|
16
|
+
unit: WeightUnit;
|
|
17
|
+
};
|