/*
* 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.162.2
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// CommerceProduct : A product on a connected store, in the platform-neutral shape.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CommerceProduct {
/// Platform-native product id.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_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>,
#[serde(
rename = "descriptionHtml",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub description_html: Option<Option<String>>,
/// URL slug of the product.
#[serde(
rename = "handle",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub handle: Option<Option<String>>,
#[serde(
rename = "vendor",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub vendor: Option<Option<String>>,
#[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<models::CommerceProductStatus>,
/// The raw status on the platform, e.g. ACTIVE on Shopify.
#[serde(rename = "platformStatus", skip_serializing_if = "Option::is_none")]
pub platform_status: Option<String>,
#[serde(
rename = "featuredImage",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub featured_image: Option<Option<Box<models::CommerceImage>>>,
/// First 20 images, in store order.
#[serde(rename = "images", skip_serializing_if = "Option::is_none")]
pub images: Option<Vec<models::CommerceImage>>,
/// 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::CommerceVariant>>,
#[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.
#[serde(
rename = "url",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub url: Option<Option<String>>,
#[serde(rename = "seo", skip_serializing_if = "Option::is_none")]
pub seo: Option<Box<models::ProductSeo>>,
#[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>>,
/// Platform-only fields. Null when the platform has none.
#[serde(
rename = "platformData",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub platform_data: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
}
impl CommerceProduct {
/// A product on a connected store, in the platform-neutral shape.
pub fn new() -> CommerceProduct {
CommerceProduct {
id: None,
account_id: None,
platform: None,
title: None,
description_html: None,
handle: None,
vendor: None,
product_type: None,
tags: None,
status: None,
platform_status: None,
featured_image: None,
images: None,
options: None,
variants: None,
total_inventory: None,
url: None,
seo: None,
created_at: None,
updated_at: None,
published_at: None,
platform_data: 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
}
}