Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update .codegen.json with commit hash of codegen and openapi spec #58

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "ac30b07", "specHash": "d50ab5f", "version": "0.3.0" }
{ "engineHash": "3391dd6", "specHash": "d50ab5f", "version": "0.3.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
}
6 changes: 5 additions & 1 deletion Box.Sdk.Gen/Internal/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ public static IEnumerable<Stream> IterateChunks(Stream stream, long chunkSize)
/// </summary>
/// <param name="dateTime">Input DateTimeOffset</param>
/// <returns>String (ISO 8601)</returns>
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;
}

/// <summary>
/// Converts string in ISO 8601 format to DateOnly.
Expand Down
Loading