@shipengine/js-api 1.0.0-next.4 → 1.0.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.
Files changed (51) hide show
  1. package/README.md +30 -0
  2. package/account-billing-plan/api.d.ts +17 -0
  3. package/account-billing-plan/index.d.ts +2 -0
  4. package/account-billing-plan/types.d.ts +37 -0
  5. package/account-settings/api.d.ts +30 -2
  6. package/account-settings/types.d.ts +22 -2
  7. package/addresses/api.d.ts +11 -0
  8. package/carriers/api.d.ts +69 -2
  9. package/carriers/types.d.ts +22 -3
  10. package/client.d.ts +157 -3
  11. package/connections/api.d.ts +18 -0
  12. package/connections/index.d.ts +2 -0
  13. package/connections/types.d.ts +36 -0
  14. package/custom-packages/api.d.ts +6 -0
  15. package/dimensions/types.d.ts +5 -0
  16. package/errors/types.d.ts +2 -2
  17. package/errors/utils.d.ts +4 -0
  18. package/funding-sources/api.d.ts +56 -0
  19. package/funding-sources/index.d.ts +2 -0
  20. package/funding-sources/types.d.ts +159 -0
  21. package/index.d.ts +7 -0
  22. package/index.js +4212 -16
  23. package/index.mjs +4027 -2786
  24. package/insurance/api.d.ts +7 -0
  25. package/labels/api.d.ts +89 -5
  26. package/order-sources/api.d.ts +17 -0
  27. package/package.json +6 -2
  28. package/rate-cards/api.d.ts +44 -0
  29. package/rate-cards/index.d.ts +2 -0
  30. package/rate-cards/types.d.ts +88 -0
  31. package/rates/api.d.ts +26 -0
  32. package/resources/types.d.ts +40 -0
  33. package/sales-order-shipments/api.d.ts +94 -5
  34. package/sales-orders/api.d.ts +25 -0
  35. package/shipments/api.d.ts +72 -0
  36. package/shipments/index.d.ts +1 -0
  37. package/shipments/types.d.ts +85 -4
  38. package/shipping-rules/api.d.ts +36 -0
  39. package/shipping-rules/index.d.ts +2 -0
  40. package/shipping-rules/types.d.ts +77 -0
  41. package/themes/api.d.ts +13 -0
  42. package/themes/index.d.ts +2 -0
  43. package/themes/types.d.ts +21 -0
  44. package/types.d.ts +10 -0
  45. package/utilities/index.d.ts +1 -0
  46. package/utilities/ip-address.d.ts +1 -0
  47. package/warehouses/api.d.ts +19 -0
  48. package/weight-band/index.d.ts +1 -0
  49. package/weight-band/types.d.ts +17 -0
  50. package/zones/index.d.ts +1 -0
  51. package/zones/types.d.ts +7 -0
@@ -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
  /**
@@ -49,6 +51,63 @@ export declare enum CustomsNonDeliveryType {
49
51
  RETURN_TO_SENDER = "return_to_sender",
50
52
  TREAT_AS_ABANDONED = "treat_as_abandoned"
51
53
  }
54
+ /**
55
+ * @category Entities
56
+ */
57
+ export type CustomsTermsOfTradeCode = "exw" | "fca" | "cpt" | "cip" | "dpu" | "dap" | "ddp" | "fas" | "fob" | "cfr" | "cif" | "ddu" | "daf" | "deq" | "des";
58
+ /**
59
+ * @category Entities
60
+ */
61
+ export interface CustomsInvoiceAdditionalDetails {
62
+ discount?: Money;
63
+ freightCharge?: Money;
64
+ insuranceCharge?: Money;
65
+ otherChargeDescription?: string;
66
+ otherCharges?: Money;
67
+ }
68
+ /**
69
+ * @category Entities
70
+ */
71
+ export interface DangerousGoods {
72
+ AddionalDescription?: string;
73
+ dangerousAmount?: {
74
+ amount: number;
75
+ unit?: string;
76
+ };
77
+ idNumber?: string;
78
+ packagingGroup?: DangerousGoodsPackagingGroup;
79
+ packagingInstruction?: string;
80
+ packagingInstructionSection?: DangerousGoodsPackagingInstructionSection;
81
+ packagingType?: string;
82
+ productClass?: string;
83
+ productClassSubsidiary?: string;
84
+ quantity?: number;
85
+ radioactive?: boolean;
86
+ regulationAuthority?: string;
87
+ regulationLevel?: DangerousGoodsRegulationLevel;
88
+ reportableQuantity?: boolean;
89
+ shippingName?: string;
90
+ technicalName?: string;
91
+ transportCategory?: string;
92
+ transportMean?: DangerousGoodsTransportMean;
93
+ tunnelCode?: string;
94
+ }
95
+ /**
96
+ * @category Entities
97
+ */
98
+ export type DangerousGoodsPackagingGroup = "i" | "ii" | "iii";
99
+ /**
100
+ * @category Entities
101
+ */
102
+ export type DangerousGoodsPackagingInstructionSection = "section_1" | "section_2" | "section_1a" | "section_1b";
103
+ /**
104
+ * @category Entities
105
+ */
106
+ export type DangerousGoodsRegulationLevel = "lightly_regulated" | "fully_regulated" | "limited_quantities" | "excepted_quantity";
107
+ /**
108
+ * @category Entities
109
+ */
110
+ export type DangerousGoodsTransportMean = "ground" | "water" | "cargo_aircraft_only" | "passenger_aircraft";
52
111
  /**
53
112
  * @category Entities
54
113
  */
