square_api_client/models/
list_subscription_events_parameters.rs

1//! Model struct for ListSubscriptionEventsParameters (query parameters)
2
3/// This is a model struct for ListSubscriptionEventsParameters (query parameters)
4#[derive(Clone, Debug, Default)]
5pub struct ListSubscriptionEventsParameters {
6    /// When the total number of resulting subscription events exceeds the limit of a paged
7    /// response, specify the cursor returned from a preceding response here to fetch the next set
8    /// of results. If the cursor is unset, the response contains the last page of the results.
9    ///
10    /// For more information, see
11    /// [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
12    pub cursor: Option<String>,
13    /// The upper limit on the number of subscription events to return in a paged response.
14    pub limit: Option<i32>,
15}
16
17impl ListSubscriptionEventsParameters {
18    pub fn to_query_string(&self) -> String {
19        self.to_string()
20    }
21}
22
23impl From<ListSubscriptionEventsParameters> for String {
24    fn from(list_subscription_events_parameters: ListSubscriptionEventsParameters) -> Self {
25        list_subscription_events_parameters.to_string()
26    }
27}
28
29impl ToString for ListSubscriptionEventsParameters {
30    fn to_string(&self) -> String {
31        let mut params = Vec::new();
32
33        if let Some(cursor) = &self.cursor {
34            params.push(format!("cursor={}", cursor));
35        }
36
37        if let Some(limit) = &self.limit {
38            params.push(format!("limit={}", limit));
39        }
40
41        if params.is_empty() {
42            String::new()
43        } else {
44            format!("?{}", params.join("&"))
45        }
46    }
47}