pub struct OperationClient {
pub content_converter: Box<dyn Convert + Send + Sync>,
pub accept_converter: Box<dyn Convert + Send + Sync>,
pub request_client: RequestClient,
}
Expand description
Low-level client optimised for communicating with the Parsec service at an operation level.
Usage is recommended when fine control over how operations are wrapped and processed is needed.
Fields§
§content_converter: Box<dyn Convert + Send + Sync>
Converter that manages request body conversions
Defaults to a Protobuf converter
accept_converter: Box<dyn Convert + Send + Sync>
Converter that manages response body conversions
Defaults to a Protobuf converter
request_client: RequestClient
Client for request and response objects
Implementations§
Source§impl OperationClient
impl OperationClient
Sourcepub fn new() -> Result<OperationClient>
pub fn new() -> Result<OperationClient>
Creates an OperationClient instance. The request client uses a timeout of 5 seconds on reads and writes on the socket. It uses the version 1.0 wire protocol to form requests, the direct authentication method and protobuf format as content type.
Sourcepub fn process_operation(
&self,
operation: NativeOperation,
provider: ProviderId,
auth: &Authentication,
) -> Result<NativeResult>
pub fn process_operation( &self, operation: NativeOperation, provider: ProviderId, auth: &Authentication, ) -> Result<NativeResult>
Send an operation to a specific provider and get a result.
§Errors
If the conversions between operation to request or between response to result fail, returns
a serializing or deserializing error. Returns an error if the operation itself failed. If the
opcode is different between request and response, InvalidServiceResponseType
is returned.