forgex 0.10.2

CLI and runtime for the Forge full-stack framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Context API: ctx.idempotency_key, ctx.dispatch_job(...).
// Use the right WebhookSignature constructor for your provider; never hand-roll HMAC.
// See: docs/skills/forge-idiomatic-engineer/references/api.md#signature-constructors

use forge::prelude::*;

#[forge::webhook(
    path = "/webhooks/{{name}}",
    signature = WebhookSignature::hmac_sha256("X-Webhook-Signature", "WEBHOOK_SECRET"),
    idempotency = "header:X-Idempotency-Key",
)]
pub async fn {{name}}(ctx: &WebhookContext, payload: serde_json::Value) -> Result<WebhookResult> {
    let _ = (ctx, payload);
    // TODO: persist or dispatch a job, then choose the right response variant.
    Ok(WebhookResult::Ok)
}