1use crate::CliOverridesPatch;
2
3#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct ReviewCommandRequest {
6 pub prompt: Option<String>,
7 pub base: Option<String>,
8 pub commit: Option<String>,
9 pub title: Option<String>,
10 pub uncommitted: bool,
11 pub overrides: CliOverridesPatch,
13}
14
15impl ReviewCommandRequest {
16 pub fn new() -> Self {
17 Self {
18 prompt: None,
19 base: None,
20 commit: None,
21 title: None,
22 uncommitted: false,
23 overrides: CliOverridesPatch::default(),
24 }
25 }
26
27 pub fn prompt(mut self, prompt: impl Into<String>) -> Self {
28 let prompt = prompt.into();
29 self.prompt = (!prompt.trim().is_empty()).then_some(prompt);
30 self
31 }
32
33 pub fn base(mut self, branch: impl Into<String>) -> Self {
34 let branch = branch.into();
35 self.base = (!branch.trim().is_empty()).then_some(branch);
36 self
37 }
38
39 pub fn commit(mut self, sha: impl Into<String>) -> Self {
40 let sha = sha.into();
41 self.commit = (!sha.trim().is_empty()).then_some(sha);
42 self
43 }
44
45 pub fn title(mut self, title: impl Into<String>) -> Self {
46 let title = title.into();
47 self.title = (!title.trim().is_empty()).then_some(title);
48 self
49 }
50
51 pub fn uncommitted(mut self, enable: bool) -> Self {
52 self.uncommitted = enable;
53 self
54 }
55
56 pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
57 self.overrides = overrides;
58 self
59 }
60}
61
62impl Default for ReviewCommandRequest {
63 fn default() -> Self {
64 Self::new()
65 }
66}
67
68#[derive(Clone, Debug, Eq, PartialEq)]
70pub struct ExecReviewCommandRequest {
71 pub prompt: Option<String>,
72 pub base: Option<String>,
73 pub commit: Option<String>,
74 pub title: Option<String>,
75 pub uncommitted: bool,
76 pub json: bool,
77 pub skip_git_repo_check: bool,
78 pub overrides: CliOverridesPatch,
80}
81
82impl ExecReviewCommandRequest {
83 pub fn new() -> Self {
84 Self {
85 prompt: None,
86 base: None,
87 commit: None,
88 title: None,
89 uncommitted: false,
90 json: false,
91 skip_git_repo_check: true,
92 overrides: CliOverridesPatch::default(),
93 }
94 }
95
96 pub fn prompt(mut self, prompt: impl Into<String>) -> Self {
97 let prompt = prompt.into();
98 self.prompt = (!prompt.trim().is_empty()).then_some(prompt);
99 self
100 }
101
102 pub fn base(mut self, branch: impl Into<String>) -> Self {
103 let branch = branch.into();
104 self.base = (!branch.trim().is_empty()).then_some(branch);
105 self
106 }
107
108 pub fn commit(mut self, sha: impl Into<String>) -> Self {
109 let sha = sha.into();
110 self.commit = (!sha.trim().is_empty()).then_some(sha);
111 self
112 }
113
114 pub fn title(mut self, title: impl Into<String>) -> Self {
115 let title = title.into();
116 self.title = (!title.trim().is_empty()).then_some(title);
117 self
118 }
119
120 pub fn uncommitted(mut self, enable: bool) -> Self {
121 self.uncommitted = enable;
122 self
123 }
124
125 pub fn json(mut self, enable: bool) -> Self {
126 self.json = enable;
127 self
128 }
129
130 pub fn skip_git_repo_check(mut self, enable: bool) -> Self {
131 self.skip_git_repo_check = enable;
132 self
133 }
134
135 pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
136 self.overrides = overrides;
137 self
138 }
139}
140
141impl Default for ExecReviewCommandRequest {
142 fn default() -> Self {
143 Self::new()
144 }
145}