@shipengine/js-api 0.40.1 → 1.0.0-next.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 (43) hide show
  1. package/account-settings/api.d.ts +2 -14
  2. package/account-settings/types.d.ts +2 -6
  3. package/addresses/api.d.ts +0 -11
  4. package/carriers/api.d.ts +2 -74
  5. package/carriers/types.d.ts +3 -22
  6. package/client.d.ts +1 -129
  7. package/custom-packages/api.d.ts +0 -6
  8. package/dimensions/types.d.ts +0 -5
  9. package/errors/types.d.ts +2 -2
  10. package/index.d.ts +0 -5
  11. package/index.js +16 -4074
  12. package/index.mjs +2829 -3936
  13. package/insurance/api.d.ts +0 -7
  14. package/labels/api.d.ts +0 -51
  15. package/order-sources/api.d.ts +0 -13
  16. package/package.json +2 -5
  17. package/rates/api.d.ts +0 -26
  18. package/resources/types.d.ts +0 -34
  19. package/sales-order-shipments/api.d.ts +5 -90
  20. package/sales-orders/api.d.ts +0 -25
  21. package/shipments/index.d.ts +0 -1
  22. package/shipments/types.d.ts +0 -13
  23. package/types.d.ts +0 -8
  24. package/warehouses/api.d.ts +0 -19
  25. package/account-billing-plan/api.d.ts +0 -13
  26. package/account-billing-plan/index.d.ts +0 -2
  27. package/account-billing-plan/types.d.ts +0 -30
  28. package/funding-sources/api.d.ts +0 -50
  29. package/funding-sources/index.d.ts +0 -2
  30. package/funding-sources/types.d.ts +0 -135
  31. package/rate-cards/api.d.ts +0 -44
  32. package/rate-cards/index.d.ts +0 -2
  33. package/rate-cards/types.d.ts +0 -88
  34. package/shipments/api.d.ts +0 -72
  35. package/shipping-rules/api.d.ts +0 -19
  36. package/shipping-rules/index.d.ts +0 -2
  37. package/shipping-rules/types.d.ts +0 -54
  38. package/utilities/index.d.ts +0 -1
  39. package/utilities/ip-address.d.ts +0 -1
  40. package/weight-band/index.d.ts +0 -1
  41. package/weight-band/types.d.ts +0 -17
  42. package/zones/index.d.ts +0 -1
  43. package/zones/types.d.ts +0 -7
@@ -1,19 +1,7 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { AccountSettings } from "./types";
3
- /**
4
- * # Account Settings API module - /v1/account/settings
5
- */
2
+ import { Settings } from "./types";
6
3
  export declare class AccountSettingsAPI {
7
4
  private client;
8
5
  constructor(client: AxiosInstance);
9
- /**
10
- * The `get` method retrieves the account settings for a given user.
11
- */
12
- get: () => Promise<import("axios").AxiosResponse<AccountSettings, any>>;
13
- /**
14
- * The `update` method updates specific account settings for a given user.
15
- *
16
- * @params Partial<AccountSettings> The account settings to update.
17
- */
18
- update: (settings: Partial<AccountSettings>) => Promise<import("axios").AxiosResponse<AccountSettings, any>>;
6
+ getAccountSettings: () => Promise<import("axios").AxiosResponse<Settings, any>>;
19
7
  }
@@ -1,8 +1,4 @@
1
- import { DimensionUnit } from "../dimensions";
2
1
  import { LabelLayout } from "../labels";
3
- import { WeightUnit } from "../weight";
4
- export interface AccountSettings {
5
- defaultLabelLayout: LabelLayout;
6
- dimensionsUnit: DimensionUnit;
7
- weightUnit: WeightUnit;
2
+ export interface Settings {
3
+ defaultLabelLayout: LabelLayout | null;
8
4
  }
@@ -1,19 +1,8 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Address, AddressExtraction, AddressValidation } from "./types";
3
- /**
4
- * # Addresses API module - /v1/addresses
5
- */
6
3
  export declare class AddressesAPI {
7
4
  private client;
8
5
  constructor(client: AxiosInstance);
9
- /**
10
- * The `validate` method validates a list of addresses.
11
- *
12
- * @params Address[] The addresses to be validated.
13
- */
14
6
  validate: (addresses: Address[]) => Promise<import("axios").AxiosResponse<AddressValidation[], any>>;
15
- /**
16
- * The `parse` method parses a string of text to extract addresses.
17
- */
18
7
  parse: (text: string, address?: Partial<Address>) => Promise<import("axios").AxiosResponse<AddressExtraction, any>>;
19
8
  }
