Struct square_rs::client::SquareClient [−][src]
pub struct SquareClient { /* fields omitted */ }
Expand description
The SquareClient contains many useful methods allowing for convenient use of the Square API.
Implementations
impl SquareClient
[src]
impl SquareClient
[src]pub fn new(access_token: &str) -> Self
[src]
pub fn new(access_token: &str) -> Self
[src]Create a new SquareClient
Arguments
access_token
- The access token for the Square App you want to use the client with is required.
Example: Create a new client
let client = SquareClient::new(ACCESS_TOKEN);
pub fn production(self) -> Self
[src]
pub fn production(self) -> Self
[src]pub async fn request<T: ?Sized>(
&self,
endpoint: SquareEndpoint,
json: &T
) -> Result<SquareResponse, SquareError> where
T: Serialize,
[src]
pub async fn request<T: ?Sized>(
&self,
endpoint: SquareEndpoint,
json: &T
) -> Result<SquareResponse, SquareError> where
T: Serialize,
[src]Sends a request to a given SquareEndpoint
Arguments
endpoint
- The SquareEndpoint to send the request tobody
- The json that will be included in the request. All types that meet the conditions to be deserialized to JSON are accepted.
Example:
self.request(SquareEndpoint::Payments, &payment).await
impl SquareClient
[src]
impl SquareClient
[src]pub fn endpoint(&self, end_point: SquareEndpoint) -> String
[src]
impl SquareClient
[src]
impl SquareClient
[src]pub async fn create_payment(
&self,
payment: Payment
) -> Result<SquareResponse, SquareError>
[src]
pub async fn create_payment(
&self,
payment: Payment
) -> Result<SquareResponse, SquareError>
[src]Create a payment with the given Payment to the Square API and get the response back
Arguments
payment
- A Payment created from the PaymentBuilder
Trait Implementations
impl Clone for SquareClient
[src]
impl Clone for SquareClient
[src]fn clone(&self) -> SquareClient
[src]
fn clone(&self) -> SquareClient
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for SquareClient
impl Send for SquareClient
impl Sync for SquareClient
impl Unpin for SquareClient
impl UnwindSafe for SquareClient
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more