public final class Message
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Message.Media
Media object describes downloadable media inside chat message with type
Message.Type.MEDIA . |
static class |
Message.Options
Used to construct new message before sending.
|
static class |
Message.Type
Represents the type of message.
|
static class |
Message.UpdateReason
Indicates reason for message update.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
org.json.JSONObject |
getAttributes()
Retrieve attributes associated with this message.
|
java.lang.String |
getAuthor()
The global identity of the author of this message.
|
Channel |
getChannel()
Returns the parent channel this message belongs to.
|
java.lang.String |
getChannelSid()
Returns the channel SID of the channel this message belongs to.
|
Message.Media |
getMedia()
Get media descriptor of an associated media attachment, if exists.
|
java.lang.String |
getMessageBody()
The body for this message.
|
long |
getMessageIndex()
Returns the index number for this message.
|
Messages |
getMessages()
Returns the parent messages object this message belongs to.
|
java.lang.String |
getSid()
Returns the identifier for this message.
|
java.lang.String |
getTimeStamp()
The last updated timestamp for this message.
|
java.util.Date |
getTimeStampAsDate()
The last updated timestamp for this message.
|
Message.Type |
getType() |
boolean |
hasMedia()
Helper method to check if message has media type.
|
static Message.Options |
options()
Options builder.
|
void |
setAttributes(org.json.JSONObject updatedAttributes,
StatusListener listener)
Change attributes associated with this message.
|
void |
updateMessageBody(java.lang.String body,
StatusListener listener)
Updates the body for a message.
|
public java.lang.String getSid()
public java.lang.String getAuthor()
public java.lang.String getTimeStamp()
public java.util.Date getTimeStampAsDate()
public java.lang.String getMessageBody()
public void updateMessageBody(java.lang.String body, StatusListener listener)
body
- The body for the message.listener
- Listener that will receive callback of the result.public java.lang.String getChannelSid()
public Channel getChannel()
public Messages getMessages()
public long getMessageIndex()
public org.json.JSONObject getAttributes() throws org.json.JSONException
org.json.JSONException
- If attributes could not be parsed.public void setAttributes(org.json.JSONObject updatedAttributes, StatusListener listener)
updatedAttributes
- Message attributes map to fully replace old attributes.listener
- Listener that will receive callback with the result.public static Message.Options options()
Messages.sendMessage(com.twilio.chat.Message.Options, com.twilio.chat.CallbackListener<com.twilio.chat.Message>)
.
Message.options()
.withMedia(new FileInputStream("/path/to/Somefile.txt"), "text/plain")
.withMediaFileName("file.txt");
public Message.Type getType()
getMedia()
shall return
the descriptor for the attached media.public boolean hasMedia()
if (message.hasMedia()) {
Message.Media media = message.getMedia();
}
public Message.Media getMedia()
public void dispose()