1use derive_builder::Builder;
2use serde::Serialize;
3use crate::structs::Comment;
4
5#[derive(Builder, Debug, Default, Serialize)]
6#[builder(setter(into, strip_option))]
7#[builder(default)]
8pub struct CreateCommentRequest {
9 pub project_key: String,
10 pub work_item_type_key: String,
11 pub work_item_id: i64,
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub content: Option<String>,
14 #[serde(skip_serializing_if = "Option::is_none")]
15 pub rich_text: Option<Vec<serde_json::Value>>,
16}
17
18#[derive(Builder, Debug, Default, Serialize)]
19#[builder(setter(into, strip_option))]
20#[builder(default)]
21pub struct GetCommentsRequest {
22 pub project_key: String,
23 pub work_item_type_key: String,
24 pub work_item_id: i64,
25 pub page_size: Option<i64>,
26 pub page_num: Option<i64>,
27}
28
29#[derive(Builder, Debug, Default, Serialize)]
30#[builder(setter(into, strip_option))]
31#[builder(default)]
32pub struct UpdateCommentRequest {
33 pub project_key: String,
34 pub work_item_type_key: String,
35 pub work_item_id: i64,
36 pub comment_id: i64,
37 #[serde(skip_serializing_if = "Option::is_none")]
38 pub content: Option<String>,
39 #[serde(skip_serializing_if = "Option::is_none")]
40 pub rich_text: Option<Vec<serde_json::Value>>,
41}
42
43#[derive(Builder, Debug, Default, Serialize)]
44#[builder(setter(into, strip_option))]
45#[builder(default)]
46pub struct DeleteCommentRequest {
47 pub project_key: String,
48 pub work_item_type_key: String,
49 pub work_item_id: i64,
50 pub comment_id: i64,
51}
52
53pub type CreateCommentResponse = i64;
54pub type GetCommentsResponse = Vec<Comment>;
55pub type UpdateCommentResponse = serde_json::Value;
56pub type DeleteCommentResponse = serde_json::Value;