@shipengine/js-api 0.16.2 → 0.18.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 +11 -0
- package/index.mjs +11 -0
- package/package.json +1 -1
- package/rate-cards/api.d.ts +2 -1
- package/rate-cards/types.d.ts +26 -4
- package/types.d.ts +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/types.d.ts +1 -0
- 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
|
};
|
|
@@ -3280,6 +3288,9 @@ class RateCardsAPI {
|
|
|
3280
3288
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
3281
3289
|
);
|
|
3282
3290
|
};
|
|
3291
|
+
this.create = (rateCardInput) => {
|
|
3292
|
+
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3293
|
+
};
|
|
3283
3294
|
this.client = client;
|
|
3284
3295
|
}
|
|
3285
3296
|
}
|
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
|
};
|
|
@@ -3276,6 +3284,9 @@ class RateCardsAPI {
|
|
|
3276
3284
|
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
3277
3285
|
);
|
|
3278
3286
|
};
|
|
3287
|
+
this.create = (rateCardInput) => {
|
|
3288
|
+
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3289
|
+
};
|
|
3279
3290
|
this.client = client;
|
|
3280
3291
|
}
|
|
3281
3292
|
}
|
package/package.json
CHANGED
package/rate-cards/api.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { RateCard } from "./types";
|
|
2
|
+
import { RateCard, RateCardInput } from "./types";
|
|
3
3
|
export declare class RateCardsAPI {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: AxiosInstance);
|
|
6
6
|
list: (carrierIds: string[]) => Promise<import("axios").AxiosResponse<{
|
|
7
7
|
rateCards: RateCard[];
|
|
8
8
|
}, any>>;
|
|
9
|
+
create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
|
|
9
10
|
}
|
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,16 +8,36 @@ 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
|
*/
|
|
12
29
|
export interface RateCard {
|
|
13
30
|
carrierId: string;
|
|
14
|
-
currency
|
|
31
|
+
currency?: Currency;
|
|
15
32
|
endDate?: string;
|
|
16
33
|
id: string;
|
|
17
34
|
name: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
services?: RateService[];
|
|
36
|
+
shipFrom?: ShipFromLocation;
|
|
37
|
+
startDate?: string;
|
|
38
|
+
status?: string;
|
|
21
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @category Entities
|
|
42
|
+
*/
|
|
43
|
+
export type RateCardInput = Partial<RateCard> & Pick<RateCard, "carrierId" | "name">;
|
package/types.d.ts
CHANGED
package/utilities/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
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
|
+
};
|