use revolt_database::{util::reference::Reference, Database}; use revolt_models::v0::Webhook; use revolt_result::Result; use rocket::{serde::json::Json, State}; /// Gets a webhook /// /// Gets a webhook with a token #[utoipa::path( tag = "Webhooks", params( ("webhook_id" = Reference, Path), ("token" = String, Path), ), responses( (status = 200, body = Webhook), ), )] #[get("//")] pub async fn webhook_fetch_token( db: &State, webhook_id: Reference<'_>, token: String, ) -> Result> { let webhook = webhook_id.as_webhook(db).await?; webhook.assert_token(&token)?; Ok(Json(webhook.into())) }