chore: update routes to use utoipa
This commit is contained in:
@@ -7,10 +7,16 @@ use revolt_result::Result;
|
||||
use rocket::State;
|
||||
use rocket_empty::EmptyResponse;
|
||||
|
||||
/// # Deletes a webhook
|
||||
/// Deletes a webhook
|
||||
///
|
||||
/// Deletes a webhook
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
security(("Session-Token" = []), ("Bot-Token" = [])),
|
||||
responses(
|
||||
(status = 204),
|
||||
),
|
||||
)]
|
||||
#[delete("/<webhook_id>")]
|
||||
pub async fn webhook_delete(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -3,10 +3,15 @@ use revolt_result::Result;
|
||||
use rocket::State;
|
||||
use rocket_empty::EmptyResponse;
|
||||
|
||||
/// # Deletes a webhook
|
||||
/// Deletes a webhook
|
||||
///
|
||||
/// Deletes a webhook with a token
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
responses(
|
||||
(status = 204),
|
||||
),
|
||||
)]
|
||||
#[delete("/<webhook_id>/<token>")]
|
||||
pub async fn webhook_delete_token(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -8,10 +8,16 @@ use revolt_result::{create_error, Result};
|
||||
use rocket::{serde::json::Json, State};
|
||||
use validator::Validate;
|
||||
|
||||
/// # Edits a webhook
|
||||
/// Edits a webhook
|
||||
///
|
||||
/// Edits a webhook
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
security(("Session-Token" = []), ("Bot-Token" = [])),
|
||||
responses(
|
||||
(status = 200, body = Webhook),
|
||||
),
|
||||
)]
|
||||
#[patch("/<webhook_id>", data = "<data>")]
|
||||
pub async fn webhook_edit(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -5,10 +5,15 @@ use revolt_models::validator::Validate;
|
||||
use revolt_result::{create_error, Result};
|
||||
use rocket::{serde::json::Json, State};
|
||||
|
||||
/// # Edits a webhook
|
||||
/// Edits a webhook
|
||||
///
|
||||
/// Edits a webhook with a token
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
responses(
|
||||
(status = 200, body = Webhook),
|
||||
),
|
||||
)]
|
||||
#[patch("/<webhook_id>/<token>", data = "<data>")]
|
||||
pub async fn webhook_edit_token(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -10,10 +10,16 @@ use rocket::{serde::json::Json, State};
|
||||
|
||||
use validator::Validate;
|
||||
|
||||
/// # Executes a webhook
|
||||
/// Executes a webhook
|
||||
///
|
||||
/// Executes a webhook and sends a message
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
params(IdempotencyKey),
|
||||
responses(
|
||||
(status = 200, body = v0::Message)
|
||||
)
|
||||
)]
|
||||
#[post("/<webhook_id>/<token>", data = "<data>")]
|
||||
pub async fn webhook_execute(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -708,10 +708,13 @@ fn convert_event(data: &str, event_name: &str) -> Result<Event> {
|
||||
})
|
||||
}
|
||||
|
||||
/// # Executes a webhook specific to github
|
||||
/// Executes a webhook specific to github
|
||||
///
|
||||
/// Executes a webhook specific to github and sends a message containing the relevant info about the event
|
||||
#[utoipa::path(tag = "Webhooks", params(EventHeader))]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
params(EventHeader)
|
||||
)]
|
||||
#[post("/<webhook_id>/<token>/github", data = "<data>")]
|
||||
pub async fn webhook_execute_github(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -7,10 +7,16 @@ use revolt_permissions::{calculate_channel_permissions, ChannelPermission};
|
||||
use revolt_result::Result;
|
||||
use rocket::{serde::json::Json, State};
|
||||
|
||||
/// # Gets a webhook
|
||||
/// Gets a webhook
|
||||
///
|
||||
/// Gets a webhook
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
security(("Session-Token" = []), ("Bot-Token" = [])),
|
||||
responses(
|
||||
(status = 200, body = Webhook),
|
||||
),
|
||||
)]
|
||||
#[get("/<webhook_id>")]
|
||||
pub async fn webhook_fetch(
|
||||
db: &State<Database>,
|
||||
|
||||
@@ -3,10 +3,15 @@ use revolt_models::v0::Webhook;
|
||||
use revolt_result::Result;
|
||||
use rocket::{serde::json::Json, State};
|
||||
|
||||
/// # Gets a webhook
|
||||
/// Gets a webhook
|
||||
///
|
||||
/// Gets a webhook with a token
|
||||
#[utoipa::path(tag = "Webhooks")]
|
||||
#[utoipa::path(
|
||||
tag = "Webhooks",
|
||||
responses(
|
||||
(status = 200, body = Webhook),
|
||||
),
|
||||
)]
|
||||
#[get("/<webhook_id>/<token>")]
|
||||
pub async fn webhook_fetch_token(
|
||||
db: &State<Database>,
|
||||
|
||||
Reference in New Issue
Block a user