rust_woocommerce/models/
shipping_zone_methods.rs1use crate::controllers::Entity;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct ShippingZoneMethod {
6 pub id: i64,
7 pub instance_id: i32,
9 pub title: String,
11 pub order: i32,
13 pub enabled: bool,
15 pub method_id: String,
17 pub method_title: String,
19 pub method_description: String,
21 pub settings: ShippingSettings,
23}
24impl Entity for ShippingZoneMethod {
25 fn endpoint() -> String {
26 String::new()
27 }
28
29 fn child_endpoint(parent_id: i32) -> String {
30 format!("shipping/zones/{parent_id}/methods/")
31 }
32}
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct ShippingSettings {
35 pub title: ShippingMethodSettings,
36 pub requires: Option<ShippingMethodSettings>,
37}
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct ShippingMethodSettings {
40 pub id: String,
42 pub label: String,
44 pub description: String,
46 #[serde(rename = "type")]
48 pub settings_type: SettingsType,
49 pub value: String,
51 #[serde(rename = "default")]
53 pub default_value: String,
54 pub tip: String,
56 pub placeholder: String,
58 pub options: Option<serde_json::Value>,
59}
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(rename_all = "snake_case")]
62pub enum SettingsType {
63 Text,
64 Email,
65 Number,
66 Color,
67 Password,
68 Textarea,
69 Select,
70 Multiselect,
71 Radio,
72 ImageWidth,
73 Checkbox,
74}