Struct fcm::MessageBuilder [] [src]

pub struct MessageBuilder<'a> { /* fields omitted */ }

A builder to get a Message instance.

Examples

use fcm::MessageBuilder;

let mut builder = MessageBuilder::new("<FCM API Key>", "<registration id>");
builder.dry_run(true);
let message = builder.finalize();

Methods

impl<'a> MessageBuilder<'a>
[src]

[src]

Get a new instance of Message. You need to supply either a registration id, or a topic (/topics/...).

Important traits for &'a mut W
[src]

String value to replace format specifiers in the body string.

Important traits for &'a mut W
[src]

Set this parameter to identify groups of messages that can be collapsed.

Important traits for &'a mut W
[src]

Set the priority of the message. You can set Normal or High priorities.

Examples:

use fcm::{MessageBuilder, Priority};

let mut builder = MessageBuilder::new("<FCM API Key>", "<registration id>");
builder.priority(Priority::High);
let message = builder.finalize();

Important traits for &'a mut W
[src]

To set the content-available field on iOS

Important traits for &'a mut W
[src]

When set to true, sends the message only when the device is active.

Important traits for &'a mut W
[src]

How long (in seconds) to keep the message on FCM servers in case the device is offline. The maximum and default is 4 weeks.

Important traits for &'a mut W
[src]

Package name of the application where the registration tokens must match.

Important traits for &'a mut W
[src]

When set to true, allows you to test FCM without actually sending the message.

[src]

Use this to add custom key-value pairs to the message. This data must be handled appropriately on the client end. The data can be anything that Serde can serialize to JSON.

Examples:

use fcm::MessageBuilder;
use std::collections::HashMap;

let mut map = HashMap::new();
map.insert("message", "Howdy!");

let mut builder = MessageBuilder::new("<FCM API Key>", "<registration id>");
builder.data(&map);
let message = builder.finalize();

Important traits for &'a mut W
[src]

Use this to set a Notification for the message.

Examples:

use fcm::{MessageBuilder, NotificationBuilder};

let mut builder = NotificationBuilder::new();
builder.title("Hey!");
builder.body("Do you want to catch up later?");
let notification = builder.finalize();
 
let mut builder = MessageBuilder::new("<FCM API Key>", "<registration id>");
builder.notification(notification);
let message = builder.finalize();

[src]

Complete the build and get a Message instance

Trait Implementations

impl<'a> Debug for MessageBuilder<'a>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> Send for MessageBuilder<'a>

impl<'a> Sync for MessageBuilder<'a>