pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub fn new<S: AsRef<str>>(api: S) -> Client
pub fn new<S: AsRef<str>>(api: S) -> Client
Examples found in repository?
examples/accounts.rs (line 10)
7async fn main() -> mercury_rust::Result<()> {
8
9 let secret_key = env::var("API_KEY").expect("Missing 'API_KEY'.");
10 let client = Client::new(secret_key);
11
12 let accounts = Account::list(&client).await?;
13
14 if let ListData::<Account>::Accounts( ref list ) = accounts.data {
15
16 for account in list.iter() {
17 println!("Account: {}", account.name);
18 println!("Available Balance: {}", account.available_balance);
19 println!("Current Balance: {}", account.current_balance);
20 println!("Account Type: {:?}", account.kind);
21 println!();
22 }
23
24 }
25
26 Ok(())
27}
pub async fn get<A, B>( &self, path: &str, param: Vec<&str>, data: B, ) -> Result<A>
pub async fn post<A, B>( &self, path: &str, param: Vec<&str>, data: B, ) -> Result<A>
pub async fn put<A, B>( &self, path: &str, param: Vec<&str>, data: B, ) -> Result<A>
pub async fn delete<A, B>( &self, path: &str, param: Vec<&str>, data: B, ) -> Result<A>
pub async fn request<A, B>( &self, method: Method, path: &str, param: Vec<&str>, data: B, ) -> Result<A>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more