public interface MessageClient
Use Webex.messages()
to get an instance of MessageClient.
Modifier and Type | Interface and Description |
---|---|
static interface |
MessageClient.ProgressHandler
A callback to indicate the progress of an action in already processed size (bytes).
|
Modifier and Type | Method and Description |
---|---|
void |
delete(java.lang.String messageId,
CompletionHandler<java.lang.Void> handler)
Deletes a message asynchronously by message id.
|
void |
downloadFile(RemoteFile remoteFile,
java.io.File path,
MessageClient.ProgressHandler progressHandler,
CompletionHandler<android.net.Uri> completionHandler)
Downloads a file attachement asynchronously.
|
void |
downloadThumbnail(RemoteFile remoteFile,
java.io.File path,
MessageClient.ProgressHandler progressHandler,
CompletionHandler<android.net.Uri> completionHandler)
Downloads the thumbnail (preview image) of a file attachment asynchronously.
|
void |
edit(Message originalMessage,
Message.Text text,
Mention[] mentions,
CompletionHandler<MessageObserver.MessageEdited> handler)
Edit a previous sent message asynchronously.
|
void |
get(java.lang.String messageId,
CompletionHandler<Message> handler)
Retrieves a message asynchronously by message Id.
|
void |
list(java.lang.String spaceId,
Before before,
int max,
Mention[] mentions,
CompletionHandler<java.util.List<Message>> handler)
Lists all messages in a space by space Id asynchronously.
|
void |
list(java.lang.String spaceId,
java.lang.String before,
java.lang.String beforeMessage,
java.lang.String mentionedPeople,
int max,
CompletionHandler<java.util.List<Message>> handler)
Deprecated.
|
void |
markAsRead(java.lang.String spaceId)
Mark all messages in the space read.
|
void |
markAsRead(java.lang.String spaceId,
java.lang.String messageId)
Mark messages sent before the specified message in the space are read, including the specified message.
|
void |
post(java.lang.String target,
Message.Draft draft,
CompletionHandler<Message> handler)
Posts a message to a space or a person asynchronously.
|
void |
post(java.lang.String idOrEmail,
java.lang.String text,
Mention[] mentions,
LocalFile[] files,
CompletionHandler<Message> handler)
Deprecated.
|
void |
post(java.lang.String spaceId,
java.lang.String personId,
java.lang.String personEmail,
java.lang.String text,
java.lang.String markdown,
java.lang.String[] files,
CompletionHandler<Message> handler)
Deprecated.
|
void |
postToPerson(EmailAddress email,
Message.Text text,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a person asynchronously.
|
void |
postToPerson(EmailAddress email,
java.lang.String text,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a person asynchronously.
|
void |
postToPerson(java.lang.String id,
Message.Text text,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a person asynchronously.
|
void |
postToPerson(java.lang.String id,
java.lang.String text,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a person asynchronously.
|
void |
postToSpace(java.lang.String id,
Message.Text text,
Mention[] mentions,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a space asynchronously.
|
void |
postToSpace(java.lang.String id,
java.lang.String text,
Mention[] mentions,
LocalFile[] files,
CompletionHandler<Message> handler)
Posts a message with optional file attachments to a space asynchronously.
|
void |
setMessageObserver(MessageObserver observer)
Sets a
MessageObserver in this client. |
void setMessageObserver(MessageObserver observer)
MessageObserver
in this client.observer
- the observer object.MessageObserver
void list(@NonNull java.lang.String spaceId, @Nullable Before before, int max, @Nullable Mention[] mentions, @NonNull CompletionHandler<java.util.List<Message>> handler)
The list sorts the messages in descending order by creation date.
spaceId
- The identifier of a space.before
- If not nil, list messages sent only before this condition.max
- The maximum number of messages to be listed in the response.mentions
- If not nil, only list messages with any mention listed here.handler
- A closure to be executed once the request has finished with a list of messages based on the above criteria.void get(@NonNull java.lang.String messageId, @NonNull CompletionHandler<Message> handler)
messageId
- The identifier of the message.handler
- A closure to be executed once the message has been retrieved.void post(@NonNull java.lang.String target, @NonNull Message.Draft draft, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
To notify specific person or everyone in a space, mentions should be used.
Having @johndoe
in the content of the message does not generate notification.
target
- The identifier of a space or a person or an email address to which the message is to be posted.draft
- The content of message to be posted to the space.handler
- A closure to be executed once the message has posted.void edit(@NonNull Message originalMessage, @Nullable Message.Text text, @Nullable Mention[] mentions, @NonNull CompletionHandler<MessageObserver.MessageEdited> handler)
originalMessage
- The message that is editing.text
- The new text that will replace original message, if not edit this value, please set the value same with original message.mentions
- The mentioned person list that will replace original message, if not edit this value, please set the value same with original message.handler
- A closure to be executed once the message has edited. A MessageObserver.MessageEdited
event will gain if success.
Developer can call Message.update(MessageObserver.MessageEdited)
method to update to original message.void postToPerson(@NonNull java.lang.String id, @Nullable java.lang.String text, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
id
- The identifier of a person to which the message is to be posted.text
- The content of message to be posted to the person. The content can be plain text, html, or markdown.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void postToPerson(@NonNull java.lang.String id, @Nullable Message.Text text, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
id
- The identifier of a person to which the message is to be posted.text
- The content of message to be posted to the person. The content can be plain text, html, or markdown.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void postToPerson(@NonNull EmailAddress email, @Nullable java.lang.String text, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
email
- The email address of a person to which the message is to be posted.text
- The content of message to be posted to the person. The content can be plain text, html, or markdown.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void postToPerson(@NonNull EmailAddress email, @Nullable Message.Text text, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
email
- The email address of a person to which the message is to be posted.text
- The content of message to be posted to the person. The content can be plain text, html, or markdown.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void postToSpace(@NonNull java.lang.String id, @Nullable java.lang.String text, @Nullable Mention[] mentions, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
To notify specific person or everyone in a space, mentions should be used.
Having @johndoe
in the content of the message does not generate notification.
id
- The identifier of a space to which the message is to be posted.text
- The content of message to be posted to the space. The content can be plain text, html, or markdown.mentions
- Notify either one or all in a space about this message.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void postToSpace(@NonNull java.lang.String id, @Nullable Message.Text text, @Nullable Mention[] mentions, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
To notify specific person or everyone in a space, mentions should be used.
Having @johndoe
in the content of the message does not generate notification.
id
- The identifier of a space to which the message is to be posted.text
- The content of message to be posted to the space. The content can be plain text, html, or markdown.mentions
- Notify either one or all in a space about this message.files
- Local files to be attached with the message. Null if no files to be attached.handler
- A closure to be executed once the message has posted.void downloadFile(@NonNull RemoteFile remoteFile, @Nullable java.io.File path, @Nullable MessageClient.ProgressHandler progressHandler, @NonNull CompletionHandler<android.net.Uri> completionHandler)
remoteFile
- The reference to the file attachment to be downloaded. Use @{link Message#getRemoteFiles()} to get the references.path
- The local file directory to save the remote file.progressHandler
- The download progress indicator.completionHandler
- A closure to be executed when the download has completed. The URI contains the path to the downloaded file.void downloadThumbnail(@NonNull RemoteFile remoteFile, @Nullable java.io.File path, @Nullable MessageClient.ProgressHandler progressHandler, @NonNull CompletionHandler<android.net.Uri> completionHandler)
remoteFile
- The remote file whose thumbnail to be downloaded.path
- The local file directory to save the thumbnail.progressHandler
- The download progress indicator.completionHandler
- A closure to be executed when the download has completed. The URI contains the path to the downloaded thumbnail.void delete(@NonNull java.lang.String messageId, @NonNull CompletionHandler<java.lang.Void> handler)
messageId
- The identifier of the message.handler
- A closure to be executed once the request has finished.@Deprecated void list(@NonNull java.lang.String spaceId, @Nullable java.lang.String before, @Nullable java.lang.String beforeMessage, @Nullable java.lang.String mentionedPeople, int max, @NonNull CompletionHandler<java.util.List<Message>> handler)
The list sorts the messages in descending order by creation date.
spaceId
- The identifier of the space.before
- If not nil, only list messages sent only before this date and time, in ISO8601 format.beforeMessage
- If not nil, only list messages sent only before this message by id.mentionedPeople
- If not nil, only list messages metion people.max
- The maximum number of messages in the response.handler
- A closure to be executed once the request has finished.@Deprecated void post(@Nullable java.lang.String spaceId, @Nullable java.lang.String personId, @Nullable java.lang.String personEmail, @Nullable java.lang.String text, @Nullable java.lang.String markdown, @Nullable java.lang.String[] files, @NonNull CompletionHandler<Message> handler)
spaceId
- The identifier of the space where the message is to be posted.personId
- The identifier of the recipient of this private 1:1 message.personEmail
- The email address of the recipient when sending a private 1:1 message.text
- The plain text message to be posted to the space.markdown
- The markdown text message to be posted to the space.files
- A public URL that Cisco Webex can use to fetch attachments. Currently supports only a single URL. Cisco Webex downloads the content from the URL one time shortly after the message is created and automatically converts it to a format that all Cisco Webex clients can render.handler
- A closure to be executed once the request has finished.@Deprecated void post(@NonNull java.lang.String idOrEmail, @Nullable java.lang.String text, @Nullable Mention[] mentions, @Nullable LocalFile[] files, @NonNull CompletionHandler<Message> handler)
The content of the message can be plain text, html, or markdown.
To notify specific person or everyone in a space, mentions should be used.
Having @johndoe
in the content of the message does not generate notification.
idOrEmail
- The identifier of a space or a person or an email address to which the message is to be posted.text
- The content of message to be posted to the space. The content can be plain text, html, or markdown.mentions
- Notify either one or all in a space about this message. Ignored if post to a person or an email.files
- Local files to be attached with the message. Nil if no files to be attached.handler
- A closure to be executed once the message has posted.void markAsRead(@NonNull java.lang.String spaceId)
spaceId
- the id of space.void markAsRead(@NonNull java.lang.String spaceId, @NonNull java.lang.String messageId)
spaceId
- the id of space.messageId
- the id of a message.