Class AttachmentsApi


  • public class AttachmentsApi
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object deleteAttachment​(AttachmentDeleteBody attachmentDeleteBody, java.lang.String appId)
      Delete Attachment Remove an attachment uploaded to Sunshine Conversations through the Upload attachment API.
      java.lang.Object deleteAttachment​(java.lang.String bearerToken, AttachmentDeleteBody attachmentDeleteBody, java.lang.String appId)
      Delete Attachment Remove an attachment uploaded to Sunshine Conversations through the Upload attachment API.
      AttachmentMediaTokenResponse generateMediaJsonWebToken​(AttachmentMediaTokenBody attachmentMediaTokenBody, java.lang.String appId)
      Generate Media Token Generates a media JWT for a list of attachment paths.
      AttachmentMediaTokenResponse generateMediaJsonWebToken​(java.lang.String bearerToken, AttachmentMediaTokenBody attachmentMediaTokenBody, java.lang.String appId)
      Generate Media Token Generates a media JWT for a list of attachment paths.
      ApiClient getApiClient()  
      void setApiClient​(ApiClient apiClient)  
      java.lang.Object setCookie​(java.lang.String appId)
      Set Cookie With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT.
      java.lang.Object setCookie​(java.lang.String bearerToken, java.lang.String appId)
      Set Cookie With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT.
      AttachmentResponse uploadAttachment​(java.io.File source, java.lang.String appId, java.lang.String access, java.lang.String _for, java.lang.String conversationId)
      Upload Attachment Upload an attachment to Sunshine Conversations to use in future messages.
      AttachmentResponse uploadAttachment​(java.lang.String bearerToken, java.io.File source, java.lang.String appId, java.lang.String access, java.lang.String _for, java.lang.String conversationId)
      Upload Attachment Upload an attachment to Sunshine Conversations to use in future messages.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AttachmentsApi

        public AttachmentsApi()
      • AttachmentsApi

        public AttachmentsApi​(ApiClient apiClient)
    • Method Detail

      • getApiClient

        public ApiClient getApiClient()
      • setApiClient

        public void setApiClient​(ApiClient apiClient)
      • deleteAttachment

        public java.lang.Object deleteAttachment​(AttachmentDeleteBody attachmentDeleteBody,
                                                 java.lang.String appId)
                                          throws ApiException
        Delete Attachment Remove an attachment uploaded to Sunshine Conversations through the Upload attachment API. See [Attachments for Messages](#section/Attachments-for-Messages) to have attachments automatically deleted when deleting messages, conversations or users. <aside class=\"notice\">Note that deleted attachments can remain available on our CDN’s cache up to 15 minutes after the delete call.</aside>
        Parameters:
        attachmentDeleteBody - (required)
        appId - Identifies the app. (required)
        Returns:
        a Object
        Throws:
        ApiException - if fails to make API call
      • generateMediaJsonWebToken

        public AttachmentMediaTokenResponse generateMediaJsonWebToken​(AttachmentMediaTokenBody attachmentMediaTokenBody,
                                                                      java.lang.String appId)
                                                               throws ApiException
        Generate Media Token Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. <aside class=\"notice\">Note you have the ability to allow files using different rules, see <a href=\"https://docs.smooch.io/guide/private-attachments\">Private Attachments</a> for more details.</aside>
        Parameters:
        attachmentMediaTokenBody - (required)
        appId - Identifies the app. (required)
        Returns:
        a AttachmentMediaTokenResponse
        Throws:
        ApiException - if fails to make API call
      • setCookie

        public java.lang.Object setCookie​(java.lang.String appId)
                                   throws ApiException
        Set Cookie With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment.
        Parameters:
        appId - Identifies the app. (required)
        Returns:
        a Object
        Throws:
        ApiException - if fails to make API call
      • uploadAttachment

        public AttachmentResponse uploadAttachment​(java.io.File source,
                                                   java.lang.String appId,
                                                   java.lang.String access,
                                                   java.lang.String _for,
                                                   java.lang.String conversationId)
                                            throws ApiException
        Upload Attachment Upload an attachment to Sunshine Conversations to use in future messages. Files are uploaded using the multipart/form-data content type. Use the returned mediaUrl to send a file, image or carousel message. <aside class=\"notice\">Note that Sunshine Conversations limits the size and type of file you can upload to the platform. See the <a href=\"https://docs.smooch.io/guide/validating-files\">file validation</a> guide for more details.</aside>
        Parameters:
        source - (required)
        appId - Identifies the app. (required)
        access - The access level for the attachment. Currently the available access levels are public and private. (required)
        _for - Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. (optional)
        conversationId - Links the attachment getting uploaded to the conversation ID. (optional)
        Returns:
        a AttachmentResponse
        Throws:
        ApiException - if fails to make API call
      • deleteAttachment

        public java.lang.Object deleteAttachment​(java.lang.String bearerToken,
                                                 AttachmentDeleteBody attachmentDeleteBody,
                                                 java.lang.String appId)
                                          throws ApiException
        Delete Attachment Remove an attachment uploaded to Sunshine Conversations through the Upload attachment API. See [Attachments for Messages](#section/Attachments-for-Messages) to have attachments automatically deleted when deleting messages, conversations or users. <aside class=\"notice\">Note that deleted attachments can remain available on our CDN’s cache up to 15 minutes after the delete call.</aside>
        Parameters:
        bearerToken - a token to be used for this request (required)
        attachmentDeleteBody - (required)
        appId - Identifies the app. (required)
        Returns:
        a Object
        Throws:
        ApiException - if fails to make API call
      • generateMediaJsonWebToken

        public AttachmentMediaTokenResponse generateMediaJsonWebToken​(java.lang.String bearerToken,
                                                                      AttachmentMediaTokenBody attachmentMediaTokenBody,
                                                                      java.lang.String appId)
                                                               throws ApiException
        Generate Media Token Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. <aside class=\"notice\">Note you have the ability to allow files using different rules, see <a href=\"https://docs.smooch.io/guide/private-attachments\">Private Attachments</a> for more details.</aside>
        Parameters:
        bearerToken - a token to be used for this request (required)
        attachmentMediaTokenBody - (required)
        appId - Identifies the app. (required)
        Returns:
        a AttachmentMediaTokenResponse
        Throws:
        ApiException - if fails to make API call
      • setCookie

        public java.lang.Object setCookie​(java.lang.String bearerToken,
                                          java.lang.String appId)
                                   throws ApiException
        Set Cookie With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment.
        Parameters:
        bearerToken - a token to be used for this request (required)
        appId - Identifies the app. (required)
        Returns:
        a Object
        Throws:
        ApiException - if fails to make API call
      • uploadAttachment

        public AttachmentResponse uploadAttachment​(java.lang.String bearerToken,
                                                   java.io.File source,
                                                   java.lang.String appId,
                                                   java.lang.String access,
                                                   java.lang.String _for,
                                                   java.lang.String conversationId)
                                            throws ApiException
        Upload Attachment Upload an attachment to Sunshine Conversations to use in future messages. Files are uploaded using the multipart/form-data content type. Use the returned mediaUrl to send a file, image or carousel message. <aside class=\"notice\">Note that Sunshine Conversations limits the size and type of file you can upload to the platform. See the <a href=\"https://docs.smooch.io/guide/validating-files\">file validation</a> guide for more details.</aside>
        Parameters:
        bearerToken - a token to be used for this request (required)
        source - (required)
        appId - Identifies the app. (required)
        access - The access level for the attachment. Currently the available access levels are public and private. (required)
        _for - Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. (optional)
        conversationId - Links the attachment getting uploaded to the conversation ID. (optional)
        Returns:
        a AttachmentResponse
        Throws:
        ApiException - if fails to make API call