odoo_api/jsonrpc/request/
web.rs1use serde::Serialize;
2use std::fmt::Debug;
3
4use super::{JsonRpcId, JsonRpcMethod, JsonRpcParams, JsonRpcRequest, JsonRpcVersion};
5
6#[derive(Debug, Serialize)]
17#[serde(transparent)]
18pub struct OdooWebContainer<T>
19where
20 T: OdooWebMethod + JsonRpcParams<Container<T> = Self>,
21{
22 pub(crate) inner: T,
23}
24
25pub trait OdooWebMethod
27where
28 Self: Sized + Debug + Serialize + JsonRpcParams<Container<Self> = OdooWebContainer<Self>>,
29 Self::Container<Self>: Debug + Serialize,
30{
31 fn endpoint(&self) -> &'static str;
33
34 fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self> {
36 JsonRpcRequest {
37 jsonrpc: JsonRpcVersion::V2,
38 method: JsonRpcMethod::Call,
39 id,
40 params: OdooWebContainer { inner: self },
41 }
42 }
43}