Class FilesUploadV2Request
java.lang.Object
com.slack.api.methods.request.files.FilesUploadV2Request
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
ConstructorsConstructorDescriptionFilesUploadV2Request
(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
Modifier and TypeMethodDescriptionbuilder()
protected boolean
boolean
Description of image for screen-reader.Channel ID where the file will be shared.File contents via a POST variable.getFile()
File contents via `multipart/form-data`.byte[]
File contents via `multipart/form-data`.Name of the file being uploaded.The message text introducing the file in specified channel.Syntax type of the snippet being uploaded.Provide another message's ts value to upload this file as a reply.getTitle()
Title of the file, which is visible in the Slack UI.getToken()
Authentication token.Multiple files to uploadint
hashCode()
boolean
Deprecated.void
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
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
Title of the file, which is visible in the Slack UI.void
Authentication token.void
setUploadFiles
(List<FilesUploadV2Request.UploadFile> uploadFiles) Multiple files to uploadtoString()
-
Constructor Details
-
FilesUploadV2Request
public FilesUploadV2Request() -
FilesUploadV2Request
-
-
Method Details
-
builder
-
getToken
Authentication token. Requires scope: `files:write`- Specified by:
getToken
in interfaceSlackApiRequest
- Returns:
- token string value or null
-
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
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
Name of the file being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
getTitle
Title of the file, which is visible in the Slack UI. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
getAltTxt
Description of image for screen-reader. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
getSnippetType
Syntax type of the snippet being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
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
Multiple files to upload -
getInitialComment
The message text introducing the file in specified channel. -
getChannel
Channel ID where the file will be shared. If not specified the file will be private. -
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
Authentication token. Requires scope: `files:write`- Specified by:
setToken
in interfaceSlackApiRequest
-
setFile
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
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
Name of the file being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
setTitle
Title of the file, which is visible in the Slack UI. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
setAltTxt
Description of image for screen-reader. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
setSnippetType
Syntax type of the snippet being uploaded. (this is mainly for backward compatibility - using uploadFiles instead is recommended) -
setRequestFileInfo
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
Multiple files to upload -
setInitialComment
The message text introducing the file in specified channel. -
setChannel
Channel ID where the file will be shared. If not specified the file will be private. -
setThreadTs
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
-
canEqual
-
hashCode
public int hashCode() -
toString
-