fastcomments_sdk/client/src/models/
save_comment_response.rs1use crate::client::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SaveCommentResponse {
16 #[serde(rename = "status")]
17 pub status: models::ApiStatus,
18 #[serde(rename = "comment")]
19 pub comment: Box<models::FComment>,
20 #[serde(rename = "user", deserialize_with = "Option::deserialize")]
21 pub user: Option<Box<models::UserSessionInfo>>,
22 #[serde(rename = "moduleData", skip_serializing_if = "Option::is_none")]
24 pub module_data: Option<std::collections::HashMap<String, serde_json::Value>>,
25}
26
27impl SaveCommentResponse {
28 pub fn new(status: models::ApiStatus, comment: models::FComment, user: Option<models::UserSessionInfo>) -> SaveCommentResponse {
29 SaveCommentResponse {
30 status,
31 comment: Box::new(comment),
32 user: if let Some(x) = user {Some(Box::new(x))} else {None},
33 module_data: None,
34 }
35 }
36}
37