@shipengine/js-api 0.20.0 → 0.22.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/index.js CHANGED
@@ -3288,12 +3288,20 @@ class RateCardsAPI {
3288
3288
  `/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
3289
3289
  );
3290
3290
  };
3291
+ this.get = (rateCardId) => {
3292
+ return this.client.get(`/v1/rate_cards/${rateCardId}`);
3293
+ };
3291
3294
  this.create = (rateCardInput) => {
3292
3295
  return this.client.post("/v1/rate_cards", rateCardInput);
3293
3296
  };
3294
3297
  this.update = (rateCard) => {
3295
3298
  return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
3296
3299
  };
3300
+ this.download = (rateCardId) => {
3301
+ return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
3302
+ responseType: "blob"
3303
+ });
3304
+ };
3297
3305
  this.client = client;
3298
3306
  }
3299
3307
  }
@@ -3485,12 +3493,17 @@ class ShipEngineAPI {
3485
3493
  transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
3486
3494
  transformResponse: [
3487
3495
  (data) => {
3488
- if (data)
3496
+ if (data && !(data instanceof Blob))
3489
3497
  return JSON.parse(data);
3490
3498
  else
3491
- return;
3499
+ return data;
3492
3500
  },
3493
- (data) => humpsExports.camelizeKeys(data)
3501
+ (data) => {
3502
+ if (data && !(data instanceof Blob))
3503
+ return humpsExports.camelizeKeys(data);
3504
+ else
3505
+ return data;
3506
+ }
3494
3507
  ]
3495
3508
  });
3496
3509
  client.interceptors.response.use(
package/index.mjs CHANGED
@@ -3284,12 +3284,20 @@ class RateCardsAPI {
3284
3284
  `/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
3285
3285
  );
3286
3286
  };
3287
+ this.get = (rateCardId) => {
3288
+ return this.client.get(`/v1/rate_cards/${rateCardId}`);
3289
+ };
3287
3290
  this.create = (rateCardInput) => {
3288
3291
  return this.client.post("/v1/rate_cards", rateCardInput);
3289
3292
  };
3290
3293
  this.update = (rateCard) => {
3291
3294
  return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
3292
3295
  };
3296
+ this.download = (rateCardId) => {
3297
+ return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
3298
+ responseType: "blob"
3299
+ });
3300
+ };
3293
3301
  this.client = client;
3294
3302
  }
3295
3303
  }
@@ -3481,12 +3489,17 @@ class ShipEngineAPI {
3481
3489
  transformRequest: [(data) => humpsExports.decamelizeKeys(data), (data) => JSON.stringify(data)],
3482
3490
  transformResponse: [
3483
3491
  (data) => {
3484
- if (data)
3492
+ if (data && !(data instanceof Blob))
3485
3493
  return JSON.parse(data);
3486
3494
  else
3487
- return;
3495
+ return data;
3488
3496
  },
3489
- (data) => humpsExports.camelizeKeys(data)
3497
+ (data) => {
3498
+ if (data && !(data instanceof Blob))
3499
+ return humpsExports.camelizeKeys(data);
3500
+ else
3501
+ return data;
3502
+ }
3490
3503
  ]
3491
3504
  });
3492
3505
  client.interceptors.response.use(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -6,6 +6,8 @@ export declare class RateCardsAPI {
6
6
  list: (carrierIds: string[]) => Promise<import("axios").AxiosResponse<{
7
7
  rateCards: RateCard[];
8
8
  }, any>>;
9
+ get: (rateCardId: string) => Promise<import("axios").AxiosResponse<RateCard, any>>;
9
10
  create: (rateCardInput: RateCardInput) => Promise<import("axios").AxiosResponse<RateCard, any>>;
10
11
  update: (rateCard: RateCard) => Promise<import("axios").AxiosResponse<RateCard, any>>;
12
+ download: (rateCardId: string) => Promise<import("axios").AxiosResponse<Blob, any>>;
11
13
  }