@shipengine/js-api 0.31.0 → 0.32.1

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.
@@ -1,8 +1,19 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { AccountSettings } from "./types";
3
+ /**
4
+ * # Account Settings API module - /v1/account/settings
5
+ */
3
6
  export declare class AccountSettingsAPI {
4
7
  private client;
5
8
  constructor(client: AxiosInstance);
9
+ /**
10
+ * The `get` method retrieves the account settings for a given user.
11
+ */
6
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
+ */
7
18
  update: (settings: Partial<AccountSettings>) => Promise<import("axios").AxiosResponse<AccountSettings, any>>;
8
19
  }
@@ -1,8 +1,19 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Address, AddressExtraction, AddressValidation } from "./types";
3
+ /**
4
+ * # Addresses API module - /v1/addresses
5
+ */
3
6
  export declare class AddressesAPI {
4
7
  private client;
5
8
  constructor(client: AxiosInstance);
9
+ /**
10
+ * The `validate` method validates a list of addresses.
11
+ *
12
+ * @params Address[] The addresses to be validated.
13
+ */
6
14
  validate: (addresses: Address[]) => Promise<import("axios").AxiosResponse<AddressValidation[], any>>;
15
+ /**
16
+ * The `parse` method parses a string of text to extract addresses.
17
+ */
7
18
  parse: (text: string, address?: Partial<Address>) => Promise<import("axios").AxiosResponse<AddressExtraction, any>>;
8
19
  }
package/carriers/api.d.ts CHANGED
@@ -1,29 +1,81 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Currency, Money } from "../payments";
3
3
  import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, CarrierService, PackageRatingType, WalletTransactionHistory } from "./types";
