square_api_client/models/list_customer_groups_parameters.rs
1//! Query parameters for the List Customer Groups API
2
3/// This is a model struct for ListCustomerGroupsParameters (query parameters)
4#[derive(Clone, Debug, Default)]
5pub struct ListCustomerGroupsParameters {
6 /// A pagination cursor returned by a previous call to this endpoint. Provide this cursor to
7 /// retrieve the next set of results for your original query.
8 ///
9 /// For more information, see
10 /// [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
11 pub cursor: Option<String>,
12 /// The maximum number of results to return in a single page. This limit is advisory. The
13 /// response might contain more or fewer results. If the limit is less than 1 or greater than
14 /// 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is
15 /// 50.
16 ///
17 /// For more information, see
18 /// [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).
19 pub limit: Option<i32>,
20}
21
22impl ListCustomerGroupsParameters {
23 pub fn to_query_string(&self) -> String {
24 self.to_string()
25 }
26}
27
28impl From<ListCustomerGroupsParameters> for String {
29 fn from(list_customer_groups_parameters: ListCustomerGroupsParameters) -> Self {
30 list_customer_groups_parameters.to_string()
31 }
32}
33
34impl ToString for ListCustomerGroupsParameters {
35 fn to_string(&self) -> String {
36 let mut params = Vec::new();
37
38 if let Some(cursor) = &self.cursor {
39 params.push(format!("cursor={}", cursor));
40 }
41
42 if let Some(limit) = self.limit {
43 params.push(format!("limit={}", limit));
44 }
45
46 if params.is_empty() {
47 String::new()
48 } else {
49 format!("?{}", params.join("&"))
50 }
51 }
52}