square-ox

Crates.iosquare-ox
lib.rssquare-ox
version0.2.0
sourcesrc
created_at2022-07-25 20:43:51.379369
updated_at2022-09-07 01:03:36.371362
descriptionAn easy, idiomatic, and flexible way of interacting with the Square API, following Rust conventions.
homepage
repositoryhttps://github.com/emilHof/square-ox
max_upload_size
id632824
size502,942
(emilHof)

documentation

README

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()?;

Commit count: 115

cargo fmt