#square #payment #finance #api-bindings #query #card-processing

square-ox

An easy, idiomatic, and flexible way of interacting with the Square API, following Rust conventions

3 unstable releases

0.2.0 Sep 7, 2022
0.1.2 Aug 1, 2022
0.1.1 Jul 26, 2022
0.1.0 Jul 25, 2022

#361 in HTTP client


Used in square-ox-derive

Custom license

405KB
9K SLoC

square-ox


A crate for accessing the Square API Rest endpoint in an idiomatic manner.

Using this crate you are able to formulate standard queries to the Square API without worrying about the underlying workflows and specific JSON schemas.

A square-rs fork

Examples


Setup and Authentication with the API

use square_ox::client::SquareClient;
let client = SquareClient::new("your_access_token");

Sending Requests

// listing all locations
let locations = client.locations().list().await?;


// retrieving the count of an item in the inventory
let count = client.inventory()
.retrieve_count(
"some_obj_id".to_string(),
Some("some_loc_id".to_string())
)
.await()?;

// registering a new booking
client.bookings().create(
    Builder::from(BookingsPost::default())
    .start_at("2022-10-11T16:30:00Z".to_string())
    .customer_id("some_id".to_string())
    .add_appointment_segment(AppointmentSegment {
    duration_minutes: 60.00,
    team_member_id: "some_id".to_string(),
    any_team_member_id: None,
    intermission_minutes: None,
    resource_ids: None,
    service_variation_id: "some_id".to_string(),
    service_variation_version:  1655427266071,
    })
    .build()
    .await?
).await()?;

Dependencies

~6–18MB
~252K SLoC