@shipengine/js-api 0.47.1 → 0.48.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/index.js CHANGED
@@ -3774,7 +3774,16 @@ class ShippingRulesAPI {
3774
3774
  * `ShippingRule`.
3775
3775
  */
3776
3776
  this.edit = (shippingRule) => {
3777
- return this.client.put(`/v1/shipping_rules/${shippingRule.id}`, shippingRule);
3777
+ return this.client.put(
3778
+ `/v1/shipping_rules/${shippingRule.shippingRuleId}`,
3779
+ shippingRule
3780
+ );
3781
+ };
3782
+ /**
3783
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
3784
+ */
3785
+ this.getConditionOptions = () => {
3786
+ return this.client.get(`/v1/shipping_rules/rule_conditions_options`);
3778
3787
  };
3779
3788
  this.client = client;
3780
3789
  }
package/index.mjs CHANGED
@@ -3770,7 +3770,16 @@ class ShippingRulesAPI {
3770
3770
  * `ShippingRule`.
3771
3771
  */
3772
3772
  this.edit = (shippingRule) => {
3773
- return this.client.put(`/v1/shipping_rules/${shippingRule.id}`, shippingRule);
3773
+ return this.client.put(
3774
+ `/v1/shipping_rules/${shippingRule.shippingRuleId}`,
3775
+ shippingRule
3776
+ );
3777
+ };
3778
+ /**
3779
+ * The `getConditionOptions` method retrieves the list of condition options availables for creating shipping rules.
3780
+ */
3781
+ this.getConditionOptions = () => {
3782
+ return this.client.get(`/v1/shipping_rules/rule_conditions_options`);
3774
3783
  };
3775
3784
  this.client = client;
3776
3785
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.47.1",
3
+ "version": "0.48.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { ShippingRule, ShippingRuleInput } from "./types";
2
+ import { RuleConditionsOptions, ShippingRule, ShippingRuleInput } from "./types";
3
3
  /**
4
4
  * # Shipping Rules API module - /v1/shipping_rules
5
5
  */
@@ -29,4 +29,8 @@ export declare class ShippingRulesAPI {
29
29
  * `ShippingRule`.
30
30
  */
31
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>>;
32
36
  }
@@ -2,17 +2,25 @@ import { ISOString } from "../resources";
2
2
  /**
3
3
  * @category Entities
4
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";
5
+ 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";
6
6
  /**
7
7
  * @category Entities
8
8
  */
9
- type RuleTypeCondition = "is" | "is_less" | "is_more" | "is_not";
9
+ 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";
10
+ /**
11
+ * @category Entities
12
+ */
13
+ type RuleValueType = "STRING" | "LIST" | "INTEGER" | "DECIMAL";
14
+ /**
15
+ * @category Entities
16
+ */
17
+ type RuleValueField = "SELECT" | "MULTISELECT" | "FIELD";
10
18
  /**
11
19
  * @category Entities
12
20
  */
13
21
  export interface ShippingRulesConditions {
14
- identifier: RuleType;
15
- operation: RuleTypeCondition;
22
+ identifier: RuleIdentifier;
23
+ operation: RuleOperation;
16
24
  value: string;
17
25
  }
18
26
  /**
@@ -28,7 +36,7 @@ export interface Rule {
28
36
  */
29
37
  export interface ShippingRuleSelectedService {
30
38
  carrierId: string;
31
- carrierServiceCode: string;
39
+ serviceCode: string;
32
40
  }
33
41
  /**
34
42
  * @category Entities
@@ -40,13 +48,24 @@ export interface ShippingRule {
40
48
  default: ShippingRuleSelectedService;
41
49
  deleted?: boolean;
42
50
  deletedAt?: ISOString;
43
- id: string;
44
51
  name: string;
45
52
  rules?: Rule[];
53
+ shippingRuleId: string;
46
54
  updatedAt?: ISOString;
47
55
  }
48
56
  /**
49
57
  * @category Entities
50
58
  */
51
- export type ShippingRuleInput = Omit<ShippingRule, "id">;
59
+ export type ShippingRuleInput = Omit<ShippingRule, "shippingRuleId">;
60
+ /**
61
+ * @category Entities
62
+ */
63
+ export interface RuleConditionsOptions {
64
+ identifier: RuleIdentifier;
65
+ operations: RuleOperation[];
66
+ unitOptions?: string[];
67
+ valueField: RuleValueField;
68
+ valueOptions?: string[];
69
+ valueType: RuleValueType;
70
+ }
52
71
  export {};