Constructor
-
new Attachment(thumbnailCreator)
-
Attachments can be used to send files between Participants in existing Conversation.
When created, it becomes a part of Message.Audio and video attachments should have thumbnails.
Parameters:
Name Type Description thumbnailCreator
AvayaClientServices.Services.Messaging.ThumbnailCreator
Methods
-
createThumbnail() → {AvayaClientServices.Base.Promise.<(AvayaClientServices.Services.Messaging.Attachment|String)>}
-
If possible, creates a thumbnail for attachment.
Returns:
-
getDownloadURL() → {String}
-
Returns attachment URL.
Returns:
{ String }
-
getDuration() → {Number}
-
Returns attachment duration in seconds. Applicable for audio/video files.
Returns:
{ Number }
-
getMimeType() → {String}
-
Returns attachment MIME type.
Returns:
{ String }
-
getName() → {String|undefined}
-
Returns attachment name.
Returns:
{ String | undefined }
-
getSize() → {Number}
-
Returns attachment size in bytes.
Returns:
{ Number }
-
getThumbnail() → {AvayaClientServices.Services.Messaging.Attachment|undefined}
-
Returns attachment thumbnail if possible. If not, returns undefined.
Returns:
{ AvayaClientServices.Services.Messaging.Attachment | undefined }
-
removeThumbnail() → {void}
-
Removes thumbnail from attachment.
Returns:
{ void }
-
setDuration(duration) → {void}
-
Sets attachment duration in seconds. Applicable for audio/video files.
Parameters:
Name Type Description duration
Number Value in seconds.
Returns:
{ void }
-
setMimeType(mimeType) → {void}
-
Sets attachment MIME type.
Parameters:
Name Type Description mimeType
String MIME type for attachment.
Returns:
{ void }
-
setName(name) → {void}
-
Sets attachment name.
Parameters:
Name Type Description name
String Name for attachment.
Returns:
{ void }
Managing callbacks
-
addOnHasThumbnailChangedCallback(callback) → {void}
-
Adds new onHasThumbnailChangedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onHasThumbnailChangedCallback Returns:
{ void }
-
addOnIsSelfGeneratedCallback(callback) → {void}
-
Adds new onIsSelfGeneratedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onIsSelfGeneratedCallback Returns:
{ void }
-
addOnStatusChangedCallback(callback) → {void}
-
Adds new onStatusChangedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onStatusChangedCallback Returns:
{ void }
-
removeOnHasThumbnailChangedCallback(callback) → {void}
-
Removes existing onHasThumbnailChangedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onHasThumbnailChangedCallback Returns:
{ void }
-
removeOnIsSelfGeneratedCallback(callback) → {void}
-
Removes existing onIsSelfGeneratedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onIsSelfGeneratedCallback Returns:
{ void }
-
removeOnStatusChangedCallback(callback) → {void}
-
Removes existing onStatusChangedCallback.
Parameters:
Name Type Description callback
AvayaClientServices.Services.Messaging.Attachment#onStatusChangedCallback Returns:
{ void }
Capabilities
-
getCreateThumbnailCapability() → {AvayaClientServices.Base.Capability}
-
Gets capability to create a thumbnail for attachment.
if (attachment MIME type is supported) allow else deny
Returns:
-
getRemoveCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if attachment can be removed.
This capability is Allowed when Attachment is in a draft state.if (attachment is DRAFT_UNSENT) allow else deny
Returns:
-
getRemoveThumbnailCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if thumbnail can be removed from attachment.
This capability is Allowed when Attachment is in a draft state.if (attachment is DRAFT_UNSENT) allow else deny
Returns:
-
getUpdateDurationCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if attachment duration property can be changed.
This capability is Allowed when Attachment is in a draft state.if (attachment is DRAFT_UNSENT) allow else deny
Returns:
-
getUpdateIsSelfGeneratedCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if a thumbnail for attachment can be created.
Returns:
-
getUpdateMimeTypeCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if attachment MIME type property can be changed.
This capability is Allowed when Attachment is in draft state.if (attachment is DRAFT_UNSENT) allow else deny
Returns:
-
getUpdateNameCapability() → {AvayaClientServices.Base.Capability}
-
Returns Capability object that indicates if attachment name property can be changed.
This capability is Allowed when Attachment is in a draft state.if (attachment is DRAFT_UNSENT) allow else deny
Returns:
Type Definitions
-
onHasThumbnailChangedCallback(attachment, hasThumbnail) → {void}
-
Interface for callback function to be invoked when attachment has a thumbnail created or removed.
Parameters:
Name Type Description attachment
AvayaClientServices.Services.Messaging.Attachment Instance of attachment.
hasThumbnail
boolean True if an attachment now has a thumbnail. False otherwise.
Returns:
{ void }
-
onIsSelfGeneratedCallback(Attachment, isSelfGenerated) → {void}
-
Interface for callback function to be invoked when attachment's isSelfGenerated flag changes.
Parameters:
Name Type Description Attachment
AvayaClientServices.Services.Messaging.Attachment Instance of attachment.
isSelfGenerated
boolean New value of isSelfGenerated flag.
Returns:
{ void }
-
onStatusChangedCallback(attachment, resourceStatus) → {void}
-
Interface for callback function to be invoked when attachment's resource status changes.
Parameters:
Name Type Description attachment
AvayaClientServices.Services.Messaging.Attachment Instance of attachment.
resourceStatus
string New attachment's resource status.
Returns:
{ void }