alchemy_api/api/notify/
update_webhook.rs1use crate::cores::endpoint::Endpoint;
2use derive_builder::Builder;
3use http::Method;
4use serde::{Deserialize, Serialize};
5use serde_with::{serde_as, skip_serializing_none};
6
7#[serde_as]
9#[skip_serializing_none]
10#[derive(Builder, Default, Debug, Clone, Serialize, Deserialize)]
11#[builder(setter(into))]
12pub struct UpdateWebhook {
13 webhook_id: String,
15 is_active: bool,
18}
19
20impl UpdateWebhook {
21 pub fn builder() -> UpdateWebhookBuilder {
23 UpdateWebhookBuilder::default()
24 }
25}
26
27impl Endpoint for UpdateWebhook {
28 fn method(&self) -> http::Method {
29 Method::PUT
30 }
31
32 fn endpoint(&self) -> std::borrow::Cow<'static, str> {
33 "api/update-webhook".into()
34 }
35
36 fn body(&self) -> anyhow::Result<Option<(&'static str, Vec<u8>)>> {
37 let body = serde_json::to_vec(self)?;
38 Ok(Some(("application/json", body)))
39 }
40}