@shipengine/js-api 0.36.0 → 0.38.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.
@@ -0,0 +1,13 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { AccountBillingPlanResponse } from "./types";
3
+ /**
4
+ * # Account Billing Plan API module - /v1/account/billing_plan
5
+ */
6
+ export declare class AccountBillingPlanAPI {
7
+ private client;
8
+ constructor(client: AxiosInstance);
9
+ /**
10
+ * The `get` method retrieves the account billing plan for the current user.
11
+ */
12
+ get: () => Promise<import("axios").AxiosResponse<AccountBillingPlanResponse, any>>;
13
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,30 @@
1
+ export declare enum AccountBillingPlanChangeType {
2
+ Downgrade = 0,
3
+ Cancellation = 1
4
+ }
5
+ export type AccountBillingPlan = {
6
+ code: string;
7
+ name: string;
8
+ };
9
+ /**
10
+ * Responses
11
+ */
12
+ /**
13
+ * "cancelledAt", "pendingChange" and "trialEndAt" are only available when applies
14
+ * won't be on the response otherwise
15
+ */
16
+ export type AccountBillingPlanResponse = {
17
+ billingPlan: AccountBillingPlan;
18
+ cancelledAt?: string;
19
+ currentBillingCycle: {
20
+ endsAt: string;
21
+ startedAt: string;
22
+ };
23
+ pendingChange?: {
24
+ changeTo: AccountBillingPlan;
25
+ effectiveAt: string;
26
+ requestedAt: string;
27
+ type: AccountBillingPlanChangeType;
28
+ };
29
+ trialEndAt?: string;
30
+ };
package/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AxiosRequestHeaders } from "axios";
2
+ import { AccountBillingPlanAPI } from "./account-billing-plan";
2
3
  import { AccountSettingsAPI } from "./account-settings";
3
4
  import { AddressesAPI } from "./addresses";
4
5
  import { CarriersAPI } from "./carriers";
@@ -12,6 +13,7 @@ import { RatesAPI } from "./rates";
12
13
  import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
13
14
  import { SalesOrdersAPI } from "./sales-orders";
14
15
  import { ShipmentsAPI } from "./shipments";
16
+ import { ShippingRulesAPI } from "./shipping-rules";
15
17
  import { WarehousesAPI } from "./warehouses";
16
18
  /**
17
19
  * # ShipEngine API Client Headers
@@ -54,6 +56,11 @@ export declare class ShipEngineAPI {
54
56
  * @see {@link AccountSettingsAPI | The Account Settings API module}
55
57
  */
56
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;
57
64
  /**
58
65
  * The `addresses` method provides access to the Address Validation endpoints
59
66
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -145,4 +152,11 @@ export declare class ShipEngineAPI {
145
152
  * @see {@link WarehousesAPI | The Warehouses API module}
146
153
  */
147
154
  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;
148
162
  }
package/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./resources";
18
18
  export * from "./sales-order-shipments";
19
19
  export * from "./sales-orders";
20
20
  export * from "./shipments";
21
+ export * from "./shipping-rules";
21
22
  export * from "./utilities";
22
23
  export * from "./warehouses";
23
24
  export * from "./weight";
package/index.js CHANGED
@@ -3227,6 +3227,19 @@ var lib = {
3227
3227
  stringify: stringify
3228
3228
  };
3229
3229
 
