Initial schema for webhook.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#![forbid(unsafe_code)]
|
||||
use axum::http::StatusCode;
|
||||
use axum::routing::get;
|
||||
use axum::routing::post;
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
use axum::http::HeaderMap;
|
||||
use axum::http::StatusCode;
|
||||
use axum::Json;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
||||
pub(crate) async fn hook() -> (StatusCode, Json<HookResponse>) {
|
||||
pub(crate) async fn hook(
|
||||
headers: HeaderMap,
|
||||
Json(payload): Json<HookRequest>,
|
||||
) -> (StatusCode, Json<HookResponse>) {
|
||||
(StatusCode::OK, Json(HookResponse { ok: true }))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Deserialize)]
|
||||
pub(crate) struct HookRequest {
|
||||
#[serde(rename = "ref")]
|
||||
ref_field: String,
|
||||
before: String,
|
||||
compare_url: String,
|
||||
commits: Value,
|
||||
total_commits: u64,
|
||||
head_commit: Value,
|
||||
repository: Value,
|
||||
pusher: Value,
|
||||
sender: Value,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct HookResponse {
|
||||
ok: bool,
|
||||
|
||||
Reference in New Issue
Block a user