@shipengine/js-api 0.19.1 → 0.20.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.
@@ -52,15 +52,15 @@ export interface CarrierPackage {
52
52
  * @category Entities
53
53
  */
54
54
  export interface CarrierRatePackageFormat {
55
- apiCode: string;
56
- carrierPackageTypeCode: string;
57
- description?: string;
58
- dimensions?: DimensionsWithUnit;
59
- id: string;
55
+ apiCode?: string;
56
+ carrierPackageTypeCode?: string;
57
+ description: string;
58
+ dimensions: DimensionsWithUnit;
59
+ maxWeight: WeightWithUnit;
60
60
  name: string;
61
+ packageId: string;
61
62
  packageTypeId?: string;
62
63
  status: string;
63
- weight: WeightWithUnit;
64
64
  }
65
65
  /**
66
66
  * @category Entities
package/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from "./shipments";
21
21
  export * from "./utilities";
22
22
  export * from "./warehouses";
23
23
  export * from "./weight";
24
+ export * from "./zones";
package/index.js CHANGED
@@ -3291,6 +3291,9 @@ class RateCardsAPI {
3291
3291
  this.create = (rateCardInput) => {
3292
3292
  return this.client.post("/v1/rate_cards", rateCardInput);
3293
3293
  };
3294
+ this.update = (rateCard) => {
3295
+ return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
3296
+ };
3294
3297
  this.client = client;
3295
3298
  }
3296
3299
  }
package/index.mjs CHANGED
@@ -3287,6 +3287,9 @@ class RateCardsAPI {
3287
3287
  this.create = (rateCardInput) => {
3288
3288
  return this.client.post("/v1/rate_cards", rateCardInput);
3289
3289
  };
3290
+ this.update = (rateCard) => {
3291
+ return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
3292
+ };
3290
3293
  this.client = client;
3291
3294
  }
3292
3295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -7,4 +7,5 @@ export declare class RateCardsAPI {
7
7
  rateCards: RateCard[];
8
8
  }, any>>;
9
9
  create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
10
+ update: (rateCard: RateCard) => Promise<import("axios").AxiosResponse<RateCard, any>>;
10
11
  }
@@ -1,6 +1,8 @@
1
1
  import { CarrierRatePackageFormat, CarrierService } from "../carriers";
2
2
  import { Currency } from "../payments";
3
+ import { ISOString } from "../resources";
3
4
  import { WeightBandIncremental, WeightBandMinMax } from "../weight-band";
5
+ import { Zone } from "../zones";
4
6
  /**
5
7
  * @category Entities
6
8
  */
@@ -8,19 +10,58 @@ export interface ShipFromLocation {
8
10
  countryCode: string;
9
11
  postalCode?: string;
10
12
  }
13
+ /**
14
+ * @category Entities
15
+ */
16
+ export interface RateSurcharge {
17
+ fixedAmount: {
18
+ currency: Currency;
19
+ value: number;
20
+ };
21
+ name: string;
22
+ surchargeCode: string;
23
+ surchargeId: string;
24
+ }
11
25
  /**
12
26
  * @category Entities
13
27
  */
14
28
  export type RateService = Pick<CarrierService, "serviceCode" | "name"> & {
15
- packageTypes: RatePackageType[];
29
+ packageTypes?: RatePackageType[];
30
+ surcharges?: RateSurcharge[];
31
+ };
32
+ /**
33
+ * @category Entities
34
+ */
35
+ export type RateCardRate = {
36
+ currency: Currency;
37
+ value: number;
38
+ };
39
+ /**
40
+ * @category Entities
41
+ */
42
+ export type ZoneWithRate = Zone & {
43
+ rate?: RateCardRate;
44
+ surcharges?: RateSurcharge[];
45
+ };
46
+ /**
47
+ * @category Entities
48
+ */
49
+ export type RateWeightBandMinMax = WeightBandMinMax & {
50
+ zones?: ZoneWithRate[];
51
+ };
52
+ /**
53
+ * @category Entities
54
+ */
55
+ export type RateWeightBandIncremental = WeightBandIncremental & {
56
+ zones?: ZoneWithRate[];
16
57
  };
17
58
  /**
18
59
  * @category Entities
19
60
  */
20
- export type RatePackageType = CarrierRatePackageFormat & {
21
- weightBands: {
22
- incrementalBands: WeightBandIncremental[];
23
- minMaxBands: WeightBandMinMax[];
61
+ export type RatePackageType = Pick<CarrierRatePackageFormat, "packageId" | "name" | "description" | "dimensions" | "maxWeight"> & {
62
+ weightBands?: {
63
+ incrementalBands?: RateWeightBandIncremental[];
64
+ minMaxBands?: RateWeightBandMinMax[];
24
65
  };
25
66
  };
26
67
  /**
@@ -28,14 +69,17 @@ export type RatePackageType = CarrierRatePackageFormat & {
28
69
  */
29
70
  export interface RateCard {
30
71
  carrierId: string;
72
+ createdAt?: ISOString;
31
73
  currency?: Currency;
32
- endDate?: string;
74
+ endDate?: ISOString;
33
75
  id: string;
34
76
  name: string;
77
+ publishedAt?: ISOString;
35
78
  services?: RateService[];
36
79
  shipFrom?: ShipFromLocation;
37
- startDate?: string;
80
+ startDate?: ISOString;
38
81
  status?: string;
82
+ surcharges?: RateSurcharge[];
39
83
  }
40
84
  /**
41
85
  * @category Entities
package/types.d.ts CHANGED
@@ -19,3 +19,4 @@ export * from "./shipments/types";
19
19
  export * from "./warehouses/types";
20
20
  export * from "./weight/types";
21
21
  export * from "./weight-band/types";
22
+ export * from "./zones/types";
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @category Entities
3
+ */
4
+ export type Zone = {
5
+ name: string;
6
+ zoneCode: string;
7
+ zoneId: string;
8
+ };