Skip to content

Commit 2494bb5

Browse files
Patrik-Stasmirgee
andauthored
Include @id on forward message (#495)
Signed-off-by: Patrik Stas <[email protected]> Co-authored-by: Miroslav Kovar <[email protected]>
1 parent 38bbee2 commit 2494bb5

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agency_client/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ futures = "0.3.21"
2626
url = "1.5.1"
2727
failure = "0.1.6"
2828
async-std = "1.11.0"
29+
uuid = {version = "0.8", default-features = false, features = ["v4"]}
2930

3031
[target.'cfg(target_os = "android")'.dependencies]
3132
android_logger = "0.5"

agency_client/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use self::update_message::{UpdateMessageStatusByConnections, UpdateMessageStatus
4949
use self::utils::update_profile::{UpdateConfigs, UpdateConfigsResponse, UpdateProfileDataBuilder};
5050
use self::mocking::AgencyMockDecrypted;
5151
use async_trait::async_trait;
52+
use uuid::Uuid;
5253

5354
#[derive(Debug, Serialize)]
5455
#[serde(untagged)]
@@ -269,18 +270,20 @@ pub struct ForwardV2 {
269270
fwd: String,
270271
#[serde(rename = "@msg")]
271272
msg: Value,
273+
#[serde(rename = "@id")]
274+
id: String,
272275
}
273276

274277
impl ForwardV2 {
275278
fn new(fwd: String, msg: Vec<u8>) -> AgencyClientResult<A2AMessage> {
276279
let msg = serde_json::from_slice(msg.as_slice())
277280
.map_err(|err| AgencyClientError::from_msg(AgencyClientErrorKind::InvalidState, err))?;
278-
279281
Ok(A2AMessage::Version2(A2AMessageV2::Forward(
280282
ForwardV2 {
281283
msg_type: MessageTypes::build_v2(A2AMessageKinds::Forward),
282284
fwd,
283285
msg,
286+
id: Uuid::new_v4().to_string()
284287
}
285288
)))
286289
}

0 commit comments

Comments
 (0)