001package com.box.sdk.sharedlink;
002
003import com.box.sdk.BoxSharedLink;
004
005/**
006 * Represents request to create shared link with permissions.
007 */
008public class BoxSharedLinkRequest extends AbstractSharedLinkRequest<BoxSharedLinkRequest> {
009
010    /**
011     * Sets the permissions associated with this shared link.
012     *
013     * @param canDownload whether the shared link can be downloaded.
014     * @param canPreview  whether the shared link can be previewed.
015     * @param canEdit whether the file shared with the link can be edited.
016     * @return this request.
017     */
018    public BoxSharedLinkRequest permissions(boolean canDownload, boolean canPreview, boolean canEdit) {
019        BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions();
020        permissions.setCanDownload(canDownload);
021        permissions.setCanPreview(canPreview);
022        permissions.setCanEdit(canEdit);
023        getLink().setPermissions(permissions);
024        return this;
025    }
026
027    /**
028     * Sets the permissions associated with this shared link.
029     *
030     * @param canDownload whether the shared link can be downloaded.
031     * @param canPreview  whether the shared link can be previewed.
032     * @return this request.
033     */
034    public BoxSharedLinkRequest permissions(boolean canDownload, boolean canPreview) {
035        return this.permissions(canDownload, canPreview, false);
036    }
037
038}