50 lines
922 B
Rust
50 lines
922 B
Rust
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<String>,
|
|
pub to_domain: String,
|
|
pub token: Option<String>,
|
|
pub request_nr: Option<u64>,
|
|
pub data: Value,
|
|
}
|
|
|
|
pub struct OutputEnvelope {
|
|
pub error: Option<Error>,
|
|
pub request_nr: Option<u64>,
|
|
pub data: Value,
|
|
}
|
|
|
|
pub struct Session {
|
|
id: String,
|
|
nr: i32,
|
|
account: Option<Account>,
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|