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 e8e820d995d09ad23131dcc7ed3f50ee0112d938 Mon Sep 17 00:00:00 2001 From: release-plz Date: Thu, 24 Aug 2023 13:13:14 +0000 Subject: [PATCH 3/3] chore: release --- shopify-cli/CHANGELOG.md | 24 +++++++++++++++++++ shopify-cli/Cargo.toml | 2 +- shopify/CHANGELOG.md | 51 ++++++++++++++++++++++++++++++++++++++++ shopify/Cargo.toml | 2 +- 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 shopify-cli/CHANGELOG.md create mode 100644 shopify/CHANGELOG.md diff --git a/shopify-cli/CHANGELOG.md b/shopify-cli/CHANGELOG.md new file mode 100644 index 0000000..4e2039e --- /dev/null +++ b/shopify-cli/CHANGELOG.md @@ -0,0 +1,24 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.0](https://github.com/jearle10/shopify/releases/tag/shopify-cli-v0.1.0) - 2023-08-24 + +### Added +- new pagination support; upgrade Product & Variant api to 2020-07 + +### Fixed +- fix order Property::value type + +### Other +- Fix fulfillment order creation field name +- Support new FulfillmentOrder API +- Shopify schema changes +- Order risk api +- upgrade clap +- shipping line source is optional +- add OrderApi::get diff --git a/shopify-cli/Cargo.toml b/shopify-cli/Cargo.toml index b09a78d..f6acc0a 100644 --- a/shopify-cli/Cargo.toml +++ b/shopify-cli/Cargo.toml @@ -11,4 +11,4 @@ clap = { version = "3.1.12", features = ["derive"] } shopify = { path = "../shopify" } dotenv = "0.15.0" serde_json = "1.0.56" -serde = { version = "1", features = ["derive"] } \ No newline at end of file +serde = { version = "1", features = ["derive"] } diff --git a/shopify/CHANGELOG.md b/shopify/CHANGELOG.md new file mode 100644 index 0000000..e75671d --- /dev/null +++ b/shopify/CHANGELOG.md @@ -0,0 +1,51 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.7](https://github.com/jearle10/shopify/compare/shopify-v0.1.6...shopify-v0.1.7) - 2023-08-24 + +### Added +- add ShipmentStatus::LabelPrinted +- make GetPage: Clone +- new pagination support; upgrade Product & Variant api to 2020-07 +- request_raw + +### Fixed +- fix order Property::value type + +### Other +- Merge branch 'cicd' into master +- Fix fulfillment order creation field name +- Resolve compile error within order module +- update fulfilment module test with new fields (sku sharing and order opt in) +- Resolve compiler errors with tests in inventory module +- add new fields +- Support new FulfillmentOrder API +- sku is nullable +- more nullable +- country is nullable +- Shopify schema changes +- body_html is nullable +- Order risk api +- Property value is nullable. +- rust 2018, reqwest 0.11, thiserror +- first name is optional +- shipping line source is optional +- optional fields +- add OrderApi::get +- fix an error caught in production +- create_fulfillment, update_fulfillment accept &NewFulfillment +- Make NewFulfillment Clone +- :tracking_urls +- :location_id +- Make enum Copy, Clone, PartialEq +- Should retry on Io error. +- Fix a typo. +- Inventory API initial +- Address.country_code is nullable. +- Fix test TMP_DIR +- 0.2.0 diff --git a/shopify/Cargo.toml b/shopify/Cargo.toml index c4d6fb5..0af93c9 100644 --- a/shopify/Cargo.toml +++ b/shopify/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shopify" -version = "0.1.6" +version = "0.1.7" authors = ["fluxxu "] description = "Shopify API Client for Rust." license = "MIT"