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