16 unstable releases (4 breaking)

0.6.0 Mar 8, 2024
0.5.0 Jan 23, 2024
0.4.8 Sep 4, 2023
0.3.4 Oct 18, 2022

#2 in #shopify

Download history 2/week @ 2023-12-01 6/week @ 2024-01-19 8/week @ 2024-02-23 119/week @ 2024-03-01 483/week @ 2024-03-08

610 downloads per month

MIT license

50KB
981 lines

shopify_api

crates.io Documentation MIT/Apache-2 licensed CI Issues

An ergonomic, Shopify API Client for Rust.

  • GraphQL API support with automatic data deserialization
  • Changelog

Example

This asynchronous example uses Tokio and enables some optional features, so your Cargo.toml could look like this:

[dependencies]
shopify_api = "0.6"
tokio = { version = "1", features = ["full"] }

And then the code:

use shopify_api::*;
use shopify_api::utils::ReadJsonTreeSteps;
use serde::{Deserialize};

#[derive(Deserialize)]
struct Shop {
  name: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let shopify = Shopify::new("hello", "world", String::from("2024-04"), None);

  let graphql_query = r#"
    query {
      shop {
      name
     }
  }"#;

  let variables = serde_json::json!({});
  let json_finder = vec![ReadJsonTreeSteps::Key("data"), ReadJsonTreeSteps::Key("shop")];

  let shop: Shop = shopify.graphql_query(graphql_query, &variables, &json_finder).await.unwrap();
  Ok(())
}

License

Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Dependencies

~7–21MB
~311K SLoC