1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use crate::common::RequestTrait;
use crate::serialization::inconsistent_bool;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug)]
pub struct Field {
pub id: String,
pub name: String,
#[serde(rename = "type")]
pub field_type: String,
pub desc: Option<String>,
pub options: Option<HashMap<String, String>>,
pub show_field: Option<HashMap<String, String>>,
pub value: Option<serde_json::Value>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct PackageField {
pub id: String,
pub name: String,
#[serde(rename = "type")]
pub package_field_type: String,
pub options: Option<HashMap<String, String>>,
#[serde(rename = "default")]
pub package_field_default: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct GetCourierFieldsResponse {
#[serde(deserialize_with = "inconsistent_bool")]
pub multi_packages: bool,
pub fields: Vec<Field>,
pub package_fields: Vec<PackageField>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct GetCourierFields {
pub courier_code: String,
}
impl RequestTrait<GetCourierFieldsResponse> for GetCourierFields {
const METHOD: &'static str = "getCourierFields";
}