-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(messages): Add pickup protocol support
Signed-off-by: Naian <[email protected]>
- Loading branch information
1 parent
0372994
commit 67cee69
Showing
14 changed files
with
202 additions
and
104 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use crate::decorators::thread::Thread; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct PickupDecoratorsCommon { | ||
#[builder(default, setter(strip_option))] | ||
#[serde(rename = "~thread")] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub thread: Option<Thread>, | ||
#[builder(default, setter(strip_option))] | ||
#[serde(rename = "~transport")] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub transport: Option<Transport>, | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct Transport { | ||
pub return_route: ReturnRoute, | ||
#[builder(default, setter(strip_option))] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub return_route_thread: Option<Thread>, | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq)] | ||
pub enum ReturnRoute { | ||
#[default] | ||
None, | ||
All, | ||
Thread, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_with::{base64::Base64, serde_as}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use super::decorators::PickupDecoratorsCommon; | ||
use crate::msg_parts::MsgParts; | ||
|
||
pub type Delivery = MsgParts<DeliveryContent, PickupDecoratorsCommon>; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct DeliveryContent { | ||
#[builder(default, setter(strip_option))] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub recipient_key: Option<String>, | ||
#[serde(rename = "~attach")] | ||
pub attach: Vec<DeliveryAttach>, | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct DeliveryAttach { | ||
#[serde(rename = "@id")] | ||
pub id: String, | ||
pub data: DeliveryAttachData, | ||
} | ||
|
||
#[serde_as] | ||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct DeliveryAttachData { | ||
#[serde_as(as = "Base64")] | ||
pub base64: Vec<u8>, | ||
} |
15 changes: 15 additions & 0 deletions
15
messages/src/msg_fields/protocols/pickup/delivery_request.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use super::decorators::PickupDecoratorsCommon; | ||
use crate::msg_parts::MsgParts; | ||
|
||
pub type DeliveryRequest = MsgParts<DeliveryRequestContent, PickupDecoratorsCommon>; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct DeliveryRequestContent { | ||
pub limit: u32, | ||
#[builder(default, setter(strip_option))] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub recipient_key: Option<String>, | ||
} |
12 changes: 12 additions & 0 deletions
12
messages/src/msg_fields/protocols/pickup/live_delivery_change.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use super::decorators::PickupDecoratorsCommon; | ||
use crate::msg_parts::MsgParts; | ||
|
||
pub type LiveDeliveryChange = MsgParts<LiveDeliveryChangeContent, PickupDecoratorsCommon>; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct LiveDeliveryChangeContent { | ||
pub live_delivery: bool, | ||
} |
12 changes: 12 additions & 0 deletions
12
messages/src/msg_fields/protocols/pickup/messages_received.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use super::decorators::PickupDecoratorsCommon; | ||
use crate::msg_parts::MsgParts; | ||
|
||
pub type MessagesReceived = MsgParts<MessagesReceivedContent, PickupDecoratorsCommon>; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct MessagesReceivedContent { | ||
pub message_id_list: Vec<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
messages/src/msg_fields/protocols/pickup/status-request.rs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
messages/src/msg_fields/protocols/pickup/status_request.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use typed_builder::TypedBuilder; | ||
|
||
use super::decorators::PickupDecoratorsCommon; | ||
use crate::msg_parts::MsgParts; | ||
|
||
pub type StatusRequest = MsgParts<StatusRequestContent, PickupDecoratorsCommon>; | ||
|
||
#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq, TypedBuilder)] | ||
pub struct StatusRequestContent { | ||
#[builder(default, setter(strip_option))] | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub recipient_key: Option<String>, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters