Class FcmSendMessageRequest.Builder
- java.lang.Object
-
- com.mongodb.stitch.core.services.fcm.FcmSendMessageRequest.Builder
-
- Enclosing class:
- FcmSendMessageRequest
public static class FcmSendMessageRequest.Builder extends Object
A builder that can buildFcmSendMessageRequest
s.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Constructs a new builder for an FCM send message request.
-
Method Summary
Modifier and Type Method Description FcmSendMessageRequest
build()
Builds, validates, and returns theFcmSendMessageRequest
.FcmSendMessageRequest.Builder
withCollapseKey(String collapseKey)
Sets the group of messages that can be collapsed.FcmSendMessageRequest.Builder
withContentAvailable(boolean contentAvailable)
Sets whether or not to indicate to the client that content is available in order to wake the device.FcmSendMessageRequest.Builder
withData(Document data)
Sets the custom data to send in the payload.FcmSendMessageRequest.Builder
withMutableContent(boolean mutableContent)
Sets whether or not the content in the message can be mutated.FcmSendMessageRequest.Builder
withNotification(FcmSendMessageNotification notification)
Sets the predefined, user-visible key-value pairs of the notification payload.FcmSendMessageRequest.Builder
withPriority(FcmSendMessagePriority priority)
Sets the priority of the message.FcmSendMessageRequest.Builder
withTimeToLive(long timeToLive)
Sets how long (in seconds) the message should be kept in FCM storage if the device is offline.
-
-
-
Method Detail
-
withPriority
public FcmSendMessageRequest.Builder withPriority(@Nonnull FcmSendMessagePriority priority)
Sets the priority of the message.- Parameters:
priority
- the priority of the message.- Returns:
- the builder.
-
withCollapseKey
public FcmSendMessageRequest.Builder withCollapseKey(@Nonnull String collapseKey)
Sets the group of messages that can be collapsed.- Parameters:
collapseKey
- the group of messages that can be collapsed.- Returns:
- the builder.
-
withContentAvailable
public FcmSendMessageRequest.Builder withContentAvailable(boolean contentAvailable)
Sets whether or not to indicate to the client that content is available in order to wake the device. Note: for messages to iOS devices only.- Parameters:
contentAvailable
- whether or not to indicate to the client that content is available in order to wake the device.- Returns:
- the builder.
-
withMutableContent
public FcmSendMessageRequest.Builder withMutableContent(boolean mutableContent)
Sets whether or not the content in the message can be mutated. Note: for messages to iOS devices only.- Parameters:
mutableContent
- whether or not the content in the message can be mutated.- Returns:
- the builder.
-
withTimeToLive
public FcmSendMessageRequest.Builder withTimeToLive(long timeToLive)
Sets how long (in seconds) the message should be kept in FCM storage if the device is offline.- Parameters:
timeToLive
- how long (in seconds) the message should be kept in FCM storage if the device is offline.- Returns:
- the builder.
-
withData
public FcmSendMessageRequest.Builder withData(@Nonnull Document data)
Sets the custom data to send in the payload.- Parameters:
data
- the custom data to send in the payload.- Returns:
- the builder.
-
withNotification
public FcmSendMessageRequest.Builder withNotification(@Nonnull FcmSendMessageNotification notification)
Sets the predefined, user-visible key-value pairs of the notification payload.- Parameters:
notification
- the predefined, user-visible key-value pairs of the notification payload.- Returns:
- the builder.
-
build
public FcmSendMessageRequest build()
Builds, validates, and returns theFcmSendMessageRequest
.- Returns:
- the built FCM send message request.
-
-