Struct odoo_api::jsonrpc::OdooApiRequest
source · pub struct OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq,{
pub version: JsonRpcVersion,
pub method: JsonRpcMethod,
pub id: JsonRpcId,
pub params: JsonRpcRequestParams<T>,
}
Expand description
An Odoo JSON-RPC API request
This struct represents the base JSON data, and is paramterized over the
OdooApiMethod
(e.g., the param
field will be an OdooApiMethod
)
See: base/controllers/rpc.py See also: odoo/http.py
Fields§
§version: JsonRpcVersion
The JSON-RPC version (2.0
)
method: JsonRpcMethod
The JSON-RPC method (call
)
id: JsonRpcId
The request id
This is not used for any stateful behaviour on the Odoo/Python side
params: JsonRpcRequestParams<T>
The request params (service, method, and arguments)
Implementations§
source§impl<T: OdooApiMethod + Serialize + Debug + PartialEq> OdooApiRequest<T>
impl<T: OdooApiMethod + Serialize + Debug + PartialEq> OdooApiRequest<T>
sourcepub fn to_json_value(&self) -> Result<Value>
pub fn to_json_value(&self) -> Result<Value>
Convert the request struct into a serde_json::Value
sourcepub fn to_json_string(&self) -> Result<String>
pub fn to_json_string(&self) -> Result<String>
Convert the request struct into a “minified” string
sourcepub fn to_json_string_pretty(&self) -> Result<String>
pub fn to_json_string_pretty(&self) -> Result<String>
Convert the request struct into a “prettified” string
sourcepub fn parse_json_response(&self, json_data: &str) -> Result<OdooApiResponse<T>>
pub fn parse_json_response(&self, json_data: &str) -> Result<OdooApiResponse<T>>
Parse a JSON string into the OdooApiMethod::Response
associated type
Trait Implementations§
source§impl<T> Debug for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + Debug,
impl<T> Debug for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + Debug,
source§impl<'de, T> Deserialize<'de> for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> PartialEq<OdooApiRequest<T>> for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + PartialEq,
impl<T> PartialEq<OdooApiRequest<T>> for OdooApiRequest<T>where
T: OdooApiMethod + Serialize + Debug + PartialEq + PartialEq,
source§fn eq(&self, other: &OdooApiRequest<T>) -> bool
fn eq(&self, other: &OdooApiRequest<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.