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 class
FilesUploadV2Request.FilesUploadV2RequestBuilder
static class
FilesUploadV2Request.UploadFile
-
Constructor Summary
Constructors Constructor Description FilesUploadV2Request()
FilesUploadV2Request(String token, File file, byte[] fileData, String content, String filename, String title, String altTxt, String snippetType, boolean requestFileInfo, List<FilesUploadV2Request.UploadFile> uploadFiles, String initialComment, String channel, String threadTs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FilesUploadV2Request.FilesUploadV2RequestBuilder
builder()
protected boolean
canEqual(Object other)
boolean
equals(Object o)
String
getAltTxt()
Description of image for screen-reader.String
getChannel()
Channel ID where the file will be shared.String
getContent()
File contents via a POST variable.File
getFile()
File contents via `multipart/form-data`.byte[]
getFileData()
File contents via `multipart/form-data`.String
getFilename()
Name of the file being uploaded.String
getInitialComment()
The message text introducing the file in specified channel.String
getSnippetType()
Syntax type of the snippet being uploaded.String
getThreadTs()
Provide another message's ts value to upload this file as a reply.String
getTitle()
Title of the file, which is visible in the Slack UI.String
getToken()
Authentication token.List<FilesUploadV2Request.UploadFile>
getUploadFiles()
Multiple files to uploadint
hashCode()
boolean
isRequestFileInfo()
Deprecated.void
setAltTxt(String altTxt)
Description of image for screen-reader.void
setChannel(String channel)
Channel ID where the file will be shared.void
setContent(String content)
File contents via a POST variable.void
setFile(File file)
File contents via `multipart/form-data`.void
setFileData(byte[] fileData)
File contents via `multipart/form-data`.void
setFilename(String filename)
Name of the file being uploaded.void
setInitialComment(String initialComment)
The message text introducing the file in specified channel.void
setRequestFileInfo(boolean requestFileInfo)
Deprecated.void
setSnippetType(String snippetType)
Syntax type of the snippet being uploaded.void
setThreadTs(String threadTs)
Provide another message's ts value to upload this file as a reply.void
setTitle(String title)
Title of the file, which is visible in the Slack UI.void
setToken(String token)
Authentication token.void
setUploadFiles(List<FilesUploadV2Request.UploadFile> uploadFiles)
Multiple files to uploadString
toString()
-
-
-
Constructor Detail
-
FilesUploadV2Request
public FilesUploadV2Request()
-
FilesUploadV2Request
public FilesUploadV2Request(String token, File file, byte[] fileData, String content, String filename, String title, String altTxt, String snippetType, boolean requestFileInfo, List<FilesUploadV2Request.UploadFile> uploadFiles, String initialComment, String channel, String threadTs)
-
-
Method Detail
-
builder
public static FilesUploadV2Request.FilesUploadV2RequestBuilder builder()
-
getToken
public String getToken()
Authentication token. Requires scope: `files:write`- Specified by:
getToken
in 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)
-
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 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)
-
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.
-
canEqual
protected boolean canEqual(Object other)
-
-