shopify_client/
types.rs

1#[derive(serde::Deserialize, Debug)]
2pub struct OrderQueryResp {
3    pub orders: Vec<Order>,
4}
5
6#[derive(serde::Deserialize, Debug, Clone)]
7pub struct GetOrderResp {
8    pub order: Order,
9}
10
11#[derive(serde::Deserialize, Debug)]
12pub struct ErrorResp {
13    pub errors: String,
14}
15
16#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
17pub struct Order {
18    pub id: u128,
19    pub email: Option<String>,
20    pub phone: Option<String>,
21    pub line_items: Vec<LineItem>,
22    pub fulfillment_status: Option<String>,
23    pub fulfillments: Vec<Fulfillment>,
24    pub payment_gateway_names: Vec<String>,
25    pub subtotal_price_set: PriceSet,
26    pub total_discounts_set: PriceSet,
27    pub total_price_set: PriceSet,
28    pub total_shipping_price_set: PriceSet,
29    pub total_tax_set: PriceSet,
30    pub order_status_url: Option<String>,
31    pub financial_status: Option<String>,
32    pub name: String,
33    pub customer: Customer,
34    pub created_at: String,
35}
36
37#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
38pub struct Fulfillment {
39    pub id: u128,
40    pub status: String,
41    pub tracking_number: Option<String>,
42    pub tracking_company: Option<String>,
43    pub tracking_url: Option<String>,
44}
45
46#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
47pub struct Customer {
48    pub id: u128,
49    pub email: Option<String>,
50    pub phone: Option<String>,
51    pub first_name: Option<String>,
52    pub last_name: Option<String>,
53}
54
55#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
56
57pub struct LineItem {
58    pub id: u128,
59    pub quantity: i64,
60    pub title: String,
61    pub product_id: Option<u128>,
62    pub variant_title: Option<String>,
63    pub variant_id: u128,
64    pub price_set: PriceSet,
65    pub requires_shipping: bool,
66    pub properties: Vec<Property>,
67}
68
69#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
70pub struct Property {
71    pub name: String,
72    pub value: String,
73}
74
75#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
76pub struct PriceSet {
77    pub shop_money: Money,
78    pub presentment_money: Money,
79}
80
81#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
82pub struct Money {
83    pub amount: String,
84    pub currency_code: String,
85}
86
87#[derive(serde::Deserialize, Debug, serde::Serialize)]
88pub struct PatchOrderRequest {
89    pub order: PatchOrder,
90}
91
92#[derive(serde::Deserialize, Debug, serde::Serialize)]
93pub struct PatchOrder {
94    pub tags: Vec<String>,
95}
96
97#[derive(serde::Deserialize, Debug, serde::Serialize)]
98pub struct WebhookResponse {
99    pub message: String,
100}
101
102#[derive(serde::Deserialize, Debug, serde::Serialize, Clone)]
103pub enum APIError {
104    ServerError { errors: String },
105    FailedToParse,
106    NetworkError,
107}