package/carriers/api.d.ts CHANGED
@@ -1,89 +1,17 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { Currency, Money } from "../payments";
3
- import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, CarrierService, CarrierZone, PackageRatingType, WalletTransactionHistory } from "./types";
4
- /**
5
- * # Carriers API module - /v1/carriers
6
- */
2
+ import { Money } from "../payments";
3
+ import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection } from "./types";
7
4
  export declare class CarriersAPI {
8
5
  private client;
9
6
  constructor(client: AxiosInstance);
10
- /**
11
- * The `list` method retrieves a list of connected carriers for a given user.
12
- */
13
7
  list: () => Promise<import("axios").AxiosResponse<{
14
8
  carriers: Carrier[];
15
9
  }, any>>;
16
- /**
17
- * The `get` method retrieves a specific carrier by `carrierId`.
18
- */
19
10
  get: (carrierId: string) => Promise<import("axios").AxiosResponse<Carrier, any>>;
20
- /**
21
- * The `connect` method connects a carrier account to a user's ShipEngine account.
22
- */
23
11
  connect: ({ carrierCode, ...connection }: CarrierConnection) => Promise<import("axios").AxiosResponse<void, any>>;
24
- /**
25
- * The `addFunds` method allows a user to add funds to their carrier account balance.
26
- * Not all carrier providers allow you to maintain a balance.
27
- *
28
- * - For example, FedEx does
29
- * not require you to maintain a balance that will be used when purchasing labels.
30
- */
31
12
  addFunds: (carrierId: string, funds: Money) => Promise<import("axios").AxiosResponse<{
32
13
  balance: Money;
33
14
  }, any>>;
34
- /**
35
- * The `updateAutoFunding` method allows a user to update the auto-funding settings
36
- * on their ShipEngine account.
37
- *
38
- * e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
39
- * per day you wish to auto-fund your account.
40
- */
41
15
  updateAutoFunding: (carrierId: string, options: CarrierAutoFundingSettings) => Promise<import("axios").AxiosResponse<CarrierAutoFundingSettingsResponse, any>>;
42
- /**
43
- * The `getAutoFunding` method retrieves the current auto-funding settings.
44
- *
45
- * If no auto-funding rules have been set, the response will contain the default
46
- * values for auto-funding. Auto-funding is disabled by default.
47
- */
48
16
  getAutoFunding: (carrierId: string) => Promise<import("axios").AxiosResponse<CarrierAutoFundingSettingsResponse, any>>;
49
- /**
50
- * The `getWalletHistory` method retrieves the wallet transaction history for
51
- * a ShipEngine wallet account.
52
- */
53
- getWalletHistory: (startDate: Date, endDate: Date, page: number) => Promise<import("axios").AxiosResponse<WalletTransactionHistory, any>>;
54
- /**
55
- * The `getServices` method retrieves a list of shipping services that a given carrier offers.
56
- */
57
- getServices: (carrierId: string) => Promise<import("axios").AxiosResponse<{
58
- services: CarrierService[];
59
- }, any>>;
60
- /**
61
- * The `getPackageRatingGroup` method retrieves a list of package rating groups.
62
- * This is primarily used for carriers that support negotiated rates, and a user
63
- * has a rate card with multiple package rating groups.
64
- */
65
- getPackageRatingGroup: (carrierId: string) => Promise<import("axios").AxiosResponse<{
66
- packageRatingGroup: PackageRatingType[];
67
- }, any>>;
68
- /**
69
- * The `getCountries` method retrieves a list of countries that a given carrier
70
- * supports shipping to.
71
- */
72
- getCountries: (carrierId: string) => Promise<import("axios").AxiosResponse<{
73
- countries: string[];
74
- }, any>>;
75
- /**
76
- * The `getCurrencies` method retrieves a list of currencies that a given carrier
77
- * supports the usage of.
78
- */
79
- getCurrencies: (carrierId: string) => Promise<import("axios").AxiosResponse<{
80
- currencies: Currency[];
81
- }, any>>;
82
- /**
83
- * The `getZones` method retrieves a list of zones for which the attached carrier
84
- * provides support to.
85
- */
86
- getZones: (carrierId: string) => Promise<import("axios").AxiosResponse<{
87
- zones: CarrierZone[];
88
- }, any>>;
89
17
  }
@@ -1,7 +1,6 @@
1
1
  import { Address } from "../addresses";
