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