openlark_workflow/v2/comment/
models.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Default)]
7pub struct CreateCommentBody {
8 pub content: String,
10}
11
12#[derive(Debug, Clone, Serialize, Default)]
14pub struct UpdateCommentBody {
15 pub content: String,
17}
18
19#[derive(Debug, Clone, Deserialize)]
21pub struct CreateCommentResponse {
22 pub comment_guid: String,
24 pub task_guid: String,
26 pub content: String,
28 pub creator: String,
30 pub created_at: String,
32 pub updated_at: String,
34}
35
36#[derive(Debug, Clone, Deserialize)]
38pub struct GetCommentResponse {
39 pub comment_guid: String,
41 pub task_guid: String,
43 pub content: String,
45 pub creator: String,
47 pub created_at: String,
49 pub updated_at: String,
51}
52
53#[derive(Debug, Clone, Deserialize)]
55pub struct UpdateCommentResponse {
56 pub comment_guid: String,
58 pub task_guid: String,
60 pub content: String,
62 pub updated_at: String,
64}
65
66#[derive(Debug, Clone, Deserialize)]
68pub struct DeleteCommentResponse {
69 pub success: bool,
71 pub comment_guid: String,
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
77pub struct CommentItem {
78 pub comment_guid: String,
80 pub task_guid: String,
82 pub content: String,
84 pub creator: String,
86 pub created_at: String,
88 pub updated_at: String,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
94pub struct ListCommentsResponse {
95 #[serde(default)]
97 pub has_more: bool,
98 #[serde(skip_serializing_if = "Option::is_none")]
100 pub page_token: Option<String>,
101 #[serde(skip_serializing_if = "Option::is_none")]
103 pub total: Option<i32>,
104 #[serde(default)]
106 pub items: Vec<CommentItem>,
107}
108
109#[cfg(test)]
110#[allow(unused_imports)]
111mod tests {
112
113 #[test]
114 fn test_serialization_roundtrip() {
115 let json = r#"{"test": "value"}"#;
117 assert!(serde_json::from_str::<serde_json::Value>(json).is_ok());
118 }
119
120 #[test]
121 fn test_deserialization_from_json() {
122 let json = r#"{"field": "data"}"#;
124 let value: serde_json::Value = serde_json::from_str(json).unwrap();
125 assert_eq!(value["field"], "data");
126 }
127}