1#[derive(Debug, Clone)]
5pub struct ListParams {
6 pub page: u32,
8 pub per_page: u32,
10 pub search: Option<String>,
12 pub mailing_list: Option<String>,
14}
15
16impl Default for ListParams {
17 fn default() -> Self {
18 Self {
19 page: 1,
20 per_page: 50,
21 search: None,
22 mailing_list: None,
23 }
24 }
25}
26
27#[derive(Debug, Clone)]
29pub struct ReviewQuery {
30 pub id: Option<i64>,
32 pub patchset_id: Option<i64>,
34}
35
36#[derive(Debug, Clone)]
38pub struct RetryConfig {
39 pub max_retries: u32,
41 pub base_delay_ms: u64,
43 pub max_delay_ms: u64,
45 pub backoff_factor: f64,
47}
48
49impl Default for RetryConfig {
50 fn default() -> Self {
51 Self {
52 max_retries: 3,
53 base_delay_ms: 500,
54 max_delay_ms: 10_000,
55 backoff_factor: 2.0,
56 }
57 }
58}
59
60impl RetryConfig {
61 #[must_use]
63 pub fn from_remote(config: &crate::config::RemoteConfig) -> Self {
64 Self {
65 max_retries: config.max_retries,
66 ..Self::default()
67 }
68 }
69}
70
71#[cfg(test)]
72mod tests {
73 use super::*;
74
75 #[test]
76 fn list_params_defaults() {
77 let params = ListParams::default();
78 assert_eq!(params.page, 1);
79 assert_eq!(params.per_page, 50);
80 assert!(params.search.is_none());
81 assert!(params.mailing_list.is_none());
82 }
83
84 #[test]
85 fn retry_config_defaults() {
86 let config = RetryConfig::default();
87 assert_eq!(config.max_retries, 3);
88 assert_eq!(config.base_delay_ms, 500);
89 assert_eq!(config.max_delay_ms, 10_000);
90 }
91}