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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
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()
}
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