Module webhook_transform

Module webhook_transform 

Source
Expand description

Webhook payload transformation

Transform incoming webhook payloads before passing to workflows.

§Example

use oxify_model::{
    PayloadTransform, TransformOperation, FieldMapping,
    TransformPipeline, PayloadTransformError,
};
use serde_json::json;

// Create a transform that extracts and renames fields
let transform = PayloadTransform::new()
    .extract_field("$.data.user", "user")
    .rename_field("$.action", "event_type")
    .add_default("source", json!("webhook"))
    .filter_fields(&["user", "event_type", "source"]);

// Apply the transform
let input = json!({
    "action": "user.created",
    "data": {
        "user": { "id": 123, "name": "Alice" }
    }
});

let result = transform.apply(&input).unwrap();
// result = { "user": { "id": 123, "name": "Alice" }, "event_type": "user.created", "source": "webhook" }

Structs§

FieldMapping
Field mapping for bulk rename/extract operations
PayloadTransform
Payload transformation configuration
TransformPipeline
Transformation pipeline for chaining multiple transforms

Enums§

PayloadTransformError
Error type for payload transformation
StringTransformType
String transformation types
TransformOperation
A single transformation operation