aiway_plugin/
wasm_types.rs1use serde::{Deserialize, Serialize};
7use std::sync::Arc;
8
9pub const HOOK_ON_REQUEST: i32 = 1;
11pub const HOOK_ON_REQUEST_BODY: i32 = 2;
12pub const HOOK_ON_RESPONSE: i32 = 3;
13pub const HOOK_ON_RESPONSE_BODY: i32 = 4;
14pub const HOOK_ON_LOGGING: i32 = 5;
15
16#[derive(Serialize, Deserialize)]
18pub struct WasmInput {
19 pub config: Arc<str>,
21 pub body: Option<Vec<u8>>,
23 pub request_id: Option<String>,
25 pub request_ts: Option<i64>,
27}
28
29#[derive(Serialize, Deserialize)]
31pub struct WasmOutput {
32 pub body: Option<Vec<u8>>,
34 pub respond: Option<WasmRespond>,
37}
38
39#[derive(Serialize, Deserialize)]
41pub struct WasmRespond {
42 pub status: u16,
44 pub headers: Vec<(String, String)>,
46 pub body: Vec<u8>,
48}
49
50#[derive(Serialize, Deserialize)]
52pub struct WasmPluginInfo {
53 pub name: String,
55 pub version: String,
57 pub description: String,
59 pub default_config: String,
61 pub readme: Option<String>,
63}