[][src]Struct aiven_rs::payment::PaymentApi

pub struct PaymentApi { /* fields omitted */ }

Methods

impl PaymentApi[src]

pub async fn add_credit_card<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<ResCard, AivenError>
[src]

Add credit card for user

https://api.aiven.io/doc/#api-Payment-CreditCardAdd

Arguments

  • stripe_token - Credit card Stripe token

Examples

Basic usage:

use serde_json::json;
use std::collections::HashMap;

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::from_token("https://api.aiven.io", "v1", "aiven-token");
let mut json = HashMap::new();
json.insert("stripe_token", "tok_17JIPf2eZvKY2CIkGwJXpO");
let response = client
        .payment()
        .add_credit_card(&json)
        .await?;
Ok(())
}

pub async fn delete_credit_card<'_, '_>(
    &'_ self,
    card_id: &'_ str
) -> Result<(), AivenError>
[src]

Delete user's credit card

https://api.aiven.io/doc/#api-Payment-CreditCardDelete

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::from_token("https://api.aiven.io", "v1", "aiven-token");

let response = client
        .payment()
        .delete_credit_card("unique-card-id")
        .await?;
Ok(())
}

pub async fn list_credit_cards<'_>(&'_ self) -> Result<ResCards, AivenError>[src]

List user's credit cards

https://api.aiven.io/doc/#api-Payment-CreditCardsList

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::from_token("https://api.aiven.io", "v1", "aiven-token");

let response = client
        .payment()
        .list_credit_cards()
        .await?;
Ok(())
}

pub async fn update_credit_card<'_, '_, '_, T: Serialize + ?Sized>(
    &'_ self,
    card_id: &'_ str,
    json_body: &'_ T
) -> Result<ResCard, AivenError>
[src]

Update user's credit card

https://api.aiven.io/doc/#api-Payment-CreditCardUpdate

Examples

Basic usage:

use serde_json::json;

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::from_token("https://api.aiven.io", "v1", "aiven-token");
let json = json!({
"exp_month": 1,
"exp_year": 2015,
"name": "John Smith"
});
let response = client
        .payment()
        .update_credit_card("cardid",&json)
        .await?;
Ok(())
}

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,