From 0a6d89bd77e165a0ae63dacd9f854bd49ba817ce Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Wed, 8 Jan 2025 23:20:21 -0600 Subject: [PATCH] fix: default nullable properties to actually datetimeoffset min value when new'd up --- src/AnthropicClient/Models/MessageBatchResponse.cs | 8 ++++---- .../Unit/Models/MessageBatchResponseTests.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AnthropicClient/Models/MessageBatchResponse.cs b/src/AnthropicClient/Models/MessageBatchResponse.cs index 925e713..2df3b43 100644 --- a/src/AnthropicClient/Models/MessageBatchResponse.cs +++ b/src/AnthropicClient/Models/MessageBatchResponse.cs @@ -27,13 +27,13 @@ public class MessageBatchResponse /// Gets the counts of requests in the batch. /// [JsonPropertyName("request_counts")] - public MessageBatchRequestCounts RequestCounts { get; init; } = new MessageBatchRequestCounts(); + public MessageBatchRequestCounts RequestCounts { get; init; } = new(); /// /// Gets the date and time when the batch ended. /// [JsonPropertyName("ended_at")] - public DateTimeOffset? EndedAt { get; init; } + public DateTimeOffset? EndedAt { get; init; } = DateTimeOffset.MinValue; /// /// Gets the date and time when the batch was created. @@ -51,13 +51,13 @@ public class MessageBatchResponse /// Gets the date and time when the batch was archived. /// [JsonPropertyName("archived_at")] - public DateTimeOffset? ArchivedAt { get; init; } + public DateTimeOffset? ArchivedAt { get; init; } = DateTimeOffset.MinValue; /// /// Gets the date and time when the batch cancellation was initiated. /// [JsonPropertyName("cancel_initiated_at")] - public DateTimeOffset? CancelInitiatedAt { get; init; } + public DateTimeOffset? CancelInitiatedAt { get; init; } = DateTimeOffset.MinValue; /// /// Gets the URL to the results of the batch. diff --git a/tests/AnthropicClient.Tests/Unit/Models/MessageBatchResponseTests.cs b/tests/AnthropicClient.Tests/Unit/Models/MessageBatchResponseTests.cs index 4cde6a1..5001b4d 100644 --- a/tests/AnthropicClient.Tests/Unit/Models/MessageBatchResponseTests.cs +++ b/tests/AnthropicClient.Tests/Unit/Models/MessageBatchResponseTests.cs @@ -50,7 +50,7 @@ public class MessageBatchResponseTests : SerializationTest Id = "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF", Type = "message_batch", ProcessingStatus = "in_progress", - RequestCounts = new MessageBatchRequestCounts + RequestCounts = new() { Processing = 100, Succeeded = 50, @@ -94,7 +94,7 @@ public class MessageBatchResponseTests : SerializationTest Id = "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF", Type = "message_batch", ProcessingStatus = "in_progress", - RequestCounts = new MessageBatchRequestCounts + RequestCounts = new() { Processing = 100, Succeeded = 50,