1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
//! Rust async client library for accessing the [Coinbase API](https://developers.coinbase.com/api/v2). //! //! ## Usage //! //! Add this to your `Cargo.toml`: //! //! ```toml //! [dependencies] //! coinbase = "1" //! ``` //! //! To make API calls, you need to create an instance of the Coinbase **[`Client`][client]**. The client can be created by calling `coinbase::Client::new(api_key, api_secret)`, or by calling `coinbase::Client::from_env()` and passing the credentials in `COINBASE_API_KEY`, and `COINBASE_API_SECRET` environment variables. //! //! ## Examples //! //! The following example shows you how to connect to Coinbase, and retrieve basic information: //! //! ```ignore //! use coinbase::Client; //! //! #[tokio::main] //! async fn main() { //! let client = Client::from_env().unwrap(); //! //! println!( //! "Auth Info: {}", //! serde_json::to_string(&client.get_auth_info().await.unwrap()).unwrap() //! ); //! //! println!( //! "Current User: {}", //! serde_json::to_string(&client.get_current_user().await.unwrap()).unwrap() //! ); //! //! let accounts_resp = client.list_accounts(&Default::default()).await.unwrap(); //! println!( //! "Accounts: {}", //! serde_json::to_string(&accounts_resp).unwrap() //! ); //! //! for account in &accounts_resp.data { //! let transactions_resp = client //! .list_transactions(&account.id, &PaginationOptions::default()) //! .await //! .unwrap(); //! println!( //! "Transactions for account {}: {}", //! &account.id, //! serde_json::to_string(&transactions_resp).unwrap() //! ); //! } //! } //! ``` pub mod accounts; pub mod client; pub mod errors; pub mod transactions; pub mod users; pub use client::Client;