4
+ /**
5
+ * # Carriers API module - /v1/carriers
6
+ */
4
7
  export declare class CarriersAPI {
5
8
  private client;
6
9
  constructor(client: AxiosInstance);
10
+ /**
11
+ * The `list` method retrieves a list of connected carriers for a given user.
12
+ */
7
13
  list: () => Promise<import("axios").AxiosResponse<{
8
14
  carriers: Carrier[];
9
15
  }, any>>;
16
+ /**
17
+ * The `get` method retrieves a specific carrier by `carrierId`.
18
+ */
10
19
  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
+ */
11
23
  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
+ */
12
31
  addFunds: (carrierId: string, funds: Money) => Promise<import("axios").AxiosResponse<{
13
32
  balance: Money;
14
33
  }, 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
+ */
15
41
  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
+ */
16
48
  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
+ */
17
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
+ */
18
57
  getServices: (carrierId: string) => Promise<import("axios").AxiosResponse<{
19
58
  services: CarrierService[];
20
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
+ */
21
65
  getPackageRatingGroup: (carrierId: string) => Promise<import("axios").AxiosResponse<{
22
66
  packageRatingGroup: PackageRatingType[];
23
67
  }, any>>;
68
+ /**
69
+ * The `getCountries` method retrieves a list of countries that a given carrier
70
+ * supports shipping to.
71
+ */
24
72
  getCountries: (carrierId: string) => Promise<import("axios").AxiosResponse<{
25
73
  countries: string[];
26
74
  }, any>>;
75
+ /**
76
+ * The `getCurrencies` method retrieves a list of currencies that a given carrier
77
+ * supports the usage of.
78
+ */
27
79
  getCurrencies: (carrierId: string) => Promise<import("axios").AxiosResponse<{
28
80
  currencies: Currency[];
29
81
  }, any>>;
package/client.d.ts CHANGED
@@ -13,28 +13,136 @@ import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
13
13
  import { SalesOrdersAPI } from "./sales-orders";
14
14
  import { ShipmentsAPI } from "./shipments";
15
15
  import { WarehousesAPI } from "./warehouses";
16
+ /**
17
+ * # ShipEngine API Client Headers
18
+ */
16
19
  export type ShipEngineAPIHeaders = AxiosRequestHeaders;
20
+ /**
21
+ * # ShipEngine API Client Configuration
22
+ */
17
23
  export interface ShipEngineAPIConfig {
24
+ /**
25
+ * `baseURL` is an optional string that represents the base URL to be used for all requests.
26
+ */
18
27
  baseURL?: string;
28
+ /**
29
+ * `getToken` is an optional callback function that returns a token to used to authenticate all requests.
30
+ */
19
31
  getToken: () => Promise<string> | string;
32
+ /**
33
+ * `headers` are optional HTTP headers to be sent with all requests.
34
+ */
20
35
  headers?: ShipEngineAPIHeaders;
21
36
  }
37
+ /**
38
+ * # ShipEngine API Client
39
+ *
40
+ * - This class is the ShipEngine API Client that facilitates all requests. e.g.
41
+ * Rate Shopping, Label Creation, etc.
42
+ */
22
43
  export declare class ShipEngineAPI {
23
44
  private client;
24
45
  constructor(token: string, { baseURL, headers, getToken }: ShipEngineAPIConfig);
46
+ /**
47
+ * The `token` method takes in a string and sets it as the Authorization header for all requests.
48
+ */
25
49
  set token(token: string);
50
+ /**
51
+ * The `accountSettings` method provides access to the Account Settings endpoints
52
+ * in ShipEngine API.
53
+ *
54
+ * @see {@link AccountSettingsAPI | The Account Settings API module}
55
+ */
26
56
  get accountSettings(): AccountSettingsAPI;
57
+ /**
58
+ * The `addresses` method provides access to the Address Validation endpoints
59
+ * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
60
+ *
61
+ * @see {@link AddressesAPI | The Addresses API module}
62
+ */
27
63
  get addresses(): AddressesAPI;
64
+ /**
65
+ * The `carriers` method provides access to the Carrier endpoints in ShipEngine
66
+ * API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
67
+ *
68
+ * @see {@link CarriersAPI | The Carriers API module}
69
+ */
28
70
  get carriers(): CarriersAPI;
71
+ /**
72
+ * The `customPackages` method provides access to the Packages endpoint in ShipEngine
73
+ * API. e.g. List Packages
74
+ *
75
+ * @see {@link CustomPackagesAPI | The Custom Packages API module}
76
+ */
29
77
  get customPackages(): CustomPackagesAPI;
78
+ /**
79
+ * The `fundingSources` method provides access to the Funding Sources endpoints
80
+ * in ShipEngine API.
81
+ *
82
+ * @see {@link FundingSourcesAPI | The Funding Sources API module}
83
+ */
30
84
  get fundingSources(): FundingSourcesAPI;
85
+ /**
86
+ * The `insurance` method provides access to the Insurance endpoint in ShipEngine
87
+ * API. e.g. Get Insurance Balance
88
+ *
89
+ * @see {@link InsuranceAPI | The Insurance API module}
90
+ */
31
91
  get insurance(): InsuranceAPI;
92
+ /**
93
+ * The `labels` method provides access to the Label endpoints in ShipEngine API.
94
+ * e.g. Create Label, Get Label, Void Label, etc.
95
+ *
96
+ * @see {@link LabelsAPI | The Labels API module}
97
+ */
32
98
  get labels(): LabelsAPI;
99
+ /**
100
+ * The `orderSources` method provides access to the Order Sources endpoints in
101
+ * ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
102
+ *
103
+ * @see {@link OrderSourcesAPI | The Order Sources API module}
104
+ */
33
105
  get orderSources(): OrderSourcesAPI;
106
+ /**
107
+ * The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
108
+ * API.
109
+ *
110
+ * @see {@link RateCardsAPI | The Rate Cards API module}
111
+ */
34
112
  get rateCards(): RateCardsAPI;
113
+ /**
114
+ * The `rates` method provides access to the Rate endpoints in ShipEngine API.
115
+ * e.g. Get Rates
116
+ *
117
+ * @see {@link RatesAPI | The Rates API module}
118
+ */
35
119
  get rates(): RatesAPI;
120
+ /**
121
+ * The `salesOrderShipments` method provides access to the `v-beta` Sales
122
+ * Order Shipments endpoints in ShipEngine API.
123
+ *
124
+ * @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
125
+ */
36
126
  get salesOrderShipments(): SalesOrderShipmentsAPI;
127
+ /**
128
+ * The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
129
+ * in ShipEngine API.
130
+ *
131
+ * @see {@link SalesOrdersAPI | The Sales Orders API module}
132
+ */
37
133
  get salesOrders(): SalesOrdersAPI;
134
+ /**
135
+ * The `shipments` method provides access to the Shipment endpoints in ShipEngine
136
+ * API. e.g. Create Shipment, Get Shipment, etc.
137
+ *
138
+ * @see {@link ShipmentsAPI | The Shipments API module}
139
+ */
38
140
  get shipments(): ShipmentsAPI;
141
+ /**
142
+ * The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
143
+ * API. e.g. List Warehouses, Get Warehouse, etc.
144
+ *
145
+ * @see {@link WarehousesAPI | The Warehouses API module}
146
+ */
39
147
  get warehouses(): WarehousesAPI;
40
148
  }
@@ -1,8 +1,14 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { CustomPackage } from "./types";
3
+ /**
4
+ * # Custom Packages API module - /v1/packages
5
+ */
3
6
  export declare class CustomPackagesAPI {
4
7
  private client;
5
8
  constructor(client: AxiosInstance);
9
+ /**
10
+ * The `list` method retrieves a list of custom packages a given user has created.
11
+ */
6
12
  list: () => Promise<import("axios").AxiosResponse<{
7
13
  packages: CustomPackage[];
8
14
  }, any>>;
@@ -1,19 +1,44 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Money } from "../payments";
3
3
  import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress } from "./types";
4
+ /**
5
+ * # Funding Sources API module - /v1/funding_sources
6
+ */
4
7
  export declare class FundingSourcesAPI {
5
8
  private client;
6
9
  constructor(client: AxiosInstance);
10
+ /**
11
+ * The `list` method retrieves a list of funding sources for a given user.
12
+ */
7
13
  list: () => Promise<import("axios").AxiosResponse<{
8
14
  fundingSources: FundingSource[];
9
15
  }, any>>;
16
+ /**
17
+ * The `get` method retrieves a specific funding source by `fundingSourceId`.
18
+ */
10
19
  get: (fundingSourceId: string) => Promise<import("axios").AxiosResponse<FundingSource, any>>;
20
+ /**
21
+ * The `create` method creates a new funding source for a given user. This requires
22
+ * payment information to be collected from the user.
23
+ */
11
24
  create: (createFundingSource: CreateFundingSource) => Promise<import("axios").AxiosResponse<{
12
25
  fundingSource: FundingSource;
13
26
  }, any>>;
27
+ /**
28
+ * The `update` method updates a funding source for a given user. This allows the
29
+ * user to update the billing address or payment information associated with the
30
+ * funding source.
31
+ */
14
32
  update: (billingInfo: FundingSourceAddress, creditCardInfo: CreditCardInfo, fundingSourceId: string) => Promise<import("axios").AxiosResponse<{
15
33
  fundingSource: FundingSource;
16
34
  }, any>>;
35
+ /**
36
+ * The `registerCarrier` method registers a carrier account and associates
37
+ * it with a given funding source.
38
+ */
17
39
  registerCarrier: (carrier: CarrierRegistration) => Promise<import("axios").AxiosResponse<CarrierRegistrationResponse, any>>;
40
+ /**
41
+ * The `addFunds` method allows you to add funds to a funding source.
42
+ */
18
43
  addFunds: (amount: Money, fundingSourceId: string) => Promise<import("axios").AxiosResponse<AddFundsResponse, any>>;
19
44
  }