From c8289077d312944be84154c7ce1d3ed1a30b43dc Mon Sep 17 00:00:00 2001 From: Jian Earle Date: Sat, 29 Jul 2023 19:46:45 +0100 Subject: [PATCH 1/3] Updated readme --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dccd47d..7fb2a77 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ +![Crates.io](https://img.shields.io/crates/l/shopify/0.1.0) +![Crates.io](https://img.shields.io/crates/v/shopify) +![Crates.io](https://img.shields.io/crates/d/shopify) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Ventmere/shopify/ci.yml) + # shopify -Shopify API Client for Rust \ No newline at end of file + +Shopify is an unofficial sdk for the Shopify e-commerce platform written in rust. + +## Installation +```rust +cargo install shopify +``` + +## Usage +```rust +use shopify::client::Client; +use shopify::shop; + +// Create a new client +let client = Client::new( + "SHOPIFY_BASE_URL", + "SHOPIFY_API_KEY", + "SHOPIFY_PASSWORD" +); + +// Retrieve shop details +let shop = shop::ShopApi::get(&client); + +``` + +## License +This project is license under an MIT license \ No newline at end of file From 157e0a325ec02e679c0913ec59294f594fabaf61 Mon Sep 17 00:00:00 2001 From: Flux Xu Date: Mon, 7 Aug 2023 23:50:41 -0400 Subject: [PATCH 2/3] Fix fulfillment order creation field name --- shopify-cli/src/main.rs | 13 +++++++++++-- shopify/src/order/fulfillment.rs | 3 ++- shopify/src/order/fulfillment_order.rs | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/shopify-cli/src/main.rs b/shopify-cli/src/main.rs index 441b20e..f370fac 100644 --- a/shopify-cli/src/main.rs +++ b/shopify-cli/src/main.rs @@ -20,6 +20,7 @@ enum SubCommand { OrderGetRisks(OrderGet), OrderGetFulfillmentOrders(OrderGet), OrderFulfill(OrderFulfill), + LocationList, } #[derive(Parser)] @@ -57,6 +58,7 @@ fn main() { } SubCommand::OrderList => order_list(&client), SubCommand::OrderFulfill(fulfill) => order_fulfill(&client, &fulfill), + SubCommand::LocationList => location_list(&client), } } @@ -160,6 +162,7 @@ fn order_fulfill(client: &Client, fulfill: &OrderFulfill) { use shopify::order::*; let fos = client.get_fulfillment_orders(fulfill.id).unwrap(); + dbg!(&fos); let (fo, li) = fos .iter() .filter(|fo| fo.status == FulfillmentOrderStatus::Open) @@ -196,9 +199,9 @@ fn order_fulfill(client: &Client, fulfill: &OrderFulfill) { .create_fulfillment(&CreateFulfillmentRequest { line_items_by_fulfillment_order: vec![LineItemsByFulfillmentOrder { fulfillment_order_id: fo.id, - line_items: vec![FulfillmentOrderLineItems { + fulfillment_order_line_items: vec![FulfillmentOrderLineItems { id: li.id, - quantity: None, + quantity: 1, }], }], notify_customer: Some(true), @@ -212,3 +215,9 @@ fn order_fulfill(client: &Client, fulfill: &OrderFulfill) { serde_json::to_writer_pretty(std::io::stdout(), &r).unwrap() } + +fn location_list(client: &Client,) { + use shopify::inventory::LocationApi; + + serde_json::to_writer_pretty(std::io::stdout(), &client.get_list().unwrap()).unwrap() +} \ No newline at end of file diff --git a/shopify/src/order/fulfillment.rs b/shopify/src/order/fulfillment.rs index f2a9e41..0f5d947 100644 --- a/shopify/src/order/fulfillment.rs +++ b/shopify/src/order/fulfillment.rs @@ -77,12 +77,13 @@ pub struct CreateFulfillmentRequest { #[derive(Debug, Serialize, Deserialize)] pub struct LineItemsByFulfillmentOrder { pub fulfillment_order_id: i64, - pub line_items: Vec, + pub fulfillment_order_line_items: Vec, } #[derive(Debug, Serialize, Deserialize)] pub struct TrackingInfo { pub company: String, pub number: String, + #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, } diff --git a/shopify/src/order/fulfillment_order.rs b/shopify/src/order/fulfillment_order.rs index ee21f75..9afffab 100644 --- a/shopify/src/order/fulfillment_order.rs +++ b/shopify/src/order/fulfillment_order.rs @@ -74,7 +74,7 @@ pub struct MoveFulfillmentOrderRequest { #[derive(Debug, Serialize, Deserialize)] pub struct FulfillmentOrderLineItems { pub id: i64, - pub quantity: Option, + pub quantity: i64, } #[derive(Debug, Serialize, Deserialize)] From a3e6c75302fa5b9b8aeccdb67383d99001c89f89 Mon Sep 17 00:00:00 2001 From: Jian Earle <37029790+jearle10@users.noreply.github.com> Date: Thu, 24 Aug 2023 14:16:07 +0100 Subject: [PATCH 3/3] Make release PR dependent on formatting --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 341ed3c..a5e9e0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: # Maintains CHANGELOG.md, bumps version in cargo.toml and creates PR against current branch release-PR: - needs: build_and_test + needs: format runs-on: ubuntu-latest steps: - name: Checkout repository