@shipengine/js-api 4.0.1 → 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
@@ -3723,6 +3723,18 @@ class LabelsAPI {
3723
3723
  this.void = (labelId) => {
3724
3724
  return this.client.put(`/v1/labels/${labelId}/void`);
3725
3725
  };
3726
+ /**
3727
+ * The `download` method allows for downloading a CSV document of labels based on the provided parameters.
3728
+ */
3729
+ this.download = (params) => {
3730
+ return this.client.get("/v1/labels/downloads", {
3731
+ headers: {
3732
+ Accept: "text/csv"
3733
+ },
3734
+ params,
3735
+ responseType: "blob"
3736
+ });
3737
+ };
3726
3738
  this.client = client;
3727
3739
  }
3728
3740
  }
@@ -4183,6 +4195,18 @@ class ShipmentsAPI {
4183
4195
  this.cancel = (shipmentId) => {
4184
4196
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4185
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
+ };
4186
4210
  this.client = client;
4187
4211
  }
4188
4212
  }
package/index.mjs CHANGED
@@ -3719,6 +3719,18 @@ class LabelsAPI {
3719
3719
  this.void = (labelId) => {
3720
3720
  return this.client.put(`/v1/labels/${labelId}/void`);
3721
3721
  };
3722
+ /**
3723
+ * The `download` method allows for downloading a CSV document of labels based on the provided parameters.
3724
+ */
3725
+ this.download = (params) => {
3726
+ return this.client.get("/v1/labels/downloads", {
3727
+ headers: {
3728
+ Accept: "text/csv"
3729
+ },
3730
+ params,
3731
+ responseType: "blob"
3732
+ });
3733
+ };
3722
3734
  this.client = client;
3723
3735
  }
3724
3736
  }
@@ -4179,6 +4191,18 @@ class ShipmentsAPI {
4179
4191
  this.cancel = (shipmentId) => {
4180
4192
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4181
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
+ };
4182
4206
  this.client = client;
4183
4207
  }
4184
4208
  }
package/labels/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { CreateLabelOptions, Label, ListLabelsParams, ListLabelsResult, VoidRequest } from "./types";
2
+ import { CreateLabelOptions, DownloadLabelsParams, Label, ListLabelsParams, ListLabelsResult, VoidRequest } from "./types";
3
3
  /**
4
4
  * # Labels API module - /v1/labels
5
5
  */
@@ -32,4 +32,8 @@ export declare class LabelsAPI {
32
32
  * The `void` method allows a user to void a label by `labelId`.
33
33
  */
34
34
  void: (labelId: string) => Promise<import("axios").AxiosResponse<VoidRequest, any>>;
35
+ /**
36
+ * The `download` method allows for downloading a CSV document of labels based on the provided parameters.
37
+ */
38
+ download: (params?: DownloadLabelsParams) => Promise<import("axios").AxiosResponse<Blob, any>>;
35
39
  }
package/labels/types.d.ts CHANGED
@@ -10,6 +10,7 @@ export type LabelFormat = "pdf" | "png" | "zpl";
10
10
  export type LabelLayout = "4x6" | "letter";
11
11
  export type LabelStatus = "processing" | "completed" | "error" | "voided";
12
12
  export type LabelTrackingStatus = "unknown" | "in_transit" | "delivered" | "error";
13
+ export type LabelColumns = "shipment_id" | "label_id" | "external_order_id" | "external_shipment_id" | "packages" | "recipient" | "shipping_service" | "created_date" | "ship_date" | "status" | "tracking_status";
13
14
  export type Label = {
14
15
  alternativeIdentifiers?: string[];
15
16
  batchId: string;
@@ -142,3 +143,13 @@ export interface CreateLabelOptions {
142
143
  */
143
144
  validateAddress?: string;
144
145
  }
146
+ export type DownloadLabelsParams = {
147
+ /**
148
+ * CSV column names to export
149
+ */
150
+ columns?: LabelColumns[];
151
+ /**
152
+ * Specific label ID to filter by
153
+ */
154
+ labelId?: string;
155
+ } & ListLabelsParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.0.1",
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;