Interface Attachment


  • public interface Attachment
    Attachment class is representing a message optional parameter. It can contain any file uploaded by sending participant.

    If user is sending a picture, the client application is responsible for creating a second preview picture and setting proper object parameters. In the case of any other attachment type, a preview is not needed. An attachment can be removed, if parent message hasn't been sent yet.

    • Method Detail

      • removeListener

        void removeListener​(AttachmentListener listener)
        Removes a listener from the attachment.
        Parameters:
        listener - AttachmentListener instance that is removed from the service.
      • getId

        java.lang.String getId()
        The unique ID of the attachment.
        Returns:
        the unique ID of attachment.
      • getMessageId

        java.lang.String getMessageId()
        The ID of the message that the attachment is associated with.
        Returns:
        the ID of message that the attachment is associated with.
      • getDuration

        int getDuration()
        Duration of video or audio attachment represented in seconds.
        Returns:
        duration of attachment represented in seconds.
      • getSize

        long getSize()
        Size of attachment in bytes.
        Returns:
        size of attachment in bytes.
      • getLocationForConsumption

        java.lang.String getLocationForConsumption()
        Deprecated.
        THIS METHOD WILL BE REMOVED IN RELEASE VERSION 3.3. Use the consume() method instead.
        Returns the location of the attachment so that it can be opened by the application. This method has the additional effect of changing the status of the attachment to Opened.
        Returns:
        Location of attachment or empty string if location is not avaliable.
      • consume

        java.lang.String consume()
        Returns the location of the attachment so that it can be opened by the application. This method has the additional effect of changing the status of the attachment to Opened.
        Returns:
        Location of attachment or empty string if location is not avaliable.
      • setName

        void setName​(java.lang.String name,
                     MessagingCompletionHandler completionHandler)
        Set attachment name.
        Parameters:
        name - attachment name.
        completionHandler - The completion handler which will be invoked when the operation returns.
      • setThumbnail

        void setThumbnail​(boolean isThumbnail,
                          MessagingCompletionHandler completionHandler)
        Set isThumbnail property.
        Parameters:
        isThumbnail - new value of isThumbnail property.
        completionHandler - The completion handler which will be invoked when the operation returns.
      • setGeneratedContent

        void setGeneratedContent​(boolean isGeneratedContent,
                                 MessagingCompletionHandler completionHandler)
        Set isGeneratedContent property.
        Parameters:
        isGeneratedContent - new value of isGeneratedContent property.
        completionHandler - {The completion handler which will be invoked when the operation returns.
      • setLocation

        void setLocation​(java.lang.String location,
                         MessagingCompletionHandler completionHandler)
        Set attachment location.
        Parameters:
        location - attachment location.
        completionHandler - The completion handler which will be invoked when the operation returns.
      • setMimeType

        void setMimeType​(java.lang.String mimeType,
                         MessagingCompletionHandler messagingCompletionHandler)
        Set attachment MIME type.
        Parameters:
        mimeType - attachment MIME type.
        messagingCompletionHandler - The completion handler which will be invoked when the operation returns.
      • getUpdateNameCapability

        Capability getUpdateNameCapability()
        Returns a Capability object that indicates if the attachment's name property can be changed.

        This capability is Allowed when the Attachment is in a draft or error state.

        Returns:
        a Capability object that indicates if the attachment's name property can be changed.
        See Also:
        setName(String, MessagingCompletionHandler)
      • getUpdateThumbnailCapability

        Capability getUpdateThumbnailCapability()
        Returns a Capability object that indicates if the attachment's thumbnail property can be changed.

        This capability is Allowed when the Attachment is in a draft or error state.

        Returns:
        a Capability object that indicates if the attachment's thumbnail property can be changed.
        See Also:
        setThumbnail(boolean, MessagingCompletionHandler)
      • getUpdateGeneratedContentCapability

        Capability getUpdateGeneratedContentCapability()
        Returns a Capability object that indicates if the attachment's "generated content" property can be changed.

        This capability is Allowed when the Attachment is in a draft or error state.

        Returns:
        Capability object that indicates if the attachment's "generated content" property can be changed.
        See Also:
        setGeneratedContent(boolean, MessagingCompletionHandler)
      • getUpdateLocationCapability

        Capability getUpdateLocationCapability()
        Returns a Capability object that indicates if the attachment's location property can be changed.

        This capability is Allowed when the Attachment is in a draft or error state.

        Returns:
        Capability object that indicates if the attachment's location property can be changed.
        See Also:
        setLocation(String, MessagingCompletionHandler)
      • getUpdateMimeTypeCapability

        Capability getUpdateMimeTypeCapability()
        Returns a Capability object that indicates if the attachment's MIME type property can be changed.

        This capability is Allowed when the Attachment is in a draft or error state.

        Returns:
        Capability object that indicates if the attachment's MIME type property can be changed.
        See Also:
        setMimeType(String, MessagingCompletionHandler)
      • getDownloadCapability

        Capability getDownloadCapability()
        Returns a Capability object that indicates if the attachment can be downloaded.

        This capability is Allowed when all of the following conditions are true:

        • The messaging service is online (has an active connection to the server).
        • The Attachment is in a "ready to download" state.
        Returns:
        Capability object that indicates if the attachment can be downloaded.
        See Also:
        download(String, MessagingCompletionHandler)
      • getConsumeCapability

        Capability getConsumeCapability()
        Returns a Capability object that indicates if the attachment can be consumed.

        This capability is Allowed when the Attachment is in either the downloaded or consumed state.

        When the capability is not Allowed, the getLocationForConsumption() will return an empty string.

        Returns:
        Capability object that indicates if the attachment can be consumed.
        See Also:
        getLocationForConsumption()