@shipengine/js-api 0.6.3 → 0.7.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/client.d.ts CHANGED
@@ -9,6 +9,7 @@ import { OrderSourcesAPI } from "./order-sources";
9
9
  import { RatesAPI } from "./rates";
10
10
  import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
11
11
  import { SalesOrdersAPI } from "./sales-orders";
12
+ import { ShipmentsAPI } from "./shipments";
12
13
  import { WarehousesAPI } from "./warehouses";
13
14
  export type ShipEngineAPIHeaders = AxiosRequestHeaders;
14
15
  export interface ShipEngineAPIConfig {
@@ -30,5 +31,6 @@ export declare class ShipEngineAPI {
30
31
  get rates(): RatesAPI;
31
32
  get salesOrderShipments(): SalesOrderShipmentsAPI;
32
33
  get salesOrders(): SalesOrdersAPI;
34
+ get shipments(): ShipmentsAPI;
33
35
  get warehouses(): WarehousesAPI;
34
36
  }
package/index.js CHANGED
@@ -5180,6 +5180,19 @@ class SalesOrdersAPI {
5180
5180
  }
5181
5181
  }
5182
5182
 
5183
+ class ShipmentsAPI {
5184
+ constructor(client) {
5185
+ this.client = client;
5186
+ this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
5187
+ return this.client.get(
5188
+ `/v1/shipments/${shipmentId}/rates`,
5189
+ createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
5190
+ );
5191
+ };
5192
+ this.client = client;
5193
+ }
5194
+ }
5195
+
5183
5196
  class WarehousesAPI {
5184
5197
  constructor(client) {
5185
5198
  this.client = client;
@@ -5367,6 +5380,9 @@ class ShipEngineAPI {
5367
5380
  get salesOrders() {
5368
5381
  return new SalesOrdersAPI(this.client);
5369
5382
  }
5383
+ get shipments() {
5384
+ return new ShipmentsAPI(this.client);
5385
+ }
5370
5386
  get warehouses() {
5371
5387
  return new WarehousesAPI(this.client);
5372
5388
  }
@@ -5391,6 +5407,7 @@ exports.SE = types;
5391
5407
  exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
5392
5408
  exports.SalesOrdersAPI = SalesOrdersAPI;
5393
5409
  exports.ShipEngineAPI = ShipEngineAPI;
5410
+ exports.ShipmentsAPI = ShipmentsAPI;
5394
5411
  exports.WarehousesAPI = WarehousesAPI;
5395
5412
  exports.isCodedError = isCodedError;
5396
5413
  exports.isCodedErrors = isCodedErrors;
package/index.mjs CHANGED
@@ -5176,6 +5176,19 @@ class SalesOrdersAPI {
5176
5176
  }
5177
5177
  }
5178
5178
 
5179
+ class ShipmentsAPI {
5180
+ constructor(client) {
5181
+ this.client = client;
5182
+ this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
5183
+ return this.client.get(
5184
+ `/v1/shipments/${shipmentId}/rates`,
5185
+ createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
5186
+ );
5187
+ };
5188
+ this.client = client;
5189
+ }
5190
+ }
5191
+
5179
5192
  class WarehousesAPI {
5180
5193
  constructor(client) {
5181
5194
  this.client = client;
@@ -5363,9 +5376,12 @@ class ShipEngineAPI {
5363
5376
  get salesOrders() {
5364
5377
  return new SalesOrdersAPI(this.client);
5365
5378
  }
5379
+ get shipments() {
5380
+ return new ShipmentsAPI(this.client);
5381
+ }
5366
5382
  get warehouses() {
5367
5383
  return new WarehousesAPI(this.client);
5368
5384
  }
5369
5385
  }
5370
5386
 
5371
- export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, WarehousesAPI, isCodedError, isCodedErrors };
5387
+ export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, WarehousesAPI, isCodedError, isCodedErrors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { ShipmentRateResponse } from "./types";
3
+ export type GetShipmentRatesOptions = {
4
+ /**
5
+ * Date to filter rates by (they must be more recent than this date if passed)
6
+ * @example "2019-03-12T19:24:13.657Z"
7
+ */
8
+ createdAtStart?: string;
9
+ shipmentId: string;
10
+ };
11
+ export declare class ShipmentsAPI {
12
+ private client;
13
+ constructor(client: AxiosInstance);
14
+ getShipmentRates: ({ shipmentId, createdAtStart }: GetShipmentRatesOptions) => Promise<import("axios").AxiosResponse<ShipmentRateResponse, any>>;
15
+ }
@@ -1 +1,2 @@
1
1
  export * from "./types";
2
+ export * from "./api";
@@ -1,7 +1,9 @@
1
1
  import { Address, AddressValidation } from "../addresses";
2
2
  import { CarrierPackage } from "../carriers";
3
+ import { CodedError } from '../errors';
3
4
  import { OrderSourceCode } from "../order-sources";
4
5
  import { Money } from "../payments";
6
+ import { Rate } from '../rates';
5
7
  import { Download, LinkedResource } from "../resources";
6
8
  import { WeightWithUnit } from "../weight";
7
9
  /**
@@ -195,3 +197,12 @@ export interface Shipment {
195
197
  validateAddress?: AddressValidationOptions;
196
198
  warehouseId?: string;
197
199
  }
200
+ export type ShipmentRateResponse = {
201
+ created_at: string;
202
+ errors: CodedError[];
203
+ invalidRates: Rate[];
204
+ rate_request_id: string;
205
+ rates: Rate[];
206
+ shipment_id: string;
207
+ status: "working" | "completed" | "partial" | "error";
208
+ }[];