rust_woocommerce/models/
order_notes.rs

1use crate::controllers::Entity;
2use chrono::NaiveDateTime;
3use serde::{Deserialize, Serialize};
4
5use crate::controllers::order_notes::{
6    NoId, NoNote, OrderNotesCreateBuilder, OrderNotesUpdateBuilder,
7};
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct OrderNotes {
10    /// Unique identifier for the resource.
11    pub id: i32,
12    /// Order note author    
13    pub author: String,
14    /// The date the order note was created, in the site's timezone.
15    pub date_created: NaiveDateTime,
16    /// The date the order note was created, as GMT.
17    pub date_created_gmt: NaiveDateTime,
18    /// Order note content.
19    pub note: String,
20    /// If true, the note will be shown to customers, and they will be notified. If false, the note will be for admin reference only. Default is false.
21    pub customer_note: bool,
22    /// If true, this note will be attributed to the current user. If false, the note will be attributed to the system. Default is false.    
23    pub added_by_user: Option<bool>,
24}
25impl OrderNotes {
26    pub fn create() -> OrderNotesCreateBuilder<NoNote> {
27        OrderNotesCreateBuilder::<NoNote>::new()
28    }
29    pub fn update() -> OrderNotesUpdateBuilder<NoId> {
30        OrderNotesUpdateBuilder::<NoId>::new()
31    }
32}
33impl Entity for OrderNotes {
34    fn endpoint() -> String {
35        String::new()
36    }
37
38    fn child_endpoint(parent_id: i32) -> String {
39        format!("orders/{parent_id}/notes/")
40    }
41}