2
2
  import { DimensionsWithUnit } from "../dimensions";
3
3
  import { CreditCard, Money } from "../payments";
4
- import { WeightWithUnit } from "../weight";
5
4
  /**
6
5
  * @category Entities
7
6
  */
@@ -48,20 +47,6 @@ export interface CarrierPackage {
48
47
  packageCode: string;
49
48
  packageId?: string;
50
49
  }
51
- /**
52
- * @category Entities
53
- */
54
- export interface PackageRatingType {
55
- apiCode?: string;
56
- carrierPackageTypeCode: string;
57
- description: string;
58
- dimensions: DimensionsWithUnit;
59
- maxWeight: WeightWithUnit;
60
- name: string;
61
- packageId: string;
62
- packageTypeId?: string;
63
- status: string;
64
- }
65
50
  /**
66
51
  * @category Entities
67
52
  */
@@ -101,15 +86,15 @@ export type CarrierConnection = {
101
86
  carrierCode: "dhl_express_walleted";
102
87
  nickname: string;
103
88
  };
104
- export type WalletTransactionType = "adjustment" | "purchase" | "reload" | "void";
105
89
  export type WalletTransaction = {
106
90
  amount: number;
107
91
  balance: number;
108
- carrier: Pick<Carrier, "carrierId" | "carrierCode" | "friendlyName">;
92
+ carrierId: string;
93
+ carrierProvider: string;
109
94
  labelId: string;
110
95
  transactionDate: string;
111
96
  transactionId: string;
112
- transactionType: WalletTransactionType;
97
+ transactionType: "fund" | "void" | "adjustment" | "purchase";
113
98
  };
