use serde::Serialize;
use std::fmt::Debug;
use super::{JsonRpcId, JsonRpcMethod, JsonRpcParams, JsonRpcRequest, JsonRpcVersion};
#[derive(Debug, Serialize)]
#[serde(transparent)]
pub struct OdooWebContainer<T>
where
T: OdooWebMethod + JsonRpcParams<Container<T> = Self>,
{
pub(crate) inner: T,
}
pub trait OdooWebMethod
where
Self: Sized + Debug + Serialize + JsonRpcParams<Container<Self> = OdooWebContainer<Self>>,
Self::Container<Self>: Debug + Serialize,
{
fn endpoint(&self) -> &'static str;
fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self> {
JsonRpcRequest {
jsonrpc: JsonRpcVersion::V2,
method: JsonRpcMethod::Call,
id,
params: OdooWebContainer { inner: self },
}
}
}