Web Client 8.1.0-beta5

FirebaseMpnBuilder

FirebaseMpnBuilder

Utility class that provides methods to build or parse the JSON structure used to represent the format of a push notification.
It provides getters and setters for the fields of a push notification, following the format specified by Google's Firebase Cloud Messaging (FCM). This format is compatible with MpnSubscription#setNotificationFormat.

Constructor

new FirebaseMpnBuilder(notificationFormatopt)

Creates an object to be used to create a push notification format.
Use setters methods to set the value of push notification fields or use a JSON structure to initialize the fields.

Parameters:
Name Type Attributes Description
notificationFormat <optional>

A JSON structure representing a push notification format.

See:

Methods

build() → {String}

Produces the JSON structure for the push notification format specified by this object.

Returns:

the JSON structure for the push notification format.

Type
String

getBody() → {String}

Gets the value of webpush.notification.body field.

Returns:

the value of webpush.notification.body field, or null if absent.

Type
String

getData() → {Object}

Gets sub-fields of the webpush.data field.

Returns:

a map with sub-fields of the webpush.data field, or null if absent.

Type
Object

getHeaders() → {Object}

Gets sub-fields of the webpush.headers field.

Returns:

a map with sub-fields of the webpush.headers field, or null if absent.

Type
Object

getIcon() → {String}

Gets the value of webpush.notification.icon field.

Returns:

the value of webpush.notification.icon field, or null if absent.

Type
String

getTitle() → {String}

Gets the value of webpush.notification.title field.

Returns:

the value of webpush.notification.title field, or null if absent.

Type
String

setBody(body) → {FirebaseMpnBuilder}

Sets the webpush.notification.body field.

Parameters:
Name Type Description
body String

A string to be used for the webpush.notification.body field value, or null to clear it.

Returns:

this MpnBuilder object, for fluent use.

Type
FirebaseMpnBuilder

setData(data) → {FirebaseMpnBuilder}

Sets sub-fields of the webpush.data field.

Parameters:
Name Type Description
data Object

A map to be used for sub-fields of the webpush.data field, or null to clear it.

Returns:

this MpnBuilder object, for fluent use.

Type
FirebaseMpnBuilder

setHeaders(headers) → {FirebaseMpnBuilder}

Sets sub-fields of the webpush.headers field.

Parameters:
Name Type Description
headers Object

map to be used for sub-fields of the webpush.headers field, or null to clear it.

Returns:

this MpnBuilder object, for fluent use.

Type
FirebaseMpnBuilder

setIcon(icon) → {FirebaseMpnBuilder}

Sets the webpush.notification.icon field.

Parameters:
Name Type Description
icon String

A string to be used for the webpush.notification.icon field value, or null to clear it.

Returns:

this MpnBuilder object, for fluent use.

Type
FirebaseMpnBuilder

setTitle(title) → {FirebaseMpnBuilder}

Sets the webpush.notification.title field.

Parameters:
Name Type Description
title String

A string to be used for the webpush.notification.title field value, or null to clear it.

Returns:

this MpnBuilder object, for fluent use.

Type
FirebaseMpnBuilder