@@ -73,16 +132,21 @@ export type TaxableIdentifierType = "vat" | "eori" | "ssn" | "ein" | "tin" | "io
73
132
  /**
74
133
  * @category Entities
75
134
  */
76
- export interface CustomsItem {
135
+ export interface Product {
77
136
  countryOfOrigin?: string;
78
- customsItemId?: string;
137
+ dangerousGoods?: DangerousGoods;
79
138
  description?: string;
80
139
  harmonizedTariffCode?: string;
140
+ midCode?: string;
141
+ productId?: string;
142
+ productUrl?: string;
81
143
  quantity: number;
82
144
  sku?: string;
83
145
  skuDescription?: string;
84
146
  unitOfMeasure?: string;
85
- value: Money | number;
147
+ value: Money;
148
+ vatRate?: number;
149
+ weight?: WeightWithUnit;
86
150
  }
87
151
  /**
88
152
  * @category Entities
@@ -100,6 +164,7 @@ export interface ShipmentItem {
100
164
  * @category Entities
101
165
  */
102
166
  export type ShipmentPackage = Omit<CarrierPackage, "name"> & {
167
+ contentDescription?: string;
103
168
  externalPackageId?: string;
104
169
  formDownload?: LinkedResource;
105
170
  insuredValue?: Money;
@@ -109,6 +174,7 @@ export type ShipmentPackage = Omit<CarrierPackage, "name"> & {
109
174
  reference2: string;
110
175
  reference3: string;
111
176
  };
177
+ products?: Product[];
112
178
  sequence?: number;
113
179
  trackingNumber?: string;
114
180
  weight: WeightWithUnit;
@@ -135,8 +201,12 @@ export type PaymentTypes = "any" | "cash" | "cash_equivalent" | "none";
135
201
  */
136
202
  export type Customs = {
137
203
  contents: CustomsContents;
138
- customsItems: CustomsItem[];
204
+ contentsExplanation?: string;
205
+ declaration?: string;
206
+ importerOfRecord?: Address;
207
+ invoiceAdditionalDetails?: CustomsInvoiceAdditionalDetails;
139
208
  nonDelivery: CustomsNonDeliveryOptions;
209
+ termsOfTradeCode?: CustomsTermsOfTradeCode;
140
210
  };
141
211
  /**
142
212
  * @category Entities
@@ -144,6 +214,7 @@ export type Customs = {
144
214
  export interface Shipment {
145
215
  addressValidation?: AddressValidation;
146
216
  advancedOptions?: {
217
+ additionalHandling?: boolean;
147
218
  billToAccount?: string;
148
219
  billToCountryCode?: string;
149
220
  billToParty?: BillToParties;
@@ -167,6 +238,7 @@ export interface Shipment {
167
238
  useUpsGroundFreightPricing?: boolean;
168
239
  };
169
240
  carrierId: string;
241
+ comparisonRateType?: string;
170
242
  confirmation: ConfirmationType;
171
243
  createdAt: string;
172
244
  customs?: Customs;
@@ -193,3 +265,12 @@ export interface Shipment {
193
265
  validateAddress?: AddressValidationOptions;
194
266
  warehouseId?: string;
195
267
  }
268
+ export type ShipmentRateResponse = {
269
+ createdAt: string;
270
+ errors: CodedError[];
271
+ invalidRates: Rate[];
272
+ rateRequestId: string;
273
+ rates: Rate[];
274
+ shipmentId: string;
275
+ status: "working" | "completed" | "partial" | "error";
276
+ }[];
@@ -0,0 +1,36 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { RuleConditionsOptions, ShippingRule, ShippingRuleInput } from "./types";
3
+ /**
4
+ * # Shipping Rules API module - /v1/shipping_rules
5
+ */
6
+ export declare class ShippingRulesAPI {
7
+ private client;
8
+ constructor(client: AxiosInstance);
9
+ /**
10
+ * The `list` method retrieves the list of shipping rules by seller.
11
+ */
12
+ list: () => Promise<import("axios").AxiosResponse<{
13
+ shippingRules: ShippingRule[];
14
+ }, any>>;
15
+ /**
16
+ * The `get` method retrieves a specific shipping rule by `shippingRuleId`.
17
+ */
18
+ get: (shippingRuleId: string) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
19
+ /**
20
+ * The `create` method creates a new shipping rule for a given user.
21
+ */
22
+ create: (shippingRule: ShippingRuleInput) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
23
+ /**
24
+ * The `delete` method deletes a shipping rule by `shippingRuleId`.
25
+ */
26
+ delete: (shippingRuleId: string) => Promise<import("axios").AxiosResponse<any, any>>;
27
+ /**
28
+ * The `edit` method edits a specific shipping rule by `shippingRuleId` with a new
29
+ * `ShippingRule`.
30
+ */
31
+ edit: (shippingRule: ShippingRule) => Promise<import("axios").AxiosResponse<ShippingRule, any>>;
32
+ /**
33
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
34
+ */
35
+ getConditionOptions: () => Promise<import("axios").AxiosResponse<RuleConditionsOptions[], any>>;
36
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,77 @@
1
+ import { DimensionUnit } from "../dimensions";
2
+ import { ISOString } from "../resources";
3
+ import { WeightUnit } from "../weight";
4
+ /**
5
+ * @category Entities
6
+ */
7
+ export type RuleIdentifier = "MAX_DIMENSION" | "NUMBER_OF_PACKAGES" | "SHIP_FROM_ADDRESS_RESIDENTIAL_INDICATOR" | "SHIP_FROM_COUNTRY_CODE" | "SHIP_TO_ADDRESS_RESIDENTIAL_INDICATOR" | "SHIP_TO_COUNTRY_CODE" | "SHIP_TO_POSTAL_CODE" | "SHIP_FROM_POSTAL_CODE" | "SHIPMENT_VALUE" | "WAREHOUSE_ID" | "WEIGHT";
8
+ /**
9
+ * @category Entities
10
+ */
11
+ export type RuleOperation = "IS" | "IS_LESS_THAN" | "IS_GREATER_THAN" | "IS_NOT" | "IN" | "NOT_IN" | "STARTS_WITH" | "IS_LESS_OR_EQUAL_TO" | "IS_GREATER_OR_EQUAL_TO";
12
+ /**
13
+ * @category Entities
14
+ */
15
+ export type RuleValueType = "STRING" | "LIST" | "INTEGER" | "DECIMAL";
16
+ /**
17
+ * @category Entities
18
+ */
19
+ export type RuleValueField = "SELECT" | "MULTISELECT" | "FIELD";
20
+ /**
21
+ * @category Entities
22
+ */
23
+ export type RuleValueUnit = DimensionUnit | WeightUnit;
24
+ /**
25
+ * @category Entities
26
+ */
27
+ export interface ShippingRulesConditions {
28
+ identifier: RuleIdentifier;
29
+ operation: RuleOperation;
30
+ value: string | string[] | number;
31
+ valueUnit?: RuleValueUnit;
32
+ }
33
+ /**
34
+ * @category Entities
35
+ */
36
+ export interface Rule {
37
+ conditions: ShippingRulesConditions[];
38
+ priority: number;
39
+ service: ShippingRuleSelectedService;
40
+ }
41
+ /**
42
+ * @category Entities
43
+ */
44
+ export interface ShippingRuleSelectedService {
45
+ carrierId: string;
46
+ serviceCode: string;
47
+ }
48
+ /**
49
+ * @category Entities
50
+ */
51
+ export interface ShippingRule {
52
+ active?: boolean;
53
+ code?: string;
54
+ createdAt?: ISOString;
55
+ default?: ShippingRuleSelectedService;
56
+ deleted?: boolean;
57
+ deletedAt?: ISOString;
58
+ name: string;
59
+ rules?: Rule[];
60
+ shippingRuleId: string;
61
+ updatedAt?: ISOString;
62
+ }
63
+ /**
64
+ * @category Entities
65
+ */
66
+ export type ShippingRuleInput = Omit<ShippingRule, "shippingRuleId">;
67
+ /**
68
+ * @category Entities
69
+ */
70
+ export interface RuleConditionsOptions {
71
+ identifier: RuleIdentifier;
72
+ operations: RuleOperation[];
73
+ unitOptions?: RuleValueUnit[];
74
+ valueField: RuleValueField;
75
+ valueOptions?: string[];
76
+ valueType: RuleValueType;
77
+ }
@@ -0,0 +1,13 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { PartnerTheme } from "./types";
3
+ /**
4
+ * # Themes API module - /v1/themes
5
+ */
6
+ export declare class ThemesAPI {
7
+ private client;
8
+ constructor(client: AxiosInstance);
9
+ /**
10
+ * The `get` method retrieves a specific theme by `themeId`.
11
+ */
12
+ get: (themeId: string) => Promise<import("axios").AxiosResponse<PartnerTheme, any>>;
13
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,21 @@
1
+ export type PartnerThemeLogo = {
2
+ contentType: "image/jpeg" | "image/png";
3
+ imageData: string;
4
+ };
5
+ export type PartnerThemeOnboarding = {
6
+ completeButtonText?: string;
7
+ completeText?: string;
8
+ completeTitle?: string;
9
+ startText?: string;
10
+ startTitle?: string;
11
+ };
12
+ export type PartnerTheme = {
13
+ brand: string;
14
+ createdAt: string;
15
+ logo?: PartnerThemeLogo;
16
+ modifiedAt: string;
17
+ name: string;
18
+ onboarding?: PartnerThemeOnboarding;
19
+ returnUrl?: string;
20
+ themeId: string;
21
+ };
package/types.d.ts CHANGED
@@ -1,17 +1,27 @@
1
+ export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
2
+ export * from "./account-settings/types";
3
+ export * from "./account-billing-plan/types";
1
4
  export * from "./addresses/types";
2
5
  export * from "./carriers/types";
6
+ export * from "./connections/types";
3
7
  export * from "./custom-packages/types";
4
8
  export * from "./dimensions/types";
5
9
  export * from "./errors/types";
10
+ export * from "./funding-sources/types";
6
11
  export * from "./insurance/types";
7
12
  export * from "./labels/types";
8
13
  export * from "./order-sources/types";
9
14
  export * from "./payments/types";
10
15
  export * from "./rates/types";
16
+ export * from "./rate-cards/types";
11
17
  export * from "./relay-points/types";
12
18
  export * from "./resources/types";
13
19
  export * from "./sales-order-shipments/types";
14
20
  export * from "./sales-orders/types";
15
21
  export * from "./shipments/types";
22
+ export * from "./shipping-rules/types";
23
+ export * from "./themes/types";
16
24
  export * from "./warehouses/types";
17
25
  export * from "./weight/types";
26
+ export * from "./weight-band/types";
27
+ export * from "./zones/types";
@@ -0,0 +1 @@
1
+ export * from "./ip-address";
@@ -0,0 +1 @@
1
+ export declare const getEndUserIpAddress: () => Promise<string | undefined>;
@@ -1,12 +1,31 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Warehouse } from "./types";
3
+ /**
4
+ * # Warehouses API module - /v1/warehouses
5
+ */
3
6
  export declare class WarehousesAPI {
4
7
  private client;
5
8
  constructor(client: AxiosInstance);
9
+ /**
10
+ * The `list` method retrieves a list of `warehouses` (Ship From Locations)
11
+ * for a given user.
12
+ */
6
13
  list: () => Promise<import("axios").AxiosResponse<{
7
14
  warehouses: Warehouse[];
8
15
  }, any>>;
16
+ /**
17
+ * The `create` method allows for creation of warehouses (Ship From Locations)
18
+ * on a users ShipEngine account.
19
+ */
9
20
  create: (warehouse: Partial<Warehouse>) => Promise<import("axios").AxiosResponse<Warehouse, any>>;
21
+ /**
22
+ * The `update` method updates a specific warehouse (Ship From Location) for a
23
+ * given user by `warehouseId`.
24
+ */
10
25
  update: (warehouseId: string, warehouse: Partial<Warehouse>) => Promise<import("axios").AxiosResponse<void, any>>;
26
+ /**
27
+ * The `delete` method deletes a specific warehouse (Ship From Location) by
28
+ * `warehouseId` from a users ShipEngine account.
29
+ */
11
30
  delete: (warehouseId: string) => Promise<import("axios").AxiosResponse<void, any>>;
12
31
  }
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -0,0 +1,17 @@
1
+ import { WeightUnit } from "../weight";
2
+ /**
3
+ * @category Entities
4
+ */
5
+ export type WeightBandIncremental = {
6
+ increment: number;
7
+ minimum: number;
8
+ unit: WeightUnit;
9
+ };
10
+ /**
11
+ * @category Entities
12
+ */
13
+ export type WeightBandMinMax = {
14
+ maximum: number;
15
+ minimum: number;
16
+ unit: WeightUnit;
17
+ };
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @category Entities
3
+ */
4
+ export type Zone = {
5
+ name: string;
6
+ zoneCode: string;
7
+ };