114
99
  export type TransactionHistoryCsvLink = {
115
100
  transactionHistoryReport: string;
@@ -121,7 +106,3 @@ export type WalletTransactionHistory = {
121
106
  total: number;
122
107
  transactions: WalletTransaction[];
123
108
  };
124
- export type CarrierZone = {
125
- apiCode: string;
126
- name: string;
127
- };
package/client.d.ts CHANGED
@@ -1,162 +1,34 @@
1
1
  import { AxiosRequestHeaders } from "axios";
2
- import { AccountBillingPlanAPI } from "./account-billing-plan";
3
2
  import { AccountSettingsAPI } from "./account-settings";
4
3
  import { AddressesAPI } from "./addresses";
5
4
  import { CarriersAPI } from "./carriers";
6
5
  import { CustomPackagesAPI } from "./custom-packages";
7
- import { FundingSourcesAPI } from "./funding-sources";
8
6
  import { InsuranceAPI } from "./insurance";
9
7
  import { LabelsAPI } from "./labels";
10
8
  import { OrderSourcesAPI } from "./order-sources";
11
- import { RateCardsAPI } from "./rate-cards";
12
9
  import { RatesAPI } from "./rates";
13
10
  import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
14
11
  import { SalesOrdersAPI } from "./sales-orders";
15
- import { ShipmentsAPI } from "./shipments";
16
- import { ShippingRulesAPI } from "./shipping-rules";
17
12
  import { WarehousesAPI } from "./warehouses";
18
- /**
19
- * # ShipEngine API Client Headers
20
- */
21
13
  export type ShipEngineAPIHeaders = AxiosRequestHeaders;
22
- /**
23
- * # ShipEngine API Client Configuration
24
- */
25
14
  export interface ShipEngineAPIConfig {
26
- /**
27
- * `baseURL` is an optional string that represents the base URL to be used for all requests.
28
- */
29
15
  baseURL?: string;
30
- /**
31
- * `getToken` is an optional callback function that returns a token to used to authenticate all requests.
32
- */
33
16
  getToken: () => Promise<string> | string;
34
- /**
35
- * `headers` are optional HTTP headers to be sent with all requests.
36
- */
37
17
  headers?: ShipEngineAPIHeaders;
38
18
  }
39
- /**
40
- * # ShipEngine API Client
41
- *
42
- * - This class is the ShipEngine API Client that facilitates all requests. e.g.
43
- * Rate Shopping, Label Creation, etc.
44
- */
45
19
  export declare class ShipEngineAPI {
46
20
  private client;
47
21
  constructor(token: string, { baseURL, headers, getToken }: ShipEngineAPIConfig);
48
- /**
49
- * The `token` method takes in a string and sets it as the Authorization header for all requests.
50
- */
51
22
  set token(token: string);
52
- /**
53
- * The `accountSettings` method provides access to the Account Settings endpoints
54
- * in ShipEngine API.
55
- *
56
- * @see {@link AccountSettingsAPI | The Account Settings API module}
57
- */
58
- get accountSettings(): AccountSettingsAPI;
59
- /**
60
- * The `accountBillingPlan` method provides access to the Account Billing Plan endpoints
61
- * in ShipEngine API.
62
- */
63
- get accountBillingPlan(): AccountBillingPlanAPI;
64
- /**
65
- * The `addresses` method provides access to the Address Validation endpoints
66
- * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
67
- *
68
- * @see {@link AddressesAPI | The Addresses API module}
69
- */
70
23
  get addresses(): AddressesAPI;
71
- /**
72
- * The `carriers` method provides access to the Carrier endpoints in ShipEngine
73
- * API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
74
- *
75
- * @see {@link CarriersAPI | The Carriers API module}
76
- */
24
+ get accountSettings(): AccountSettingsAPI;
77
25
  get carriers(): CarriersAPI;
78
- /**
79
- * The `customPackages` method provides access to the Packages endpoint in ShipEngine
80
- * API. e.g. List Packages
81
- *
82
- * @see {@link CustomPackagesAPI | The Custom Packages API module}
83
- */
84
26
  get customPackages(): CustomPackagesAPI;
85
- /**
86
- * The `fundingSources` method provides access to the Funding Sources endpoints
87
- * in ShipEngine API.
88
- *
89
- * @see {@link FundingSourcesAPI | The Funding Sources API module}
90
- */
91
- get fundingSources(): FundingSourcesAPI;
92
- /**
93
- * The `insurance` method provides access to the Insurance endpoint in ShipEngine
94
- * API. e.g. Get Insurance Balance
95
- *
96
- * @see {@link InsuranceAPI | The Insurance API module}
97
- */
98
27
  get insurance(): InsuranceAPI;
99
- /**
100
- * The `labels` method provides access to the Label endpoints in ShipEngine API.
101
- * e.g. Create Label, Get Label, Void Label, etc.
102
- *
103
- * @see {@link LabelsAPI | The Labels API module}
104
- */
105
28
  get labels(): LabelsAPI;
106
- /**
107
- * The `orderSources` method provides access to the Order Sources endpoints in
108
- * ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
109
- *
110
- * @see {@link OrderSourcesAPI | The Order Sources API module}
111
- */
112
29
  get orderSources(): OrderSourcesAPI;
113
- /**
114
- * The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
115
- * API.
116
- *
117
- * @see {@link RateCardsAPI | The Rate Cards API module}
118
- */
119
- get rateCards(): RateCardsAPI;
120
- /**
121
- * The `rates` method provides access to the Rate endpoints in ShipEngine API.
122
- * e.g. Get Rates
123
- *
124
- * @see {@link RatesAPI | The Rates API module}
125
- */
126
30
  get rates(): RatesAPI;
127
- /**
128
- * The `salesOrderShipments` method provides access to the `v-beta` Sales
129
- * Order Shipments endpoints in ShipEngine API.
130
- *
131
- * @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
132
- */
133
31
  get salesOrderShipments(): SalesOrderShipmentsAPI;
134
- /**
135
- * The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
136
- * in ShipEngine API.
137
- *
138
- * @see {@link SalesOrdersAPI | The Sales Orders API module}
139
- */
140
32
  get salesOrders(): SalesOrdersAPI;
141
- /**
142
- * The `shipments` method provides access to the Shipment endpoints in ShipEngine
143
- * API. e.g. Create Shipment, Get Shipment, etc.
144
- *
145
- * @see {@link ShipmentsAPI | The Shipments API module}
146
- */
147
- get shipments(): ShipmentsAPI;
148
- /**
149
- * The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
150
- * API. e.g. List Warehouses, Get Warehouse, etc.
151
- *
152
- * @see {@link WarehousesAPI | The Warehouses API module}
153
- */
154
33
  get warehouses(): WarehousesAPI;
155
- /**
156
- * The `shippingRules` method provides access to the Shipping Rules endpoints in ShipEngine
157
- * API.
158
- *
159
- * @see {@link ShippingRulesAPI | The Shipping Rules API module}
160
- */
161
- get shippingRules(): ShippingRulesAPI;
162
34
  }
@@ -1,14 +1,8 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { CustomPackage } from "./types";
3
- /**
4
- * # Custom Packages API module - /v1/packages
5
- */
6
3
  export declare class CustomPackagesAPI {
7
4
  private client;
8
5
  constructor(client: AxiosInstance);
9
- /**
10
- * The `list` method retrieves a list of custom packages a given user has created.
11
- */
12
6
  list: () => Promise<import("axios").AxiosResponse<{
13
7
  packages: CustomPackage[];
14
8
  }, any>>;
@@ -6,13 +6,8 @@ export type DimensionUnit = "inch" | "centimeter";
6
6
  * @category Entities
7
7
  */
8
8
  export interface Dimensions {
9
- girth?: number;
10
9
  height: number;
11
10
  length: number;
12
- lengthPlusGirth?: number;
13
- noThreeSidesExceed?: number;
14
- noTwoSidesExceed?: number;
15
- volume?: number;
16
11
  width: number;
17
12
  }
18
13
  /**
package/errors/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @category Entities
3
3
  */
4
- export type CodedErrorCode = "auto_fund_not_supported" | "batch_cannot_be_modified" | "carrier_conflict" | "carrier_disconnected" | "carrier_not_connected" | "carrier_not_supported" | "confirmation_not_supported" | "default_warehouse_cannot_be_deleted" | "duplicated_rate_card" | "empty_file" | "field_conflict" | "field_value_required" | "forbidden" | "identifier_conflict" | "identifiers_must_match" | "insufficient_funds" | "insufficient_rate_card_data" | "invalid_address" | "invalid_billing_plan" | "invalid_currency" | "invalid_field_value" | "invalid_file_type" | "invalid_file_size" | "invalid_identifier" | "invalid_status" | "invalid_string_length" | "invalid_zones" | "invalid_packages" | "invalid_weight_bands" | "invalid_weight_bands_rates" | "invalid_rates" | "label_images_not_supported" | "meter_failure" | "not_found" | "order_source_not_active" | "rate_limit_exceeded" | "refresh_not_supported" | "repeated_surcharges_in_rate_card" | "repeated_surcharges_in_services" | "repeated_surcharges_in_zone" | "request_body_required" | "return_label_not_supported" | "settings_not_supported" | "subscription_inactive" | "terms_not_accepted" | "tracking_not_supported" | "trial_expired" | "unauthorized" | "unknown" | "unspecified" | "verification_failure" | "warehouse_conflict" | "webhook_event_type_conflict";
4
+ export type CodedErrorCode = "auto_fund_not_supported" | "batch_cannot_be_modified" | "carrier_conflict" | "carrier_disconnected" | "carrier_not_connected" | "carrier_not_supported" | "confirmation_not_supported" | "default_warehouse_cannot_be_deleted" | "field_conflict" | "field_value_required" | "forbidden" | "identifier_conflict" | "identifiers_must_match" | "insufficient_funds" | "invalid_address" | "invalid_billing_plan" | "invalid_field_value" | "invalid_identifier" | "invalid_status" | "invalid_string_length" | "label_images_not_supported" | "meter_failure" | "order_source_not_active" | "rate_limit_exceeded" | "refresh_not_supported" | "request_body_required" | "return_label_not_supported" | "settings_not_supported" | "subscription_inactive" | "terms_not_accepted" | "tracking_not_supported" | "trial_expired" | "unauthorized" | "unknown" | "unspecified" | "verification_failure" | "warehouse_conflict" | "webhook_event_type_conflict";
5
5
  /**
6
6
  * @category Entities
7
7
  */
8
- export type CodedErrorSource = "carrier" | "order_source" | "shipengine" | "elements" | "client" | "rate_card_manager";
8
+ export type CodedErrorSource = "carrier" | "order_source" | "shipengine" | "elements" | "client";
9
9
  /**
10
10
  * @category Entities
11
11
  */
package/index.d.ts CHANGED
@@ -6,20 +6,15 @@ export * from "./client";
6
6
  export * from "./custom-packages";
7
7
  export * from "./dimensions";
8
8
  export * from "./errors";
9
- export * from "./funding-sources";
10
9
  export * from "./insurance";
11
10
  export * from "./labels";
12
11
  export * from "./order-sources";
13
12
  export * from "./payments";
14
13
  export * from "./rates";
15
- export * from "./rate-cards";
16
14
  export * from "./relay-points";
17
15
  export * from "./resources";
18
16
  export * from "./sales-order-shipments";
19
17
  export * from "./sales-orders";
20
18
  export * from "./shipments";
21
- export * from "./shipping-rules";
22
- export * from "./utilities";
23
19
  export * from "./warehouses";
24
20
  export * from "./weight";
25
- export * from "./zones";