diff --git a/src/client.rs b/src/client.rs index dbd24e4e..b663541b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -61,12 +61,14 @@ impl Client { .await } - /// Invoke an Dapr output binding. + /// Invoke a Dapr output binding. /// /// # Arguments /// /// * `name` - The name of the output binding to invoke. /// * `data` - The data which will be sent to the output binding. + /// * `metadata` - The metadata key-pairs to be sent + /// * `operation` - The operation name for the binding to invoke. pub async fn invoke_binding( &mut self, name: S, @@ -77,21 +79,40 @@ impl Client { where S: Into, { - let mut mdata = HashMap::::new(); - if let Some(m) = metadata { - mdata = m; - } - self.0 .invoke_binding(InvokeBindingRequest { name: name.into(), data, operation: operation.into(), - metadata: mdata, + metadata: metadata.unwrap_or_default(), }) .await } + /// Invoke a Dapr output binding without expecting a response. + /// + /// # Arguments + /// + /// * `name` - The name of the output binding to invoke. + /// * `operation` - The operation name for the binding to invoke. + pub async fn invoke_output_binding(&mut self, name: S, operation: S) -> Result<(), Error> + where + S: Into, + { + let result = self + .0 + .invoke_binding(InvokeBindingRequest { + name: name.into(), + operation: operation.into(), + ..Default::default() + }) + .await; + match result { + Ok(_) => Ok(()), + Err(_) => Err(result.unwrap_err()), + } + } + /// Publish a payload to multiple consumers who are listening on a topic. /// /// Dapr guarantees at least once semantics for this endpoint.