feat: implement GetMessageBatchResultsAsync method

This commit is contained in:
Stevan Freeborn
2025-01-09 23:17:41 -06:00
parent 0a6d89bd77
commit c56adf394c
16 changed files with 294 additions and 23 deletions
@@ -0,0 +1,14 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result that was cancelled.
/// </summary>
public class CanceledMessageBatchResult : MessageBatchResult
{
/// <summary>
/// Initializes a new instance of the <see cref="CanceledMessageBatchResult"/> class.
/// </summary>
public CanceledMessageBatchResult() : base(MessageBatchResultType.Canceled)
{
}
}
@@ -0,0 +1,19 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result that contains an error response.
/// </summary>
public class ErroredMessageBatchResult : MessageBatchResult
{
/// <summary>
/// Gets the error of the message batch result.
/// </summary>
public AnthropicError Error { get; init; } = new AnthropicError();
/// <summary>
/// Initializes a new instance of the <see cref="ErroredMessageBatchResult"/> class.
/// </summary>
public ErroredMessageBatchResult() : base(MessageBatchResultType.Errored)
{
}
}
@@ -0,0 +1,14 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result that has expired.
/// </summary>
public class ExpiredMessageBatchResult : MessageBatchResult
{
/// <summary>
/// Initializes a new instance of the <see cref="ExpiredMessageBatchResult"/> class.
/// </summary>
public ExpiredMessageBatchResult() : base(MessageBatchResultType.Expired)
{
}
}
@@ -0,0 +1,26 @@
using AnthropicClient.Utils;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result.
/// </summary>
public abstract class MessageBatchResult
{
/// <summary>
/// Gets the type of the message batch result.
/// </summary>
public string Type { get; init; } = string.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="MessageBatchResult"/> class.
/// </summary>
/// <param name="type">The type of the message batch result.</param>
/// <returns>An instance of the <see cref="MessageBatchResult"/> class.</returns>
public MessageBatchResult(string type)
{
ArgumentValidator.ThrowIfNullOrWhitespace(type, nameof(type));
Type = type;
}
}
@@ -0,0 +1,20 @@
using System.Text.Json.Serialization;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result item.
/// </summary>
public class MessageBatchResultItem
{
/// <summary>
/// Gets the custom ID of the message batch result item.
/// </summary>
[JsonPropertyName("custom_id")]
public string CustomId { get; init; } = string.Empty;
/// <summary>
/// Gets the result of the message batch result item.
/// </summary>
public MessageBatchResult Result { get; init; } = default!;
}
@@ -0,0 +1,27 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents the types of message batch results.
/// </summary>
public static class MessageBatchResultType
{
/// <summary>
/// Represents a succeeded message batch result.
/// </summary>
public const string Succeeded = "succeeded";
/// <summary>
/// Represents an errored message batch result.
/// </summary>
public const string Errored = "errored";
/// <summary>
/// Represents a canceled message batch result.
/// </summary>
public const string Canceled = "canceled";
/// <summary>
/// Represents an expired message batch result.
/// </summary>
public const string Expired = "expired";
}
@@ -0,0 +1,20 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents a message batch result that contains a message response.
/// </summary>
public class SucceededMessageBatchResult : MessageBatchResult
{
/// <summary>
/// Gets the message of the message batch result.
/// </summary>
public MessageResponse Message { get; init; } = new MessageResponse();
/// <summary>
/// Initializes a new instance of the <see cref="SucceededMessageBatchResult"/> class.
/// </summary>
/// <returns>An instance of the <see cref="SucceededMessageBatchResult"/> class.</returns>
public SucceededMessageBatchResult() : base(MessageBatchResultType.Succeeded)
{
}
}