Skip to content

Commit e23dc43

Browse files
committed
feat: add support for bookmarks
1 parent 6684e04 commit e23dc43

File tree

4 files changed

+433
-74
lines changed

4 files changed

+433
-74
lines changed

doc/files.md

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
Files
2-
=====
1+
# Files
32

43
File objects represent individual files in Box. They can be used to download a
54
file's contents, upload new versions, and perform other common file operations
65
(move, copy, delete, etc.).
76

8-
* [Get a File's Information](#get-a-files-information)
9-
* [Update a File's Information](#update-a-files-information)
10-
* [Upload a File](#upload-a-file)
11-
* [Copy a File](#copy-a-file)
12-
* [Delete a File](#delete-a-file)
13-
* [Get Previous Versions of a File](#get-previous-versions-of-a-file)
14-
* [Promote a Previous Version of a File](#promote-a-previous-version-of-a-file)
15-
* [Delete a Previous Version of a File](#delete-a-previous-version-of-a-file)
7+
- [Get a File's Information](#get-a-files-information)
8+
- [Update a File's Information](#update-a-files-information)
9+
- [Upload a File](#upload-a-file)
10+
- [Copy a File](#copy-a-file)
11+
- [Delete a File](#delete-a-file)
12+
- [Get Previous Versions of a File](#get-previous-versions-of-a-file)
13+
- [Promote a Previous Version of a File](#promote-a-previous-version-of-a-file)
14+
- [Delete a Previous Version of a File](#delete-a-previous-version-of-a-file)
1615

17-
Get a File's Information
18-
------------------------
16+
## Get a File's Information
1917

2018
Calling `getFileInfo()` on a file returns a snapshot of the file's info.
2119

@@ -24,24 +22,22 @@ BoxFile file = new BoxFile(api, 'file-id');
2422
BoxFile.Info info = file.getFileInfo();
2523
```
2624

27-
Update a File's Information
28-
---------------------------
25+
## Update a File's Information
2926

3027
Updating a file's information is done by creating a new `BoxFile.Info`
3128
object or updating an existing one, and then calling `updateFileInfo(BoxFile.Info)`.
3229

3330
```java
3431
BoxFile file = new BoxFile(api, 'file-id');
35-
BoxFile.Info info = new BoxFile.Info();
32+
BoxFile.Info info = file.getFileInfo();
3633
info.addValue('name', 'New_File_Name.jpg');
3734
BoxFile.Info newFileInfo = file.updateFileInfo(info);
3835
```
3936

40-
Upload a File
41-
-------------
37+
## Upload a File
4238

4339
Files are uploaded to a folder by calling either the `uploadFile(Attachment, String)`
44-
or `uploadFile(Document, String)` method. If the `newName` String parameter is blank,
40+
or `uploadFile(Document, String)` method. If the `newName` String parameter is blank,
4541
the name of the Attachment or Document is used.
4642

4743
```java
@@ -54,8 +50,7 @@ Upload progress can be tracked by providing the size of the file and a
5450
[`uploadFile(InputStream, String, long, ProgressListener)`][upload2]. The
5551
`ProgressListener` will then receive progress updates as the upload completes.
5652

57-
Copy a File
58-
-----------
53+
## Copy a File
5954

6055
A file can be copied to a new folder and optionally be renamed with the
6156
`copy(BoxFolder)` and `copy(BoxFolder, String)` methods.
@@ -66,8 +61,7 @@ BoxFile file = new BoxFile(api, 'file-id');
6661
BoxFile.Info copiedFileInfo = file.copy(rootFolder, 'New Name');
6762
```
6863

69-
Delete a File
70-
-------------
64+
## Delete a File
7165

7266
Calling the `deleteFile()` method will move the file to the user's trash.
7367

@@ -76,8 +70,7 @@ BoxFile file = new BoxFile(api, 'file-id');
7670
file.deleteFile();
7771
```
7872

79-
Get a trashed File
80-
------------------
73+
## Get a trashed File
8174

8275
Calling the `getTrashedFile()` method will retrieve a trashed file to the user including
8376
information about when the file was moved to the trash.
@@ -87,8 +80,7 @@ BoxFile file = new BoxFile(api, 'file-id');
8780
file.getTrashedFile();
8881
```
8982

90-
Get Previous Versions of a File
91-
-------------------------------
83+
## Get Previous Versions of a File
9284

9385
For users with premium accounts, versions of a file can be retrieved with the
9486
`getVersions()` method.
@@ -98,11 +90,10 @@ BoxFile file = new BoxFile(api, 'file-id');
9890
list<BoxFileVersion.Info> versions = file.getVersions();
9991
```
10092

101-
Promote a Previous Version of a File
102-
------------------------------------
93+
## Promote a Previous Version of a File
10394

10495
A previous version of a file can be promoted with the `promoteFileVersion()`
105-
method to become the current version of the file. Since the `file_version` object returned
96+
method to become the current version of the file. Since the `file_version` object returned
10697
from the Box API doesn't include the File Id, you must set it manually before promoting a
10798
file version.
10899

@@ -114,8 +105,7 @@ firstVersion.setFileId('file-id');
114105
firstVersion.promoteFileVersion();
115106
```
116107

117-
Delete a Previous Version of a File
118-
-----------------------------------
108+
## Delete a Previous Version of a File
119109

120110
A version of a file can be deleted and moved to the trash by calling
121111
`deleteFileVersion()`. Since the `file_version` object returned

doc/folders.md

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
Folders
2-
=======
1+
# Folders
32

43
Folder objects represent a folder from a user's account. They can be used to
54
iterate through a folder's contents, collaborate a folder with another user or
65
group, and perform other common folder operations (move, copy, delete, etc.).
76

8-
* [Get the User's Root Folder](#get-the-users-root-folder)
9-
* [Get a Folder's Items](#get-a-folders-items)
10-
* [Get a Folder's Information](#get-a-folders-information)
11-
* [Update a Folder's Information](#update-a-folders-information)
12-
* [Create a Folder](#create-a-folder)
13-
* [Copy a Folder](#copy-a-folder)
14-
* [Move a Folder](#move-a-folder)
15-
* [Rename a Folder](#rename-a-folder)
16-
* [Delete a Folder](#delete-a-folder)
17-
* [Created a Shared Link for a Folder](#created-a-shared-link-for-a-folder)
18-
* [Share a Folder](#share-a-folder)
19-
* [Get All Collaborations for a Folder](#get-all-collaborations-for-a-folder)
20-
21-
Get the User's Root Folder
22-
--------------------------
7+
- [Get the User's Root Folder](#get-the-users-root-folder)
8+
- [Get a Folder's Items](#get-a-folders-items)
9+
- [Get a Folder's Information](#get-a-folders-information)
10+
- [Update a Folder's Information](#update-a-folders-information)
11+
- [Create a Folder](#create-a-folder)
12+
- [Copy a Folder](#copy-a-folder)
13+
- [Move a Folder](#move-a-folder)
14+
- [Rename a Folder](#rename-a-folder)
15+
- [Delete a Folder](#delete-a-folder)
16+
- [Created a Shared Link for a Folder](#created-a-shared-link-for-a-folder)
17+
- [Share a Folder](#share-a-folder)
18+
- [Get All Collaborations for a Folder](#get-all-collaborations-for-a-folder)
19+
20+
## Get the User's Root Folder
2321

2422
The user's root folder can be accessed with the static
2523
`getRootFolder(BoxAPIConnection)` method.
@@ -28,12 +26,11 @@ The user's root folder can be accessed with the static
2826
BoxFolder rootFolder = BoxFolder.getRootFolder(api);
2927
```
3028

31-
Get a Folder's Items
32-
--------------------
29+
## Get a Folder's Items
3330

34-
A call to `getChildren()` will return the contents of a `BoxFolder`. Optionally, an offset and limit
31+
A call to `getChildren()` will return the contents of a `BoxFolder`. Optionally, an offset and limit
3532
can be set to iterate over a large folder. Large folder operations will likely
36-
fail due to governor limits on callouts or heap size. This method could be detrimental depending
33+
fail due to governor limits on callouts or heap size. This method could be detrimental depending
3734
on your use case.
3835

3936
```java
@@ -48,8 +45,7 @@ for (BoxItem.Info itemInfo : children) {
4845
}
4946
```
5047

51-
Get a Folder's Information
52-
--------------------------
48+
## Get a Folder's Information
5349

5450
Calling `getFolderInfo()` on a folder returns a snapshot of the folder's
5551
info.
@@ -59,22 +55,20 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
5955
BoxFolder.Info info = folder.getFolderInfo();
6056
```
6157

62-
Update a Folder's Information
63-
-----------------------------
58+
## Update a Folder's Information
6459

6560
Updating a folder's information is done by creating a new `BoxFolder.Info`
6661
object or updating an existing one, and then calling
6762
`updateFolderInfo(BoxFolder.Info)`.
6863

6964
```java
7065
BoxFolder folder = new BoxFolder(api, 'folder-id');
71-
BoxFolder.Info info = folder.new Info();
66+
BoxFolder.Info info = folder.getFolderInfo();
7267
info.addValue('description', 'Some folder I made');
7368
folder.updateFolderInfo(info);
7469
```
7570

76-
Create a Folder
77-
---------------
71+
## Create a Folder
7872

7973
Create a child folder by calling `createFolder(String)` on the
8074
parent folder.
@@ -84,8 +78,7 @@ BoxFolder parentFolder = new BoxFolder(api, 'parent-folder-id');
8478
BoxFolder.Info childFolderInfo = parentFolder.createFolder('Child Folder Name');
8579
```
8680

87-
Copy a Folder
88-
-------------
81+
## Copy a Folder
8982

9083
Call the `copy(BoxFolder)` method to copy a folder to another folder.
9184

@@ -105,8 +98,7 @@ BoxFolder destination = new BoxFolder(api, 'destination-folder-id');
10598
folder.copy(destination, 'New Folder Name');
10699
```
107100

108-
Move a Folder
109-
-------------
101+
## Move a Folder
110102

111103
Call the `move(BoxFolder)` method with the destination you want the folder moved
112104
to.
@@ -119,8 +111,7 @@ folder.move(destination);
119111

120112
Similar to the `copy` method, the folder can be renamed by calling `move(BoxFolder, String)`.
121113

122-
Rename a Folder
123-
---------------
114+
## Rename a Folder
124115

125116
Call the `rename(String)` method with a new name for the folder.
126117

@@ -141,8 +132,7 @@ info.addValue('name', 'New Folder Name');
141132
folder.updateFolderInfo(info);
142133
```
143134

144-
Delete a Folder
145-
---------------
135+
## Delete a Folder
146136

147137
A folder can be deleted with the `deleteFolder(boolean)` method. Passing
148138
true to this method indicates that the folder and its contents should be
@@ -153,8 +143,7 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
153143
folder.deleteFolder(true);
154144
```
155145

156-
Created a Shared Link for a Folder
157-
----------------------------------
146+
## Created a Shared Link for a Folder
158147

159148
You can get a shared link for a folder by calling the
160149
`createSharedLink(BoxSharedLink.Access, DateTime, BoxSharedLink.Permissions)` method.
@@ -165,12 +154,11 @@ BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions();
165154
BoxSharedLink.Info linkInfo = folder.createSharedLink(BoxSharedLink.Access.OPEN, null, permissions);
166155
```
167156

168-
Share a Folder
169-
--------------
157+
## Share a Folder
170158

171159
You can invite another person to collaborate on a folder with the
172160
[collaborate(String, BoxCollaboration.Role)` method. The Box user with the email address
173-
specified will receive a collaboration request. If the email is not associated with a Box
161+
specified will receive a collaboration request. If the email is not associated with a Box
174162
account, an invitation to create a Box account will be sent.
175163

176164
```java
@@ -188,8 +176,7 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
188176
BoxCollaboration.Info collabInfo = folder.collaborate(collaborator, BoxCollaboration.Role.EDITOR);
189177
```
190178

191-
Get All Collaborations for a Folder
192-
-----------------------------------
179+
## Get All Collaborations for a Folder
193180

194181
The `getCollaborations()` method will return a list
195182
of `BoxCollaboration.Info` objects for a folder.

doc/web-links.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Web Links
2+
3+
Web link objects represent a web link (bookmark) from a user's account. They can perform common web link operations, like create, read, update, and delete.
4+
5+
## Get a Web Link's Information
6+
7+
Calling `getWebLinkInfo()` on a web link returns a snapshot of the web link's info.
8+
9+
```java
10+
BoxWebLink webLink = new BoxWebLink(api, 'web-link-id');
11+
BoxWebLink.Info info = webLink.getWebLinkInfo();
12+
```
13+
14+
## Update a Web Link's Information
15+
16+
Updating a web link's information is done by creating a new `BoxWebLink.Info` object or updating an existing one, and then calling `updateWebLinkInfo(BoxWebLink.Info)`.
17+
18+
```java
19+
BoxWebLink webLink = new BoxWebLink(api, '12303730068');
20+
BoxWebLink.Info info = webLink.getWebLinkInfo();
21+
info.addValue('description', 'Some web link I made');
22+
BoxWebLink.Info updated = webLink.updateWebLinkInfo(info);
23+
```
24+
25+
## Delete a Web Link
26+
27+
A web link can be deleted with the `deleteWebLink()` method.
28+
29+
```java
30+
BoxWebLink webLink = new BoxWebLink(api, 'web-link-id');
31+
webLink.deleteWebLink();
32+
```

0 commit comments

Comments
 (0)