squareup/models/
list_subscription_events_parameters.rs1use std::fmt::Display;
4
5#[derive(Clone, Debug, Default)]
7pub struct ListSubscriptionEventsParameters {
8 pub cursor: Option<String>,
15 pub limit: Option<i32>,
17}
18
19impl ListSubscriptionEventsParameters {
20 pub fn to_query_string(&self) -> String {
21 self.to_string()
22 }
23}
24
25impl From<ListSubscriptionEventsParameters> for String {
26 fn from(list_subscription_events_parameters: ListSubscriptionEventsParameters) -> Self {
27 list_subscription_events_parameters.to_string()
28 }
29}
30
31impl Display for ListSubscriptionEventsParameters {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 let mut params = Vec::new();
34
35 if let Some(cursor) = &self.cursor {
36 params.push(format!("cursor={}", cursor));
37 }
38
39 if let Some(limit) = &self.limit {
40 params.push(format!("limit={}", limit));
41 }
42
43 let str = if params.is_empty() {
44 String::new()
45 } else {
46 format!("?{}", params.join("&"))
47 };
48 write!(f, "{}", str)
49 }
50}