@shipengine/js-api 4.1.0 → 4.2.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
@@ -4195,6 +4195,18 @@ class ShipmentsAPI {
4195
4195
  this.cancel = (shipmentId) => {
4196
4196
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4197
4197
  };
4198
+ /**
4199
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
4200
+ */
4201
+ this.download = (params) => {
4202
+ return this.client.get("/v1/shipments/downloads", {
4203
+ headers: {
4204
+ Accept: "text/csv"
4205
+ },
4206
+ params,
4207
+ responseType: "blob"
4208
+ });
4209
+ };
4198
4210
  this.client = client;
4199
4211
  }
4200
4212
  }
package/index.mjs CHANGED
@@ -4191,6 +4191,18 @@ class ShipmentsAPI {
4191
4191
  this.cancel = (shipmentId) => {
4192
4192
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4193
4193
  };
4194
+ /**
4195
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
4196
+ */
4197
+ this.download = (params) => {
4198
+ return this.client.get("/v1/shipments/downloads", {
4199
+ headers: {
4200
+ Accept: "text/csv"
4201
+ },
4202
+ params,
4203
+ responseType: "blob"
4204
+ });
4205
+ };
4194
4206
  this.client = client;
4195
4207
  }
4196
4208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { BatchableQuery, CreationRangeQuery, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery, TaggableQuery } from "../resources";
3
- import { Shipment, ShipmentRateResponse, ShipmentStatus } from "./types";
2
+ import { PageableResult } from "../resources";
3
+ import { DownloadShipmentsParams, ListShipmentOptions, Shipment, ShipmentRateResponse } from "./types";
4
4
  /**
5
5
  * # Shipments - Get Shipment Rates Options
6
6
  */
@@ -15,17 +15,6 @@ export type GetShipmentRatesOptions = {
15
15
  */
16
16
  shipmentId: string;
17
17
  };
18
- export type ListShipmentOptions = {
19
- /**
20
- * `salesOrderIds` is an array of sales order IDs to be used when listing sales
21
- * orders.
22
- */
23
- salesOrderId?: string;
24
- /**
25
- * `shipmentStatus` is the current fulfillment status of the shipment.
26
- */
27
- shipmentStatus?: ShipmentStatus;
28
- } & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
29
18
  /**
30
19
  * # Shipments - List Shipments Result
31
20
  */
@@ -82,4 +71,8 @@ export declare class ShipmentsAPI {
82
71
  * https://shipengine.github.io/shipengine-openapi/#operation/cancel_shipments
83
72
  */
84
73
  cancel: (shipmentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
74
+ /**
75
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
76
+ */
77
+ download: (params?: DownloadShipmentsParams) => Promise<import("axios").AxiosResponse<Blob, any>>;
85
78
  }
@@ -4,7 +4,7 @@ import { CodedError } from "../errors";
4
4
  import { OrderSourceCode } from "../order-sources";
5
5
  import { Money } from "../payments";
6
6
  import { Rate } from "../rates";
7
- import { Download, LinkedResource } from "../resources";
7
+ import { BatchableQuery, CreationRangeQuery, Download, LinkedResource, ModificationRangeQuery, PageableQuery, SortableQuery, TaggableQuery } from "../resources";
8
8
  import { WeightWithUnit } from "../weight";
9
9
  export type AddressValidationOptions = "no_validation" | "validate_only" | "validate_and_clean";
10
10
  export type CustomsContents = "documents" | "gift" | "merchandise" | "returned_goods" | "sample";
@@ -254,3 +254,33 @@ export type ShipmentRateResponse = {
254
254
  shipmentId: string;
255
255
  status: "working" | "completed" | "partial" | "error";
256
256
  }[];
257
+ export type ListShipmentOptions = {
258
+ /**
259
+ * `batchId` is an optional string to retrieve shipments within a given batch.
260
+ */
261
+ batchId?: string;
262
+ /**
263
+ * `salesOrderIds` is an array of sales order IDs to be used when listing sales
264
+ * orders.
265
+ */
266
+ salesOrderId?: string;
267
+ /**
268
+ * Specific shipment number to filter by
269
+ */
270
+ shipmentNumber?: string;
271
+ /**
272
+ * `shipmentStatus` is the current fulfillment status of the shipment.
273
+ */
274
+ shipmentStatus?: ShipmentStatus;
275
+ } & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
276
+ export type ShipmentColumns = "shipment_id" | "packages" | "recipient" | "shipping_service" | "created_date" | "modified_at" | "status";
277
+ export type DownloadShipmentsParams = {
278
+ /**
279
+ * CSV column names to export
280
+ */
281
+ columns?: ShipmentColumns[];
282
+ /**
283
+ * Specific shipment ID to filter by
284
+ */
285
+ shipmentId?: string;
286
+ } & ListShipmentOptions;