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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFilesUploadV2Request.FilesUploadV2RequestBuilderstatic classFilesUploadV2Request.UploadFile
-
Constructor Summary
Constructors Constructor Description FilesUploadV2Request()FilesUploadV2Request(String token, File file, byte[] fileData, String content, String filename, String title, String altTxt, String snippetType, List<FilesUploadV2Request.UploadFile> uploadFiles, String initialComment, String channel, String threadTs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilesUploadV2Request.FilesUploadV2RequestBuilderbuilder()protected booleancanEqual(Object other)booleanequals(Object o)StringgetAltTxt()Description of image for screen-reader.StringgetChannel()Channel ID where the file will be shared.StringgetContent()File contents via a POST variable.FilegetFile()File contents via `multipart/form-data`.byte[]getFileData()File contents via `multipart/form-data`.StringgetFilename()Name of the file being uploaded.StringgetInitialComment()The message text introducing the file in specified channel.StringgetSnippetType()Syntax type of the snippet being uploaded.StringgetThreadTs()Provide another message's ts value to upload this file as a reply.StringgetTitle()Title of the file, which is visible in the Slack UI.StringgetToken()Authentication token.List<FilesUploadV2Request.UploadFile>getUploadFiles()Multiple files to uploadinthashCode()voidsetAltTxt(String altTxt)Description of image for screen-reader.voidsetChannel(String channel)Channel ID where the file will be shared.voidsetContent(String content)File contents via a POST variable.voidsetFile(File file)File contents via `multipart/form-data`.voidsetFileData(byte[] fileData)File contents via `multipart/form-data`.voidsetFilename(String filename)Name of the file being uploaded.voidsetInitialComment(String initialComment)The message text introducing the file in specified channel.voidsetSnippetType(String snippetType)Syntax type of the snippet being uploaded.voidsetThreadTs(String threadTs)Provide another message's ts value to upload this file as a reply.voidsetTitle(String title)Title of the file, which is visible in the Slack UI.voidsetToken(String token)Authentication token.voidsetUploadFiles(List<FilesUploadV2Request.UploadFile> uploadFiles)Multiple files to uploadStringtoString()
-
-
-
Method Detail
-
builder
public static FilesUploadV2Request.FilesUploadV2RequestBuilder builder()
-
getToken
public String getToken()
Authentication token. Requires scope: `files:write`- Specified by:
getTokenin interfaceSlackApiRequest- 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)
-
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:
setTokenin interfaceSlackApiRequest
-
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)
-
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.
-
canEqual
protected boolean canEqual(Object other)
-
-