pub struct Cards<'a> { /* private fields */ }Implementations§
Source§impl<'a> Cards<'a>
impl<'a> Cards<'a>
Sourcepub async fn retrieve(
self,
card_id: String,
) -> Result<SquareResponse, SquareError>
pub async fn retrieve( self, card_id: String, ) -> Result<SquareResponse, SquareError>
Find a specific Card by querying the Square API with the card_id.
§Arguments:
card_id- The id of the card you are looking to retrieve
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient
};
async {
let locations = SquareClient::new("some_token")
.cards()
.retrieve("some_id".to_string())
.await;
};Sourcepub async fn list(
self,
search_query: Option<Vec<(String, String)>>,
) -> Result<SquareResponse, SquareError>
pub async fn list( self, search_query: Option<Vec<(String, String)>>, ) -> Result<SquareResponse, SquareError>
See which Cards are on file by requesting the information from the Square API and receiving them formatted as a list of Cards.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient
};
async {
let locations = SquareClient::new("some_token")
.cards()
.list(None)
.await;
};Sourcepub async fn create(
self,
card: CardWrapper,
) -> Result<SquareResponse, SquareError>
pub async fn create( self, card: CardWrapper, ) -> Result<SquareResponse, SquareError>
Create a new Card registered at the Square API.
§Arguments:
card- A Card wrapped in a CardWrapper
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient,
api::cards::CardWrapper,
builder::Builder
};
async {
let card = Builder::from(CardWrapper::default())
.source_id("some_id".to_string())
.customer_id("some_id".to_string())
.build()
.await
.unwrap();
let locations = SquareClient::new("some_token")
.cards()
.create(card)
.await;
};Sourcepub async fn disable(
self,
card_id: String,
) -> Result<SquareResponse, SquareError>
pub async fn disable( self, card_id: String, ) -> Result<SquareResponse, SquareError>
Disable Card at the Square API.
§Arguments:
card_id- The id of the Card you want to disable.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient
};
async {
let locations = SquareClient::new("some_token")
.cards()
.disable("some_id".to_string())
.await;
};Auto Trait Implementations§
impl<'a> Freeze for Cards<'a>
impl<'a> RefUnwindSafe for Cards<'a>
impl<'a> Send for Cards<'a>
impl<'a> Sync for Cards<'a>
impl<'a> Unpin for Cards<'a>
impl<'a> UnwindSafe for Cards<'a>
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