Class ElementalNode
-
- All Implemented Interfaces:
public final class ElementalNodeThe channel element allows a notification to be customized based on which channel it is sent through. For example, you may want to display a detailed message when the notification is sent through email, and a more concise message in a push notification. Channel elements are only valid as top-level elements; you cannot nest channel elements. If there is a channel element specified at the top-level of the document, all sibling elements must be channel elements. Note: As an alternative, most elements support a
channelproperty. Which allows you to selectively display an individual element on a per channel basis. See the control flow docs for more details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceElementalNode.VisitorAn interface that defines how to map each variant of ElementalNode to a value of type T.
-
Method Summary
-
-
Method Detail
-
textNodeWithType
final Optional<ElementalTextNodeWithType> textNodeWithType()
-
metaNodeWithType
final Optional<ElementalMetaNodeWithType> metaNodeWithType()
-
channelNodeWithType
final Optional<ElementalChannelNodeWithType> channelNodeWithType()
The channel element allows a notification to be customized based on which channel it is sent through. For example, you may want to display a detailed message when the notification is sent through email, and a more concise message in a push notification. Channel elements are only valid as top-level elements; you cannot nest channel elements. If there is a channel element specified at the top-level of the document, all sibling elements must be channel elements. Note: As an alternative, most elements support a
channelproperty. Which allows you to selectively display an individual element on a per channel basis. See the control flow docs for more details.
-
imageNodeWithType
final Optional<ElementalImageNodeWithType> imageNodeWithType()
-
actionNodeWithType
final Optional<ElementalActionNodeWithType> actionNodeWithType()
-
dividerNodeWithType
final Optional<ElementalDividerNodeWithType> dividerNodeWithType()
-
quoteNodeWithType
final Optional<ElementalQuoteNodeWithType> quoteNodeWithType()
-
htmlNodeWithType
final Optional<ElementalHtmlNodeWithType> htmlNodeWithType()
-
isTextNodeWithType
final Boolean isTextNodeWithType()
-
isMetaNodeWithType
final Boolean isMetaNodeWithType()
-
isChannelNodeWithType
final Boolean isChannelNodeWithType()
-
isImageNodeWithType
final Boolean isImageNodeWithType()
-
isActionNodeWithType
final Boolean isActionNodeWithType()
-
isDividerNodeWithType
final Boolean isDividerNodeWithType()
-
isQuoteNodeWithType
final Boolean isQuoteNodeWithType()
-
isHtmlNodeWithType
final Boolean isHtmlNodeWithType()
-
asTextNodeWithType
final ElementalTextNodeWithType asTextNodeWithType()
-
asMetaNodeWithType
final ElementalMetaNodeWithType asMetaNodeWithType()
-
asChannelNodeWithType
final ElementalChannelNodeWithType asChannelNodeWithType()
The channel element allows a notification to be customized based on which channel it is sent through. For example, you may want to display a detailed message when the notification is sent through email, and a more concise message in a push notification. Channel elements are only valid as top-level elements; you cannot nest channel elements. If there is a channel element specified at the top-level of the document, all sibling elements must be channel elements. Note: As an alternative, most elements support a
channelproperty. Which allows you to selectively display an individual element on a per channel basis. See the control flow docs for more details.
-
asImageNodeWithType
final ElementalImageNodeWithType asImageNodeWithType()
-
asActionNodeWithType
final ElementalActionNodeWithType asActionNodeWithType()
-
asDividerNodeWithType
final ElementalDividerNodeWithType asDividerNodeWithType()
-
asQuoteNodeWithType
final ElementalQuoteNodeWithType asQuoteNodeWithType()
-
asHtmlNodeWithType
final ElementalHtmlNodeWithType asHtmlNodeWithType()
-
accept
final <T extends Any> T accept(ElementalNode.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 = elementalNode.accept(new ElementalNode.Visitor<Optional<String>>() { @Override public Optional<String> visitTextNodeWithType(ElementalTextNodeWithType textNodeWithType) { return Optional.of(textNodeWithType.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ElementalNode 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.
-
ofTextNodeWithType
final static ElementalNode ofTextNodeWithType(ElementalTextNodeWithType textNodeWithType)
-
ofMetaNodeWithType
final static ElementalNode ofMetaNodeWithType(ElementalMetaNodeWithType metaNodeWithType)
-
ofChannelNodeWithType
final static ElementalNode ofChannelNodeWithType(ElementalChannelNodeWithType channelNodeWithType)
The channel element allows a notification to be customized based on which channel it is sent through. For example, you may want to display a detailed message when the notification is sent through email, and a more concise message in a push notification. Channel elements are only valid as top-level elements; you cannot nest channel elements. If there is a channel element specified at the top-level of the document, all sibling elements must be channel elements. Note: As an alternative, most elements support a
channelproperty. Which allows you to selectively display an individual element on a per channel basis. See the control flow docs for more details.
-
ofImageNodeWithType
final static ElementalNode ofImageNodeWithType(ElementalImageNodeWithType imageNodeWithType)
-
ofActionNodeWithType
final static ElementalNode ofActionNodeWithType(ElementalActionNodeWithType actionNodeWithType)
-
ofDividerNodeWithType
final static ElementalNode ofDividerNodeWithType(ElementalDividerNodeWithType dividerNodeWithType)
-
ofQuoteNodeWithType
final static ElementalNode ofQuoteNodeWithType(ElementalQuoteNodeWithType quoteNodeWithType)
-
ofHtmlNodeWithType
final static ElementalNode ofHtmlNodeWithType(ElementalHtmlNodeWithType htmlNodeWithType)
-
-
-
-