Class FilesUploadV2Request

java.lang.Object
com.slack.api.methods.request.files.FilesUploadV2Request
All Implemented Interfaces:
SlackApiRequest

public class FilesUploadV2Request extends Object implements SlackApiRequest
Wrapper method to enable developers to easily use the new way of uploading files. To mitigate the confusion among existing users of files.upload API, this method internally performs a few HTTP requests.

- step1: https://api.slack.com/methods/files.getUploadURLExternal (per file) - step2: POST requests to upload_url (per file) - step3: https://api.slack.com/methods/files.completeUploadExternal (only once)

Although most of the parameters are compatible, there are few difference. Unlike files.upload API, this new way allows developers to upload multiple files at a time. Also, the following operations are no longer supported. - Share the uploaded files in multiple channels - Set filetype for a file

  • Constructor Details

  • Method Details

    • builder

    • getToken

      public String getToken()
      Authentication token. Requires scope: `files:write`
      Specified by:
      getToken in interface SlackApiRequest
      Returns:
      token string value or null
    • getFile

      public File getFile()
      File contents via `multipart/form-data`. If omitting this parameter, you must submit `content`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getFileData

      public byte[] getFileData()
      File contents via `multipart/form-data`. If omitting this parameter, you must submit `content`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getContent

      public String getContent()
      File contents via a POST variable. If omitting this parameter, you must provide a `file`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getFilename

      public String getFilename()
      Name of the file being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getTitle

      public String getTitle()
      Title of the file, which is visible in the Slack UI. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getAltTxt

      public String getAltTxt()
      Description of image for screen-reader. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • getSnippetType

      public String getSnippetType()
      Syntax type of the snippet being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • isRequestFileInfo

      @Deprecated public boolean isRequestFileInfo()
      Deprecated.
      Fetches all the file metadata for better v1 compatibility when this property is true. Note that, starting in v1.34, this flag does not do anything. The full file metadata is now returned without additional files.info API calls.
    • getUploadFiles

      public List<FilesUploadV2Request.UploadFile> getUploadFiles()
      Multiple files to upload
    • getInitialComment

      public String getInitialComment()
      The message text introducing the file in specified channel.
    • getChannel

      public String getChannel()
      Channel ID where the file will be shared. If not specified the file will be private.
    • getThreadTs

      public String getThreadTs()
      Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
    • setToken

      public void setToken(String token)
      Authentication token. Requires scope: `files:write`
      Specified by:
      setToken in interface SlackApiRequest
    • setFile

      public void setFile(File file)
      File contents via `multipart/form-data`. If omitting this parameter, you must submit `content`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setFileData

      public void setFileData(byte[] fileData)
      File contents via `multipart/form-data`. If omitting this parameter, you must submit `content`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setContent

      public void setContent(String content)
      File contents via a POST variable. If omitting this parameter, you must provide a `file`. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setFilename

      public void setFilename(String filename)
      Name of the file being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setTitle

      public void setTitle(String title)
      Title of the file, which is visible in the Slack UI. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setAltTxt

      public void setAltTxt(String altTxt)
      Description of image for screen-reader. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setSnippetType

      public void setSnippetType(String snippetType)
      Syntax type of the snippet being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended)
    • setRequestFileInfo

      @Deprecated public void setRequestFileInfo(boolean requestFileInfo)
      Deprecated.
      Fetches all the file metadata for better v1 compatibility when this property is true. Note that, starting in v1.34, this flag does not do anything. The full file metadata is now returned without additional files.info API calls.
    • setUploadFiles

      public void setUploadFiles(List<FilesUploadV2Request.UploadFile> uploadFiles)
      Multiple files to upload
    • setInitialComment

      public void setInitialComment(String initialComment)
      The message text introducing the file in specified channel.
    • setChannel

      public void setChannel(String channel)
      Channel ID where the file will be shared. If not specified the file will be private.
    • setThreadTs

      public void setThreadTs(String threadTs)
      Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object