Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
![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

Testing CI
Testiong Release PLease

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
24 changes: 24 additions & 0 deletions shopify-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion shopify-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
serde = { version = "1", features = ["derive"] }
13 changes: 11 additions & 2 deletions shopify-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum SubCommand {
OrderGetRisks(OrderGet),
OrderGetFulfillmentOrders(OrderGet),
OrderFulfill(OrderFulfill),
LocationList,
}

#[derive(Parser)]
Expand Down Expand Up @@ -57,6 +58,7 @@ fn main() {
}
SubCommand::OrderList => order_list(&client),
SubCommand::OrderFulfill(fulfill) => order_fulfill(&client, &fulfill),
SubCommand::LocationList => location_list(&client),
}
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand All @@ -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()
}
51 changes: 51 additions & 0 deletions shopify/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion shopify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shopify"
version = "0.1.6"
version = "0.1.7"
authors = ["fluxxu <fluxxu@gmail.com>"]
description = "Shopify API Client for Rust."
license = "MIT"
Expand Down
3 changes: 2 additions & 1 deletion shopify/src/order/fulfillment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ pub struct CreateFulfillmentRequest {
#[derive(Debug, Serialize, Deserialize)]
pub struct LineItemsByFulfillmentOrder {
pub fulfillment_order_id: i64,
pub line_items: Vec<FulfillmentOrderLineItems>,
pub fulfillment_order_line_items: Vec<FulfillmentOrderLineItems>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct TrackingInfo {
pub company: String,
pub number: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
}
2 changes: 1 addition & 1 deletion shopify/src/order/fulfillment_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct MoveFulfillmentOrderRequest {
#[derive(Debug, Serialize, Deserialize)]
pub struct FulfillmentOrderLineItems {
pub id: i64,
pub quantity: Option<i64>,
pub quantity: i64,
}

#[derive(Debug, Serialize, Deserialize)]
Expand Down