rust_woocommerce/models/
product_attribute_terms.rs

1use crate::controllers::Entity;
2use serde::{Deserialize, Serialize};
3
4use crate::controllers::product_attribute_terms::{
5    AttributeTermCreateBuilder, AttributeTermUpdateBuilder, NoName,
6};
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct AttributeTerm {
9    /// Unique identifier for the resource.
10    pub id: i32,
11    /// Term name.
12    pub name: String,
13    /// An alphanumeric identifier for the resource unique to its type.
14    pub slug: String,
15    /// HTML description of the resource.
16    pub description: String,
17    /// Menu order, used to custom sort the resource.
18    pub menu_order: i32,
19    /// Number of published products for the resource.
20    pub count: i32,
21}
22impl Entity for AttributeTerm {
23    fn endpoint() -> String {
24        String::new()
25    }
26
27    fn child_endpoint(parent_id: i32) -> String {
28        format!("products/attributes/{parent_id}/terms/")
29    }
30}
31impl AttributeTerm {
32    pub fn create() -> AttributeTermCreateBuilder<NoName> {
33        AttributeTermCreateBuilder::default()
34    }
35    pub fn update() -> AttributeTermUpdateBuilder {
36        AttributeTermUpdateBuilder::default()
37    }
38}