mod handler; pub use handler::endpoint; use serde_json::Value; use crate::error::{Error, ErrorClass, ErrorKind}; use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize)] pub struct InputEnvelope { pub endpoint: String, pub from_domain: Option, pub to_domain: String, pub token: Option, pub request_nr: Option, pub data: Value, } pub struct OutputEnvelope { pub error: Option, pub request_nr: Option, pub data: Value, } pub struct Session { id: String, nr: i32, account: Option, } pub struct Account { } impl InputEnvelope { pub fn respond(&self, data: Value) -> OutputEnvelope { OutputEnvelope { error: None, request_nr: self.request_nr, data, } } } impl Session { pub async fn from_token(token: &str) -> Self { todo!("session") } }