diff --git a/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs b/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs index 5ed28f37b..bc9f3fa53 100644 --- a/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs +++ b/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs @@ -266,6 +266,30 @@ public async Task ViewVersions_ShouldReturnCorrectVersionNumber_WhenFileVersionI Assert.AreEqual("2", response.Entries[0].VersionNumber); } + [TestMethod] + public async Task AddSharedLink_ForValidNewFile_ShouldCreateNewSharedLink() + { + var file = await CreateSmallFile(); + + var sharedLinkRequest = new BoxSharedLinkRequest() + { + VanityName = GetShortUniqueName("SharedLink"), + Access = BoxSharedLinkAccessType.open, + Permissions = new BoxPermissionsRequest + { + Download = true, + Edit = true, + } + }; + + var response = await UserClient.FilesManager.CreateSharedLinkAsync(file.Id, sharedLinkRequest); + + Assert.AreEqual(file.Id, response.Id); + Assert.AreEqual(BoxSharedLinkAccessType.open, response.SharedLink.Access); + Assert.IsTrue(response.SharedLink.Permissions.CanDownload); + Assert.IsTrue(response.SharedLink.Permissions.CanEdit); + } + private int GetNumberOfParts(long totalSize, long partSize) { if (partSize == 0) diff --git a/Box.V2.Test.Integration/BoxWebLinkManagerIntegrationTest.cs b/Box.V2.Test.Integration/BoxWebLinkManagerIntegrationTest.cs index 80c4c8e19..323790faa 100644 --- a/Box.V2.Test.Integration/BoxWebLinkManagerIntegrationTest.cs +++ b/Box.V2.Test.Integration/BoxWebLinkManagerIntegrationTest.cs @@ -62,5 +62,21 @@ public async Task DeleteWebLinkAsync_ForExistingWebLink_ShouldDeleteWebLinkAndEx await Assert.ThrowsExceptionAsync(async () => { _ = await UserClient.WebLinksManager.GetWebLinkAsync(weblink.Id); }); } + + [TestMethod] + public async Task AddSharedLink_ForNewWeblink_ShouldCreateNewSharedLink() + { + var webLink = await CreateWebLink(GetUniqueName("weblink"), FolderId); + + var sharedLinkReq = new BoxSharedLinkRequest() + { + Access = BoxSharedLinkAccessType.open + }; + + var response = await UserClient.WebLinksManager.CreateSharedLinkAsync(webLink.Id, sharedLinkReq); + + Assert.AreEqual(webLink.Id, response.Id); + Assert.AreEqual(BoxSharedLinkAccessType.open, response.SharedLink.Access); + } } } diff --git a/Box.V2.Test.Integration/Configuration/IntegrationTestBase.cs b/Box.V2.Test.Integration/Configuration/IntegrationTestBase.cs index a5fa0d762..1c7847ff8 100644 --- a/Box.V2.Test.Integration/Configuration/IntegrationTestBase.cs +++ b/Box.V2.Test.Integration/Configuration/IntegrationTestBase.cs @@ -149,6 +149,11 @@ protected static string GetUniqueName(string resourceName, bool includeSpecialCh return uniqueName; } + protected static string GetShortUniqueName(string resourceName) + { + return GetUniqueName(resourceName, false).Substring(0, 20); + } + public static async Task ExecuteCommand(ICleanupCommand command) { IBoxClient client = GetClient(command); diff --git a/Box.V2.Test/Box.V2.Test.csproj b/Box.V2.Test/Box.V2.Test.csproj index a873a5117..2796b7359 100644 --- a/Box.V2.Test/Box.V2.Test.csproj +++ b/Box.V2.Test/Box.V2.Test.csproj @@ -47,12 +47,18 @@ PreserveNewest + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest @@ -74,6 +80,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Box.V2.Test/BoxFilesManagerTest.cs b/Box.V2.Test/BoxFilesManagerTest.cs index 4caf1d070..d87fca3b2 100644 --- a/Box.V2.Test/BoxFilesManagerTest.cs +++ b/Box.V2.Test/BoxFilesManagerTest.cs @@ -412,12 +412,11 @@ public async Task CopyFile_ValidResponse_ValidFile() public async Task CreateFileSharedLink_ValidResponse_ValidFile() { /*** Arrange ***/ - var responseString = "{ \"type\": \"file\", \"id\": \"5000948880\", \"sequence_id\": \"3\", \"etag\": \"3\", \"sha1\": \"134b65991ed521fcfe4724b7d814ab8ded5185dc\", \"name\": \"tigers.jpeg\", \"description\": \"a picture of tigers\", \"size\": 629644, \"path_collection\": { \"total_count\": 2, \"entries\": [ { \"type\": \"folder\", \"id\": \"0\", \"sequence_id\": null, \"etag\": null, \"name\": \"All Files\" }, { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" } ] }, \"created_at\": \"2012-12-12T10:55:30-08:00\", \"modified_at\": \"2012-12-12T11:04:26-08:00\", \"created_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"modified_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"owned_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"shared_link\": { \"url\": \"https://www.box.com/s/rh935iit6ewrmw0unyul\", \"download_url\": \"https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg\", \"vanity_url\": null, \"vanity_name\": \"my-custom-vanity-name\", \"is_password_enabled\": false, \"unshared_at\": null, \"download_count\": 0, \"preview_count\": 0, \"access\": \"open\", \"permissions\": { \"can_download\": true, \"can_preview\": true } }, \"parent\": { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" }, \"item_status\": \"active\" }"; Handler.Setup(h => h.ExecuteAsync(It.IsAny())) .Returns(Task.FromResult>(new BoxResponse() { Status = ResponseStatus.Success, - ContentString = responseString + ContentString = LoadFixtureFromJson("Fixtures/BoxFiles/CreateFileSharedLink200.json") })); var sharedLink = new BoxSharedLinkRequest() @@ -440,6 +439,7 @@ public async Task CreateFileSharedLink_ValidResponse_ValidFile() Assert.AreEqual("user", f.CreatedBy.Type); Assert.AreEqual("17738362", f.CreatedBy.Id); Assert.AreEqual("my-custom-vanity-name", f.SharedLink.VanityName); + Assert.AreEqual(true, f.SharedLink.Permissions.CanEdit); } [TestMethod] diff --git a/Box.V2.Test/BoxFoldersManagerTest.cs b/Box.V2.Test/BoxFoldersManagerTest.cs index 430ce15c5..b373acc79 100644 --- a/Box.V2.Test/BoxFoldersManagerTest.cs +++ b/Box.V2.Test/BoxFoldersManagerTest.cs @@ -586,7 +586,7 @@ public async Task CreateFolderSharedLink_ValidResponse_ValidFolder() .Returns(() => Task.FromResult>(new BoxResponse() { Status = ResponseStatus.Success, - ContentString = "{ \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\", \"created_at\": \"2012-12-12T10:53:43-08:00\", \"modified_at\": \"2012-12-12T11:15:04-08:00\", \"description\": \"Some pictures I took\", \"size\": 629644, \"path_collection\": { \"total_count\": 1, \"entries\": [ { \"type\": \"folder\", \"id\": \"0\", \"sequence_id\": null, \"etag\": null, \"name\": \"All Files\" } ] }, \"created_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"modified_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"owned_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"shared_link\": { \"url\": \"https://www.box.com/s/vspke7y05sb214wjokpk\", \"download_url\": \"https://www.box.com/shared/static/vspke7y05sb214wjokpk\", \"vanity_url\": null, \"vanity_name\": \"my-custom-vanity-name\", \"is_password_enabled\": false, \"unshared_at\": null, \"download_count\": 0, \"preview_count\": 0, \"access\": \"open\", \"permissions\": { \"can_download\": true, \"can_preview\": true } }, \"folder_upload_email\": { \"access\": \"open\", \"email\": \"upload.Picture.k13sdz1@u.box.com\" }, \"parent\": { \"type\": \"folder\", \"id\": \"0\", \"sequence_id\": null, \"etag\": null, \"name\": \"All Files\" }, \"item_status\": \"active\", \"item_collection\": { \"total_count\": 1, \"entries\": [ { \"type\": \"file\", \"id\": \"5000948880\", \"sequence_id\": \"3\", \"etag\": \"3\", \"sha1\": \"134b65991ed521fcfe4724b7d814ab8ded5185dc\", \"name\": \"tigers.jpeg\" } ], \"offset\": 0, \"limit\": 100 } }" + ContentString = LoadFixtureFromJson("Fixtures/BoxFolders/CreateFolderSharedLink200.json") })); /*** Act ***/ @@ -605,6 +605,34 @@ public async Task CreateFolderSharedLink_ValidResponse_ValidFolder() Assert.AreEqual("1", f.ETag); Assert.AreEqual("Pictures", f.Name); Assert.AreEqual("my-custom-vanity-name", f.SharedLink.VanityName); + Assert.AreEqual(false, f.SharedLink.Permissions.CanEdit); + } + + [TestMethod] + public async Task CreateFolderSharedLink_ShouldThrowArgumentException_WhenEditIsTrue() + { + /*** Arrange ***/ + IBoxRequest boxRequest = null; + Handler.Setup(h => h.ExecuteAsync(It.IsAny())) + .Returns(() => Task.FromResult>(new BoxResponse() + { + Status = ResponseStatus.Success, + ContentString = LoadFixtureFromJson("Fixtures/BoxFolders/CreateFolderSharedLink200.json") + })) + .Callback(r => boxRequest = r); + + var sharedLink = new BoxSharedLinkRequest() + { + Access = BoxSharedLinkAccessType.collaborators, + VanityName = "my-custom-vanity-name", + Permissions = new BoxPermissionsRequest + { + Edit = true + } + }; + + /*** Act && Assert ***/ + await Assert.ThrowsExceptionAsync(async () => { _ = await _foldersManager.CreateSharedLinkAsync("12345", sharedLink); }); } [TestMethod] diff --git a/Box.V2.Test/BoxWebLinksManagerTest.cs b/Box.V2.Test/BoxWebLinksManagerTest.cs index b23962959..d234a4130 100644 --- a/Box.V2.Test/BoxWebLinksManagerTest.cs +++ b/Box.V2.Test/BoxWebLinksManagerTest.cs @@ -457,7 +457,6 @@ public async Task Copy_ValidResponse() public async Task CreateWebLinkSharedLink_ValidResponse_ValidFile() { /*** Arrange ***/ - var responseString = "{ \"type\": \"web_link\", \"id\": \"5000948880\", \"sequence_id\": \"3\", \"etag\": \"3\", \"sha1\": \"134b65991ed521fcfe4724b7d814ab8ded5185dc\", \"name\": \"tigers.jpeg\", \"description\": \"a picture of tigers\", \"size\": 629644, \"path_collection\": { \"total_count\": 2, \"entries\": [ { \"type\": \"folder\", \"id\": \"0\", \"sequence_id\": null, \"etag\": null, \"name\": \"All Files\" }, { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" } ] }, \"created_at\": \"2012-12-12T10:55:30-08:00\", \"modified_at\": \"2012-12-12T11:04:26-08:00\", \"created_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"modified_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"owned_by\": { \"type\": \"user\", \"id\": \"17738362\", \"name\": \"sean rose\", \"login\": \"sean@box.com\" }, \"shared_link\": { \"url\": \"https://www.box.com/s/rh935iit6ewrmw0unyul\", \"vanity_name\": \"my-custom-vanity-name\", \"download_url\": \"https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg\", \"vanity_url\": null, \"is_password_enabled\": false, \"unshared_at\": null, \"download_count\": 0, \"preview_count\": 0, \"access\": \"open\", \"permissions\": { \"can_download\": true, \"can_preview\": true } }, \"parent\": { \"type\": \"folder\", \"id\": \"11446498\", \"sequence_id\": \"1\", \"etag\": \"1\", \"name\": \"Pictures\" }, \"item_status\": \"active\" }"; IBoxRequest boxRequest = null; var webLinksUri = new Uri(Constants.WebLinksEndpointString); Config.SetupGet(x => x.WebLinksEndpointUri).Returns(webLinksUri); @@ -465,14 +464,14 @@ public async Task CreateWebLinkSharedLink_ValidResponse_ValidFile() .Returns(Task.FromResult>(new BoxResponse() { Status = ResponseStatus.Success, - ContentString = responseString + ContentString = LoadFixtureFromJson("Fixtures/BoxWebLinks/CreateWebLinkSharedLink200.json") })) .Callback(r => boxRequest = r); var sharedLink = new BoxSharedLinkRequest() { Access = BoxSharedLinkAccessType.collaborators, - VanityName = "my-custom-vanity-name" + VanityName = "my-custom-vanity-name", }; /*** Act ***/ @@ -490,6 +489,33 @@ public async Task CreateWebLinkSharedLink_ValidResponse_ValidFile() Assert.AreEqual("my-custom-vanity-name", w.SharedLink.VanityName); } + [TestMethod] + public async Task CreateWebLinkSharedLink_ShouldThrowArgumentException_WhenEditIsTrue() + { + /*** Arrange ***/ + IBoxRequest boxRequest = null; + Handler.Setup(h => h.ExecuteAsync(It.IsAny())) + .Returns(Task.FromResult>(new BoxResponse() + { + Status = ResponseStatus.Success, + ContentString = LoadFixtureFromJson("Fixtures/BoxWebLinks/CreateWebLinkSharedLink200.json") + })) + .Callback(r => boxRequest = r); + + var sharedLink = new BoxSharedLinkRequest() + { + Access = BoxSharedLinkAccessType.collaborators, + VanityName = "my-custom-vanity-name", + Permissions = new BoxPermissionsRequest + { + Edit = true + } + }; + + /*** Act && Assert ***/ + await Assert.ThrowsExceptionAsync(async () => { _ = await _webLinkManager.CreateSharedLinkAsync("12345", sharedLink); }); + } + [TestMethod] public async Task DeleteWebLinkSharedLink_ValidResponse_ValidFile() { diff --git a/Box.V2.Test/Fixtures/BoxFiles/CreateFileSharedLink200.json b/Box.V2.Test/Fixtures/BoxFiles/CreateFileSharedLink200.json new file mode 100644 index 000000000..c70e3e9af --- /dev/null +++ b/Box.V2.Test/Fixtures/BoxFiles/CreateFileSharedLink200.json @@ -0,0 +1,73 @@ +{ + "type": "file", + "id": "5000948880", + "sequence_id": "3", + "etag": "3", + "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc", + "name": "tigers.jpeg", + "description": "a picture of tigers", + "size": 629644, + "path_collection": { + "total_count": 2, + "entries": [ + { + "type": "folder", + "id": "0", + "sequence_id": null, + "etag": null, + "name": "All Files" + }, + { + "type": "folder", + "id": "11446498", + "sequence_id": "1", + "etag": "1", + "name": "Pictures" + } + ] + }, + "created_at": "2012-12-12T10:55:30-08:00", + "modified_at": "2012-12-12T11:04:26-08:00", + "created_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "modified_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "owned_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "shared_link": { + "url": "https://www.box.com/s/rh935iit6ewrmw0unyul", + "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", + "vanity_url": null, + "vanity_name": "my-custom-vanity-name", + "is_password_enabled": false, + "unshared_at": null, + "download_count": 0, + "preview_count": 0, + "access": "open", + "permissions": { + "can_download": true, + "can_preview": true, + "can_edit": true + } + }, + "parent": { + "type": "folder", + "id": "11446498", + "sequence_id": "1", + "etag": "1", + "name": "Pictures" + }, + "item_status": "active" +} diff --git a/Box.V2.Test/Fixtures/BoxFolders/CreateFolderSharedLink200.json b/Box.V2.Test/Fixtures/BoxFolders/CreateFolderSharedLink200.json new file mode 100644 index 000000000..5258d9f1f --- /dev/null +++ b/Box.V2.Test/Fixtures/BoxFolders/CreateFolderSharedLink200.json @@ -0,0 +1,84 @@ +{ + "type": "folder", + "id": "11446498", + "sequence_id": "1", + "etag": "1", + "name": "Pictures", + "created_at": "2012-12-12T10:53:43-08:00", + "modified_at": "2012-12-12T11:15:04-08:00", + "description": "Some pictures I took", + "size": 629644, + "path_collection": { + "total_count": 1, + "entries": [ + { + "type": "folder", + "id": "0", + "sequence_id": null, + "etag": null, + "name": "All Files" + } + ] + }, + "created_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "modified_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "owned_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "shared_link": { + "url": "https://www.box.com/s/vspke7y05sb214wjokpk", + "download_url": "https://www.box.com/shared/static/vspke7y05sb214wjokpk", + "vanity_url": null, + "vanity_name": "my-custom-vanity-name", + "is_password_enabled": false, + "unshared_at": null, + "download_count": 0, + "preview_count": 0, + "access": "open", + "permissions": { + "can_download": true, + "can_preview": true, + "can_edit" : false + } + }, + "folder_upload_email": { + "access": "open", + "email": "upload.Picture.k13sdz1@u.box.com" + }, + "parent": { + "type": "folder", + "id": "0", + "sequence_id": null, + "etag": null, + "name": "All Files" + }, + "item_status": "active", + "item_collection": { + "total_count": 1, + "entries": [ + { + "type": "file", + "id": "5000948880", + "sequence_id": "3", + "etag": "3", + "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc", + "name": "tigers.jpeg" + } + ], + "offset": 0, + "limit": 100 + } +} diff --git a/Box.V2.Test/Fixtures/BoxWebLinks/CreateWebLinkSharedLink200.json b/Box.V2.Test/Fixtures/BoxWebLinks/CreateWebLinkSharedLink200.json new file mode 100644 index 000000000..3f13217b9 --- /dev/null +++ b/Box.V2.Test/Fixtures/BoxWebLinks/CreateWebLinkSharedLink200.json @@ -0,0 +1,73 @@ +{ + "type": "web_link", + "id": "5000948880", + "sequence_id": "3", + "etag": "3", + "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc", + "name": "tigers.jpeg", + "description": "a picture of tigers", + "size": 629644, + "path_collection": { + "total_count": 2, + "entries": [ + { + "type": "folder", + "id": "0", + "sequence_id": null, + "etag": null, + "name": "All Files" + }, + { + "type": "folder", + "id": "11446498", + "sequence_id": "1", + "etag": "1", + "name": "Pictures" + } + ] + }, + "created_at": "2012-12-12T10:55:30-08:00", + "modified_at": "2012-12-12T11:04:26-08:00", + "created_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "modified_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "owned_by": { + "type": "user", + "id": "17738362", + "name": "sean rose", + "login": "sean@box.com" + }, + "shared_link": { + "url": "https://www.box.com/s/rh935iit6ewrmw0unyul", + "vanity_name": "my-custom-vanity-name", + "download_url": "https://www.box.com/shared/static/rh935iit6ewrmw0unyul.jpeg", + "vanity_url": null, + "is_password_enabled": false, + "unshared_at": null, + "download_count": 0, + "preview_count": 0, + "access": "open", + "permissions": { + "can_download": true, + "can_preview": true, + "can_edit": false + } + }, + "parent": { + "type": "folder", + "id": "11446498", + "sequence_id": "1", + "etag": "1", + "name": "Pictures" + }, + "item_status": "active" +} diff --git a/Box.V2/Extensions/BoxExtensions.cs b/Box.V2/Extensions/BoxExtensions.cs index b3b0c0353..ecaf77c17 100644 --- a/Box.V2/Extensions/BoxExtensions.cs +++ b/Box.V2/Extensions/BoxExtensions.cs @@ -36,5 +36,17 @@ internal static string ThrowIfNullOrWhiteSpace(this string value, string name) { return string.IsNullOrWhiteSpace(value) ? throw new ArgumentException("Required field cannot be null or whitespace", name) : value; } + + /// + /// Checks if a value is equal to the expectedValue + /// + /// + /// + /// + /// + internal static T ThrowIfDifferent(this T value, string name, T expectedValue) + { + return value != null && !value.Equals(expectedValue) ? throw new ArgumentException($"Field should equal to {expectedValue} or null", name) : value; + } } } diff --git a/Box.V2/Managers/BoxFoldersManager.cs b/Box.V2/Managers/BoxFoldersManager.cs index 509c0db44..60486e415 100644 --- a/Box.V2/Managers/BoxFoldersManager.cs +++ b/Box.V2/Managers/BoxFoldersManager.cs @@ -207,6 +207,9 @@ public async Task CreateSharedLinkAsync(string id, BoxSharedLinkReque { id.ThrowIfNullOrWhiteSpace("id"); + if (sharedLinkRequest?.Permissions != null) + sharedLinkRequest.Permissions.Edit.ThrowIfDifferent("sharedLinkRequest.permissions.edit", false); + BoxRequest request = new BoxRequest(_config.FoldersEndpointUri, id) .Method(RequestMethod.Put) .Param(ParamFields, fields) diff --git a/Box.V2/Managers/BoxWebLinksManager.cs b/Box.V2/Managers/BoxWebLinksManager.cs index 0f544aac9..d67770b07 100644 --- a/Box.V2/Managers/BoxWebLinksManager.cs +++ b/Box.V2/Managers/BoxWebLinksManager.cs @@ -130,6 +130,9 @@ public async Task CreateSharedLinkAsync(string id, BoxSharedLinkRequ id.ThrowIfNullOrWhiteSpace("id"); sharedLinkRequest.ThrowIfNull("sharedLinkRequest"); + if (sharedLinkRequest?.Permissions != null) + sharedLinkRequest.Permissions.Edit.ThrowIfDifferent("sharedLinkRequest.permissions.edit", false); + BoxRequest request = new BoxRequest(_config.WebLinksEndpointUri, id) .Method(RequestMethod.Put) .Param(ParamFields, fields) diff --git a/Box.V2/Models/BoxPermission.cs b/Box.V2/Models/BoxPermission.cs index 48f7e954b..96232fd82 100644 --- a/Box.V2/Models/BoxPermission.cs +++ b/Box.V2/Models/BoxPermission.cs @@ -18,5 +18,11 @@ public class BoxPermission /// [JsonProperty("can_preview")] public virtual bool CanPreview { get; set; } + + /// + /// Whether the item can be edited or not + /// + [JsonProperty("can_edit")] + public virtual bool? CanEdit { get; set; } } } diff --git a/Box.V2/Models/Request/BoxPermissionsRequest.cs b/Box.V2/Models/Request/BoxPermissionsRequest.cs index 2f25732cc..fed4d3da8 100644 --- a/Box.V2/Models/Request/BoxPermissionsRequest.cs +++ b/Box.V2/Models/Request/BoxPermissionsRequest.cs @@ -22,6 +22,13 @@ public class BoxPermissionsRequest [JsonProperty(PropertyName = "can_preview")] [JsonConverter(typeof(StringEnumConverter))] public BoxPermissionType? Preview { get; set; } + + /// + /// Defines if the shared link allows for the item to be edited. + /// This value can only be true if can_download is also true and if the item has a type of file + /// + [JsonProperty(PropertyName = "can_edit")] + public bool? Edit { get; set; } } ///