square_api_client/models/
retrieve_inventory_count_parameters.rs

1//! Model struct for RetrieveInventoryCountParams type
2
3#[derive(Clone, Debug, Default)]
4pub struct RetrieveInventoryCountParams {
5    pub location_ids: Option<Vec<String>>,
6    /// The pagination cursor returned in the previous response. Leave unset for an initial request.
7    /// The page size is currently set to be 100.
8    /// See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for
9    /// more information.
10    pub cursor: Option<String>,
11}
12
13impl RetrieveInventoryCountParams {
14    pub fn to_query_string(&self) -> String {
15        self.to_string()
16    }
17}
18
19impl From<RetrieveInventoryCountParams> for String {
20    fn from(retrieve_inventory_count_parameters: RetrieveInventoryCountParams) -> Self {
21        retrieve_inventory_count_parameters.to_string()
22    }
23}
24
25impl ToString for RetrieveInventoryCountParams {
26    fn to_string(&self) -> String {
27        let mut params = Vec::new();
28
29        if let Some(location_ids) = &self.location_ids {
30            params.push(format!("location_ids={}", location_ids.join(",")));
31        }
32
33        if let Some(cursor) = &self.cursor {
34            params.push(format!("cursor={}", cursor));
35        }
36
37        if params.is_empty() {
38            String::new()
39        } else {
40            format!("?{}", params.join("&"))
41        }
42    }
43}