pub struct NotificationRequested {
pub channel: String,
pub template: Option<String>,
pub body: Option<String>,
pub to: Value,
pub data: Value,
pub trigger: String,
}Expand description
A request to tell someone something, staged by a hook trigger’s send_email or notify. An
effect outside the database is never performed inside the write’s transaction: the request is an
outbox row (NotificationRequested) that commits with the write, and a consumer (a mail or
notification module’s relay subscriber) performs it, at least once and idempotently.
The payload is this struct as JSON. channel is email or notify; a send_email names a
template and a notify a template or a literal body; to is what the trigger’s recipient
expression evaluated to (an address, an id, or a list of them); data is the template’s
variables; trigger is <Model>.<key> of the trigger that asked.
Fields§
§channel: Stringemail or notify.
template: Option<String>The template to render, when the request names one.
body: Option<String>The literal text of a notify, with its #{field} already filled in.
to: ValueThe recipients, as evaluated.
data: ValueThe template variables, as evaluated.
trigger: StringThe trigger that asked: <Model>.<key>.
Implementations§
Source§impl NotificationRequested
impl NotificationRequested
Sourcepub fn record(
&self,
aggregate: &str,
aggregate_id: &str,
company_id: Uuid,
ctx: &WriteCtx,
) -> OutboxRecord
pub fn record( &self, aggregate: &str, aggregate_id: &str, company_id: Uuid, ctx: &WriteCtx, ) -> OutboxRecord
The outbox row of this request, about aggregate (User) aggregate_id, under company_id
(see WriteCtx::company_of), carrying the write’s correlation and causation ids.
Trait Implementations§
Source§impl Clone for NotificationRequested
impl Clone for NotificationRequested
Source§impl Debug for NotificationRequested
impl Debug for NotificationRequested
Source§impl<'de> Deserialize<'de> for NotificationRequested
impl<'de> Deserialize<'de> for NotificationRequested
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for NotificationRequested
impl PartialEq for NotificationRequested
Source§impl Serialize for NotificationRequested
impl Serialize for NotificationRequested
impl StructuralPartialEq for NotificationRequested
Auto Trait Implementations§
impl Freeze for NotificationRequested
impl RefUnwindSafe for NotificationRequested
impl Send for NotificationRequested
impl Sync for NotificationRequested
impl Unpin for NotificationRequested
impl UnsafeUnpin for NotificationRequested
impl UnwindSafe for NotificationRequested
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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