diff --git a/.github/linters/.textlintrc b/.github/linters/.textlintrc
new file mode 100644
index 000000000..64e2ba653
--- /dev/null
+++ b/.github/linters/.textlintrc
@@ -0,0 +1,10 @@
+{
+ "filters": {
+ "comments": true
+ },
+ "rules": {
+ "terminology" : {
+ "defaultTerms": true
+ }
+ }
+}
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 7e6522b44..354c5ae4e 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
- branches:
- - main
jobs:
framework:
@@ -30,7 +28,7 @@ jobs:
- name: Build
run: msbuild .\Box.V2
- name: Test
- run: dotnet test .\Box.V2.Test -f net45
+ run: dotnet test .\Box.V2.Test -f net462
core:
name: Build and Test - Core
diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml
index 4422e5bae..994970b3c 100644
--- a/.github/workflows/integration_tests.yml
+++ b/.github/workflows/integration_tests.yml
@@ -6,8 +6,6 @@ on:
- main
pull_request:
types: [opened, synchronize]
- branches:
- - main
jobs:
core:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 4f80f07f8..d9dc8d608 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -3,8 +3,6 @@ name: Lint Code Base
on:
pull_request:
types: [opened, synchronize]
- branches:
- - main
jobs:
build:
@@ -25,5 +23,6 @@ jobs:
VALIDATE_POWERSHELL: false
VALIDATE_EDITORCONFIG: false
VALIDATE_MARKDOWN: false
+ NATURAL_LANGUAGE_CONFIG_FILE: .textlintrc
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/spell-check-lint.yml b/.github/workflows/spell-check-lint.yml
index d2cad31c3..12de24138 100644
--- a/.github/workflows/spell-check-lint.yml
+++ b/.github/workflows/spell-check-lint.yml
@@ -2,8 +2,6 @@ name: spell-check-lint
on:
pull_request_target:
types: [opened, synchronize, edited]
- branches:
- - main
jobs:
spellcheck-request-title:
runs-on: ubuntu-latest
diff --git a/Box.V2.Samples.JWTAuth/Box.V2.Samples.JWTAuth.csproj b/Box.V2.Samples.JWTAuth/Box.V2.Samples.JWTAuth.csproj
index 1b6422644..2599e4b67 100644
--- a/Box.V2.Samples.JWTAuth/Box.V2.Samples.JWTAuth.csproj
+++ b/Box.V2.Samples.JWTAuth/Box.V2.Samples.JWTAuth.csproj
@@ -9,7 +9,7 @@
Properties
Box.V2.Samples.JWTAuth
Box.V2.Samples.JWTAuth
- v4.5
+ v4.6.2
512
false
diff --git a/Box.V2.Samples.JWTAuth/app.config b/Box.V2.Samples.JWTAuth/app.config
index dd59599d5..8da232354 100644
--- a/Box.V2.Samples.JWTAuth/app.config
+++ b/Box.V2.Samples.JWTAuth/app.config
@@ -29,7 +29,7 @@
-
+
diff --git a/Box.V2.Samples.TransactionalAuth/App.config b/Box.V2.Samples.TransactionalAuth/App.config
index ed556dfaa..54b98f54e 100644
--- a/Box.V2.Samples.TransactionalAuth/App.config
+++ b/Box.V2.Samples.TransactionalAuth/App.config
@@ -1,7 +1,7 @@
-
+
diff --git a/Box.V2.Samples.TransactionalAuth/Box.V2.Samples.TransactionalAuth.csproj b/Box.V2.Samples.TransactionalAuth/Box.V2.Samples.TransactionalAuth.csproj
index 1ecaad2e0..9a643d6b1 100644
--- a/Box.V2.Samples.TransactionalAuth/Box.V2.Samples.TransactionalAuth.csproj
+++ b/Box.V2.Samples.TransactionalAuth/Box.V2.Samples.TransactionalAuth.csproj
@@ -9,7 +9,7 @@
Properties
Box.V2.Samples.TransactionalAuth
Box.V2.Samples.TransactionalAuth
- v4.5
+ v4.6.2
512
true
diff --git a/Box.V2.Test.Integration/Box.V2.Test.Integration.csproj b/Box.V2.Test.Integration/Box.V2.Test.Integration.csproj
index 5d14cedcf..3bf9da260 100644
--- a/Box.V2.Test.Integration/Box.V2.Test.Integration.csproj
+++ b/Box.V2.Test.Integration/Box.V2.Test.Integration.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.0;net45
+ netcoreapp2.0;net462
false
false
@@ -10,15 +10,15 @@
-
-
+
+
-
+
diff --git a/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs b/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs
index bd7b15c51..2df46d33c 100644
--- a/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs
+++ b/Box.V2.Test.Integration/BoxFilesManagerIntegrationTest.cs
@@ -181,12 +181,12 @@ await Retry(async () =>
[TestMethod]
[ExpectedException(typeof(TimeoutException))]
- public async Task DownloadStreamAsync_ForTimeoutShorterThanDownloadTime_ShouldAbortDownload()
+ public async Task DownloadAsync_ForTimeoutShorterThanDownloadTime_ShouldAbortDownload()
{
var uploadedFile = await CreateSmallFile(FolderId);
var timeout = new TimeSpan(0, 0, 0, 0, 1);
- await UserClient.FilesManager.DownloadStreamAsync(uploadedFile.Id, timeout: timeout);
+ await UserClient.FilesManager.DownloadAsync(uploadedFile.Id, timeout: timeout);
}
[TestMethod]
diff --git a/Box.V2.Test.Integration/BoxSearchManagerIntegrationTest.cs b/Box.V2.Test.Integration/BoxSearchManagerIntegrationTest.cs
index 352fa7ad9..49f656d13 100644
--- a/Box.V2.Test.Integration/BoxSearchManagerIntegrationTest.cs
+++ b/Box.V2.Test.Integration/BoxSearchManagerIntegrationTest.cs
@@ -13,7 +13,7 @@ public async Task SearchAsync_ForNonExistentKeyword_ShouldReturnNoResults()
{
const string Keyword = "NonExistentKeyWord";
- BoxCollection results = await UserClient.SearchManager.SearchAsync(Keyword, 200);
+ BoxCollection results = await UserClient.SearchManager.QueryAsync(Keyword, limit: 200);
Assert.IsNotNull(results);
Assert.AreEqual(0, results.Entries.Count);
diff --git a/Box.V2.Test/Box.V2.Test.csproj b/Box.V2.Test/Box.V2.Test.csproj
index 1e1ee6084..a8a2d9936 100644
--- a/Box.V2.Test/Box.V2.Test.csproj
+++ b/Box.V2.Test/Box.V2.Test.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.0;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net45
+ netcoreapp2.0;netcoreapp2.2;netcoreapp3.1;net5.0;net6.0;net462
false
false
@@ -9,32 +9,21 @@
-
-
-
+
+
+
+
-
- 4.7.0
-
-
+
-
- 4.2.1312.1622
-
-
- ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll
-
-
- ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll
-
diff --git a/Box.V2.Test/BoxCCGAuthTest.cs b/Box.V2.Test/BoxCCGAuthTest.cs
index f8e3d6c18..3e7b0eb45 100644
--- a/Box.V2.Test/BoxCCGAuthTest.cs
+++ b/Box.V2.Test/BoxCCGAuthTest.cs
@@ -29,7 +29,6 @@ public BoxCCGAuthTest()
_boxConfig.SetupGet(x => x.ClientId).Returns("123");
_boxConfig.SetupGet(x => x.ClientSecret).Returns("SECRET");
_boxConfig.SetupGet(x => x.BoxApiHostUri).Returns(new Uri(Constants.BoxApiHostUriString));
- _boxConfig.SetupGet(x => x.BoxAuthTokenApiUri).Returns(new Uri(Constants.BoxAuthTokenApiUriString));
_ccgAuth = new BoxCCGAuth(_boxConfig.Object, _service);
}
diff --git a/Box.V2.Test/BoxConfigTest.cs b/Box.V2.Test/BoxConfigTest.cs
index 7bc7c027b..66141bf79 100644
--- a/Box.V2.Test/BoxConfigTest.cs
+++ b/Box.V2.Test/BoxConfigTest.cs
@@ -31,9 +31,9 @@ public void BoxConfig_SetUriString()
var exampleUri = new Uri("https://example.com/");
config = BoxConfigBuilder.CreateFromJsonString(JsonString)
- .SetBoxApiUri(exampleUri)
+ .SetBoxApiHostUri(exampleUri)
.Build();
- Assert.AreEqual(config.BoxApiUri, exampleUri);
+ Assert.AreEqual(config.BoxApiUri, exampleUri + "2.0/");
}
[TestMethod]
@@ -63,20 +63,6 @@ public void BoxConfig_CreateFromString()
Assert.AreEqual(config.EnterpriseId, "eid-123");
}
- [TestMethod]
- public void BoxConfig_SetAuthTokenUriString()
- {
- var boxConfig = new BoxConfigBuilder("", "")
- .Build();
- Assert.AreEqual(boxConfig.BoxAuthTokenApiUri, new Uri(Constants.BoxAuthTokenApiUriString));
-
- var exampleUri = new Uri("https://example.com/token");
- var newConfig = new BoxConfigBuilder("", "")
- .SetBoxTokenApiUri(exampleUri)
- .Build();
- Assert.AreEqual(newConfig.BoxAuthTokenApiUri.ToString(), exampleUri + "/");
- }
-
[TestMethod]
public void BoxConfig_SetBoxApiHostUri()
{
diff --git a/Box.V2.Test/BoxFilesManagerTest.cs b/Box.V2.Test/BoxFilesManagerTest.cs
index e558d3948..e44df03ab 100644
--- a/Box.V2.Test/BoxFilesManagerTest.cs
+++ b/Box.V2.Test/BoxFilesManagerTest.cs
@@ -865,43 +865,6 @@ public async Task DeleteFile_ErrorResponse_Exception()
}
}
- [TestMethod]
- public async Task DownloadStream_ValidResponse_ValidStream()
- {
-
- using (var exampleFile = new FileStream(string.Format(GetSaveFolderPath(), "example.png"), FileMode.OpenOrCreate))
- {
- /*** Arrange ***/
- var location = new Uri("http://dl.boxcloud.com");
- var headers = new HttpResponseMessage().Headers;
- headers.Location = location;
- Handler.Setup(h => h.ExecuteAsync(It.IsAny()))
- .Returns(Task.FromResult>(new BoxResponse()
- {
- Status = ResponseStatus.Success,
- Headers = headers
-
- }));
- IBoxRequest boxRequest = null;
- Handler.Setup(h => h.ExecuteAsync(It.IsAny()))
- .Returns(Task.FromResult>(new BoxResponse()
- {
- Status = ResponseStatus.Success,
- ResponseObject = exampleFile
-
- }))
- .Callback(r => boxRequest = r); ;
-
- /*** Act ***/
- Stream result = await _filesManager.DownloadStreamAsync("34122832467");
-
- /*** Assert ***/
-
- Assert.IsNotNull(result, "Stream is Null");
-
- }
- }
-
[TestMethod]
public async Task Download_LargeOffset_ValidStream()
{
diff --git a/Box.V2.Test/BoxFoldersManagerTest.cs b/Box.V2.Test/BoxFoldersManagerTest.cs
index b373acc79..ad0f3acd4 100644
--- a/Box.V2.Test/BoxFoldersManagerTest.cs
+++ b/Box.V2.Test/BoxFoldersManagerTest.cs
@@ -75,60 +75,6 @@ public async Task GetFolderItems_ValidResponse_SortDirection()
Assert.AreEqual("DESC", boxRequest.Parameters["direction"]);
}
- [TestMethod]
- public async Task GetFolder_ValidResponse_ValidFolder()
- {
- Handler.Setup(h => h.ExecuteAsync(It.IsAny()))
- .Returns(() => Task.FromResult>(new BoxResponse()
- {
- Status = ResponseStatus.Success,
- ContentString = "{ \"type\":\"folder\", \"id\":\"0\", \"sequence_id\":null, \"etag\":null, \"name\":\"All Files\", \"created_at\":null, \"modified_at\":null, \"description\":\"\", \"size\":61591428468, \"path_collection\":{ \"total_count\":0, \"entries\":[ ] }, \"created_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"brianytang@gmail.com\" }, \"modified_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"brianytang@gmail.com\" }, \"trashed_at\":null, \"purged_at\":null, \"content_created_at\":null, \"content_modified_at\":null, \"owned_by\":{ \"type\":\"user\", \"id\":\"189912110\", \"name\":\"Brian\", \"login\":\"brianytang@gmail.com\" }, \"shared_link\":null, \"folder_upload_email\":null, \"parent\":null, \"item_status\":\"active\", \"item_collection\":{ \"total_count\":10, \"entries\":[ { \"type\":\"folder\", \"id\":\"766352168\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Books\" }, { \"type\":\"folder\", \"id\":\"869883498\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"bytLabs\" }, { \"type\":\"folder\", \"id\":\"767221958\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Games\" }, { \"type\":\"folder\", \"id\":\"766174084\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Mixes\" }, { \"type\":\"folder\", \"id\":\"57181304\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Muzik\" }, { \"type\":\"folder\", \"id\":\"857305570\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"My\" }, { \"type\":\"folder\", \"id\":\"627316229\", \"sequence_id\":\"1\", \"etag\":\"1\", \"name\":\"My Music Folder\" }, { \"type\":\"folder\", \"id\":\"860155462\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"sample\" }, { \"type\":\"folder\", \"id\":\"775829294\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Software\" }, { \"type\":\"folder\", \"id\":\"811565831\", \"sequence_id\":\"0\", \"etag\":\"0\", \"name\":\"Test\" } ], \"offset\":0, \"limit\":10, \"order\":[ { \"by\":\"type\", \"direction\":\"ASC\" }, { \"by\":\"name\", \"direction\":\"ASC\" } ] } }"
- }));
-
- BoxFolder f = await _foldersManager.GetItemsAsync("0", 10);
-
- Assert.AreEqual(f.Id, "0");
- Assert.AreEqual(f.Type, "folder");
- Assert.IsNull(f.SequenceId);
- Assert.IsNull(f.ETag);
- Assert.IsNull(f.CreatedAt);
- Assert.IsNull(f.ModifiedAt);
- Assert.AreEqual(f.Description, "");
- Assert.AreEqual(f.Size, 61591428468);
- Assert.AreEqual(f.PathCollection.TotalCount, 0);
- Assert.AreEqual(f.PathCollection.Entries.Count, 0);
- Assert.AreEqual(f.CreatedBy.Type, "user");
- Assert.AreEqual(f.CreatedBy.Id, "189912110");
- Assert.AreEqual(f.CreatedBy.Name, "Brian");
- Assert.AreEqual(f.CreatedBy.Login, "brianytang@gmail.com");
- Assert.AreEqual(f.ModifiedBy.Type, "user");
- Assert.AreEqual(f.ModifiedBy.Id, "189912110");
- Assert.AreEqual(f.ModifiedBy.Name, "Brian");
- Assert.AreEqual(f.ModifiedBy.Login, "brianytang@gmail.com");
- //Assert.IsNull(f.TrashedAt); // Need to add property
- //Assert.IsNull(f.PurgedAt); // Need to add property
- //Assert.IsNull(f.ContentCreatedAt); // Need to add property
- //Assert.IsNull(f.ContentModifiedAt); // Need to add property
- Assert.AreEqual(f.OwnedBy.Type, "user");
- Assert.AreEqual(f.OwnedBy.Id, "189912110");
- Assert.AreEqual(f.OwnedBy.Name, "Brian");
- Assert.AreEqual(f.OwnedBy.Login, "brianytang@gmail.com");
- Assert.IsNull(f.SharedLink);
- Assert.IsNull(f.FolderUploadEmail);
- Assert.IsNull(f.Parent);
- Assert.AreEqual(f.ItemStatus, "active");
- Assert.AreEqual(f.Id, "0");
- Assert.AreEqual(f.Name, "All Files");
- Assert.AreEqual(f.ModifiedBy.Id, "189912110");
- Assert.AreEqual(f.ItemCollection.TotalCount, 10);
- Assert.AreEqual(f.ItemCollection.Entries.Count, 10);
- //Assert.AreEqual(f.Offset, "0"); // Need to add property
- //Assert.AreEqual(f.Order[0].By, "type"); // Need to add property
- //Assert.AreEqual(f.Order[0].Direction, "ASC"); // Need to add property
- //Assert.AreEqual(f.Order[1].By, "name"); // Need to add property
- //Assert.AreEqual(f.Order[1].Direction, "ASC"); // Need to add property
- }
-
[TestMethod]
public async Task CreateFolder_ValidResponse_ValidFolder()
{
@@ -707,7 +653,7 @@ public async Task GetTrashedItems_ValidResponse_ValidFiles()
}));
/*** Act ***/
- BoxCollection i = await _foldersManager.GetTrashItemsAsync("fakeId", 10);
+ BoxCollection i = await _foldersManager.GetTrashItemsAsync(10);
BoxItem i1 = i.Entries.FirstOrDefault();
BoxItem i2 = i.Entries.Skip(1).FirstOrDefault();
diff --git a/Box.V2.Test/BoxMetadataManagerTest.cs b/Box.V2.Test/BoxMetadataManagerTest.cs
index 94f224fa5..d28bb1455 100644
--- a/Box.V2.Test/BoxMetadataManagerTest.cs
+++ b/Box.V2.Test/BoxMetadataManagerTest.cs
@@ -554,120 +554,6 @@ public async Task SetFolderMetadataAsync_Create_Error()
}
}
- [TestMethod]
- public async Task ExecuteMetadataQuery_ValidResponse()
- {
- /*** Arrange ***/
- IBoxRequest boxRequest = null;
- Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
- .Returns(Task.FromResult>>(new BoxResponse>()
- {
- Status = ResponseStatus.Success,
- ContentString = LoadFixtureFromJson("Fixtures/BoxMetadata/ExecuteMetadataQuery200.json")
- }))
- .Callback(r => boxRequest = r);
-
- /*** Act ***/
- var queryParams = new Dictionary
- {
- { "arg", 100 }
- };
- var orderByList = new List();
- var orderBy = new BoxMetadataQueryOrderBy()
- {
- FieldKey = "amount",
- Direction = BoxSortDirection.ASC
- };
- orderByList.Add(orderBy);
- var marker = "q3f87oqf3qygou5t478g9gwrbul";
- BoxCollectionMarkerBased items = await _metadataManager.ExecuteMetadataQueryAsync(from: "enterprise_123456.someTemplate", query: "amount >= :arg", queryParameters: queryParams, ancestorFolderId: "5555", indexName: "amountAsc", orderBy: orderByList, marker: marker, autoPaginate: false);
- /*** Assert ***/
-
- // Request check
- Assert.IsNotNull(boxRequest);
- Assert.AreEqual(RequestMethod.Post, boxRequest.Method);
- Assert.AreEqual(MetadataQueryUri, boxRequest.AbsoluteUri.AbsoluteUri);
- var payload = JObject.Parse(boxRequest.Payload);
- Assert.AreEqual("enterprise_123456.someTemplate", payload["from"]);
- Assert.AreEqual("amount >= :arg", payload["query"]);
- Assert.AreEqual(100, payload["query_params"]["arg"]);
- Assert.AreEqual("5555", payload["ancestor_folder_id"]);
- var payloadOrderBy = JArray.Parse(payload["order_by"].ToString());
- Assert.AreEqual("amount", payloadOrderBy[0]["field_key"]);
- Assert.AreEqual("ASC", payloadOrderBy[0]["direction"]);
- Assert.AreEqual(marker, payload["marker"]);
-
- // Response check
- Assert.AreEqual(items.Entries[0].Item.Type, "file");
- Assert.AreEqual(items.Entries[0].Item.Id, "1617554169109");
- Assert.AreEqual(items.Entries[0].Item.Name, "My Contract.docx");
- Assert.AreEqual(items.Entries[0].Item.SequenceId, "0");
- Assert.AreEqual(items.Entries[0].Item.CreatedBy.Type, "user");
- Assert.AreEqual(items.Entries[0].Item.CreatedBy.Login, "admin@company.com");
- Assert.AreEqual(items.Entries[0].Item.Parent.Id, "16125613433");
- Assert.AreEqual(items.NextMarker, "AAAAAmVYB1FWec8GH6yWu2nwmanfMh07IyYInaa7DZDYjgO1H4KoLW29vPlLY173OKsci6h6xGh61gG73gnaxoS+o0BbI1/h6le6cikjlupVhASwJ2Cj0tOD9wlnrUMHHw3/ISf+uuACzrOMhN6d5fYrbidPzS6MdhJOejuYlvsg4tcBYzjauP3+VU51p77HFAIuObnJT0ff");
- var metadata = JObject.FromObject(items.Entries[0].Metadata["enterprise_123456"]);
- Assert.AreEqual(metadata["someTemplate"]["$parent"], "file_161753469109");
- Assert.AreEqual(metadata["someTemplate"]["customerName"], "Phoenix Corp");
- Assert.AreEqual(metadata["someTemplate"]["$typeVersion"], 0);
- Assert.AreEqual(metadata["someTemplate"]["region"], "West");
- }
-
- [TestMethod]
- public async Task ExecuteMetadataQueryWithFields_ValidResponse()
- {
- /*** Arrange ***/
- IBoxRequest boxRequest = null;
- Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
- .Returns(Task.FromResult>>(new BoxResponse>()
- {
- Status = ResponseStatus.Success,
- ContentString = LoadFixtureFromJson("Fixtures/BoxMetadata/ExecuteMetadataWithFieldsQuery200.json")
- }))
- .Callback(r => boxRequest = r);
-
- /*** Act ***/
- var queryParams = new Dictionary
- {
- { "arg", "Bob Dylan" }
- };
- var fields = new List
- {
- "id",
- "name",
- "sha1",
- "metadata.enterprise_240748.catalogImages.photographer"
- };
- var marker = "q3f87oqf3qygou5t478g9gwrbul";
- BoxCollectionMarkerBased items = await _metadataManager.ExecuteMetadataQueryAsync(from: "enterprise_67890.catalogImages", query: "photographer = :arg", fields: fields, queryParameters: queryParams, ancestorFolderId: "0", marker: marker, autoPaginate: false);
- /*** Assert ***/
-
- // Request check
- Assert.IsNotNull(boxRequest);
- Assert.AreEqual(RequestMethod.Post, boxRequest.Method);
- Assert.AreEqual(MetadataQueryUri, boxRequest.AbsoluteUri.AbsoluteUri);
- var payload = JObject.Parse(boxRequest.Payload);
- Assert.AreEqual("enterprise_67890.catalogImages", payload["from"]);
- Assert.AreEqual("photographer = :arg", payload["query"]);
- Assert.AreEqual("0", payload["ancestor_folder_id"]);
- var payloadFields = JArray.Parse(payload["fields"].ToString());
- Assert.AreEqual("id", payloadFields[0]);
- Assert.AreEqual("name", payloadFields[1]);
- Assert.AreEqual("sha1", payloadFields[2]);
- Assert.AreEqual("metadata.enterprise_240748.catalogImages.photographer", payloadFields[3]);
- Assert.AreEqual(marker, payload["marker"]);
-
- // Response check
- Assert.AreEqual(items.Entries[0].Type, "file");
- Assert.AreEqual(items.Entries[0].Id, "1244738582");
- Assert.AreEqual(items.Entries[0].Name, "Very Important.docx");
- Assert.AreEqual(items.Entries[1].Type, "folder");
- Assert.AreEqual(items.Entries[1].Id, "124242482");
- Assert.AreEqual(items.Entries[1].Name, "Also Important.docx");
- var file = (BoxFile)items.Entries[0];
- Assert.AreEqual(file.Metadata["enterprise_67890"]["catalogImages"]["photographer"].Value, "Bob Dylan");
- }
-
[TestMethod]
public async Task ExecuteMetadataQueryWithoutUseIndexWithFields_ValidResponse()
{
diff --git a/Box.V2.Test/BoxRetentionPoliciesManagerTest.cs b/Box.V2.Test/BoxRetentionPoliciesManagerTest.cs
index 33eb40d6d..71f342c96 100644
--- a/Box.V2.Test/BoxRetentionPoliciesManagerTest.cs
+++ b/Box.V2.Test/BoxRetentionPoliciesManagerTest.cs
@@ -260,8 +260,8 @@ public async Task GetFileVersionsUnderRetentionForAssignment_ValidResponse()
var retentionPolicyAssignmentId = "12345";
var responseString = "{ \"entries\": [{ \"id\": 12345, \"etag\": 1, \"type\": \"file_version\", \"sequence_id\": 3, \"name\": \"Contract.pdf\", \"sha1\": \"85136C79CBF9FE36BB9D05D0639C70C265C18D37\", \"file_version\": { \"id\": 123456, \"type\": \"file_version\", \"sha1\": \"134b65991ed521fcfe4724b7d814ab8ded5185dc\" }, \"applied_at\": \"2012-12-12T10:53:43-08:00\" } ], \"limit\": 1000, \"marker\": \"some marker\" }";
IBoxRequest boxRequest = null;
- Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
- .Returns(Task.FromResult>>(new BoxResponse>()
+ Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
+ .Returns(Task.FromResult>>(new BoxResponse>()
{
Status = ResponseStatus.Success,
ContentString = responseString
@@ -269,7 +269,7 @@ public async Task GetFileVersionsUnderRetentionForAssignment_ValidResponse()
.Callback(r => boxRequest = r);
/*** Act ***/
- BoxCollectionMarkerBased results = await _retentionPoliciesManager.GetFileVersionsUnderRetentionForAssignmentAsync(retentionPolicyAssignmentId);
+ BoxCollectionMarkerBased results = await _retentionPoliciesManager.GetFileVersionsUnderRetentionForAssignmentAsync(retentionPolicyAssignmentId);
/*** Assert ***/
@@ -281,7 +281,7 @@ public async Task GetFileVersionsUnderRetentionForAssignment_ValidResponse()
// Response check
Assert.AreEqual("12345", results.Entries[0].Id);
Assert.AreEqual("Contract.pdf", results.Entries[0].Name);
- Assert.AreEqual("file_version", results.Entries[0].Type);
+ Assert.AreEqual("file", results.Entries[0].Type);
Assert.AreEqual("file_version", results.Entries[0].FileVersion.Type);
}
}
diff --git a/Box.V2.Test/BoxSearchManagerTest.cs b/Box.V2.Test/BoxSearchManagerTest.cs
index 91e5045da..a37586b22 100644
--- a/Box.V2.Test/BoxSearchManagerTest.cs
+++ b/Box.V2.Test/BoxSearchManagerTest.cs
@@ -33,7 +33,7 @@ public async Task SearchKeyword_ValidResponse_ValidResults()
.Callback(r => boxRequest = r);
/*** Act ***/
- BoxCollection results = await SearchManager.SearchAsync("fakeKeyword", 10, sort: "modified_at", direction: BoxSortDirection.ASC);
+ BoxCollection results = await SearchManager.QueryAsync("fakeKeyword", limit: 10, sort: "modified_at", direction: BoxSortDirection.ASC);
var queryParams = boxRequest.Parameters;
/*** Assert ***/
Assert.AreEqual(4, results.TotalCount);
@@ -41,54 +41,6 @@ public async Task SearchKeyword_ValidResponse_ValidResults()
Assert.AreEqual("ASC", queryParams["direction"]);
}
- [TestMethod]
- public async Task SearchWithDateRanges_ValidResponse_ValidResults()
- {
- /*** Arrange ***/
- var responseString = "{\"total_count\":4,\"entries\":[{\"type\":\"file\",\"id\":\"1874102965\",\"sequence_id\":\"0\",\"etag\":\"0\",\"sha1\":\"63a112a4567fb556f5269735102a2f24f2cbea56\",\"name\":\"football.jpg\",\"description\":\"\",\"size\":260271,\"path_collection\":{\"total_count\":1,\"entries\":[{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"}]},\"created_at\":\"2012-03-22T18:25:07-07:00\",\"modified_at\":\"2012-10-25T14:40:05-07:00\",\"created_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"modified_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"owned_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"shared_link\":null,\"parent\":{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"},\"item_status\":\"active\", \"sort\":\"modified_at\", \"direction\":\"ASC\"}],\"offset\":0,\"limit\":1}";
- IBoxRequest boxRequest = null;
-
- Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
- .Returns(Task.FromResult>>(new BoxResponse>()
- {
- Status = ResponseStatus.Success,
- ContentString = responseString
- }))
- .Callback(r => boxRequest = r);
-
- /*** Act ***/
- var startDate = new DateTimeOffset(1988, 11, 18, 9, 30, 0, TimeSpan.Zero);
- var endDate = new DateTimeOffset(2018, 11, 18, 9, 30, 0, TimeSpan.Zero);
- var results = await SearchManager.SearchAsync("test", createdAtRangeFromDate: startDate, createdAtRangeToDate: endDate, updatedAtRangeFromDate: startDate, updatedAtRangeToDate: endDate);
-
- /*** Assert ***/
- Assert.AreEqual("query=test&created_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C2018-11-18T09%3A30%3A00%2B00%3A00&updated_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C2018-11-18T09%3A30%3A00%2B00%3A00&limit=30&offset=0", boxRequest.GetQueryString());
- }
-
- [TestMethod]
- public async Task SearchWithOpenDateRanges_ValidResponse_ValidResults()
- {
- /*** Arrange ***/
- var responseString = "{\"total_count\":4,\"entries\":[{\"type\":\"file\",\"id\":\"1874102965\",\"sequence_id\":\"0\",\"etag\":\"0\",\"sha1\":\"63a112a4567fb556f5269735102a2f24f2cbea56\",\"name\":\"football.jpg\",\"description\":\"\",\"size\":260271,\"path_collection\":{\"total_count\":1,\"entries\":[{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"}]},\"created_at\":\"2012-03-22T18:25:07-07:00\",\"modified_at\":\"2012-10-25T14:40:05-07:00\",\"created_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"modified_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"owned_by\":{\"type\":\"user\",\"id\":\"175065494\",\"name\":\"Andrew Luck\",\"login\":\"aluck@colts.com\"},\"shared_link\":null,\"parent\":{\"type\":\"folder\",\"id\":\"0\",\"sequence_id\":null,\"etag\":null,\"name\":\"All Files\"},\"item_status\":\"active\", \"sort\":\"modified_at\", \"direction\":\"ASC\"}],\"offset\":0,\"limit\":1}";
- IBoxRequest boxRequest = null;
-
- Handler.Setup(h => h.ExecuteAsync>(It.IsAny()))
- .Returns(Task.FromResult>>(new BoxResponse>()
- {
- Status = ResponseStatus.Success,
- ContentString = responseString
- }))
- .Callback(r => boxRequest = r);
-
- /*** Act ***/
- var startDate = new DateTimeOffset(1988, 11, 18, 9, 30, 0, TimeSpan.Zero);
- var endDate = new DateTimeOffset(2018, 11, 18, 9, 30, 0, TimeSpan.Zero);
- var results = await SearchManager.SearchAsync("test", createdAtRangeFromDate: startDate, updatedAtRangeToDate: endDate);
-
- /*** Assert ***/
- Assert.AreEqual("query=test&created_at_range=1988-11-18T09%3A30%3A00%2B00%3A00%2C&updated_at_range=%2C2018-11-18T09%3A30%3A00%2B00%3A00&limit=30&offset=0", boxRequest.GetQueryString());
- }
-
[TestMethod]
public async Task Query_ValidResponse_ValidResults()
{
diff --git a/Box.V2.Test/BoxTasksManagerTest.cs b/Box.V2.Test/BoxTasksManagerTest.cs
index d6868017f..2bfd8aa3b 100644
--- a/Box.V2.Test/BoxTasksManagerTest.cs
+++ b/Box.V2.Test/BoxTasksManagerTest.cs
@@ -270,8 +270,8 @@ public async Task GetTaskAssignment_TranslatedStatus()
""completed_at"": null,
""assigned_at"": ""2013-05-10T11:43:41-07:00"",
""reminded_at"": null,
- ""resolution_state"": ""未完了"",
- ""status"": ""incomplete"",
+ ""resolution_state"": ""incomplete"",
+ ""status"": ""未完了"",
""assigned_by"": {
""type"": ""user"",
""id"": ""33333"",
@@ -295,8 +295,8 @@ public async Task GetTaskAssignment_TranslatedStatus()
/*** Assert ***/
- Assert.AreEqual("incomplete", result.Status);
- Assert.AreEqual("未完了", result.LocalizedStatus);
+ Assert.AreEqual("incomplete", result.LocalizedStatus);
+ Assert.AreEqual("未完了", result.Status);
Assert.AreEqual(ResolutionStateType.incomplete, result.ResolutionState);
}
diff --git a/Box.V2.Test/CCGAuthRepositoryTest.cs b/Box.V2.Test/CCGAuthRepositoryTest.cs
index 14814563a..5aa3c3d9d 100644
--- a/Box.V2.Test/CCGAuthRepositoryTest.cs
+++ b/Box.V2.Test/CCGAuthRepositoryTest.cs
@@ -33,7 +33,6 @@ public CCGAuthRepositoryTest()
_boxConfig.SetupGet(x => x.ClientId).Returns("123");
_boxConfig.SetupGet(x => x.ClientSecret).Returns("SECRET");
_boxConfig.SetupGet(x => x.BoxApiHostUri).Returns(new Uri(Constants.BoxApiHostUriString));
- _boxConfig.SetupGet(x => x.BoxAuthTokenApiUri).Returns(new Uri(Constants.BoxAuthTokenApiUriString));
_ccgAuth = new BoxCCGAuth(_boxConfig.Object, _service);
_userAuthRepository = new CCGAuthRepository(null, _ccgAuth, _userId);
_adminAuthRepository = new CCGAuthRepository(null, _ccgAuth, _userId);
diff --git a/Box.V2/Box.V2.csproj b/Box.V2/Box.V2.csproj
index e21f81ef2..22cd981d1 100644
--- a/Box.V2/Box.V2.csproj
+++ b/Box.V2/Box.V2.csproj
@@ -9,7 +9,7 @@
Properties
Box.V2
Box.V2
- v4.5
+ v4.6.2
512
@@ -21,7 +21,7 @@
full
false
bin\Debug\
- TRACE;DEBUG;NET45
+ TRACE;DEBUG;NET462
prompt
4
@@ -29,7 +29,7 @@
pdbonly
true
bin\Release\
- TRACE;RELEASE;NET45
+ TRACE;RELEASE;NET462
prompt
4
@@ -37,7 +37,7 @@
pdbonly
true
bin\Release\
- TRACE;RELEASE;NET45
+ TRACE;RELEASE;NET462
prompt
4
true
@@ -82,6 +82,8 @@
+
+
diff --git a/Box.V2/Box.V2.nuspec b/Box.V2/Box.V2.nuspec
index ced5f901c..4fd41d3e5 100644
--- a/Box.V2/Box.V2.nuspec
+++ b/Box.V2/Box.V2.nuspec
@@ -9,7 +9,7 @@
https://github.com/box/box-windows-sdk-v2
Apache-2.0
false
- Windows SDK for v2 of the Box API. The SDK is targeting .NET Framework 4.5
+ Windows SDK for v2 of the Box API. The SDK is targeting .NET Framework 4.6.2
See https://github.com/box/box-windows-sdk-v2/blob/main/CHANGELOG.md#460-2022-10-18
Copyright 2021
Box V2 SDK Platform Enterprise Collaboration Storage File Management
diff --git a/Box.V2/Config/BoxConfig.cs b/Box.V2/Config/BoxConfig.cs
index da654bfaf..26695f174 100644
--- a/Box.V2/Config/BoxConfig.cs
+++ b/Box.V2/Config/BoxConfig.cs
@@ -59,7 +59,6 @@ public BoxConfig(BoxConfigBuilder builder)
BoxAccountApiHostUri = builder.BoxAccountApiHostUri;
BoxApiUri = builder.BoxApiUri;
BoxUploadApiUri = builder.BoxUploadApiUri;
- BoxAuthTokenApiUri = builder.BoxAuthTokenApiUri;
RedirectUri = builder.RedirectUri;
DeviceId = builder.DeviceId;
DeviceName = builder.DeviceName;
@@ -156,14 +155,6 @@ public Uri BoxApiUri
private set { _boxApiUri = value; }
}
- private Uri _boxAuthTokenApiUri;
- [Obsolete("Use BoxApiHostUri instead")]
- public Uri BoxAuthTokenApiUri
- {
- get { return _boxAuthTokenApiUri ?? new Uri(BoxApiHostUri, Constants.AuthTokenEndpointString); }
- private set { _boxAuthTokenApiUri = value; }
- }
-
public string ClientId { get; private set; }
public string ConsumerKey { get; private set; }
public string ClientSecret { get; private set; }
diff --git a/Box.V2/Config/BoxConfigBuilder.cs b/Box.V2/Config/BoxConfigBuilder.cs
index e3064ee5c..9d4863904 100644
--- a/Box.V2/Config/BoxConfigBuilder.cs
+++ b/Box.V2/Config/BoxConfigBuilder.cs
@@ -140,18 +140,6 @@ public BoxConfigBuilder SetBoxAccountApiHostUri(Uri boxAccountApiHostUri)
return this;
}
- ///
- /// Sets BoxAPI uri.
- ///
- /// BoxAPI uri.
- /// this BoxConfigBuilder object for chaining
- [Obsolete("Use SetBoxApiHostUri() instead")]
- public BoxConfigBuilder SetBoxApiUri(Uri boxApiUri)
- {
- BoxApiUri = EnsureEndsWithSlash(boxApiUri);
- return this;
- }
-
///
/// Sets BoxAPI upload uri.
///
@@ -163,18 +151,6 @@ public BoxConfigBuilder SetBoxUploadApiUri(Uri boxUploadApiUri)
return this;
}
- ///
- /// Sets BoxAPI auth token uri.
- ///
- /// BoxAPI auth token uri.
- /// this BoxConfigBuilder object for chaining
- [Obsolete("Use SetBoxApiHostUri() instead")]
- public BoxConfigBuilder SetBoxTokenApiUri(Uri boxAuthTokenApiUri)
- {
- BoxAuthTokenApiUri = EnsureEndsWithSlash(boxAuthTokenApiUri);
- return this;
- }
-
///
/// Sets redirect uri.
///
@@ -283,14 +259,6 @@ public Uri BoxApiUri
private set { _boxApiUri = value; }
}
- private Uri _boxAuthTokenApiUri;
- [Obsolete("Use BoxApiHostUri instead")]
- public Uri BoxAuthTokenApiUri
- {
- get { return _boxAuthTokenApiUri ?? new Uri(BoxApiHostUri, Constants.AuthTokenEndpointString); }
- private set { _boxAuthTokenApiUri = value; }
- }
-
public Uri RedirectUri { get; private set; }
public string DeviceId { get; private set; }
public string DeviceName { get; private set; }
diff --git a/Box.V2/Config/Constants.cs b/Box.V2/Config/Constants.cs
index 20942e140..6a754c7fe 100644
--- a/Box.V2/Config/Constants.cs
+++ b/Box.V2/Config/Constants.cs
@@ -162,7 +162,6 @@ public static class Constants
/*** Auth ***/
public const string AuthHeaderKey = "Authorization";
- public const string V1AuthString = "BoxAuth api_key={0}&auth_token={1}";
public const string V2AuthString = "Bearer {0}";
public const string BearerTokenType = "bearer";
public const int AccessTokenExpirationTime = 3600; // seconds
@@ -460,18 +459,6 @@ public static class UserEventTypes
///
public const string EnableTwoFactorAuth = "ENABLE_TWO_FACTOR_AUTH";
- ///
- /// Free user accepts invitation to become a managed user.
- ///
- [Obsolete("Use AdminInviteAccept instead")]
- public const string MasterInviteAccept = "MASTER_INVITE_ACCEPT";
-
- ///
- /// Free user rejects invitation to become a managed user.
- ///
- [Obsolete("Use AdminInviteReject instead")]
- public const string MasterInviteReject = "MASTER_INVITE_REJECT";
-
///
/// Free user accepts invitation to become a managed user.
///
diff --git a/Box.V2/Config/IBoxConfig.cs b/Box.V2/Config/IBoxConfig.cs
index 30b2b129b..821454d3e 100644
--- a/Box.V2/Config/IBoxConfig.cs
+++ b/Box.V2/Config/IBoxConfig.cs
@@ -11,8 +11,6 @@ public interface IBoxConfig
Uri BoxUploadApiUri { get; }
Uri BoxApiUri { get; }
- [Obsolete("Use BoxApiHostUri instead")]
- Uri BoxAuthTokenApiUri { get; }
string ClientId { get; }
string ConsumerKey { get; }
diff --git a/Box.V2/Converter/BoxFileVersionsUnderRetentionItemConverter.cs b/Box.V2/Converter/BoxFileVersionsUnderRetentionItemConverter.cs
new file mode 100644
index 000000000..a07a41300
--- /dev/null
+++ b/Box.V2/Converter/BoxFileVersionsUnderRetentionItemConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using Box.V2.Config;
+using Box.V2.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Box.V2.Converter
+{
+ // workaround for https://developer.box.com/reference/get-retention-policy-assignments-id-file-versions-under-retention/
+ // which currently returns 'file-version' instead of 'file' in 'type' field
+ internal class BoxFileVersionsUnderRetentionItemConverter : BoxItemConverter
+ {
+ protected override BoxEntity Create(Type objectType, JObject jObject)
+ {
+ // we need to identify the top level node somehow so we check if 'file version' field is present
+ if (FieldExists(ItemType, jObject) && FieldExists("file_version", jObject))
+ {
+ switch (jObject[ItemType].ToString())
+ {
+ // should work even if this bug is fixed
+ case Constants.TypeFileVersion:
+ case Constants.TypeFile:
+ jObject[ItemType] = Constants.TypeFile;
+ return new BoxFile();
+ }
+ }
+
+ return base.Create(objectType, jObject);
+ }
+ }
+}
diff --git a/Box.V2/Converter/BoxFileVersionsUnderRetentionJsonConverter.cs b/Box.V2/Converter/BoxFileVersionsUnderRetentionJsonConverter.cs
new file mode 100644
index 000000000..d1ad84589
--- /dev/null
+++ b/Box.V2/Converter/BoxFileVersionsUnderRetentionJsonConverter.cs
@@ -0,0 +1,12 @@
+using Newtonsoft.Json;
+
+namespace Box.V2.Converter
+{
+ internal class BoxFileVersionsUnderRetentionJsonConverter : BoxJsonConverter
+ {
+ public override T Parse(string content)
+ {
+ return JsonConvert.DeserializeObject(content, new BoxFileVersionsUnderRetentionItemConverter());
+ }
+ }
+}
diff --git a/Box.V2/Converter/BoxItemConverter.cs b/Box.V2/Converter/BoxItemConverter.cs
index 182a009fd..7d044e14f 100644
--- a/Box.V2/Converter/BoxItemConverter.cs
+++ b/Box.V2/Converter/BoxItemConverter.cs
@@ -9,7 +9,7 @@ namespace Box.V2.Converter
{
internal class BoxItemConverter : JsonCreationConverter
{
- private const string ItemType = "type";
+ protected const string ItemType = "type";
private const string EventSourceItemType = "item_type";
private const string WatermarkType = "watermark";
private const string GroupId = "group_id";
@@ -143,7 +143,7 @@ protected override BoxEntity Create(Type objectType, JObject jObject)
return new BoxEntity();
}
- private bool FieldExists(string fieldName, JObject jObject)
+ protected bool FieldExists(string fieldName, JObject jObject)
{
return jObject[fieldName] != null;
}
diff --git a/Box.V2/Converter/BoxJsonConverter.cs b/Box.V2/Converter/BoxJsonConverter.cs
index adebfe053..63dd128f0 100644
--- a/Box.V2/Converter/BoxJsonConverter.cs
+++ b/Box.V2/Converter/BoxJsonConverter.cs
@@ -25,7 +25,7 @@ public BoxJsonConverter()
/// The type that the content should be parsed into
/// The JSON string
/// The box representation of the JSON
- public T Parse(string content)
+ public virtual T Parse(string content)
{
return JsonConvert.DeserializeObject(content, new BoxItemConverter());
}
diff --git a/Box.V2/Managers/BoxFilesManager.cs b/Box.V2/Managers/BoxFilesManager.cs
index dbeb154d0..a5ae60bf4 100644
--- a/Box.V2/Managers/BoxFilesManager.cs
+++ b/Box.V2/Managers/BoxFilesManager.cs
@@ -49,32 +49,6 @@ public async Task GetInformationAsync(string id, IEnumerable fi
return response.ResponseObject;
}
- ///
- /// Returns the stream of the requested file.
- ///
- /// Id of the file to download.
- /// The ID specific version of this file to download.
- /// Optional timeout for response.
- /// Optional timeout for response.
- /// Optional timeout for response.
- /// Stream of the requested file.
- [Obsolete("This method is deprecated in favor of DownloadAsync()")]
- public async Task DownloadStreamAsync(string id, string versionId = null, TimeSpan? timeout = null, int? startOffsetInBytes = null, int? endOffsetInBytes = null)
- {
- id.ThrowIfNullOrWhiteSpace("id");
-
- BoxRequest request = new BoxRequest(_config.FilesEndpointUri, string.Format(Constants.ContentPathString, id)) { Timeout = timeout }
- .Param("version", versionId);
-
- if (startOffsetInBytes.HasValue && endOffsetInBytes.HasValue)
- {
- request = request.Header("Range", $"bytes={startOffsetInBytes}-{endOffsetInBytes}");
- }
-
- IBoxResponse response = await ToResponseAsync(request).ConfigureAwait(false);
- return response.ResponseObject;
- }
-
///
/// Returns the stream of the requested file.
///
@@ -461,22 +435,6 @@ public async Task GetSessionUploadStatusAsync(Uri sessio
return response.ResponseObject;
}
- ///
- /// Upload a new large file version by splitting them up and uploads in a session.
- ///
- /// The file stream.
- /// Id of the remote file.
- /// Timeout for subsequent UploadPart requests.
- /// Will report progress from 1 - 100.
- /// The BoxFileVersion object.
- [Obsolete("UploadFileVersionUsingSessionAsync is deprecated, please use UploadNewVersionUsingSessionAsync instead.")]
- public async Task UploadFileVersionUsingSessionAsync(Stream stream, string fileId, string fileName = null,
- TimeSpan? timeout = null, IProgress progress = null)
- {
- var response = await UploadNewVersionUsingSessionAsync(stream, fileId, fileName, timeout, progress).ConfigureAwait(false);
- return response.FileVersion;
- }
-
///
/// Upload a new large file version by splitting them up and uploads in a session.
///
@@ -863,25 +821,6 @@ public async Task DeleteSharedLinkAsync(string id, IEnumerable
return response.ResponseObject;
}
- ///
- /// Use this to get a list of all the collaborations on a file
- ///
- /// Id of the file
- /// Attribute(s) to include in the response
- /// Collection of the collaborations on a file
- [Obsolete("Use GetCollaborationsCollectionAsync() instead; this method does not return the data needed to page through the collection.")]
- public async Task> GetCollaborationsAsync(string id, IEnumerable fields = null)
- {
- id.ThrowIfNullOrWhiteSpace("id");
-
- BoxRequest request = new BoxRequest(_config.FilesEndpointUri, string.Format(Constants.CollaborationsPathString, id))
- .Param(ParamFields, fields);
-
- IBoxResponse> response = await ToResponseAsync>(request).ConfigureAwait(false);
-
- return response.ResponseObject;
- }
-
///
/// Use this to get a list of all the collaborations on a file
///
@@ -987,68 +926,6 @@ public async Task GetPreviewLinkAsync(string id)
return file.ExpiringEmbedLink.Url;
}
- ///
- /// Gets the stream of a preview page
- ///
- ///
- ///
- /// ///
- /// A PNG of the preview
- [Obsolete("Please use GetPreviewLinkAsync instead. This functionality is not supported by Box.")]
- public async Task GetPreviewAsync(string id, int page, bool handleRetry = true)
- {
- return (await GetPreviewResponseAsync(id, page, handleRetry: handleRetry).ConfigureAwait(false)).ResponseObject;
- }
-
- ///
- /// Get the preview and return a BoxFilePreview response.
- ///
- /// id of the file to return.
- /// page number of the file.
- /// specifies whether the method handles retries. If true, then the method would retry the call if the HTTP response is 'Accepted'. The delay for the retry is determined
- /// by the RetryAfter header, or if that header is not set, by the constant DefaultRetryDelay.
- /// BoxFilePreview that contains the stream, current page number and total number of pages in the file.
- [Obsolete("Please use GetPreviewLinkAsync instead. This functionality is not supported by Box.")]
- public async Task GetFilePreviewAsync(string id, int page, int? maxWidth = null, int? minWidth = null, int? maxHeight = null, int? minHeight = null, bool handleRetry = true)
- {
- IBoxResponse response = await GetPreviewResponseAsync(id, page, maxWidth, minWidth, maxHeight, minHeight, handleRetry).ConfigureAwait(false);
-
- var filePreview = new BoxFilePreview
- {
- CurrentPage = page,
- ReturnedStatusCode = response.StatusCode
- };
-
- if (response.StatusCode == HttpStatusCode.OK)
- {
- filePreview.PreviewStream = response.ResponseObject;
- filePreview.TotalPages = response.BuildPagesCount();
- }
-
- return filePreview;
- }
-
- private async Task> GetPreviewResponseAsync(string id, int page, int? maxWidth = null, int? minWidth = null, int? maxHeight = null, int? minHeight = null, bool handleRetry = true)
- {
- id.ThrowIfNullOrWhiteSpace("id");
-
- BoxRequest request = new BoxRequest(_config.FilesEndpointUri, string.Format(Constants.PreviewPathString, id))
- .Param("page", page.ToString())
- .Param("max_width", maxWidth.ToString())
- .Param("max_height", maxHeight.ToString())
- .Param("min_width", minWidth.ToString())
- .Param("min_height", minHeight.ToString());
-
- var response = await ToResponseAsync(request).ConfigureAwait(false);
-
- while (response.StatusCode == HttpStatusCode.Accepted && handleRetry)
- {
- await Task.Delay(GetTimeDelay(response.Headers));
- response = await ToResponseAsync(request).ConfigureAwait(false);
- }
-
- return response;
- }
///
/// Return the time to wait until retrying the call. If no RetryAfter value is specified in the header, use default value;
diff --git a/Box.V2/Managers/BoxFoldersManager.cs b/Box.V2/Managers/BoxFoldersManager.cs
index 60486e415..7c8082992 100644
--- a/Box.V2/Managers/BoxFoldersManager.cs
+++ b/Box.V2/Managers/BoxFoldersManager.cs
@@ -16,27 +16,6 @@ public class BoxFoldersManager : BoxResourceManager, IBoxFoldersManager
public BoxFoldersManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
: base(config, service, converter, auth, asUser, suppressNotifications) { }
- ///
- /// Retrieves the files and/or folders contained in the provided folder id
- ///
- ///
- ///
- ///
- [Obsolete("This endpoint is not officially supported by the API and is not guaranteed to be available in the next version. Please use GetFolderItemsAsync")]
- public async Task GetItemsAsync(string id, int limit, int offset = 0, IEnumerable fields = null)
- {
- id.ThrowIfNullOrWhiteSpace("id");
-
- BoxRequest request = new BoxRequest(_config.FoldersEndpointUri, id)
- .Param("limit", limit.ToString())
- .Param("offset", offset.ToString())
- .Param(ParamFields, fields);
-
- IBoxResponse response = await ToResponseAsync(request).ConfigureAwait(false);
-
- return response.ResponseObject;
- }
-
///
/// Retrieves the files and/or folders contained within this folder without any other metadata about the folder.
/// Any attribute in the full files or folders objects can be passed in with the fields parameter to get specific attributes,
@@ -291,33 +270,6 @@ public async Task> GetTrashItemsAsync(int limit, int offs
}
}
- ///
- /// Retrieves the files and/or folders that have been moved to the trash. Any attribute in the full files
- /// or folders objects can be passed in with the fields parameter to get specific attributes, and only those
- /// specific attributes back; otherwise, the mini format is returned for each item by default. Multiple
- /// attributes can be passed in separated by commas e.g. fields=name,created_at. Paginated results can be
- /// retrieved using the limit and offset parameters.
- ///
- /// This param is not used in implementation
- /// The maximum number of items to return
- /// The item at which to begin the response
- /// Attribute(s) to include in the response
- /// A collection of items contained in the trash is returned. An error is thrown if any of the parameters are invalid.
- [Obsolete("This method will be removed in a future update. Please use the GetTrashItemsAsync(int, int, IEnumerable) overload")]
- public async Task> GetTrashItemsAsync(string id, int limit, int offset = 0, IEnumerable fields = null)
- {
- id.ThrowIfNullOrWhiteSpace("id");
-
- BoxRequest request = new BoxRequest(_config.FoldersEndpointUri, Constants.TrashItemsPathString)
- .Param("limit", limit.ToString())
- .Param("offset", offset.ToString())
- .Param(ParamFields, fields);
-
- IBoxResponse> response = await ToResponseAsync>(request).ConfigureAwait(false);
-
- return response.ResponseObject;
- }
-
///
/// Restores an item that has been moved to the trash. Default behavior is to restore the item to the folder it was in
/// before it was moved to the trash. If that parent folder no longer exists or if there is now an item with the same
diff --git a/Box.V2/Managers/BoxMetadataManager.cs b/Box.V2/Managers/BoxMetadataManager.cs
index a1fc98309..25196f108 100644
--- a/Box.V2/Managers/BoxMetadataManager.cs
+++ b/Box.V2/Managers/BoxMetadataManager.cs
@@ -313,85 +313,6 @@ public async Task>
return response.ResponseObject;
}
- ///
- /// Allows you to query by metadata on Box items
- ///
- /// The template used in the query. Must be in the form scope.templateKey
- /// The folder_id to which to restrain the query
- /// The logical expression of the query
- /// Required if query present. The arguments for the query
- /// The name of the Index to use
- /// A list of BoxMetadataQueryOrderBy objects that contain field_key(s) to order on and the corresponding direction(s)
- /// The maximum number of items to return in a page. The default is 100 and the max is 1000.
- /// The marker to use for requesting the next page
- /// Whether or not to auto-paginate to fetch all items; defaults to false.
- /// A collection of items and their associated metadata
- [Obsolete("This method is deprecated in favor of ExecuteMetadataQueryAsync() that has a fields parameter. The API will eventually not support this method.")]
- public async Task> ExecuteMetadataQueryAsync(string from, string ancestorFolderId, string query = null, Dictionary queryParameters = null, string indexName = null, List orderBy = null, int limit = 100, string marker = null, bool autoPaginate = false)
- {
- from.ThrowIfNullOrWhiteSpace("from");
- ancestorFolderId.ThrowIfNullOrWhiteSpace("ancestorFolderId");
-
- JObject bodyObject = GetMetadataQueryBody(from, ancestorFolderId, query, queryParameters, orderBy, null, limit, marker);
-
- BoxRequest request = new BoxRequest(_config.MetadataQueryUri)
- .Method(RequestMethod.Post)
- .Payload(_converter.Serialize(bodyObject));
- request.ContentType = Constants.RequestParameters.ContentTypeJson;
-
- if (autoPaginate)
- {
- return await AutoPaginateMarkerMetadataQuery(request).ConfigureAwait(false);
- }
- else
- {
- IBoxResponse> response = await ToResponseAsync>(request).ConfigureAwait(false);
- return response.ResponseObject;
- }
- }
-
- ///
- /// Allows you to query by metadata on Box items with fields passed in
- ///
- /// The template used in the query. Must be in the form scope.templateKey
- /// The folder_id to which to restrain the query
- /// Attribute(s) to include in the response
- /// The logical expression of the query
- /// Required if query present. The arguments for the query
- /// The name of the Index to use
- /// A list of BoxMetadataQueryOrderBy objects that contain field_key(s) to order on and the corresponding direction(s)
- /// The maximum number of items to return in a page. The default is 100 and the max is 1000.
- /// The marker to use for requesting the next page
- /// Whether or not to auto-paginate to fetch all items; defaults to false.
- /// A collection of items and their associated metadata
- [Obsolete("This method no longer supports use_index. Use ExecuteMetadataQueryAsync(BoxMetadataQueryRequest queryRequest) instead.")]
- public async Task> ExecuteMetadataQueryAsync(string from, string ancestorFolderId, IEnumerable fields, string query = null, Dictionary queryParameters = null, string indexName = null, List orderBy = null, int limit = 100, string marker = null, bool autoPaginate = false)
- {
- from.ThrowIfNullOrWhiteSpace("from");
- ancestorFolderId.ThrowIfNullOrWhiteSpace("ancestorFolderId");
- if (fields == null)
- {
- throw new ArgumentException("Required field cannot be null", "fields");
- }
-
- JObject bodyObject = GetMetadataQueryBody(from, ancestorFolderId, query, queryParameters, orderBy, fields, limit, marker);
-
- BoxRequest request = new BoxRequest(_config.MetadataQueryUri)
- .Method(RequestMethod.Post)
- .Payload(_converter.Serialize(bodyObject));
- request.ContentType = Constants.RequestParameters.ContentTypeJson;
-
- if (autoPaginate)
- {
- return await AutoPaginateMarkerMetadataQueryV2(request).ConfigureAwait(false);
- }
- else
- {
- IBoxResponse> response = await ToResponseAsync>(request).ConfigureAwait(false);
- return response.ResponseObject;
- }
- }
-
///
/// Allows you to query by metadata on Box items with fields passed in
///
diff --git a/Box.V2/Managers/BoxResourceManager.cs b/Box.V2/Managers/BoxResourceManager.cs
index 60740f436..569853aff 100644
--- a/Box.V2/Managers/BoxResourceManager.cs
+++ b/Box.V2/Managers/BoxResourceManager.cs
@@ -5,7 +5,7 @@
using Box.V2.Models;
using Box.V2.Services;
using Box.V2.Utility;
-#if NET45
+#if NET462
using Microsoft.Win32;
using System.Security;
#endif
@@ -69,14 +69,15 @@ protected IBoxRequest AddDefaultHeaders(IBoxRequest request)
return request;
}
- protected async Task> ToResponseAsync(IBoxRequest request, bool queueRequest = false)
+ protected async Task> ToResponseAsync(IBoxRequest request, bool queueRequest = false,
+ IBoxConverter converter = null)
where T : class
{
AddDefaultHeaders(request);
AddAuthorization(request);
var response = await ExecuteRequest(request, queueRequest).ConfigureAwait(false);
- return response.ParseResults(_converter);
+ return converter != null ? response.ParseResults(converter) : response.ParseResults(_converter);
}
private async Task> ExecuteRequest(IBoxRequest request, bool queueRequest)
@@ -115,25 +116,10 @@ protected void AddAuthorization(IBoxRequest request, string accessToken = null)
{
var auth = accessToken ?? _auth.Session.AccessToken;
- var authString = _auth.Session.AuthVersion == AuthVersion.V1 ?
- string.Format(CultureInfo.InvariantCulture, Constants.V1AuthString, _config.ClientId, auth) :
- string.Format(CultureInfo.InvariantCulture, Constants.V2AuthString, auth);
-
- var sb = new StringBuilder(authString);
-
- // Appending device_id is required for accounts that have device pinning enabled on V1 auth
- if (_auth.Session.AuthVersion == AuthVersion.V1)
- {
- sb.Append(string.IsNullOrWhiteSpace(_config.DeviceId) ?
- string.Empty :
- string.Format("&device_id={0}", _config.DeviceId));
- sb.Append(string.IsNullOrWhiteSpace(_config.DeviceName) ?
- string.Empty :
- string.Format("&device_name={0}", _config.DeviceName));
- }
+ var authString = string.Format(CultureInfo.InvariantCulture, Constants.V2AuthString, auth);
request.Authorization = auth;
- request.Header(Constants.AuthHeaderKey, sb.ToString());
+ request.Header(Constants.AuthHeaderKey, authString);
}
///
@@ -308,7 +294,7 @@ protected string GetBoxUAHeader()
private string GetEnvNameAndVersion()
{
-#if NET45
+#if NET462
const string Subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
RegistryKey ndpKey;
@@ -329,7 +315,7 @@ private string GetEnvNameAndVersion()
{
if (ndpKey != null && ndpKey.GetValue("Release") != null)
{
- var frameworkVersion = CheckFor45PlusVersion((int)ndpKey.GetValue("Release"));
+ var frameworkVersion = CheckFor462PlusVersion((int)ndpKey.GetValue("Release"));
return frameworkVersion != null ? "env=.NET Framework/" + frameworkVersion : "";
}
else
@@ -347,10 +333,19 @@ FAIL THE BUILD
}
// Checking the version using >= will enable forward compatibility.
- private string CheckFor45PlusVersion(int releaseKey)
+ private string CheckFor462PlusVersion(int releaseKey)
{
+ if (releaseKey >= 533320)
+ return "4.8.1+";
+
+ if (releaseKey >= 528040)
+ return "4.8";
+
+ if (releaseKey >= 461808)
+ return "4.7.2";
+
if (releaseKey >= 461308)
- return "4.7.1+";
+ return "4.7.1";
if (releaseKey >= 460798)
return "4.7";
@@ -358,22 +353,8 @@ private string CheckFor45PlusVersion(int releaseKey)
if (releaseKey >= 394802)
return "4.6.2";
- if (releaseKey >= 394254)
- return "4.6.1";
-
- if (releaseKey >= 393295)
- return "4.6";
-
- if (releaseKey >= 379893)
- return "4.5.2";
-
- if (releaseKey >= 378675)
- return "4.5.1";
-
- if (releaseKey >= 378389)
- return "4.5";
// This code should never execute. A non-null release key should mean
- // that 4.5 or later is installed.
+ // that 4.6.2 or later is installed.
return null;
}
diff --git a/Box.V2/Managers/BoxRetentionPoliciesManager.cs b/Box.V2/Managers/BoxRetentionPoliciesManager.cs
index 39d67101c..0a1cc4cf6 100644
--- a/Box.V2/Managers/BoxRetentionPoliciesManager.cs
+++ b/Box.V2/Managers/BoxRetentionPoliciesManager.cs
@@ -283,7 +283,7 @@ public async Task> GetFilesUnderRetentionForAs
/// Take from "next_marker" column of a prior call to get the next page.
/// Whether or not to auto-paginate to fetch all items; defaults to false.
/// Returns the list of all file versions under retentions for the assignment.
- public async Task> GetFileVersionsUnderRetentionForAssignmentAsync(string retentionPolicyAssignmentId, IEnumerable fields = null, int limit = 100, string marker = null, bool autoPaginate = false)
+ public async Task> GetFileVersionsUnderRetentionForAssignmentAsync(string retentionPolicyAssignmentId, IEnumerable fields = null, int limit = 100, string marker = null, bool autoPaginate = false)
{
BoxRequest request = new BoxRequest(_config.RetentionPolicyAssignmentsUri, string.Format(Constants.FileVersionsUnderRetentionEndpointString, retentionPolicyAssignmentId))
.Param("retention_policy_assignment_id", retentionPolicyAssignmentId)
@@ -293,11 +293,12 @@ public async Task> GetFileVersionsUnder
if (autoPaginate)
{
- return await AutoPaginateMarker(request, limit).ConfigureAwait(false);
+ return await AutoPaginateMarker(request, limit).ConfigureAwait(false);
}
else
{
- var response = await ToResponseAsync>(request).ConfigureAwait(false);
+ var response = await ToResponseAsync>(request, false,
+ new BoxFileVersionsUnderRetentionJsonConverter()).ConfigureAwait(false);
return response.ResponseObject;
}
}
diff --git a/Box.V2/Managers/BoxSearchManager.cs b/Box.V2/Managers/BoxSearchManager.cs
index ba9344e72..a368290a0 100644
--- a/Box.V2/Managers/BoxSearchManager.cs
+++ b/Box.V2/Managers/BoxSearchManager.cs
@@ -19,89 +19,6 @@ public class BoxSearchManager : BoxResourceManager, IBoxSearchManager
public BoxSearchManager(IBoxConfig config, IBoxService service, IBoxConverter converter, IAuthRepository auth, string asUser = null, bool? suppressNotifications = null)
: base(config, service, converter, auth, asUser, suppressNotifications) { }
-
- ///
- /// Search for items that are accessible by a single user or an entire enterprise.
- ///
- /// The string to search for. Box matches the search string against object names, descriptions, text contents of files, and other data.
- /// Number of search results to return. The default is 30 and the maximum is 200.
- /// The search result at which to start the response. The default is 0.
- /// Attribute(s) to include in the response.
- /// The scope for which you want to limit your search to. Can be user_content for a search limited to only the current user or enterprise_content for the entire enterprise. To enable the enterprise_content scope for an administrator, please contact Box.
- /// Limit searches to specific file extension(s).
- /// The from date for when the item was created
- /// The to date for when the item was created
- /// The from date for when the item was last updated
- /// The to date for when the item was last updated
- /// The lower bound of the file size range in bytes
- /// The upper bound of the file size range in bytes
- /// Search by item owners
- /// Limit searches to specific parent folders
- /// Limit searches to specific Box designated content types. Can be name, description, file_content, comments, or tags.
- /// The type you want to return in your search. Can be file, folder, or web_link
- /// Allows you to search within the trash. Can be trashed_only or non_trashed_only. Searches without this parameter default to non_trashed_only
- /// Filters for a specific metadata template for files with metadata object associations. NOTE: For searches with the mdfilters param, a query string is not required. Currenly only one BoxMetadataFilterRequest element is allowed.
- /// The field to sort the search results by, e.g. "modified_at.
- /// The direction to return the results. "ASC" for ascending and "DESC" for descending.
- /// A collection of search results is returned. If there are no matching search results, the collection will be empty.
- [Obsolete("Method is deprecated; use QueryAsync() instead")]
- public async Task> SearchAsync(string keyword = null,
- int limit = 30,
- int offset = 0,
- IEnumerable fields = null,
- string scope = null,
- IEnumerable fileExtensions = null,
- DateTimeOffset? createdAtRangeFromDate = null,
- DateTimeOffset? createdAtRangeToDate = null,
- DateTimeOffset? updatedAtRangeFromDate = null,
- DateTimeOffset? updatedAtRangeToDate = null,
- int? sizeRangeLowerBoundBytes = null,
- int? sizeRangeUpperBoundBytes = null,
- IEnumerable ownerUserIds = null,
- IEnumerable ancestorFolderIds = null,
- IEnumerable contentTypes = null,
- string type = null,
- string trashContent = null,
- List mdFilters = null,
- string sort = null,
- BoxSortDirection? direction = null)
-
- {
-
- string mdFiltersString = null;
- if (mdFilters != null)
- {
- mdFiltersString = _converter.Serialize(mdFilters);
- }
-
- var createdAtRangeString = BuildDateRangeField(createdAtRangeFromDate, createdAtRangeToDate);
- var updatedAtRangeString = BuildDateRangeField(updatedAtRangeFromDate, updatedAtRangeToDate);
- var sizeRangeString = BuildSizeRangeField(sizeRangeLowerBoundBytes, sizeRangeUpperBoundBytes);
-
- BoxRequest request = new BoxRequest(_config.SearchEndpointUri)
- .Param("query", keyword)
- .Param("scope", scope)
- .Param("file_extensions", fileExtensions)
- .Param("created_at_range", createdAtRangeString)
- .Param("updated_at_range", updatedAtRangeString)
- .Param("size_range", sizeRangeString)
- .Param("owner_user_ids", ownerUserIds)
- .Param("ancestor_folder_ids", ancestorFolderIds)
- .Param("content_types", contentTypes)
- .Param("type", type)
- .Param("trash_content", trashContent)
- .Param("mdfilters", mdFiltersString)
- .Param("limit", limit.ToString())
- .Param("offset", offset.ToString())
- .Param("sort", sort)
- .Param("direction", direction.ToString())
- .Param(ParamFields, fields);
-
- IBoxResponse> response = await ToResponseAsync>(request).ConfigureAwait(false);
-
- return response.ResponseObject;
- }
-
///
/// Search for items that are accessible by a single user or an entire enterprise.
///
diff --git a/Box.V2/Managers/BoxTermsOfServiceManager.cs b/Box.V2/Managers/BoxTermsOfServiceManager.cs
index 01c15007f..d5fcc1914 100644
--- a/Box.V2/Managers/BoxTermsOfServiceManager.cs
+++ b/Box.V2/Managers/BoxTermsOfServiceManager.cs
@@ -102,23 +102,6 @@ public async Task
- /// Create a terms of service status for user.
- ///
- /// The request object for terms of service user status.
- /// The status of the terms of service for a user.
- [Obsolete("Use CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceStatusCreateRequest termsOfServiceUserStatusCreateRequest) instead.")]
- public async Task CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceUserStatusesRequest termsOfServicesUserStatusesRequest)
- {
- BoxRequest request = new BoxRequest(_config.TermsOfServiceUserStatusesUri)
- .Method(RequestMethod.Post)
- .Payload(_converter.Serialize(termsOfServicesUserStatusesRequest));
-
- IBoxResponse response = await ToResponseAsync(request).ConfigureAwait(false);
-
- return response.ResponseObject;
- }
-
///
/// Create a terms of service status for user.
///
diff --git a/Box.V2/Managers/IBoxFilesManager.cs b/Box.V2/Managers/IBoxFilesManager.cs
index f00f4f30d..7879ed1d1 100644
--- a/Box.V2/Managers/IBoxFilesManager.cs
+++ b/Box.V2/Managers/IBoxFilesManager.cs
@@ -22,18 +22,6 @@ public interface IBoxFilesManager
/// A full file object is returned if the ID is valid and if the user has access to the file.
Task GetInformationAsync(string id, IEnumerable fields = null);
- ///
- /// Returns the stream of the requested file.
- ///
- /// Id of the file to download.
- /// The ID specific version of this file to download.
- /// Optional timeout for response.
- /// Optional timeout for response.
- /// Optional timeout for response.
- /// Stream of the requested file.
- [Obsolete("This method is deprecated in favor of DownloadAsync()")]
- Task DownloadStreamAsync(string id, string versionId = null, TimeSpan? timeout = null, int? startOffsetInBytes = null, int? endOffsetInBytes = null);
-
///
/// Returns the stream of the requested file.
///
@@ -180,18 +168,6 @@ Task UploadNewVersionAsync(string fileName, string fileId, Stream strea
/// Returns an object representing the status of the upload session.
Task GetSessionUploadStatusAsync(Uri sessionUploadStatusUri);
- ///
- /// Upload a new large file version by splitting them up and uploads in a session.
- ///
- /// The file stream.
- /// Id of the remote file.
- /// Timeout for subsequent UploadPart requests.
- /// Will report progress from 1 - 100.
- /// The BoxFileVersion object.
- [Obsolete("UploadFileVersionUsingSessionAsync is deprecated, please use UploadNewVersionUsingSessionAsync instead.")]
- Task UploadFileVersionUsingSessionAsync(Stream stream, string fileId, string fileName = null,
- TimeSpan? timeout = null, IProgress progress = null);
-
///
/// Upload a new large file version by splitting them up and uploads in a session.
///
@@ -284,15 +260,6 @@ Task UploadUsingSessionAsync(Stream stream, string fileName,
/// if the ID is valid and if the update is successful.
Task DeleteSharedLinkAsync(string id, IEnumerable fields = null);
- ///
- /// Use this to get a list of all the collaborations on a file
- ///
- /// Id of the file
- /// Attribute(s) to include in the response
- /// Collection of the collaborations on a file
- [Obsolete("Use GetCollaborationsCollectionAsync() instead; this method does not return the data needed to page through the collection.")]
- Task> GetCollaborationsAsync(string id, IEnumerable fields = null);
-
///
/// Use this to get a list of all the collaborations on a file
///
@@ -338,27 +305,6 @@ Task UploadUsingSessionAsync(Stream stream, string fileName,
/// Preview link (URI) for a file that is valid for 60 seconds.
Task GetPreviewLinkAsync(string id);
- ///
- /// Gets the stream of a preview page
- ///
- ///
- ///
- /// ///
- /// A PNG of the preview
- [Obsolete("Please use GetPreviewLinkAsync instead. This functionality is not supported by Box.")]
- Task GetPreviewAsync(string id, int page, bool handleRetry = true);
-
- ///
- /// Get the preview and return a BoxFilePreview response.
- ///
- /// id of the file to return.
- /// page number of the file.
- /// specifies whether the method handles retries. If true, then the method would retry the call if the HTTP response is 'Accepted'. The delay for the retry is determined
- /// by the RetryAfter header, or if that header is not set, by the constant DefaultRetryDelay.
- /// BoxFilePreview that contains the stream, current page number and total number of pages in the file.
- [Obsolete("Please use GetPreviewLinkAsync instead. This functionality is not supported by Box.")]
- Task GetFilePreviewAsync(string id, int page, int? maxWidth = null, int? minWidth = null, int? maxHeight = null, int? minHeight = null, bool handleRetry = true);
-
///
/// Retrieves an item that has been moved to the trash.
///
diff --git a/Box.V2/Managers/IBoxFoldersManager.cs b/Box.V2/Managers/IBoxFoldersManager.cs
index 635a0eee0..fc19302be 100644
--- a/Box.V2/Managers/IBoxFoldersManager.cs
+++ b/Box.V2/Managers/IBoxFoldersManager.cs
@@ -7,15 +7,6 @@ namespace Box.V2.Managers
{
public interface IBoxFoldersManager
{
- ///
- /// Retrieves the files and/or folders contained in the provided folder id
- ///
- ///
- ///
- ///
- [Obsolete("This endpoint is not officially supported by the API and is not guaranteed to be available in the next version. Please use GetFolderItemsAsync")]
- Task GetItemsAsync(string id, int limit, int offset = 0, IEnumerable fields = null);
-
///
/// Retrieves the files and/or folders contained within this folder without any other metadata about the folder.
/// Any attribute in the full files or folders objects can be passed in with the fields parameter to get specific attributes,
@@ -127,21 +118,6 @@ public interface IBoxFoldersManager
/// A collection of items contained in the trash is returned. An error is thrown if any of the parameters are invalid.
Task> GetTrashItemsAsync(int limit, int offset = 0, IEnumerable fields = null, bool autoPaginate = false, string sort = null, BoxSortDirection? direction = null);
- ///
- /// Retrieves the files and/or folders that have been moved to the trash. Any attribute in the full files
- /// or folders objects can be passed in with the fields parameter to get specific attributes, and only those
- /// specific attributes back; otherwise, the mini format is returned for each item by default. Multiple
- /// attributes can be passed in separated by commas e.g. fields=name,created_at. Paginated results can be
- /// retrieved using the limit and offset parameters.
- ///
- /// This param is not used in implementation
- /// The maximum number of items to return
- /// The item at which to begin the response
- /// Attribute(s) to include in the response
- /// A collection of items contained in the trash is returned. An error is thrown if any of the parameters are invalid.
- [Obsolete("This method will be removed in a future update. Please use the GetTrashItemsAsync(int, int, IEnumerable) overload")]
- Task> GetTrashItemsAsync(string id, int limit, int offset = 0, IEnumerable fields = null);
-
///
/// Restores an item that has been moved to the trash. Default behavior is to restore the item to the folder it was in
/// before it was moved to the trash. If that parent folder no longer exists or if there is now an item with the same
diff --git a/Box.V2/Managers/IBoxMetadataManager.cs b/Box.V2/Managers/IBoxMetadataManager.cs
index dc2c72fef..d3366af79 100644
--- a/Box.V2/Managers/IBoxMetadataManager.cs
+++ b/Box.V2/Managers/IBoxMetadataManager.cs
@@ -167,39 +167,6 @@ public interface IBoxMetadataManager
/// Collection of enterprise metadata instances associated with the file.
Task> GetEnterpriseMetadataAsync(string scope = "enterprise");
- ///
- /// Allows you to query by metadata on Box items
- ///
- /// The template used in the query. Must be in the form scope.templateKey
- /// The folder_id to which to restrain the query
- /// The logical expression of the query
- /// Required if query present. The arguments for the query
- /// The name of the Index to use
- /// A list of BoxMetadataQueryOrderBy objects that contain field_key(s) to order on and the corresponding direction(s)
- /// The maximum number of items to return in a page. The default is 100 and the max is 1000.
- /// The marker to use for requesting the next page
- /// Whether or not to auto-paginate to fetch all items; defaults to false.
- /// A collection of items and their associated metadata
- [Obsolete("This method is deprecated in favor of ExecuteMetadataQueryAsync() that has a fields parameter. The API will eventually not support this method.")]
- Task> ExecuteMetadataQueryAsync(string from, string ancestorFolderId, string query = null, Dictionary queryParameters = null, string indexName = null, List orderBy = null, int limit = 100, string marker = null, bool autoPaginate = false);
-
- ///
- /// Allows you to query by metadata on Box items with fields passed in
- ///
- /// The template used in the query. Must be in the form scope.templateKey
- /// The folder_id to which to restrain the query
- /// Attribute(s) to include in the response
- /// The logical expression of the query
- /// Required if query present. The arguments for the query
- /// The name of the Index to use
- /// A list of BoxMetadataQueryOrderBy objects that contain field_key(s) to order on and the corresponding direction(s)
- /// The maximum number of items to return in a page. The default is 100 and the max is 1000.
- /// The marker to use for requesting the next page
- /// Whether or not to auto-paginate to fetch all items; defaults to false.
- /// A collection of items and their associated metadata
- [Obsolete("This method no longer supports use_index. Use ExecuteMetadataQueryAsync(BoxMetadataQueryRequest queryRequest) instead.")]
- Task> ExecuteMetadataQueryAsync(string from, string ancestorFolderId, IEnumerable fields, string query = null, Dictionary queryParameters = null, string indexName = null, List orderBy = null, int limit = 100, string marker = null, bool autoPaginate = false);
-
///
/// Allows you to query by metadata on Box items with fields passed in
///
diff --git a/Box.V2/Managers/IBoxRetentionPoliciesManager.cs b/Box.V2/Managers/IBoxRetentionPoliciesManager.cs
index df48539f4..0da5e3571 100644
--- a/Box.V2/Managers/IBoxRetentionPoliciesManager.cs
+++ b/Box.V2/Managers/IBoxRetentionPoliciesManager.cs
@@ -134,6 +134,6 @@ public interface IBoxRetentionPoliciesManager
/// Take from "next_marker" column of a prior call to get the next page.
/// Whether or not to auto-paginate to fetch all items; defaults to false.
/// Returns the list of all file versions under retentions for the assignment.
- Task> GetFileVersionsUnderRetentionForAssignmentAsync(string retentionPolicyAssignmentId, IEnumerable fields = null, int limit = 100, string marker = null, bool autoPaginate = false);
+ Task> GetFileVersionsUnderRetentionForAssignmentAsync(string retentionPolicyAssignmentId, IEnumerable fields = null, int limit = 100, string marker = null, bool autoPaginate = false);
}
}
diff --git a/Box.V2/Managers/IBoxSearchManager.cs b/Box.V2/Managers/IBoxSearchManager.cs
index f1e3b3f4f..71fc72533 100644
--- a/Box.V2/Managers/IBoxSearchManager.cs
+++ b/Box.V2/Managers/IBoxSearchManager.cs
@@ -11,52 +11,6 @@ namespace Box.V2.Managers
///
public interface IBoxSearchManager
{
- ///
- /// Search for items that are accessible by a single user or an entire enterprise.
- ///
- /// The string to search for. Box matches the search string against object names, descriptions, text contents of files, and other data.
- /// Number of search results to return. The default is 30 and the maximum is 200.
- /// The search result at which to start the response. The default is 0.
- /// Attribute(s) to include in the response.
- /// The scope for which you want to limit your search to. Can be user_content for a search limited to only the current user or enterprise_content for the entire enterprise. To enable the enterprise_content scope for an administrator, please contact Box.
- /// Limit searches to specific file extension(s).
- /// The from date for when the item was created
- /// The to date for when the item was created
- /// The from date for when the item was last updated
- /// The to date for when the item was last updated
- /// The lower bound of the file size range in bytes
- /// The upper bound of the file size range in bytes
- /// Search by item owners
- /// Limit searches to specific parent folders
- /// Limit searches to specific Box designated content types. Can be name, description, file_content, comments, or tags.
- /// The type you want to return in your search. Can be file, folder, or web_link
- /// Allows you to search within the trash. Can be trashed_only or non_trashed_only. Searches without this parameter default to non_trashed_only
- /// Filters for a specific metadata template for files with metadata object associations. NOTE: For searches with the mdfilters param, a query string is not required. Currenly only one BoxMetadataFilterRequest element is allowed.
- /// The field to sort the search results by, e.g. "modified_at.
- /// The direction to return the results. "ASC" for ascending and "DESC" for descending.
- /// A collection of search results is returned. If there are no matching search results, the collection will be empty.
- [Obsolete("Method is deprecated; use QueryAsync() instead")]
- Task> SearchAsync(string keyword = null,
- int limit = 30,
- int offset = 0,
- IEnumerable fields = null,
- string scope = null,
- IEnumerable fileExtensions = null,
- DateTimeOffset? createdAtRangeFromDate = null,
- DateTimeOffset? createdAtRangeToDate = null,
- DateTimeOffset? updatedAtRangeFromDate = null,
- DateTimeOffset? updatedAtRangeToDate = null,
- int? sizeRangeLowerBoundBytes = null,
- int? sizeRangeUpperBoundBytes = null,
- IEnumerable ownerUserIds = null,
- IEnumerable ancestorFolderIds = null,
- IEnumerable contentTypes = null,
- string type = null,
- string trashContent = null,
- List mdFilters = null,
- string sort = null,
- BoxSortDirection? direction = null);
-
///
/// Search for items that are accessible by a single user or an entire enterprise.
///
diff --git a/Box.V2/Managers/IBoxTermsOfServiceManager.cs b/Box.V2/Managers/IBoxTermsOfServiceManager.cs
index 36c5d6fad..8e92ffb77 100644
--- a/Box.V2/Managers/IBoxTermsOfServiceManager.cs
+++ b/Box.V2/Managers/IBoxTermsOfServiceManager.cs
@@ -47,14 +47,6 @@ public interface IBoxTermsOfServiceManager
/// The user status for terms of service objects.
Task> GetTermsOfServiceUserStatusesAsync(string tosId, string userId = null);
- ///
- /// Create a terms of service status for user.
- ///
- /// The request object for terms of service user status.
- /// The status of the terms of service for a user.
- [Obsolete("Use CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceStatusCreateRequest termsOfServiceUserStatusCreateRequest) instead.")]
- Task CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceUserStatusesRequest termsOfServicesUserStatusesRequest);
-
///
/// Create a terms of service status for user.
///
diff --git a/Box.V2/Models/BoxFileVersion.cs b/Box.V2/Models/BoxFileVersion.cs
index 227a1f543..f66a649d1 100644
--- a/Box.V2/Models/BoxFileVersion.cs
+++ b/Box.V2/Models/BoxFileVersion.cs
@@ -20,7 +20,6 @@ public class BoxFileVersion : BoxEntity
public const string FieldPurgedAt = "purged_at";
public const string FieldRestoredAt = "restored_at";
public const string FieldRestoredBy = "restored_by";
- public const string FieldFileVersion = "file_version";
public const string FieldVersionNumber = "version_number";
///
@@ -98,12 +97,6 @@ public class BoxFileVersion : BoxEntity
[JsonProperty(PropertyName = FieldRestoredBy)]
public virtual BoxUser RestoredBy { get; private set; }
- ///
- /// Represents a version of a file on Box
- ///
- [JsonProperty(PropertyName = FieldFileVersion)]
- public virtual BoxFileVersion FileVersion { get; private set; }
-
///
/// The version number of the file version
///
diff --git a/Box.V2/Models/BoxPreflightCheck.cs b/Box.V2/Models/BoxPreflightCheck.cs
index d6fe9c6c0..6a0c667de 100644
--- a/Box.V2/Models/BoxPreflightCheck.cs
+++ b/Box.V2/Models/BoxPreflightCheck.cs
@@ -9,14 +9,12 @@ namespace Box.V2.Models
public class BoxPreflightCheck
{
public const string FieldUploadUrl = "upload_url";
- [Obsolete]
public const string FieldUploadToken = "upload_token";
///
/// The upload URL to optionally use when uploading the file
///
[JsonProperty(PropertyName = FieldUploadUrl)]
- [Obsolete]
public virtual string UploadUrl { get; private set; }
///
@@ -31,10 +29,9 @@ public virtual Uri UploadUri
}
///
- /// Currently not used.
+ /// An optional access token to use to upload the file.
///
[JsonProperty(PropertyName = FieldUploadToken)]
- [Obsolete]
public virtual string UploadToken { get; private set; }
///
diff --git a/Box.V2/Models/BoxTaskAssignment.cs b/Box.V2/Models/BoxTaskAssignment.cs
index 4ef68de6f..61965400e 100644
--- a/Box.V2/Models/BoxTaskAssignment.cs
+++ b/Box.V2/Models/BoxTaskAssignment.cs
@@ -55,14 +55,13 @@ public class BoxTaskAssignment : BoxEntity
public virtual DateTimeOffset? RemindedAt { get; private set; }
///
- /// Gets the state of the resolution.
+ /// Gets the state of the resolution as an Enum.
///
- [Obsolete("This field is deprecated, and may not work consistently. Use Status or LocalizedStatus instead.")]
public virtual ResolutionStateType? ResolutionState
{
get
{
- return (ResolutionStateType)System.Enum.Parse(typeof(ResolutionStateType), Status, ignoreCase: true);
+ return (ResolutionStateType)Enum.Parse(typeof(ResolutionStateType), LocalizedStatus, ignoreCase: true);
}
}
@@ -73,7 +72,7 @@ public virtual ResolutionStateType? ResolutionState
public virtual string Status { get; private set; }
///
- /// Gets the localized/human-readable resolution status of the task assignment.
+ /// Gets the localized/human-readable resolution status of the task assignment in a string format.
///
[JsonProperty(PropertyName = FieldResolutionState)]
public virtual string LocalizedStatus { get; private set; }
diff --git a/Box.V2/Models/OAuthSession.cs b/Box.V2/Models/OAuthSession.cs
index 11566cd9e..24714d792 100644
--- a/Box.V2/Models/OAuthSession.cs
+++ b/Box.V2/Models/OAuthSession.cs
@@ -1,4 +1,3 @@
-using System;
using Box.V2.Models;
using Newtonsoft.Json;
@@ -25,25 +24,11 @@ public class OAuthSession
/// Token type (usually bearer)
[JsonConstructor]
public OAuthSession(string access_token, string refresh_token, int expires_in, string token_type)
- : this(access_token, refresh_token, expires_in, token_type, AuthVersion.V2) { }
-
- ///
- /// Instantiates a new OAuth 2 session and allows you to define the auth version. This constructor is primarily
- /// available to support legacy V1 calls. Creating an Auth session with V1 is not encouraged as they will not work in 2014
- ///
- /// A valid access token
- /// A valid refresh token
- /// Time in seconds the access token will expire
- /// Token type (usually bearer)
- /// V1 or V2 auth
- [Obsolete("V1 auth will no longer be available after 6/14")]
- public OAuthSession(string access_token, string refresh_token, int expires_in, string token_type, AuthVersion authVersion)
{
AccessToken = access_token;
RefreshToken = refresh_token;
ExpiresIn = expires_in;
TokenType = token_type;
- AuthVersion = authVersion;
}
///
@@ -81,19 +66,5 @@ public OAuthSession(string access_token, string refresh_token, int expires_in, s
///
[JsonProperty(PropertyName = FieldRestrictedTo)]
public virtual BoxRestrictedTo[] RestrictedTo { get; private set; }
-
- ///
- /// Read-only property to provide support for legacy V1 authentication
- ///
- public virtual AuthVersion AuthVersion { get; private set; }
- }
-
- ///
- /// Allows the SDK to differentiate between a V1 and a V2 auth token
- ///
- public enum AuthVersion
- {
- V1,
- V2
}
}
diff --git a/Box.V2/Models/Request/BoxPermissionsRequest.cs b/Box.V2/Models/Request/BoxPermissionsRequest.cs
index fed4d3da8..f0cfb7cbf 100644
--- a/Box.V2/Models/Request/BoxPermissionsRequest.cs
+++ b/Box.V2/Models/Request/BoxPermissionsRequest.cs
@@ -15,14 +15,6 @@ public class BoxPermissionsRequest
[JsonProperty(PropertyName = "can_download")]
public bool Download { get; set; }
- ///
- /// Whether this link allows previews. Can only be used with Open and Company
- ///
- [Obsolete("CanPreview is now deprecated in the API and cannot be altered. Results will always be true")]
- [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
diff --git a/Box.V2/Request/HttpRequestHandler.cs b/Box.V2/Request/HttpRequestHandler.cs
index 15fa2ab82..e4e68ce5d 100644
--- a/Box.V2/Request/HttpRequestHandler.cs
+++ b/Box.V2/Request/HttpRequestHandler.cs
@@ -22,7 +22,7 @@ public class HttpRequestHandler : IRequestHandler
public HttpRequestHandler(IWebProxy webProxy = null, TimeSpan? timeout = null)
{
ClientFactory.WebProxy = webProxy;
-#if NET45
+#if NET462
System.Net.ServicePointManager.Expect100Continue = false;
#endif
_timeout = timeout ?? _defaultRequestTimeout;
@@ -292,7 +292,7 @@ private static HttpClient CreateClient(bool followRedirect, IWebProxy webProxy)
{
Debug.WriteLine("Could not set TLSv1.2 security protocol!");
}
-#elif NET45
+#elif NET462
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
#else
FAIL THE BUILD
diff --git a/Box.V2/packages.config b/Box.V2/packages.config
index ff6d0bfca..4b18a6bcb 100644
--- a/Box.V2/packages.config
+++ b/Box.V2/packages.config
@@ -1,9 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index e6a1d28d2..5200bf51a 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,14 @@
# Box Windows V2 SDK
[](http://opensource.box.com/badges)
-
+

[](https://raw.githubusercontent.com/box/box-windows-sdk-v2/main/LICENSE)
[](https://github.com/box/box-windows-sdk-v2/actions/workflows/build_and_test.yml)
The Box .NET SDK can be used to make API calls to the Box APIs in a .NET project.
-The SDK is available for both .NET Framework 4.5 and .NET Core 2.0 or above. The installation of the SDK depends on the platform used.
+The SDK is available for both .NET Framework 4.6.2 and .NET Core 2.0 or above. The installation of the SDK depends on the platform used.
## Table of contents
@@ -79,18 +79,23 @@ You can find detailed usage documentation and code samples under [docs](/docs/RE
We use a modified version of [Semantic Versioning](https://semver.org/) for all changes. See [version strategy](VERSIONS.md) for details which is effective from 30 July 2022.
### Supported Version
-
+
Only the current MAJOR version of SDK is supported. New features, functionality, bug fixes, and security updates will only be added to the current MAJOR version.
-
+
A current release is on the leading edge of our SDK development, and is intended for customers who are in active development and want the latest and greatest features. Instead of stating a release date for a new feature, we set a fixed minor or patch release cadence of maximum 2-3 months (while we may release more often). At the same time, there is no schedule for major or breaking release. Instead, we will communicate one quarter in advance the upcoming breaking change to allow customers to plan for the upgrade. We always recommend that all users run the latest available minor release for whatever major version is in use. We highly recommend upgrading to the latest SDK major release at the earliest convenient time and before the EOL date.
### Version schedule
-| Version | Supported Environments | State | First Release | EOL/Terminated |
-|---------|---------------------------------------|-----------|---------------|----------------|
-| 4 | .NET Framework 4.5 and .NET Core 2.0+ | Supported | 02 Nov 2021 | TBD |
-| 3 | | EOL | 28 Jul 2017 | 02 Nov 2021 |
-| 2 | | EOL | 05 Nov 2015 | 28 Jul 2017 |
+| Version | Supported Environments | State | First Release | EOL/Terminated |
+|---------|------------------------------------------|-----------|---------------|----------------|
+| 5 | .NET Framework 4.6.2+ and .NET Core 2.0+ | Supported | 02 Nov 2021 | TBD |
+| 4 | .NET Framework 4.5+ and .NET Core 2.0+ | EOL | 02 Nov 2021 | TBD |
+| 3 | | EOL | 28 Jul 2017 | 02 Nov 2021 |
+| 2 | | EOL | 05 Nov 2015 | 28 Jul 2017 |
+
+### Migrating from the old version?
+
+If you are migrating from the old major version visit our [upgrade documentation](/docs/upgrades/).
## Questions, Bugs, and Feature Requests?
diff --git a/build/variables.ps1 b/build/variables.ps1
index 5b06b867c..f8a29f332 100644
--- a/build/variables.ps1
+++ b/build/variables.ps1
@@ -13,7 +13,7 @@ $NUGET_URL="https://api.nuget.org/v3/index.json"
$NET_CORE_VER="netcoreapp2.0"
$FRAMEWORK_ASSEMBLY_NAME="Box.V2"
$SLN_PATH="$ROOT_DIR" + "\Box.V2.sln"
-$NET_FRAMEWORK_VER="net45"
+$NET_FRAMEWORK_VER="net462"
$FRAMEWORK_PDB_PATH=$FRAMEWORK_PROJ_DIR + "\bin\Release\Box.V2.pdb"
$CORE_PDB_PATH=$CORE_PROJ_DIR + "\bin\Release\netstandard2.0\Box.V2.Core.pdb"
$PFX_PATH="$FRAMEWORK_PROJ_DIR" + "\BoxSDKKey.pfx"
diff --git a/docs/upgrades/4.x.x to 5.x.x.md b/docs/upgrades/4.x.x to 5.x.x.md
new file mode 100644
index 000000000..216b09fca
--- /dev/null
+++ b/docs/upgrades/4.x.x to 5.x.x.md
@@ -0,0 +1,248 @@
+# Upgrading from 4.x.x to 5.x.x
+
+Follow the [General changes](#general-changes) to see the changes that are package indenpendent. Also refer to the [Box.V2](#box-v2) or
+[Box.V2.Core](#box-v2-core) section depending on the package you are using.
+
+## General changes
+
+### Removed deprecated methods
+
+Some old, deprecated methods have been removed from version 5.x.x. Read this section further to see a new, alternative methods.
+
+#### BoxMetadataManager/IBoxMetadataManager
+
+```c#
+//Old
+ExecuteMetadataQueryAsync(string from, string ancestorFolderId, IEnumerable fields, string query, Dictionary queryParameters, string indexName, List orderBy, int limit, string marker, bool autoPaginate)
+
+ExecuteMetadataQueryAsync(string from, string ancestorFolderId, string query = null, Dictionary queryParameters = null, string indexName = null, List orderBy = null, int limit = 100, string marker = null, bool autoPaginate = false)
+
+//New
+ExecuteMetadataQueryAsync(BoxMetadataQueryRequest queryRequest)
+```
+
+#### BoxConfigBuilder/IBoxConfigBuilder
+
+```c#
+//Old
+SetBoxApiUri(...)
+SetBoxTokenApiUri(...)
+
+//New
+SetBoxApiHostUri(...)
+```
+
+#### BoxFilesManager/IBoxFilesManager
+
+```c#
+//Old
+DownloadStreamAsync(...)
+
+//New
+DownloadAsync(...)
+```
+
+```c#
+//Old
+UploadFileVersionUsingSessionAsync(...)
+
+//New
+UploadNewVersionUsingSessionAsync(...)
+```
+
+
+```c#
+//Old
+GetCollaborationsAsync(...)
+
+//New
+GetCollaborationsCollectionAsync(...)
+```
+
+```c#
+//Old
+GetFilePreviewAsync(...)
+GetPreviewAsync(...)
+
+//New
+GetPreviewLinkAsync(...)
+```
+
+#### BoxSearchManager/IBoxSearchManager
+
+```c#
+//Old
+SearchAsync(...)
+
+//New
+QueryAsync(...)
+```
+
+#### BoxFolderManager/IBoxFolderManager
+
+```c#
+//Old
+GetTrashItemsAsync(string id, int limit, int offset = 0, IEnumerable fields = null)
+
+//New
+GetTrashItemsAsync(int limit, int offset = 0, IEnumerable fields = null, bool autoPaginate = false, string sort = null, BoxSortDirection? direction = null)
+```
+
+```c#
+//Old
+GetItemsAsync(...)
+
+//New
+GetFolderItemsAsync(...)
+```
+
+#### BoxTermsOfServiceManager/IBoxTermsOfServiceManager
+
+```c#
+//Old
+CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceUserStatusesRequest termsOfServicesUserStatusesRequest)
+
+//New
+CreateBoxTermsOfServiceUserStatusesAsync(BoxTermsOfServiceUserStatusCreateRequest termsOfServiceUserStatusCreateRequest)
+```
+
+#### OAuthSession
+
+```c#
+//Old
+OAuthSession(string access_token, string refresh_token, int expires_in, string token_type, AuthVersion authVersion)
+
+//New
+OAuthSession(string access_token, string refresh_token, int expires_in, string token_type)
+```
+
+#### BoxRetentionPoliciesManager/IBoxRetentionPoliciesManager
+```c#
+//Old
+Task> GetFileVersionsUnderRetentionForAssignmentAsync(...)
+
+//New
+Task> GetFileVersionsUnderRetentionForAssignmentAsync(...)
+```
+
+### Deprecated fields
+
+Some old, deprecated fields have been removed from version 5.x.x. Read this section further to see a new, alternative fields.
+
+#### BoxConfigBuilder/IBoxConfigBuilder
+
+```c#
+//Old
+BoxAuthTokenApiUri
+
+//New
+BoxApiHostUri
+```
+
+#### Constants
+
+```c#
+//Old
+MasterInviteAccept
+
+//New
+AdminInviteAccept
+```
+
+```c#
+//Old
+MasterInviteReject
+
+//New
+AdminInviteReject
+```
+
+```c#
+//Old
+V1AuthString
+
+//New
+//V1 Auth is no longer support in the API.
+```
+
+#### IBoxConfig
+
+```c#
+//Old
+BoxAuthTokenApiUri
+
+//New
+BoxApiHostUri
+```
+
+#### BoxPermissionsRequest
+
+```c#
+//Old
+BoxPermissionType? Preview
+
+//New
+//Deprecated field. Value is always true
+```
+
+#### OAuthSession
+
+```c#
+//Old
+AuthVersion
+
+//New
+//Box API have now one auth version so there is no need to differentiate between them.
+```
+
+#### BoxFileVersion
+
+```c#
+//Old
+BoxFileVersion
+
+//New
+//No alternative as this field was used only in GetFileVersionsUnderRetentionForAssignmentAsync(...).
+//This method now returns proper BoxFile object instead.
+```
+
+## Box.V2
+
+### Minimal .NET runtime version upgrade
+
+If you are still using .NET Framework version lower than 4.6.2 you need to upgrade to the 4.6.2+ version. You can do it by changing target framework in the .csproj file of your project.
+
+For SDK-style projects
+
+Before
+```xml
+net45
+```
+
+After
+```xml
+net462
+```
+
+See [SDK-style target framework](https://learn.microsoft.com/en-us/dotnet/standard/frameworks) for more information.
+
+For non SDK-style projects
+
+Before
+```xml
+v4.5
+```
+
+After
+```xml
+v4.6.2
+```
+
+See [MSBuild target framework](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2022) for more information
+
+We recommend to upgrade to the newest version possible.
+See [.NET Framework lifecycle](https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework)
+
+## Box.V2.Core
+
+No changes
\ No newline at end of file