From 98a50fc32293af287d72c8148e3f3c58f695a491 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 22 Mar 2024 05:07:49 -0700 Subject: [PATCH 1/3] chore: Update .codegen.json with commit hash of codegen and openapi spec --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 4dc64b5f..f2f9a834 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "ac30b07", "specHash": "d50ab5f", "version": "0.3.0" } +{ "engineHash": "ce3d184", "specHash": "d50ab5f", "version": "0.3.0" } From edb0808c97f0dfa45139ab16430ca6de4d0946bd Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 22 Mar 2024 05:09:09 -0700 Subject: [PATCH 2/3] feat: Support datetime in Python (box/box-codegen#459) --- .codegen.json | 2 +- .../LegalHoldPoliciesManagerTests.cs | 12 ++++++++++++ Box.Sdk.Gen/Internal/Utils.cs | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.codegen.json b/.codegen.json index f2f9a834..803c7e5f 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "ce3d184", "specHash": "d50ab5f", "version": "0.3.0" } +{ "engineHash": "88dd8b0", "specHash": "d50ab5f", "version": "0.3.0" } diff --git a/Box.Sdk.Gen.Tests.Integration/Test/LegalHoldPolicies/LegalHoldPoliciesManagerTests.cs b/Box.Sdk.Gen.Tests.Integration/Test/LegalHoldPolicies/LegalHoldPoliciesManagerTests.cs index 735ae4a1..c5771748 100644 --- a/Box.Sdk.Gen.Tests.Integration/Test/LegalHoldPolicies/LegalHoldPoliciesManagerTests.cs +++ b/Box.Sdk.Gen.Tests.Integration/Test/LegalHoldPolicies/LegalHoldPoliciesManagerTests.cs @@ -30,5 +30,17 @@ public async System.Threading.Tasks.Task TestCreateUpdateGetDeleteLegalHoldPolic await client.LegalHoldPolicies.DeleteLegalHoldPolicyByIdAsync(legalHoldPolicyId: legalHoldPolicyId); } + [TestMethod] + public async System.Threading.Tasks.Task TestCreateNotOngoingLegalHoldPolicy() { + string legalHoldPolicyName = Utils.GetUUID(); + const string legalHoldDescription = "test description"; + LegalHoldPolicy legalHoldPolicy = await client.LegalHoldPolicies.CreateLegalHoldPolicyAsync(requestBody: new CreateLegalHoldPolicyRequestBody(policyName: legalHoldPolicyName) { Description = legalHoldDescription, IsOngoing = false, FilterStartedAt = Utils.DateTimeFromString(dateTime: "2021-01-01T00:00:00-08:00"), FilterEndedAt = Utils.DateTimeFromString(dateTime: "2022-01-01T00:00:00-08:00") }); + Assert.IsTrue(legalHoldPolicy.PolicyName == legalHoldPolicyName); + Assert.IsTrue(legalHoldPolicy.Description == legalHoldDescription); + Assert.IsTrue(Utils.DateTimeToString(dateTime: NullableUtils.Unwrap(legalHoldPolicy.FilterStartedAt)) == "2021-01-01T00:00:00-08:00"); + Assert.IsTrue(Utils.DateTimeToString(dateTime: NullableUtils.Unwrap(legalHoldPolicy.FilterEndedAt)) == "2022-01-01T00:00:00-08:00"); + await client.LegalHoldPolicies.DeleteLegalHoldPolicyByIdAsync(legalHoldPolicyId: legalHoldPolicy.Id); + } + } } \ No newline at end of file diff --git a/Box.Sdk.Gen/Internal/Utils.cs b/Box.Sdk.Gen/Internal/Utils.cs index 6cc76faf..13ae849f 100644 --- a/Box.Sdk.Gen/Internal/Utils.cs +++ b/Box.Sdk.Gen/Internal/Utils.cs @@ -205,7 +205,11 @@ public static IEnumerable IterateChunks(Stream stream, long chunkSize) /// /// Input DateTimeOffset /// String (ISO 8601) - public static string DateTimeToString(DateTimeOffset dateTime) => string.Concat(dateTime.ToString("s", CultureInfo.InvariantCulture), "Z"); + public static string DateTimeToString(DateTimeOffset dateTime) + { + var dateTimeAsString = dateTime.ToString("yyyy-MM-ddTHH:mm:sszzz"); + return dateTime.Offset == TimeSpan.Zero ? dateTimeAsString[..^6] + "Z" : dateTimeAsString; + } /// /// Converts string in ISO 8601 format to DateOnly. From 03779acc5550375dfa8ba19a5b373c4e049189e1 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 22 Mar 2024 05:10:29 -0700 Subject: [PATCH 3/3] chore: Update .codegen.json with commit hash of codegen and openapi spec --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 803c7e5f..601b6d8e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "88dd8b0", "specHash": "d50ab5f", "version": "0.3.0" } +{ "engineHash": "3391dd6", "specHash": "d50ab5f", "version": "0.3.0" }