/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.104.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Product : A product on the connected platform with its variants, options and images. All data lives on the platform; Zernio proxies it and stores nothing.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Product {
/// Platform-native product id (numeric string for Shopify).
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
pub platform: Option<Platform>,
#[serde(rename = "title", skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
/// URL slug of the product.
#[serde(rename = "handle", skip_serializing_if = "Option::is_none")]
pub handle: Option<String>,
/// Product description as HTML.
#[serde(
rename = "descriptionHtml",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub description_html: Option<Option<String>>,
#[serde(
rename = "vendor",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub vendor: Option<Option<String>>,
/// Free-text product type as set on the store.
#[serde(
rename = "productType",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub product_type: Option<Option<String>>,
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<String>>,
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
#[serde(
rename = "featuredImage",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub featured_image: Option<Option<Box<models::ProductImage>>>,
/// First 20 images in the product media, in store order.
#[serde(rename = "images", skip_serializing_if = "Option::is_none")]
pub images: Option<Vec<models::ProductImage>>,
/// Option axes (e.g. Size, Color) and their values.
#[serde(rename = "options", skip_serializing_if = "Option::is_none")]
pub options: Option<Vec<models::ProductOptionsInner>>,
/// First 100 variants.
#[serde(rename = "variants", skip_serializing_if = "Option::is_none")]
pub variants: Option<Vec<models::ProductVariant>>,
#[serde(rename = "seo", skip_serializing_if = "Option::is_none")]
pub seo: Option<Box<models::ProductSeo>>,
#[serde(
rename = "totalInventory",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub total_inventory: Option<Option<i32>>,
/// Public storefront URL; null while the product is not published to the online store.
#[serde(
rename = "onlineStoreUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub online_store_url: Option<Option<String>>,
#[serde(
rename = "createdAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_at: Option<Option<String>>,
#[serde(
rename = "updatedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub updated_at: Option<Option<String>>,
#[serde(
rename = "publishedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub published_at: Option<Option<String>>,
}
impl Product {
/// A product on the connected platform with its variants, options and images. All data lives on the platform; Zernio proxies it and stores nothing.
pub fn new() -> Product {
Product {
id: None,
platform: None,
title: None,
handle: None,
description_html: None,
vendor: None,
product_type: None,
tags: None,
status: None,
featured_image: None,
images: None,
options: None,
variants: None,
seo: None,
total_inventory: None,
online_store_url: None,
created_at: None,
updated_at: None,
published_at: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
#[serde(rename = "shopify")]
Shopify,
}
impl Default for Platform {
fn default() -> Platform {
Self::Shopify
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "active")]
Active,
#[serde(rename = "draft")]
Draft,
#[serde(rename = "archived")]
Archived,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}