pub struct NotificationBuilder<'a, T: Serialize = ()> {
    pub notification: NotificationItem,
    pub recipients: &'a Vec<String>,
    pub data: Option<T>,
    pub category: Option<String>,
}

Fields§

§notification: NotificationItem§recipients: &'a Vec<String>§data: Option<T>§category: Option<String>

Implementations§

source§

impl<'a> NotificationBuilder<'a, ()>

source

pub fn new(title: &str, recipients: &'a Vec<String>) -> Self

Create a new notification builder with the title and recipients. Other fields can be set by chaining the methods. Example:

use engagespot::{NotificationBuilder, NotificationItem};
let notification = NotificationBuilder::new("Title", &vec!["email1".to_string(), "email2".to_string()]).build();
source§

impl<'a, T: Serialize> NotificationBuilder<'a, T>

source

pub fn new_with_data(title: &str, recipients: &'a Vec<String>, data: T) -> Self

Create a new notification builder with the title and recipients and optional data. Other fields can be set by chaining the methods. Example:

use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct Data<'a> {
foo: &'a str,
}
use engagespot::{NotificationBuilder, NotificationItem};
let notification = NotificationBuilder::new_with_data("Title", &vec!["email1".to_string(), "email2".to_string()], &Data { foo: "bar" }).build();
source

pub fn notification_item(self, notification: NotificationItem) -> Self

Set the notification item

source

pub fn title(self, title: &str) -> Self

Set the title of the notification item.

source

pub fn message(self, message: &str) -> Self

Set the message of the notification item.

source

pub fn url(self, url: &str) -> Self

Set the url of the notification item.

source

pub fn icon(self, icon: &str) -> Self

Set the icon of the notification item.

source

pub fn recipients(self, recipients: &'a Vec<String>) -> Self

Set the recipients of the notification.

source

pub fn category(self, category: String) -> Self

Set the category of the notification.

source

pub fn data(self, data: T) -> Self

Set the additional data of the notification. Should be a serde serializable json object.

source

pub fn build(self) -> Notification<T>

Build the notification. Returns the Notification struct.

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for NotificationBuilder<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> Send for NotificationBuilder<'a, T>where T: Send,

§

impl<'a, T> Sync for NotificationBuilder<'a, T>where T: Sync,

§

impl<'a, T> Unpin for NotificationBuilder<'a, T>where T: Unpin,

§

impl<'a, T> UnwindSafe for NotificationBuilder<'a, T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more