Trait rincon_core::api::method::Prepare
[−]
[src]
pub trait Prepare { type Content: Serialize; fn operation(&self) -> Operation; fn path(&self) -> String; fn parameters(&self) -> Parameters; fn header(&self) -> Parameters; fn content(&self) -> Option<&Self::Content>; }
A Prepare
type of a method call is used to convert the method call into
a concrete request that is specific to the protocol used by a Connector
.
For example the JsonHttpConnector
converts the Prepare
type into a
HTTP-request and serializes the content as JSON into the body of the
request.
As the rincon driver uses the serde
crate as its serialization framework
the content type must implement the Serialize
trait of serde
.
Associated Types
type Content: Serialize
The type of the content of a method call.
The content is the part of a request that is sent within the body of a REST call.
Required Methods
fn operation(&self) -> Operation
Returns the type of operation this method is executing.
fn path(&self) -> String
Returns the resource path of a REST operation.
fn parameters(&self) -> Parameters
Returns the query parameters of this method.
The query parameters are usually part of the URL of a REST call.
fn header(&self) -> Parameters
Returns the header parameters of this method.
The header parameters are usually sent with the HTTP header of a REST call.
fn content(&self) -> Option<&Self::Content>
Returns the content of this method if any.
The content of a method is usually sent within the body of a REST call.