36 lines
807 B
Rust
36 lines
807 B
Rust
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
use chrono::{DateTime, Utc};
|
|
|
|
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct Function {
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub code: Vec<u8>,
|
|
pub runtime: String, // "wasm" or "deno"
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct InvokeRequest {
|
|
pub payload: Option<serde_json::Value>,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct InvokeResponse {
|
|
pub result: Option<String>,
|
|
pub error: Option<String>,
|
|
pub logs: Vec<String>,
|
|
pub status: u16,
|
|
pub headers: Option<std::collections::HashMap<String, String>>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct DeployRequest {
|
|
pub name: String,
|
|
pub code_base64: String,
|
|
pub runtime: Option<String>,
|
|
}
|
|
|