@shipengine/js-api 0.17.0 → 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 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>>;
@@ -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
  */
@@ -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
  };
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -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/types.d.ts CHANGED
@@ -18,3 +18,4 @@ export * from "./sales-orders/types";
18
18
  export * from "./shipments/types";
19
19
  export * from "./warehouses/types";
20
20
  export * from "./weight/types";
21
+ export * from "./weight-band/types";
@@ -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
+ };