Class SendMessageParams.Message.To.Recipient
-
- All Implemented Interfaces:
public final class SendMessageParams.Message.To.RecipientA single recipient of the message. Choose one of the following types based on how you want to identify the recipient: - User: Send to a specific user by user_id, email, or phone number - Audience: Send to all users in an audience - List: Send to all users in a list - List Pattern: Send to users in lists matching a pattern - Slack: Send via Slack (channel, email, or user_id) - MS Teams: Send via Microsoft Teams - PagerDuty: Send via PagerDuty - Webhook: Send via webhook
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSendMessageParams.Message.To.Recipient.VisitorAn interface that defines how to map each variant of Recipient to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<UserRecipient>user()Send to a specific user by user_id, email, phone_number, or list_id final Optional<AudienceRecipient>audience()Send to all users in an audience final Optional<ListRecipient>list()Send to all users in a specific list final Optional<ListPatternRecipient>listPattern()Send to users in lists matching a pattern final Optional<SlackRecipient>slack()Send via Slack (channel, email, or user_id) final Optional<MsTeamsRecipient>msTeams()Send via Microsoft Teams final Optional<PagerdutyRecipient>pagerduty()Send via PagerDuty final Optional<WebhookRecipient>webhook()Send via webhook final BooleanisUser()final BooleanisAudience()final BooleanisList()final BooleanisListPattern()final BooleanisSlack()final BooleanisMsTeams()final BooleanisPagerduty()final BooleanisWebhook()final UserRecipientasUser()Send to a specific user by user_id, email, phone_number, or list_id final AudienceRecipientasAudience()Send to all users in an audience final ListRecipientasList()Send to all users in a specific list final ListPatternRecipientasListPattern()Send to users in lists matching a pattern final SlackRecipientasSlack()Send via Slack (channel, email, or user_id) final MsTeamsRecipientasMsTeams()Send via Microsoft Teams final PagerdutyRecipientasPagerduty()Send via PagerDuty final WebhookRecipientasWebhook()Send via webhook final Optional<JsonValue>_json()final <T extends Any> Taccept(SendMessageParams.Message.To.Recipient.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final SendMessageParams.Message.To.Recipientvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SendMessageParams.Message.To.RecipientofUser(UserRecipient user)Send to a specific user by user_id, email, phone_number, or list_id final static SendMessageParams.Message.To.RecipientofAudience(AudienceRecipient audience)Send to all users in an audience final static SendMessageParams.Message.To.RecipientofList(ListRecipient list)Send to all users in a specific list final static SendMessageParams.Message.To.RecipientofListPattern(ListPatternRecipient listPattern)Send to users in lists matching a pattern final static SendMessageParams.Message.To.RecipientofSlack(SlackRecipient slack)Send via Slack (channel, email, or user_id) final static SendMessageParams.Message.To.RecipientofMsTeams(MsTeamsRecipient msTeams)Send via Microsoft Teams final static SendMessageParams.Message.To.RecipientofPagerduty(PagerdutyRecipient pagerduty)Send via PagerDuty final static SendMessageParams.Message.To.RecipientofWebhook(WebhookRecipient webhook)Send via webhook -
-
Method Detail
-
user
final Optional<UserRecipient> user()
Send to a specific user by user_id, email, phone_number, or list_id
-
audience
final Optional<AudienceRecipient> audience()
Send to all users in an audience
-
list
final Optional<ListRecipient> list()
Send to all users in a specific list
-
listPattern
final Optional<ListPatternRecipient> listPattern()
Send to users in lists matching a pattern
-
slack
final Optional<SlackRecipient> slack()
Send via Slack (channel, email, or user_id)
-
msTeams
final Optional<MsTeamsRecipient> msTeams()
Send via Microsoft Teams
-
pagerduty
final Optional<PagerdutyRecipient> pagerduty()
Send via PagerDuty
-
webhook
final Optional<WebhookRecipient> webhook()
Send via webhook
-
isAudience
final Boolean isAudience()
-
isListPattern
final Boolean isListPattern()
-
isPagerduty
final Boolean isPagerduty()
-
asUser
final UserRecipient asUser()
Send to a specific user by user_id, email, phone_number, or list_id
-
asAudience
final AudienceRecipient asAudience()
Send to all users in an audience
-
asList
final ListRecipient asList()
Send to all users in a specific list
-
asListPattern
final ListPatternRecipient asListPattern()
Send to users in lists matching a pattern
-
asSlack
final SlackRecipient asSlack()
Send via Slack (channel, email, or user_id)
-
asMsTeams
final MsTeamsRecipient asMsTeams()
Send via Microsoft Teams
-
asPagerduty
final PagerdutyRecipient asPagerduty()
Send via PagerDuty
-
asWebhook
final WebhookRecipient asWebhook()
Send via webhook
-
accept
final <T extends Any> T accept(SendMessageParams.Message.To.Recipient.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.courier.core.JsonValue; import java.util.Optional; Optional<String> result = recipient.accept(new Recipient.Visitor<Optional<String>>() { @Override public Optional<String> visitUser(UserRecipient user) { return Optional.of(user.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final SendMessageParams.Message.To.Recipient validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofUser
final static SendMessageParams.Message.To.Recipient ofUser(UserRecipient user)
Send to a specific user by user_id, email, phone_number, or list_id
-
ofAudience
final static SendMessageParams.Message.To.Recipient ofAudience(AudienceRecipient audience)
Send to all users in an audience
-
ofList
final static SendMessageParams.Message.To.Recipient ofList(ListRecipient list)
Send to all users in a specific list
-
ofListPattern
final static SendMessageParams.Message.To.Recipient ofListPattern(ListPatternRecipient listPattern)
Send to users in lists matching a pattern
-
ofSlack
final static SendMessageParams.Message.To.Recipient ofSlack(SlackRecipient slack)
Send via Slack (channel, email, or user_id)
-
ofMsTeams
final static SendMessageParams.Message.To.Recipient ofMsTeams(MsTeamsRecipient msTeams)
Send via Microsoft Teams
-
ofPagerduty
final static SendMessageParams.Message.To.Recipient ofPagerduty(PagerdutyRecipient pagerduty)
Send via PagerDuty
-
ofWebhook
final static SendMessageParams.Message.To.Recipient ofWebhook(WebhookRecipient webhook)
Send via webhook
-
-
-
-