com.avaya.ccs.api

## Interface EmailMediaI

- All Superinterfaces:
    MediaI

      public interface EmailMediaI
      extends MediaI

  The `EmailMediaI` object represents the 'Media' portion of an email contact. An Email is composed of an Interaction (which carries various Contact metadata) and Media (which carries email content).

  See `MediaI` for more details on `Media` objects.

  Author:
    conroy1

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addNewAttachment(java.io.File file)` Add an outbound attachment to the email media object.
    `void` | `completeAttachmentsUpload(com.avaya.ccs.core.OutboundAttachment[] attachments)` After uploading attachments as part of an email Reply or Create, the client must call this to complete the attachment upload process.
    `void` | `create(java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String body, java.lang.String note, boolean hasAttachments, java.lang.Integer skillsetId, boolean isHtml)` Create an ad-hoc or agent-initiated email.
    `java.lang.String` | `getArrivalTime()` The time that the contact arrived at the CCS component
    `java.lang.String` | `getBcc()` The Bcc party(s) of the email.
    `java.lang.String` | `getBody()` The email body
    `java.lang.String` | `getCc()` The Cc party(s) of the email.
    `java.lang.String` | `getContactId()` The Contact ID for this object.
    `java.lang.String` | `getEncoding()` The email character encoding.
    `java.lang.String` | `getFrom()` The From party of the email
    `java.util.List<com.avaya.ccs.core.InboundAttachment>` | `getInboundAttachments()` The list of `InboundAttachment`s attached to the email
    `java.lang.String` | `getMailboxAddress()` The AACC/ACCS mailbox address that handled this email
    `java.lang.String` | `getStatus()` The status of the Email media object.
    `java.lang.String` | `getSubject()` The email Subject
    `java.lang.String` | `getTo()` The To party(s) of the email.
    `java.lang.String` | `getUploadAttachmentUrl()` returns the upload attachment URL.
    `void` | `linkOutboundAttachments(com.avaya.ccs.core.OutboundAttachment[] attachments)` Deprecated.
    `void` | `reply(java.lang.String to, java.lang.String cc, java.lang.String bcc, java.lang.String subject, java.lang.String body, java.lang.String note, boolean hasAttachments, boolean isHtml)` Send a reply to an incoming email.
    `void` | `requestSuggestedResponses()` An array of `SuggestedResponse` returned by `requestSuggestedResponses()`}.
    `void` | `reschedule(java.lang.String callbackDate, java.lang.String callbackTime, java.lang.String callbackNote)`
    `void` | `setReplyResponse(com.avaya.ccs.core.EmailReplyResponse emailReplyResponse)` When an email `Reply` is sent, if it specifies that the email contains attachments (see `reply(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean)`, the server responds with a `RESPONSE` object.
    `void` | `setUploadAttachmentUrl(java.lang.String attachmentUrl)` When an email Reply (or Create) command is sent, CCS replies with a `EmailReplyResponse`.

    - ### Methods inherited from interface com.avaya.ccs.api.MediaI

      `getContactType, getId, toJsonStringMaskSensitive`

- - ### Method Detail

    - #### getContactId

          java.lang.String getContactId()
                                 throws ObjectInvalidException

      The Contact ID for this object. The Contact ID is the internal AACC/ACCS contact ID. This is not the same as the ID. The ID is composed of `AgentIdMContactId` (so the Contact ID can always be determined from the ID).

      Returns:
        ContactID for the EmailMedia object
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getArrivalTime

          java.lang.String getArrivalTime()
                                   throws ObjectInvalidException

      The time that the contact arrived at the CCS component
      Returns:
        arrival time of the contact
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getSubject

          java.lang.String getSubject()
                               throws ObjectInvalidException

      The email Subject
      Returns:
        the email subject
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getFrom

          java.lang.String getFrom()
                            throws ObjectInvalidException

      The From party of the email
      Returns:
        the From party of the email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getTo

          java.lang.String getTo()
                          throws ObjectInvalidException

      The To party(s) of the email. There may be multiple 'To' parties. getTo() returns them all as a string, delimited by ';'
      Returns:
        the 'To' parties of the email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getCc

          java.lang.String getCc()
                          throws ObjectInvalidException

      The Cc party(s) of the email. There may be multiple 'Cc' parties. getTo() returns them all as a string, delimited by ';'
      Returns:
        the 'Cc' parties of the email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getBcc

          java.lang.String getBcc()
                           throws ObjectInvalidException

      The Bcc party(s) of the email. Will always be empty for incoming emails.
      Returns:
        the 'Bcc' parties of the email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getMailboxAddress

          java.lang.String getMailboxAddress()
                                      throws ObjectInvalidException

      The AACC/ACCS mailbox address that handled this email
      Returns:
        the relevant AACC/ACCS mailbox address that handled this email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getEncoding

          java.lang.String getEncoding()
                                throws ObjectInvalidException

      The email character encoding. There are two possible types: 'PLAIN' (plain text html) or 'HTML' (html-based email)
      Returns:
        the email encoding type
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getBody

          java.lang.String getBody()
                            throws ObjectInvalidException

      The email body
      Returns:
        the email body
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getStatus

          java.lang.String getStatus()
                              throws ObjectInvalidException

      The status of the Email media object. Can be New, Open, Closed, Waiting. This reflects the status of the contact in the CCMM database
      Returns:
        the status of the email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getInboundAttachments

          java.util.List<com.avaya.ccs.core.InboundAttachment> getInboundAttachments()
                                                                              throws ObjectInvalidException

      The list of `InboundAttachment`s attached to the email
      Returns:
        the list of inbound attachments for this email
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### addNewAttachment

          void addNewAttachment(java.io.File file)
                         throws ObjectInvalidException

      Add an outbound attachment to the email media object. Note that this does NOT upload attachments to AACC/ACCS. Uploading attachments to AACC/ACCS/CCMM is a client implementation and is not done through the CCS API. When an email Reply (or Create) command is sent, CCS replies with a `EmailReplyResponse`. The EmailReplyResponse contains an upload URL. The client then uses this upload URL to upload the attachments to the server.

      Parameters:
        `file` - The attachment file
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### setUploadAttachmentUrl

          void setUploadAttachmentUrl(java.lang.String attachmentUrl)
                               throws ObjectInvalidException

      When an email Reply (or Create) command is sent, CCS replies with a `EmailReplyResponse`. The EmailReplyResponse contains an upload URL, which the client can use to upload email attachments. This is the setter for that upload attachment url.

      Parameters:
        `attachmentUrl` - : the location to upload attachments to
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### getUploadAttachmentUrl

          java.lang.String getUploadAttachmentUrl()
                                           throws ObjectInvalidException

      returns the upload attachment URL. The attachment URL is the location that the client should upload attachments to, after an email Reply or Create. See "setUploadAttachmentUrl"

      Returns:
        the upload attachment URL
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### reply

          void reply(java.lang.String to,
                     java.lang.String cc,
                     java.lang.String bcc,
                     java.lang.String subject,
                     java.lang.String body,
                     java.lang.String note,
                     boolean hasAttachments,
                     boolean isHtml)

      Send a reply to an incoming email.

      'to', 'cc', 'bcc' are single strings, with multiple addresses delimited by ';'

      'Agent note' is an optional note from the agent describing this interaction.

      'hasAttachments' should be true if this email has outgoing attachments which need to be sent. False otherwise

      'isHtml' Emails have two possible encodings: 'HTML' or 'PLAIN' in CCS. If this is a html-encoded email, then isHtml should be true.

      Parameters:
        `to` - multiple addresses delimited by ';'
        `cc` - multiple addresses delimited by ';'
        `bcc` - multiple addresses delimited by ';'
        `subject` -
        `email` - body
        `agent` - note -an optional note from the agent on this interaction
        `hasAttachments` - -true if the email has outgoing attachments, false otherwise)
        `isHtml` - - true if the body of the email is 'HTML'; false if the encoding is 'Plain'

    - #### create

          void create(java.lang.String to,
                      java.lang.String cc,
                      java.lang.String bcc,
                      java.lang.String subject,
                      java.lang.String body,
                      java.lang.String note,
                      boolean hasAttachments,
                      java.lang.Integer skillsetId,
                      boolean isHtml)
               throws ObjectInvalidException

      Create an ad-hoc or agent-initiated email.

      The flow for an ad-hoc email is as follows:

      - The Client initiates the flow by calling `UserI.initiateAdhocEmail()`.
      - CCS responds with a NEW Interaction notification.
      - To send the email, you then call this method `create(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.Integer, boolean)`.

      Ad-hoc emails are send 'From' a skillset. Skillsets are configured in CCMM with an outbound mailbox. The skillsetId parameter is the ID of the skillset that the user wants to use as the sender. Typically, a user will select the sender skillset for an ad-hoc email from a dropdown menu in a client. Available email skillsets can be requested by calling `InteractionI.getSkillsets()`

      'to', 'cc', 'bcc' are single strings, with multiple addresses delimited by ';'

      Parameters:
        `to` - Multiple addresses delimited by ';'
        `cc` - Multiple addresses delimited by ';'
        `bcc` - Multiple addresses delimited by ';'
        `subject` -
        `body` -
        `note` - Agent note
        `hasAttachments` - Set to True if the email has attachments
        `isHtml` - - true if the body of the email is 'HTML'; false if the encoding is 'Plain'
        `skillsetId` - the id of the skillset that is acting as the Sender/Originator of the email
        `isHtml` - true if the body of the email is 'HTML'; false if the encoding is 'Plain'
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### setReplyResponse

          void setReplyResponse(com.avaya.ccs.core.EmailReplyResponse emailReplyResponse)
                         throws ObjectInvalidException

      When an email `Reply` is sent, if it specifies that the email contains attachments (see `reply(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean)`, the server responds with a `RESPONSE` object. This `EmailReplyResponse` contains an upload URL, which a client can use to start uploading attachments to the CCMM server.

      It is the client's responsibility to upload attachments using this link using TCP or whatever mechanism the designer sees fit.

      When uploads have completed, the client must use `EmailMediaI#completeAttachmentUpload` to complete the attachment upload process

      Parameters:
        `emailReplyResponse` - - This sets the predefined URL where the attachment will be sent
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### linkOutboundAttachments

          @Deprecated
          void linkOutboundAttachments(com.avaya.ccs.core.OutboundAttachment[] attachments)
                                             throws ObjectInvalidException

      Deprecated.
      Experimental: do not use. To upload attachments, see `setReplyResponse(com.avaya.ccs.core.EmailReplyResponse)` and `completeAttachmentsUpload(com.avaya.ccs.core.OutboundAttachment[])`
      Parameters:
        `attachments` - - This takes in the attachment model details for outbound emails
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### completeAttachmentsUpload

          void completeAttachmentsUpload(com.avaya.ccs.core.OutboundAttachment[] attachments)
                                  throws ObjectInvalidException

      After uploading attachments as part of an email Reply or Create, the client must call this to complete the attachment upload process. This links the newly uploaded attachments to the Email object in the database layer of AACC/ACCS
      Throws:
        `ObjectInvalidException`

    - #### requestSuggestedResponses

          void requestSuggestedResponses()
                                  throws ObjectInvalidException

      An array of `SuggestedResponse` returned by `requestSuggestedResponses()`}. Agent use these objects to auto-populate an email subject, body, attachments. `SuggestedResponse` must be created in the Contact Center to be visible to agents.
      Throws:
        `ObjectInvalidException` - if the `EmailMediaI` object has been deleted

    - #### reschedule

          void reschedule(java.lang.String callbackDate,
                          java.lang.String callbackTime,
                          java.lang.String callbackNote)