Class OneDriveAPI
java.lang.Object
org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI
The Class OneDriveAPI.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionorg.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.ChangesIteratorChanges.com.microsoft.graph.models.extensions.DriveItemCopy.com.microsoft.graph.models.extensions.DriveItemCopy file.com.microsoft.graph.models.extensions.DriveItemcopyFolder(String parentId, String name, String folderId) Copy folder.com.microsoft.graph.models.extensions.DriveItemcreateFolder(String parentId, String name, Calendar created) Creates the folder.com.microsoft.graph.models.extensions.SharingLinkcreateLink(String itemId, String type) Creates a public link to view a file content.org.exoplatform.services.cms.clouddrives.onedrive.DeltaDriveFilesGets all the drive items.getBusinessPreviewLink(String itemId) Gets short-lived embeddable URLs for an item (currently only for OneDrive business account by documentation).org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.ChildIteratorgetChildIterator(String folderId) Gets the child iterator.com.microsoft.graph.models.extensions.DrivegetDrive()Gets the current user drive.com.microsoft.graph.requests.extensions.IDriveItemCollectionPagegetDriveItemCollectionPage(String folderId) Gets a list of children of the folder, with pagination.List<com.microsoft.graph.models.extensions.DriveItem>Deprecated.getInsertUploadUrl(String parentId, String name, String conflictBehavior) Gets url on which uploading should be done.com.microsoft.graph.models.extensions.DriveItemGets the item.Deprecated.Gets the root id.org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.SimpleChildIteratorgetSimpleChildIterator(Collection<org.exoplatform.services.cms.clouddrives.onedrive.HashSetCompatibleDriveItem> items) Gets the simple child iterator.org.exoplatform.services.cms.clouddrives.onedrive.OneDriveStoredTokenGets the stored token.com.microsoft.graph.models.extensions.SubscriptionSubscribes to receive drive changes using web socket.com.microsoft.graph.models.extensions.UsergetUser()Gets the user.Gets the user id.com.microsoft.graph.models.extensions.DriveIteminsert(String parentId, String fileName, Calendar created, Calendar modified, InputStream inputStream, String conflictBehavior) Insert.voidremoveFile(String fileId) Removes the file.voidremoveFolder(String fileId) Removes the folder.com.microsoft.graph.models.extensions.DriveItemupdateFile(com.microsoft.graph.models.extensions.DriveItem driveItem) Update file.com.microsoft.graph.models.extensions.DriveItemupdateFileContent(String itemId, Calendar created, Calendar modified, InputStream inputStream) Update file content.voidupdateToken(org.exoplatform.services.cms.clouddrives.onedrive.OneDriveStoredToken newToken) Update token.
-
Field Details
-
SCOPES
The Constant SCOPES.
-
-
Method Details
-
createLink
public com.microsoft.graph.models.extensions.SharingLink createLink(String itemId, String type) throws OneDriveException Creates a public link to view a file content. Currently at 23/08/2019, the business account does not support the 'embed' link type (24.06.2020 the same). We use short lived embeddable links for business accounts- Parameters:
itemId- the item idtype- must be view or embed- Returns:
- the sharing link
- Throws:
OneDriveException- the one drive exception
-
updateToken
public void updateToken(org.exoplatform.services.cms.clouddrives.onedrive.OneDriveStoredToken newToken) throws org.exoplatform.services.cms.clouddrives.CloudDriveException Update token.- Parameters:
newToken- the new token- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
removeFolder
Removes the folder.- Parameters:
fileId- the file id
-
removeFile
Removes the file.- Parameters:
fileId- the file id
-
getUser
public com.microsoft.graph.models.extensions.User getUser()Gets the user.- Returns:
- the user
-
getRootId
Gets the root id.- Returns:
- id of the root folder on the user's drive.
-
getUserId
Gets the user id.- Returns:
- the user id
-
createFolder
public com.microsoft.graph.models.extensions.DriveItem createFolder(String parentId, String name, Calendar created) Creates the folder.- Parameters:
parentId- the parent idname- the namecreated- the created- Returns:
- the drive item
-
copyFile
public com.microsoft.graph.models.extensions.DriveItem copyFile(String parentId, String fileName, String fileId) throws IOException, org.exoplatform.services.cms.clouddrives.CloudDriveException Copy file.- Parameters:
parentId- the parent idfileName- the file namefileId- the file id- Returns:
- the drive item
- Throws:
IOException- Signals that an I/O exception has occurred.org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
copyFolder
public com.microsoft.graph.models.extensions.DriveItem copyFolder(String parentId, String name, String folderId) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, IOException Copy folder.- Parameters:
parentId- the parent idname- the namefolderId- the folder id- Returns:
- the drive item
- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exceptionIOException- Signals that an I/O exception has occurred.
-
getStoredToken
public org.exoplatform.services.cms.clouddrives.onedrive.OneDriveStoredToken getStoredToken()Gets the stored token.- Returns:
- the stored token
-
getNotificationUrl
Deprecated.Gets the notification url.- Returns:
- the notification url
-
getSubscription
public com.microsoft.graph.models.extensions.Subscription getSubscription()Subscribes to receive drive changes using web socket.- Returns:
- the subscription
-
copy
public com.microsoft.graph.models.extensions.DriveItem copy(String parentId, String fileName, String fileId, boolean isFile) throws org.exoplatform.services.cms.clouddrives.RefreshAccessException, OneDriveException Copy.- Parameters:
parentId- the parent idfileName- the file namefileId- the file idisFile- the is file- Returns:
- the drive item
- Throws:
org.exoplatform.services.cms.clouddrives.RefreshAccessException- the refresh access exceptionOneDriveException- the one drive exception
-
getDriveItemCollectionPage
public com.microsoft.graph.requests.extensions.IDriveItemCollectionPage getDriveItemCollectionPage(String folderId) Gets a list of children of the folder, with pagination.- Parameters:
folderId- the folder id- Returns:
- the drive item collection page
-
getFiles
Deprecated.Gets the files.- Parameters:
folderId- the folder id- Returns:
- the files
-
changes
public org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.ChangesIterator changes(String deltaToken) Changes.- Parameters:
deltaToken- starting from which to get changes.- Returns:
OneDriveAPI.ChangesIterator
-
getInsertUploadUrl
public String getInsertUploadUrl(String parentId, String name, String conflictBehavior) throws org.exoplatform.services.cms.clouddrives.RefreshAccessException, OneDriveException Gets url on which uploading should be done.- Parameters:
parentId- where should the new file be added.name- the nameconflictBehavior- determines the behavior if a file with the name is already present. must be 'fail' or 'rename';- Returns:
- url to upload the file. see the
insertUpdate(String, InputStream) - Throws:
org.exoplatform.services.cms.clouddrives.RefreshAccessException- the refresh access exceptionOneDriveException- the one drive exception
-
insert
public com.microsoft.graph.models.extensions.DriveItem insert(String parentId, String fileName, Calendar created, Calendar modified, InputStream inputStream, String conflictBehavior) throws OneDriveException Insert.- Parameters:
parentId- the parent idfileName- the file namecreated- the createdmodified- the modifiedinputStream- the input streamconflictBehavior- the conflict behavior- Returns:
- the drive item
- Throws:
OneDriveException- the one drive exception
-
updateFileContent
public com.microsoft.graph.models.extensions.DriveItem updateFileContent(String itemId, Calendar created, Calendar modified, InputStream inputStream) throws OneDriveException Update file content.- Parameters:
itemId- the item idcreated- the createdmodified- the modifiedinputStream- the input stream- Returns:
- the drive item
- Throws:
OneDriveException- the one drive exception
-
getAllFiles
public org.exoplatform.services.cms.clouddrives.onedrive.DeltaDriveFiles getAllFiles()Gets all the drive items.- Returns:
DeltaDriveFiles
-
updateFile
public com.microsoft.graph.models.extensions.DriveItem updateFile(com.microsoft.graph.models.extensions.DriveItem driveItem) Update file.- Parameters:
driveItem- the drive item- Returns:
- the drive item
-
getItem
Gets the item.- Parameters:
itemId- the item id- Returns:
- the item
-
getDrive
public com.microsoft.graph.models.extensions.Drive getDrive()Gets the current user drive.- Returns:
Drivethe drive
-
getBusinessPreviewLink
Gets short-lived embeddable URLs for an item (currently only for OneDrive business account by documentation).- Parameters:
itemId- the item id- Returns:
- the preview link
-
getSimpleChildIterator
public org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.SimpleChildIterator getSimpleChildIterator(Collection<org.exoplatform.services.cms.clouddrives.onedrive.HashSetCompatibleDriveItem> items) throws org.exoplatform.services.cms.clouddrives.CloudDriveException Gets the simple child iterator.- Parameters:
items- the items- Returns:
- the simple child iterator
- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
getChildIterator
public org.exoplatform.services.cms.clouddrives.onedrive.OneDriveAPI.ChildIterator getChildIterator(String folderId) Gets the child iterator.- Parameters:
folderId- the folder id- Returns:
- the child iterator
-