Skip to content

Commit 4ee467f

Browse files
committed
Update bot.rs
・Add webhook setting function
1 parent 0bc993b commit 4ee467f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/bot.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,31 @@ impl LineBot {
3838
}
3939
}
4040

41+
// webhook-settings
42+
43+
pub fn update_webhook_endpoint(&self, endpoint: &str) -> Result<Response, Error> {
44+
let data: Value = json!(
45+
{
46+
"endpoint": endpoint,
47+
}
48+
);
49+
self.http_client.put("/channel/webhook/endpoint", data)
50+
}
51+
52+
pub fn get_webhook_endpoint(&self) -> Result<Response, Error> {
53+
self.http_client
54+
.get("/channel/webhook/endpoint", vec![], json!({}))
55+
}
56+
57+
pub fn test_webhook_endpoint(&self, endpoint: &str) -> Result<Response, Error> {
58+
let data: Value = json!(
59+
{
60+
"endpoint": endpoint,
61+
}
62+
);
63+
self.http_client.post("/channel/webhook/test", data)
64+
}
65+
4166
// messages
4267

4368
pub fn reply_message(

0 commit comments

Comments
 (0)