@BoxResourceType(value="web_link") public class BoxWebLink extends BoxItem
Unless otherwise noted, the methods in this class can throw an unchecked BoxAPIException
(unchecked
meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error
handling for errors related to the Box REST API, you should capture this exception explicitly.
Modifier and Type | Class and Description |
---|---|
class |
BoxWebLink.Info
Contains information about a BoxWebLink.
|
Modifier and Type | Field and Description |
---|---|
static String[] |
ALL_FIELDS
An array of all possible weblink fields that can be requested when calling
getInfo(String...) . |
static URLTemplate |
COPY_URL_TEMPLATE
Copy URL Template.
|
static URLTemplate |
WEB_LINK_URL_TEMPLATE
Web Link URL Template.
|
SHARED_ITEM_URL_TEMPLATE, WATERMARK_URL_TEMPLATE
Constructor and Description |
---|
BoxWebLink(BoxAPIConnection api,
String id)
Constructs a BoxWebLink for a weblink with a given ID.
|
Modifier and Type | Method and Description |
---|---|
BoxWebLink.Info |
copy(BoxFolder destination)
Copies this item to another folder.
|
BoxWebLink.Info |
copy(BoxFolder destination,
String newName)
Copies this item to another folder and gives it a new name.
|
BoxSharedLink |
createSharedLink(BoxSharedLinkWithoutPermissionsRequest sharedLinkRequest)
Creates a shared link.
|
void |
delete()
Deletes this weblink by moving it to the trash.
|
BoxWebLink.Info |
getInfo(String... fields)
Gets information about this item that's limited to a list of specified fields.
|
BoxItem.Info |
move(BoxFolder destination)
Moves this item to another folder.
|
BoxItem.Info |
move(BoxFolder destination,
String newName)
Moves this item to another folder and gives it a new name.
|
void |
rename(String newName)
Renames this weblink.
|
BoxWebLink.Info |
setCollections(BoxCollection... collections)
Sets the collections that this item belongs to.
|
void |
updateInfo(BoxWebLink.Info info)
Updates the information about this weblink with any info fields that have been modified locally.
|
applyWatermark, getItemURL, getSharedItem, getSharedItem, getWatermark, removeWatermark
equals, getAPI, getID, getResourceType, hashCode
public static final String[] ALL_FIELDS
getInfo(String...)
.public static final URLTemplate COPY_URL_TEMPLATE
public static final URLTemplate WEB_LINK_URL_TEMPLATE
public BoxWebLink(BoxAPIConnection api, String id)
api
- the API connection to be used by the weblink.id
- the ID of the weblink.public BoxSharedLink createSharedLink(BoxSharedLinkWithoutPermissionsRequest sharedLinkRequest)
sharedLinkRequest
- Shared link to createpublic BoxWebLink.Info copy(BoxFolder destination)
BoxItem
public BoxWebLink.Info copy(BoxFolder destination, String newName)
BoxItem
public void delete()
public BoxItem.Info move(BoxFolder destination)
BoxItem
public BoxItem.Info move(BoxFolder destination, String newName)
BoxItem
public void rename(String newName)
newName
- the new name of the weblink.public BoxWebLink.Info getInfo(String... fields)
BoxItem
public void updateInfo(BoxWebLink.Info info)
The only fields that will be updated are the ones that have been modified locally. For example, the following code won't update any information (or even send a network request) since none of the info's fields were changed:
BoxWebLink webLink = new BoxWebLink(api, id); BoxWebLink.Info info = webLink.getInfo(); webLink.updateInfo(info);
info
- the updated info.public BoxWebLink.Info setCollections(BoxCollection... collections)
BoxItem
setCollections
in class BoxItem
collections
- the collections that this item should belong to.