Package com.courier.models
Class Slack
-
- All Implemented Interfaces:
public final class Slack
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSlack.VisitorAn interface that defines how to map each variant of Slack to a value of type T.
-
Method Summary
-
-
Method Detail
-
sendToSlackChannel
final Optional<SendToSlackChannel> sendToSlackChannel()
-
sendToSlackEmail
final Optional<SendToSlackEmail> sendToSlackEmail()
-
sendToSlackUserId
final Optional<SendToSlackUserId> sendToSlackUserId()
-
isSendToSlackChannel
final Boolean isSendToSlackChannel()
-
isSendToSlackEmail
final Boolean isSendToSlackEmail()
-
isSendToSlackUserId
final Boolean isSendToSlackUserId()
-
asSendToSlackChannel
final SendToSlackChannel asSendToSlackChannel()
-
asSendToSlackEmail
final SendToSlackEmail asSendToSlackEmail()
-
asSendToSlackUserId
final SendToSlackUserId asSendToSlackUserId()
-
accept
final <T extends Any> T accept(Slack.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 = slack.accept(new Slack.Visitor<Optional<String>>() { @Override public Optional<String> visitSendToSlackChannel(SendToSlackChannel sendToSlackChannel) { return Optional.of(sendToSlackChannel.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final Slack 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.
-
ofSendToSlackChannel
final static Slack ofSendToSlackChannel(SendToSlackChannel sendToSlackChannel)
-
ofSendToSlackEmail
final static Slack ofSendToSlackEmail(SendToSlackEmail sendToSlackEmail)
-
ofSendToSlackUserId
final static Slack ofSendToSlackUserId(SendToSlackUserId sendToSlackUserId)
-
-
-
-