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
#[derive(Clone, Debug, Default)]
pub struct RetrieveInventoryCountParams {
pub location_ids: Option<Vec<String>>,
pub cursor: Option<String>,
}
impl RetrieveInventoryCountParams {
pub fn to_query_string(&self) -> String {
self.to_string()
}
}
impl From<RetrieveInventoryCountParams> for String {
fn from(retrieve_inventory_count_parameters: RetrieveInventoryCountParams) -> Self {
retrieve_inventory_count_parameters.to_string()
}
}
impl ToString for RetrieveInventoryCountParams {
fn to_string(&self) -> String {
let mut params = Vec::new();
if let Some(location_ids) = &self.location_ids {
params.push(format!("location_ids={}", location_ids.join(",")));
}
if let Some(cursor) = &self.cursor {
params.push(format!("cursor={}", cursor));
}
if params.is_empty() {
String::new()
} else {
format!("?{}", params.join("&"))
}
}
}