noah_sdk/api/
payment_methods.rs1use crate::client::NoahClient;
4use crate::error::Result;
5use crate::models::common::*;
6use crate::models::payment_methods::GetPaymentMethodsResponse;
7
8impl NoahClient {
9 #[cfg(feature = "async")]
11 pub async fn get_payment_methods(
12 &self,
13 customer_id: &CustomerID,
14 page_size: Option<u32>,
15 page_token: Option<&str>,
16 ) -> Result<GetPaymentMethodsResponse> {
17 let mut path = "/payment-methods".to_string();
18 let mut query_params = vec![format!("CustomerID={customer_id}")];
19
20 if let Some(size) = page_size {
21 query_params.push(format!("PageSize={size}"));
22 }
23 if let Some(token) = page_token {
24 query_params.push(format!("PageToken={token}"));
25 }
26
27 path.push('?');
28 path.push_str(&query_params.join("&"));
29
30 self.get(&path).await
31 }
32
33 #[cfg(feature = "sync")]
35 pub fn get_payment_methods_blocking(
36 &self,
37 customer_id: &CustomerID,
38 page_size: Option<u32>,
39 page_token: Option<&str>,
40 ) -> Result<GetPaymentMethodsResponse> {
41 let mut path = "/payment-methods".to_string();
42 let mut query_params = vec![format!("CustomerID={customer_id}")];
43
44 if let Some(size) = page_size {
45 query_params.push(format!("PageSize={size}"));
46 }
47 if let Some(token) = page_token {
48 query_params.push(format!("PageToken={token}"));
49 }
50
51 path.push('?');
52 path.push_str(&query_params.join("&"));
53
54 self.get_blocking(&path)
55 }
56}