3230
+ class AccountBillingPlanAPI {
3231
+ constructor(client) {
3232
+ this.client = client;
3233
+ /**
3234
+ * The `get` method retrieves the account billing plan for the current user.
3235
+ */
3236
+ this.get = () => {
3237
+ return this.client.get("/v1/account/billing_plan");
3238
+ };
3239
+ this.client = client;
3240
+ }
3241
+ }
3242
+
3230
3243
  class CustomPackagesAPI {
3231
3244
  constructor(client) {
3232
3245
  this.client = client;
@@ -3622,6 +3635,19 @@ class ShipmentsAPI {
3622
3635
  }
3623
3636
  }
3624
3637
 
3638
+ class ShippingRulesAPI {
3639
+ constructor(client) {
3640
+ this.client = client;
3641
+ /**
3642
+ * The `list` method retrieves the list of shipping rules by seller.
3643
+ */
3644
+ this.list = () => {
3645
+ return this.client.get(`/v1/shipping_rules`);
3646
+ };
3647
+ this.client = client;
3648
+ }
3649
+ }
3650
+
3625
3651
  class WarehousesAPI {
3626
3652
  constructor(client) {
3627
3653
  this.client = client;
@@ -3825,6 +3851,13 @@ class ShipEngineAPI {
3825
3851
  get accountSettings() {
3826
3852
  return new AccountSettingsAPI(this.client);
3827
3853
  }
3854
+ /**
3855
+ * The `accountBillingPlan` method provides access to the Account Billing Plan endpoints
3856
+ * in ShipEngine API.
3857
+ */
3858
+ get accountBillingPlan() {
3859
+ return new AccountBillingPlanAPI(this.client);
3860
+ }
3828
3861
  /**
3829
3862
  * The `addresses` method provides access to the Address Validation endpoints
3830
3863
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -3942,6 +3975,15 @@ class ShipEngineAPI {
3942
3975
  get warehouses() {
3943
3976
  return new WarehousesAPI(this.client);
3944
3977
  }
3978
+ /**
3979
+ * The `shippingRules` method provides access to the Shipping Rules endpoints in ShipEngine
3980
+ * API.
3981
+ *
3982
+ * @see {@link ShippingRulesAPI | The Shipping Rules API module}
3983
+ */
3984
+ get shippingRules() {
3985
+ return new ShippingRulesAPI(this.client);
3986
+ }
3945
3987
  }
3946
3988
 
3947
3989
  exports.AccountSettingsAPI = AccountSettingsAPI;
@@ -3967,6 +4009,7 @@ exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
3967
4009
  exports.SalesOrdersAPI = SalesOrdersAPI;
3968
4010
  exports.ShipEngineAPI = ShipEngineAPI;
3969
4011
  exports.ShipmentsAPI = ShipmentsAPI;
4012
+ exports.ShippingRulesAPI = ShippingRulesAPI;
3970
4013
  exports.WarehousesAPI = WarehousesAPI;
3971
4014
  exports.getEndUserIpAddress = getEndUserIpAddress;
3972
4015
  exports.isCodedError = isCodedError;
package/index.mjs CHANGED
@@ -3223,6 +3223,19 @@ var lib = {
3223
3223
  stringify: stringify
3224
3224
  };
3225
3225
 
3226
+ class AccountBillingPlanAPI {
3227
+ constructor(client) {
3228
+ this.client = client;
3229
+ /**
3230
+ * The `get` method retrieves the account billing plan for the current user.
3231
+ */
3232
+ this.get = () => {
3233
+ return this.client.get("/v1/account/billing_plan");
3234
+ };
3235
+ this.client = client;
3236
+ }
3237
+ }
3238
+
3226
3239
  class CustomPackagesAPI {
3227
3240
  constructor(client) {
3228
3241
  this.client = client;
@@ -3618,6 +3631,19 @@ class ShipmentsAPI {
3618
3631
  }
3619
3632
  }
3620
3633
 
3634
+ class ShippingRulesAPI {
3635
+ constructor(client) {
3636
+ this.client = client;
3637
+ /**
3638
+ * The `list` method retrieves the list of shipping rules by seller.
3639
+ */
3640
+ this.list = () => {
3641
+ return this.client.get(`/v1/shipping_rules`);
3642
+ };
3643
+ this.client = client;
3644
+ }
3645
+ }
3646
+
3621
3647
  class WarehousesAPI {
3622
3648
  constructor(client) {
3623
3649
  this.client = client;
@@ -3821,6 +3847,13 @@ class ShipEngineAPI {
3821
3847
  get accountSettings() {
3822
3848
  return new AccountSettingsAPI(this.client);
3823
3849
  }
3850
+ /**
3851
+ * The `accountBillingPlan` method provides access to the Account Billing Plan endpoints
3852
+ * in ShipEngine API.
3853
+ */
3854
+ get accountBillingPlan() {
3855
+ return new AccountBillingPlanAPI(this.client);
3856
+ }
3824
3857
  /**
3825
3858
  * The `addresses` method provides access to the Address Validation endpoints
3826
3859
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -3938,6 +3971,15 @@ class ShipEngineAPI {
3938
3971
  get warehouses() {
3939
3972
  return new WarehousesAPI(this.client);
3940
3973
  }
3974
+ /**
3975
+ * The `shippingRules` method provides access to the Shipping Rules endpoints in ShipEngine
3976
+ * API.
3977
+ *
3978
+ * @see {@link ShippingRulesAPI | The Shipping Rules API module}
3979
+ */
3980
+ get shippingRules() {
3981
+ return new ShippingRulesAPI(this.client);
3982
+ }
3941
3983
  }
3942
3984
 
3943
- export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
3985
+ export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.36.0",
3
+ "version": "0.38.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 { ShippingRule } 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
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,50 @@
1
+ import { ISOString } from "../resources";
2
+ /**
3
+ * @category Entities
4
+ */
5
+ type RuleType = "dimension" | "number_of_packages" | "ship_from_address_residential_indicator" | "ship_from_country_code" | "ship_to_address_residential_indicator" | "ship_to_country_code" | "warehouse_id" | "weight";
6
+ /**
7
+ * @category Entities
8
+ */
9
+ type RuleTypeCondition = "is" | "is_less" | "is_more" | "is_not";
10
+ /**
11
+ * @category Entities
12
+ */
13
+ export interface Conditions {
14
+ identifier: RuleType;
15
+ operation: RuleTypeCondition;
16
+ value: string;
17
+ }
18
+ /**
19
+ * @category Entities
20
+ */
21
+ export interface SelectedService {
22
+ carrierId: string;
23
+ carrierServiceCode: string;
24
+ }
25
+ /**
26
+ * @category Entities
27
+ */
28
+ export interface ShippingRule {
29
+ active?: boolean;
30
+ code?: string;
31
+ createdAt?: ISOString;
32
+ default: {
33
+ services: SelectedService[];
34
+ sortBy: string;
35
+ };
36
+ deleted?: boolean;
37
+ deletedAt?: ISOString;
38
+ id?: string;
39
+ name: string;
40
+ rules?: [
41
+ {
42
+ conditions: Conditions[];
43
+ priority: number;
44
+ services: SelectedService[];
45
+ sortBy: string;
46
+ }
47
+ ];
48
+ updatedAt?: ISOString;
49
+ }
50
+ export {};