public static final class Message.Options
extends java.lang.Object
To avoid races between message create and send the SDK first collects all information about the message to create and then creates and sends the message in a single operation.
There are two major types of messages: TEXT and MEDIA.
Modifier and Type | Method and Description |
---|---|
Message.Options |
withAttributes(org.json.JSONObject attributes)
Set new message attributes.
|
Message.Options |
withBody(java.lang.String body)
Create message with given body text.
|
Message.Options |
withMedia(java.io.InputStream in,
java.lang.String mimeType)
Create message with given media stream.
|
Message.Options |
withMediaFileName(java.lang.String filename)
Provide optional filename for media.
|
Message.Options |
withMediaProgressListener(ProgressListener listener)
Set upload progress listener for media.
|
public Message.Options withBody(java.lang.String body)
withMedia(java.io.InputStream, java.lang.String)
because they are mutually exclusive message types.
Created message type will be Message.Type.TEXT
.body
- Message text body.public Message.Options withAttributes(org.json.JSONObject attributes)
attributes
- Attributes for the message as a JSON object.public Message.Options withMedia(java.io.InputStream in, java.lang.String mimeType)
withBody(java.lang.String)
because they are mutually exclusive message types.
Created message type will be Message.Type.MEDIA
.in
- Input stream to read media data from. Provided stream could be any subclass of
java.io.InputStream inluding ByteArrayInputStream, so you could upload media from memory
or even generate it on the go.mimeType
- MIME type for the media. Media service supports popular text, picture and
video formats.java.lang.IllegalStateException
- When attempt is made to set media on a text-only message.java.lang.IllegalArgumentException
- When attempt is made to use null input stream.public Message.Options withMediaFileName(java.lang.String filename)
filename
- [description]public Message.Options withMediaProgressListener(ProgressListener listener)
listener
- [description]