square_api_client/models/
list_invoices_parameters.rs1#[derive(Clone, Debug, Default)]
5pub struct ListInvoicesParameters {
6 pub location_id: String,
8 pub cursor: Option<String>,
14 pub limit: Option<i32>,
17}
18
19impl ListInvoicesParameters {
20 pub fn to_query_string(&self) -> String {
21 self.to_string()
22 }
23}
24
25impl From<ListInvoicesParameters> for String {
26 fn from(list_invoices_parameters: ListInvoicesParameters) -> Self {
27 list_invoices_parameters.to_string()
28 }
29}
30
31impl ToString for ListInvoicesParameters {
32 fn to_string(&self) -> String {
33 let mut params = Vec::new();
34
35 if !self.location_id.is_empty() {
36 params.push(format!("location_id={}", &self.location_id));
37 }
38
39 if let Some(cursor) = &self.cursor {
40 params.push(format!("cursor={}", cursor));
41 }
42
43 if let Some(limit) = self.limit {
44 params.push(format!("limit={}", limit));
45 }
46
47 if params.is_empty() {
48 String::new()
49 } else {
50 format!("?{}", params.join("&"))
51 }
52 }
53}