Class TemplateMessage.Builder
- java.lang.Object
-
- com.courier.api.resources.send.types.TemplateMessage.Builder
-
- All Implemented Interfaces:
TemplateMessage._FinalStage,TemplateMessage.TemplateStage
- Enclosing class:
- TemplateMessage
public static final class TemplateMessage.Builder extends java.lang.Object implements TemplateMessage.TemplateStage, TemplateMessage._FinalStage
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateMessage._FinalStagebrandId(java.lang.String brandId)TemplateMessage._FinalStagebrandId(java.util.Optional<java.lang.String> brandId)TemplateMessagebuild()TemplateMessage._FinalStagechannels(java.util.Map<java.lang.String,Channel> channels)"Define run-time configuration for one or more channels.TemplateMessage._FinalStagechannels(java.util.Optional<java.util.Map<java.lang.String,Channel>> channels)TemplateMessage._FinalStagecontext(MessageContext context)Context to load with this recipient.TemplateMessage._FinalStagecontext(java.util.Optional<MessageContext> context)TemplateMessage._FinalStagedata(java.util.Map<java.lang.String,java.lang.Object> data)An arbitrary object that includes any data you want to pass to the message.TemplateMessage._FinalStagedata(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> data)TemplateMessage._FinalStagedelay(Delay delay)Defines the time to wait before delivering the message.TemplateMessage._FinalStagedelay(java.util.Optional<Delay> delay)TemplateMessage._FinalStageexpiry(Expiry expiry)"Expiry allows you to set an absolute or relative time in which a message expires.TemplateMessage._FinalStageexpiry(java.util.Optional<Expiry> expiry)TemplateMessage.Builderfrom(TemplateMessage other)TemplateMessage._FinalStagemetadata(MessageMetadata metadata)Metadata such as utm tracking attached with the notification through this channel.TemplateMessage._FinalStagemetadata(java.util.Optional<MessageMetadata> metadata)TemplateMessage._FinalStagepreferences(MessagePreferences preferences)TemplateMessage._FinalStagepreferences(java.util.Optional<MessagePreferences> preferences)TemplateMessage._FinalStageproviders(java.util.Map<java.lang.String,MessageProvidersType> providers)An object whose keys are valid provider identifiers which map to an object.TemplateMessage._FinalStageproviders(java.util.Optional<java.util.Map<java.lang.String,MessageProvidersType>> providers)TemplateMessage._FinalStagerouting(Routing routing)TemplateMessage._FinalStagerouting(java.util.Optional<Routing> routing)TemplateMessage._FinalStagetemplate(java.lang.String template)The id of the notification template to be rendered and sent to the recipient(s).TemplateMessage._FinalStagetimeout(Timeout timeout)Time in ms to attempt the channel before failing over to the next available channel.TemplateMessage._FinalStagetimeout(java.util.Optional<Timeout> timeout)TemplateMessage._FinalStageto(MessageRecipient to)The recipient or a list of recipients of the messageTemplateMessage._FinalStageto(java.util.Optional<MessageRecipient> to)
-
-
-
Method Detail
-
from
public TemplateMessage.Builder from(TemplateMessage other)
- Specified by:
fromin interfaceTemplateMessage.TemplateStage
-
template
public TemplateMessage._FinalStage template(java.lang.String template)
The id of the notification template to be rendered and sent to the recipient(s). This field or the content field must be supplied.
- Specified by:
templatein interfaceTemplateMessage.TemplateStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
to
public TemplateMessage._FinalStage to(MessageRecipient to)
The recipient or a list of recipients of the message
- Specified by:
toin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
to
public TemplateMessage._FinalStage to(java.util.Optional<MessageRecipient> to)
- Specified by:
toin interfaceTemplateMessage._FinalStage
-
expiry
public TemplateMessage._FinalStage expiry(Expiry expiry)
"Expiry allows you to set an absolute or relative time in which a message expires. Note: This is only valid for the Courier Inbox channel as of 12-08-2022."
- Specified by:
expiryin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
expiry
public TemplateMessage._FinalStage expiry(java.util.Optional<Expiry> expiry)
- Specified by:
expiryin interfaceTemplateMessage._FinalStage
-
delay
public TemplateMessage._FinalStage delay(Delay delay)
Defines the time to wait before delivering the message. You can specify one of the following options. Duration with the number of milliseconds to delay. Until with an ISO 8601 timestamp that specifies when it should be delivered. Until with an OpenStreetMap opening_hours-like format that specifies the Delivery Window (e.g., 'Mo-Fr 08:00-18:00pm')
- Specified by:
delayin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
delay
public TemplateMessage._FinalStage delay(java.util.Optional<Delay> delay)
- Specified by:
delayin interfaceTemplateMessage._FinalStage
-
timeout
public TemplateMessage._FinalStage timeout(Timeout timeout)
Time in ms to attempt the channel before failing over to the next available channel.
- Specified by:
timeoutin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
timeout
public TemplateMessage._FinalStage timeout(java.util.Optional<Timeout> timeout)
- Specified by:
timeoutin interfaceTemplateMessage._FinalStage
-
routing
public TemplateMessage._FinalStage routing(Routing routing)
- Specified by:
routingin interfaceTemplateMessage._FinalStage
-
routing
public TemplateMessage._FinalStage routing(java.util.Optional<Routing> routing)
- Specified by:
routingin interfaceTemplateMessage._FinalStage
-
providers
public TemplateMessage._FinalStage providers(java.util.Map<java.lang.String,MessageProvidersType> providers)
An object whose keys are valid provider identifiers which map to an object.
- Specified by:
providersin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
providers
public TemplateMessage._FinalStage providers(java.util.Optional<java.util.Map<java.lang.String,MessageProvidersType>> providers)
- Specified by:
providersin interfaceTemplateMessage._FinalStage
-
preferences
public TemplateMessage._FinalStage preferences(MessagePreferences preferences)
- Specified by:
preferencesin interfaceTemplateMessage._FinalStage
-
preferences
public TemplateMessage._FinalStage preferences(java.util.Optional<MessagePreferences> preferences)
- Specified by:
preferencesin interfaceTemplateMessage._FinalStage
-
metadata
public TemplateMessage._FinalStage metadata(MessageMetadata metadata)
Metadata such as utm tracking attached with the notification through this channel.
- Specified by:
metadatain interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public TemplateMessage._FinalStage metadata(java.util.Optional<MessageMetadata> metadata)
- Specified by:
metadatain interfaceTemplateMessage._FinalStage
-
context
public TemplateMessage._FinalStage context(MessageContext context)
Context to load with this recipient. Will override any context set on message.context.
- Specified by:
contextin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
context
public TemplateMessage._FinalStage context(java.util.Optional<MessageContext> context)
- Specified by:
contextin interfaceTemplateMessage._FinalStage
-
channels
public TemplateMessage._FinalStage channels(java.util.Map<java.lang.String,Channel> channels)
"Define run-time configuration for one or more channels. If you don't specify channels, the default configuration for each channel will be used. Valid ChannelId's are: email, sms, push, inbox, direct_message, banner, and webhook."
- Specified by:
channelsin interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
channels
public TemplateMessage._FinalStage channels(java.util.Optional<java.util.Map<java.lang.String,Channel>> channels)
- Specified by:
channelsin interfaceTemplateMessage._FinalStage
-
brandId
public TemplateMessage._FinalStage brandId(java.lang.String brandId)
- Specified by:
brandIdin interfaceTemplateMessage._FinalStage
-
brandId
public TemplateMessage._FinalStage brandId(java.util.Optional<java.lang.String> brandId)
- Specified by:
brandIdin interfaceTemplateMessage._FinalStage
-
data
public TemplateMessage._FinalStage data(java.util.Map<java.lang.String,java.lang.Object> data)
An arbitrary object that includes any data you want to pass to the message. The data will populate the corresponding template or elements variables.
- Specified by:
datain interfaceTemplateMessage._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
data
public TemplateMessage._FinalStage data(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> data)
- Specified by:
datain interfaceTemplateMessage._FinalStage
-
build
public TemplateMessage build()
- Specified by:
buildin interfaceTemplateMessage._FinalStage
-
-