pub struct Locations<'a> { /* private fields */ }Implementations§
Source§impl<'a> Locations<'a>
impl<'a> Locations<'a>
Sourcepub async fn list(self) -> Result<SquareResponse, SquareError>
pub async fn list(self) -> Result<SquareResponse, SquareError>
See which Locations are available by requesting the information from the Square API and subsequently receiving them formatted as a list of Locations.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient
};
async {
let locations = SquareClient::new("some_token")
.locations()
.list()
.await;
};Sourcepub async fn create(
self,
new_location: LocationCreationWrapper,
) -> Result<SquareResponse, SquareError>
pub async fn create( self, new_location: LocationCreationWrapper, ) -> Result<SquareResponse, SquareError>
Create a new Location at the Square API.
§Arguments
new_location- A LocationCreationWrapper.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient,
builder::Builder,
api::locations::LocationCreationWrapper
};
use square_ox::builder::Buildable;
async {
let location = Builder::from(LocationCreationWrapper::default())
.name("The Foo Bar".to_string())
.build()
.await
.unwrap();
let res = SquareClient::new("some_token")
.locations()
.create(location)
.await;
};Sourcepub async fn update(
self,
updated_location: LocationCreationWrapper,
location_id: String,
) -> Result<SquareResponse, SquareError>
pub async fn update( self, updated_location: LocationCreationWrapper, location_id: String, ) -> Result<SquareResponse, SquareError>
Update an existing Location at the Square API.
§Arguments
updated_location- A LocationCreationWrapper.location_id- The id of the location that is to be updated.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient,
builder::Builder,
api::locations::LocationCreationWrapper
};
async {
let location = Builder::from(LocationCreationWrapper::default())
.name("The New Foo Bar".to_string())
.build()
.await
.unwrap();
let res = SquareClient::new("some_token")
.locations()
.update(location, "foo_bar_id".to_string())
.await;
};Sourcepub async fn retrieve(
self,
location_id: String,
) -> Result<SquareResponse, SquareError>
pub async fn retrieve( self, location_id: String, ) -> Result<SquareResponse, SquareError>
Retrieve a Location from Square API by the location id.
§Arguments
location_id- The id of the location that is to be retrieved.
§Example
use square_ox::{
response::{SquareResponse, ResponseError},
client::SquareClient
};
async {
let res = SquareClient::new("some_token")
.locations()
.retrieve("foo_bar_id".to_string())
.await;
};Auto Trait Implementations§
impl<'a> Freeze for Locations<'a>
impl<'a> RefUnwindSafe for Locations<'a>
impl<'a> Send for Locations<'a>
impl<'a> Sync for Locations<'a>
impl<'a> Unpin for Locations<'a>
impl<'a> UnwindSafe for Locations<'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