public class FileRequests
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.String,java.lang.String> |
HTTP_HEADERS |
Constructor and Description |
---|
FileRequests() |
Modifier and Type | Method and Description |
---|---|
static RestRequest |
addFileShare(java.lang.String fileId,
java.lang.String entityId,
java.lang.String shareType)
Build a request that will add a file share for the specified fileId to
the specified entityId.
|
protected static ConnectUriBuilder |
base(java.lang.String firstPathSegment) |
static RestRequest |
batchFileDetails(java.util.List<java.lang.String> sfdcIds)
Build a request that can fetch the latest file details of one or more
files in a single request.
|
static RestRequest |
deleteFileShare(java.lang.String shareId)
Build a request that will delete the specified file share.
|
static RestRequest |
fileContents(java.lang.String sfdcId,
java.lang.String version)
Builds a request that can fetch the actual binary file contents of this
particular file.
|
static RestRequest |
fileDetails(java.lang.String sfdcId,
java.lang.String version)
Build a Request that can fetch the file details of a particular version
of a file.
|
static RestRequest |
fileRendition(java.lang.String sfdcId,
java.lang.String version,
RenditionType renditionType,
java.lang.Integer pageNum)
Build a Request that can fetch the a preview/rendition of a particular
page of the file (and version).
|
static RestRequest |
fileShares(java.lang.String sfdcId,
java.lang.Integer pageNum)
Build a Request that can fetch a page from the list of entities that this
file is shared to.
|
static RestRequest |
filesInUsersGroups(java.lang.String userId,
java.lang.Integer pageNum)
Build a Request that can fetch a page from the list of files from groups
that the user is a member of.
|
static RestRequest |
filesSharedWithUser(java.lang.String userId,
java.lang.Integer pageNum)
Build a Request that can fetch a page from the list of files that have
been shared with the user.
|
static java.lang.String |
getContentDocumentLinkPath() |
protected static RestRequest |
make(ConnectUriBuilder builder) |
static RestRequest |
ownedFilesList(java.lang.String userId,
java.lang.Integer pageNum)
Build a Request that can fetch a page from the files owned by the specified user.
|
static RestRequest |
uploadFile(java.io.File theFile,
java.lang.String name,
java.lang.String title,
java.lang.String description,
java.lang.String mimeType)
Build a request that can upload a new file to the server, this will
create a new file at version 1.
|
protected static void |
validateSfdcId(java.lang.String sfdcId) |
protected static void |
validateSfdcIds(java.util.List<java.lang.String> sfdcIds) |
protected static void |
validateSfdcIds(java.lang.String... sfdcIds) |
protected static final java.util.Map<java.lang.String,java.lang.String> HTTP_HEADERS
public static java.lang.String getContentDocumentLinkPath()
public static RestRequest ownedFilesList(java.lang.String userId, java.lang.Integer pageNum)
userId
- If null the context user is used, otherwise it should be an Id of a user.pageNum
- If null fetches the first page, otherwise fetches the specified page.public static RestRequest filesInUsersGroups(java.lang.String userId, java.lang.Integer pageNum)
userId
- If null the context user is used, otherwise it should be an Id of a user.pageNum
- If null fetches the first page, otherwise fetches the specified page.public static RestRequest filesSharedWithUser(java.lang.String userId, java.lang.Integer pageNum)
userId
- If null the context user is used, otherwise it should be an Id of a user.pageNum
- If null fetches the first page, otherwise fetches the specified page.public static RestRequest fileDetails(java.lang.String sfdcId, java.lang.String version)
sfdcId
- The Id of the file.version
- If null fetches the most recent version, otherwise fetches this specific version.public static RestRequest batchFileDetails(java.util.List<java.lang.String> sfdcIds)
sfdcIds
- The list of file Ids to fetch.public static RestRequest fileRendition(java.lang.String sfdcId, java.lang.String version, RenditionType renditionType, java.lang.Integer pageNum)
sfdcId
- The Id of the file.version
- If null fetches the most recent version, otherwise fetches this specific version.renditionType
- What format of rendition do you want to get.pageNum
- Which page to fetch, pages start at 0.public static RestRequest fileContents(java.lang.String sfdcId, java.lang.String version)
sfdcId
- The Id of the file.version
- The version of the file.public static RestRequest fileShares(java.lang.String sfdcId, java.lang.Integer pageNum)
sfdcId
- The Id of the file.pageNum
- If null fetches the first page, otherwise fetches the specified page.public static RestRequest addFileShare(java.lang.String fileId, java.lang.String entityId, java.lang.String shareType)
fileId
- The Id of the file being shared.entityId
- The Id of the entity to share the file to (e.g. a user or a group).shareType
- The type of share (V - View, C - Collaboration).public static RestRequest deleteFileShare(java.lang.String shareId)
shareId
- The Id of the file share record (aka ContentDocumentLink).public static RestRequest uploadFile(java.io.File theFile, java.lang.String name, java.lang.String title, java.lang.String description, java.lang.String mimeType)
theFile
- The path of the local file to upload to the server.name
- The name of this file.title
- The title of this file.description
- A description of the file.mimeType
- The mime-type of the file, if known.protected static RestRequest make(ConnectUriBuilder builder)
protected static ConnectUriBuilder base(java.lang.String firstPathSegment)
protected static void validateSfdcId(java.lang.String sfdcId)
protected static void validateSfdcIds(java.lang.String... sfdcIds)
protected static void validateSfdcIds(java.util.List<java.lang.String> sfdcIds)