Libraries
    Preparing search index...

    Interface WebhookDefinition

    Describes an out-of-band webhook that your API can send to consumers.

    Pass instances to ServerBuilder.webhook() so that @cleverbrush/server-openapi can emit them inside the webhooks map of the generated OpenAPI document.

    const userCreatedWebhook = defineWebhook('userCreated', {
    method: 'POST',
    summary: 'Fired when a new user is created',
    body: object({ id: number(), email: string() }),
    });
    interface WebhookDefinition {
        body?: SchemaBuilder<any, any, any, any, any>;
        description?: string;
        method?: string;
        name: string;
        response?: SchemaBuilder<any, any, any, any, any>;
        summary?: string;
        tags?: readonly string[];
    }
    Index

    Properties

    body?: SchemaBuilder<any, any, any, any, any>

    Schema describing the webhook request payload.

    description?: string

    Longer description for OpenAPI documentation. Supports Markdown.

    method?: string

    HTTP method sent to the consumer endpoint (default: 'POST').

    name: string

    Unique webhook name used as the key in the webhooks map.

    response?: SchemaBuilder<any, any, any, any, any>

    Schema describing the expected response from the consumer.

    summary?: string

    Short summary for OpenAPI documentation.

    tags?: readonly string[]

    Tags to group this webhook in generated documentation.