Struct nostr_sdk::nips::nip15::ProductData
source · pub struct ProductData {
pub id: String,
pub stall_id: String,
pub name: String,
pub description: Option<String>,
pub images: Option<Vec<String>>,
pub currency: String,
pub price: f64,
pub quantity: u64,
pub specs: Option<Vec<Vec<String>>>,
pub shipping: Vec<ShippingCost>,
pub categories: Option<Vec<String>>,
}
Expand description
Payload for creating or updating product
Fields§
§id: String
UUID of the product generated by merchant
stall_id: String
Id of the stall that this product belongs to
name: String
Product name
description: Option<String>
Description of the product
images: Option<Vec<String>>
Image urls of the product
currency: String
Currency used
price: f64
Price of the product
quantity: u64
Available items
specs: Option<Vec<Vec<String>>>
Specifications of the product
shipping: Vec<ShippingCost>
Shipping method costs
categories: Option<Vec<String>>
Categories of the product (will be added to tags)
Implementations§
source§impl ProductData
impl ProductData
sourcepub fn new(id: &str, stall_id: &str, name: &str, currency: &str) -> ProductData
pub fn new(id: &str, stall_id: &str, name: &str, currency: &str) -> ProductData
Create a new product
sourcepub fn description(self, description: &str) -> ProductData
pub fn description(self, description: &str) -> ProductData
Set the description of the product
sourcepub fn images(self, images: Vec<String>) -> ProductData
pub fn images(self, images: Vec<String>) -> ProductData
Add images to the product
sourcepub fn price(self, price: f64) -> ProductData
pub fn price(self, price: f64) -> ProductData
Set the price of the product
sourcepub fn quantity(self, quantity: u64) -> ProductData
pub fn quantity(self, quantity: u64) -> ProductData
Set the available quantity of the product
sourcepub fn specs(self, specs: Vec<Vec<String>>) -> ProductData
pub fn specs(self, specs: Vec<Vec<String>>) -> ProductData
Set the specifications of the product (e.g. size, color, etc.). Each inner vector should only contain 2 elements, the first being the name of the spec and the second being the value of the spec.
sourcepub fn shipping(self, shipping: Vec<ShippingCost>) -> ProductData
pub fn shipping(self, shipping: Vec<ShippingCost>) -> ProductData
Add a shipping method to the product
sourcepub fn categories(self, categories: Vec<String>) -> ProductData
pub fn categories(self, categories: Vec<String>) -> ProductData
Add categories to the product
Trait Implementations§
source§impl Clone for ProductData
impl Clone for ProductData
source§fn clone(&self) -> ProductData
fn clone(&self) -> ProductData
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ProductData
impl Debug for ProductData
source§impl<'de> Deserialize<'de> for ProductData
impl<'de> Deserialize<'de> for ProductData
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ProductData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ProductData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<ProductData> for String
impl From<ProductData> for String
source§fn from(value: ProductData) -> String
fn from(value: ProductData) -> String
Converts to this type from the input type.
source§impl Serialize for ProductData
impl Serialize for ProductData
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for ProductData
impl Send for ProductData
impl Sync for ProductData
impl Unpin for ProductData
impl UnwindSafe for ProductData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more