pub struct TransactionsClient { /* private fields */ }Expand description
Client for transactions operations
Implementations§
Source§impl TransactionsClient
impl TransactionsClient
Sourcepub fn new(client: Client, app_id: String, base_url: String) -> Self
pub fn new(client: Client, app_id: String, base_url: String) -> Self
Create a new client instance
Sourcepub async fn get<'a>(
&'a self,
transaction_id: &'a str,
) -> Result<ResponseValue<Transaction>, Error<()>>
pub async fn get<'a>( &'a self, transaction_id: &'a str, ) -> Result<ResponseValue<Transaction>, Error<()>>
Get Transaction
Get a transaction by transaction ID.
Sends a GET request to /v1/transactions/{transaction_id}
Examples found in repository?
examples/get_transaction.rs (line 41)
24async fn main() -> Result<()> {
25 tracing_subscriber::fmt()
26 .with_env_filter(
27 EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
28 )
29 .init();
30
31 // Get transaction ID from environment and initialize client
32 let transaction_id = std::env::var("PRIVY_TRANSACTION_ID")
33 .expect("PRIVY_TRANSACTION_ID environment variable not set");
34 let client = PrivyClient::new_from_env()?;
35
36 tracing::info!(
37 "initialized privy client from environment, transaction_id: {}",
38 transaction_id
39 );
40
41 let transaction = client.transactions().get(&transaction_id).await?;
42
43 tracing::info!("got transaction: {:?}", transaction);
44
45 Ok(())
46}Trait Implementations§
Source§impl Clone for TransactionsClient
impl Clone for TransactionsClient
Source§fn clone(&self) -> TransactionsClient
fn clone(&self) -> TransactionsClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransactionsClient
impl !RefUnwindSafe for TransactionsClient
impl Send for TransactionsClient
impl Sync for TransactionsClient
impl Unpin for TransactionsClient
impl !UnwindSafe for TransactionsClient
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