pub struct Notification {
pub message_id: String,
pub subscription: Subscription,
pub headers: NotificationHeaders,
pub timestamp: u64,
pub sort_key_timestamp: u64,
pub data: Option<String>,
}
Expand description
Extracts notification data from Subscription
and request data
Fields§
§message_id: String
Unique message_id for this notification
subscription: Subscription
The subscription information block
headers: NotificationHeaders
Set of associated crypto headers
timestamp: u64
UNIX timestamp in seconds
sort_key_timestamp: u64
UNIX timestamp in milliseconds
data: Option<String>
The encrypted notification body
Implementations§
source§impl Notification
impl Notification
sourcefn generate_message_id(
fernet: &MultiFernet,
uaid: Uuid,
channel_id: Uuid,
topic: Option<&str>,
timestamp: u64,
) -> String
fn generate_message_id( fernet: &MultiFernet, uaid: Uuid, channel_id: Uuid, topic: Option<&str>, timestamp: u64, ) -> String
Generate a message-id suitable for accessing the message
For topic messages, a sort_key version of 01 is used, and the topic is included for reference:
Encrypted('01' : uaid.hex : channel_id.hex : topic)
For non-topic messages, a sort_key version of 02 is used:
Encrypted('02' : uaid.hex : channel_id.hex : timestamp)
pub fn has_topic(&self) -> bool
sourcepub fn serialize_for_delivery(
&self,
) -> Result<HashMap<&'static str, Value>, ApiError>
pub fn serialize_for_delivery( &self, ) -> Result<HashMap<&'static str, Value>, ApiError>
Serialize the notification for delivery to the connection server. Some
fields in autopush_common
’s Notification
are marked with
#[serde(skip_serializing)]
so they are not shown to the UA. These
fields are still required when delivering to the connection server, so
we can’t simply convert this notification type to that one and serialize
via serde.
Trait Implementations§
source§impl Clone for Notification
impl Clone for Notification
source§fn clone(&self) -> Notification
fn clone(&self) -> Notification
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Notification
impl Debug for Notification
source§impl From<Notification> for Notification
impl From<Notification> for Notification
source§fn from(notification: Notification) -> Self
fn from(notification: Notification) -> Self
source§impl FromRequest for Notification
impl FromRequest for Notification
source§type Future = Pin<Box<dyn Future<Output = Result<Notification, <Notification as FromRequest>::Error>>>>
type Future = Pin<Box<dyn Future<Output = Result<Notification, <Notification as FromRequest>::Error>>>>
Self
. Read moresource§fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future
Self
from request parts asynchronously.Auto Trait Implementations§
impl Freeze for Notification
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnwindSafe for Notification
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more