Skip to content

Commit bf95d0b

Browse files
committed
chore: format and improve documentation for Slack FDW
- Add detailed module documentation for better API reference - Improve struct field and method documentation - Format code for better readability and consistency - Add comprehensive comments for each entity type
1 parent c0aac24 commit bf95d0b

File tree

3 files changed

+399
-298
lines changed

3 files changed

+399
-298
lines changed

wasm-wrappers/fdw/slack_fdw/src/api.rs

+54-31
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn apply_conditions_test(
66
conditions: &[(String, String, String)], // (column, operator, value)
77
) -> HashMap<String, String> {
88
let mut params = HashMap::new();
9-
9+
1010
for (column, operator, value) in conditions {
1111
match endpoint {
1212
"conversations.history" => {
@@ -17,15 +17,15 @@ pub fn apply_conditions_test(
1717
} else if column == "latest" && operator == "le" {
1818
params.insert("latest".to_string(), value.clone());
1919
}
20-
},
20+
}
2121
"users.list" => {
2222
// Users API doesn't support many filters
23-
},
23+
}
2424
"conversations.list" => {
2525
if column == "types" && operator == "eq" {
2626
params.insert("types".to_string(), value.clone());
2727
}
28-
},
28+
}
2929
"files.list" => {
3030
if column == "channel_id" && operator == "eq" {
3131
params.insert("channel".to_string(), value.clone());
@@ -36,66 +36,89 @@ pub fn apply_conditions_test(
3636
} else if column == "ts_to" && operator == "le" {
3737
params.insert("ts_to".to_string(), value.clone());
3838
}
39-
},
39+
}
4040
_ => {}
4141
}
4242
}
43-
43+
4444
params
4545
}
4646

4747
#[cfg(test)]
4848
mod tests {
4949
use super::*;
50-
50+
5151
#[test]
5252
fn test_apply_conditions_conversations_history() {
5353
let conditions = vec![
54-
("channel_id".to_string(), "eq".to_string(), "C12345".to_string()),
55-
("oldest".to_string(), "ge".to_string(), "1234567890.123456".to_string()),
54+
(
55+
"channel_id".to_string(),
56+
"eq".to_string(),
57+
"C12345".to_string(),
58+
),
59+
(
60+
"oldest".to_string(),
61+
"ge".to_string(),
62+
"1234567890.123456".to_string(),
63+
),
5664
];
57-
65+
5866
let params = apply_conditions_test("conversations.history", &conditions);
59-
67+
6068
assert_eq!(params.get("channel"), Some(&"C12345".to_string()));
6169
assert_eq!(params.get("oldest"), Some(&"1234567890.123456".to_string()));
6270
}
63-
71+
6472
#[test]
6573
fn test_apply_conditions_files_list() {
6674
let conditions = vec![
67-
("channel_id".to_string(), "eq".to_string(), "C12345".to_string()),
68-
("user_id".to_string(), "eq".to_string(), "U12345".to_string()),
69-
("ts_from".to_string(), "ge".to_string(), "1234567890.123456".to_string()),
75+
(
76+
"channel_id".to_string(),
77+
"eq".to_string(),
78+
"C12345".to_string(),
79+
),
80+
(
81+
"user_id".to_string(),
82+
"eq".to_string(),
83+
"U12345".to_string(),
84+
),
85+
(
86+
"ts_from".to_string(),
87+
"ge".to_string(),
88+
"1234567890.123456".to_string(),
89+
),
7090
];
71-
91+
7292
let params = apply_conditions_test("files.list", &conditions);
73-
93+
7494
assert_eq!(params.get("channel"), Some(&"C12345".to_string()));
7595
assert_eq!(params.get("user"), Some(&"U12345".to_string()));
76-
assert_eq!(params.get("ts_from"), Some(&"1234567890.123456".to_string()));
96+
assert_eq!(
97+
params.get("ts_from"),
98+
Some(&"1234567890.123456".to_string())
99+
);
77100
}
78-
101+
79102
#[test]
80103
fn test_apply_conditions_conversations_list() {
81-
let conditions = vec![
82-
("types".to_string(), "eq".to_string(), "public_channel".to_string()),
83-
];
84-
104+
let conditions = vec![(
105+
"types".to_string(),
106+
"eq".to_string(),
107+
"public_channel".to_string(),
108+
)];
109+
85110
let params = apply_conditions_test("conversations.list", &conditions);
86-
111+
87112
assert_eq!(params.get("types"), Some(&"public_channel".to_string()));
88113
}
89-
114+
90115
#[test]
91116
fn test_apply_conditions_unsupported_endpoint() {
92-
let conditions = vec![
93-
("test".to_string(), "eq".to_string(), "test".to_string()),
94-
];
95-
117+
let conditions = vec![("test".to_string(), "eq".to_string(), "test".to_string())];
118+
96119
let params = apply_conditions_test("unsupported.endpoint", &conditions);
97-
120+
98121
// Should return empty params for unsupported endpoint
99122
assert!(params.is_empty());
100123
}
101-
}
124+
}

0 commit comments

Comments
 (0)