docs: add missing xml comments
This commit is contained in:
@@ -2,9 +2,19 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an event from the Anthropic API.
|
||||
/// </summary>
|
||||
public class AnthropicEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of the event.
|
||||
/// </summary>
|
||||
public string Type { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The data associated with the event.
|
||||
/// </summary>
|
||||
public EventData Data { get; init; } = default!;
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -12,6 +22,12 @@ public class AnthropicEvent
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnthropicEvent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the event.</param>
|
||||
/// <param name="data">The data associated with the event.</param>
|
||||
/// <returns>A new instance of the <see cref="AnthropicEvent"/> class.</returns>
|
||||
public AnthropicEvent(string type, EventData data)
|
||||
{
|
||||
Type = type;
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a content delta.
|
||||
/// </summary>
|
||||
public abstract class ContentDelta
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the type of the content delta.
|
||||
/// </summary>
|
||||
public string Type { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentDelta"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the content delta.</param>
|
||||
/// <returns>A new instance of the <see cref="ContentDelta"/> class.</returns>
|
||||
protected ContentDelta(string type)
|
||||
{
|
||||
Type = type;
|
||||
|
||||
@@ -2,9 +2,19 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a content_block_delta event.
|
||||
/// </summary>
|
||||
public class ContentDeltaEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the index of the content block.
|
||||
/// </summary>
|
||||
public int Index { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content delta.
|
||||
/// </summary>
|
||||
public ContentDelta Delta { get; init; } = default!;
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -12,6 +22,12 @@ public class ContentDeltaEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentDeltaEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the content block.</param>
|
||||
/// <param name="delta">The content delta.</param>
|
||||
/// <returns>A new instance of the <see cref="ContentDeltaEventData"/> class.</returns>
|
||||
public ContentDeltaEventData(int index, ContentDelta delta) : base(EventType.ContentBlockDelta)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Provides constants for content delta types.
|
||||
/// </summary>
|
||||
public static class ContentDeltaType
|
||||
{
|
||||
/// <summary>
|
||||
/// The text_delta.
|
||||
/// </summary>
|
||||
public const string TextDelta = "text_delta";
|
||||
|
||||
/// <summary>
|
||||
/// The input_json_delta.
|
||||
/// </summary>
|
||||
public const string JsonDelta = "input_json_delta";
|
||||
}
|
||||
@@ -2,10 +2,19 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a content_block_start event.
|
||||
/// </summary>
|
||||
public class ContentStartEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the index of the content block.
|
||||
/// </summary>
|
||||
public int Index { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content block.
|
||||
/// </summary>
|
||||
[JsonPropertyName("content_block")]
|
||||
public Content ContentBlock { get; init; } = default!;
|
||||
|
||||
@@ -14,6 +23,12 @@ public class ContentStartEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentStartEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the content block.</param>
|
||||
/// <param name="contentBlock">The content block.</param>
|
||||
/// <returns>A new instance of the <see cref="ContentStartEventData"/> class.</returns>
|
||||
public ContentStartEventData(int index, Content contentBlock) : base(EventType.ContentBlockStart)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
@@ -2,8 +2,14 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a content_block_stop event.
|
||||
/// </summary>
|
||||
public class ContentStopEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the index of the content block.
|
||||
/// </summary>
|
||||
public int Index { get; init; }
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -11,6 +17,11 @@ public class ContentStopEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentStopEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the content block.</param>
|
||||
/// <returns>A new instance of the <see cref="ContentStopEventData"/> class.</returns>
|
||||
public ContentStopEventData(int index) : base(EventType.ContentBlockStop)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
@@ -2,8 +2,14 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for an error event.
|
||||
/// </summary>
|
||||
public class ErrorEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the error.
|
||||
/// </summary>
|
||||
public Error Error { get; init; } = default!;
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -11,6 +17,11 @@ public class ErrorEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ErrorEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="error">The error.</param>
|
||||
/// <returns>A new instance of the <see cref="ErrorEventData"/> class.</returns>
|
||||
public ErrorEventData(Error error) : base(EventType.Error)
|
||||
{
|
||||
Error = error;
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for an event.
|
||||
/// </summary>
|
||||
public abstract class EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the type of the event.
|
||||
/// </summary>
|
||||
public string Type { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the event.</param>
|
||||
/// <returns>A new instance of the <see cref="EventData"/> class.</returns>
|
||||
protected EventData(string type)
|
||||
{
|
||||
Type = type;
|
||||
|
||||
@@ -1,14 +1,52 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Provides constants for event types.
|
||||
/// </summary>
|
||||
public static class EventType
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the error event type.
|
||||
/// </summary>
|
||||
public const string Error = "error";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the ping event type.
|
||||
/// </summary>
|
||||
public const string Ping = "ping";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the message_start event type.
|
||||
/// </summary>
|
||||
public const string MessageStart = "message_start";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the message_delta event type.
|
||||
/// </summary>
|
||||
public const string MessageDelta = "message_delta";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the message_stop event type.
|
||||
/// </summary>
|
||||
public const string MessageStop = "message_stop";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the message_complete event type.
|
||||
/// </summary>
|
||||
public const string MessageComplete = "message_complete";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the content_block_start event type.
|
||||
/// </summary>
|
||||
public const string ContentBlockStart = "content_block_start";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the content_block_delta event type.
|
||||
/// </summary>
|
||||
public const string ContentBlockDelta = "content_block_delta";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the content_block_stop event type.
|
||||
/// </summary>
|
||||
public const string ContentBlockStop = "content_block_stop";
|
||||
}
|
||||
@@ -2,8 +2,14 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a JSON delta.
|
||||
/// </summary>
|
||||
public class JsonDelta : ContentDelta
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the partial JSON.
|
||||
/// </summary>
|
||||
[JsonPropertyName("partial_json")]
|
||||
public string PartialJson { get; init; } = string.Empty;
|
||||
|
||||
@@ -12,6 +18,11 @@ public class JsonDelta : ContentDelta
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonDelta"/> class.
|
||||
/// </summary>
|
||||
/// <param name="partialJson">The partial JSON.</param>
|
||||
/// <returns>A new instance of the <see cref="JsonDelta"/> class.</returns>
|
||||
public JsonDelta(string partialJson) : base(ContentDeltaType.JsonDelta)
|
||||
{
|
||||
PartialJson = partialJson;
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for the message_complete event.
|
||||
/// </summary>
|
||||
public class MessageCompleteEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the anthropic headers.
|
||||
/// </summary>
|
||||
public AnthropicHeaders Headers { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chat response message.
|
||||
/// </summary>
|
||||
public ChatResponse Message { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageCompleteEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The chat response message.</param>
|
||||
/// <param name="headers">The anthropic headers.</param>
|
||||
/// <returns>A new instance of the <see cref="MessageCompleteEventData"/> class.</returns>
|
||||
public MessageCompleteEventData(ChatResponse message, AnthropicHeaders headers) : base(EventType.MessageComplete)
|
||||
{
|
||||
Message = message;
|
||||
|
||||
@@ -2,9 +2,19 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a message_delta event.
|
||||
/// </summary>
|
||||
public class MessageDeltaEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the message delta.
|
||||
/// </summary>
|
||||
public MessageDelta Delta { get; init; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chat usage.
|
||||
/// </summary>
|
||||
public ChatUsage Usage { get; init; } = new();
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -12,6 +22,12 @@ public class MessageDeltaEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageDeltaEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="delta">The message delta.</param>
|
||||
/// <param name="usage">The chat usage.</param>
|
||||
/// <returns>A new instance of the <see cref="MessageDeltaEventData"/> class.</returns>
|
||||
public MessageDeltaEventData(MessageDelta delta, ChatUsage usage) : base(EventType.MessageDelta)
|
||||
{
|
||||
Delta = delta;
|
||||
@@ -19,11 +35,20 @@ public class MessageDeltaEventData : EventData
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a message delta.
|
||||
/// </summary>
|
||||
public class MessageDelta
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the stop reason.
|
||||
/// </summary>
|
||||
[JsonPropertyName("stop_reason")]
|
||||
public string StopReason { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stop sequence.
|
||||
/// </summary>
|
||||
[JsonPropertyName("stop_sequence")]
|
||||
public string StopSequence { get; init; } = string.Empty;
|
||||
|
||||
@@ -32,6 +57,12 @@ public class MessageDelta
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageDelta"/> class.
|
||||
/// </summary>
|
||||
/// <param name="stopReason">The stop reason.</param>
|
||||
/// <param name="stopSequence">The stop sequence.</param>
|
||||
/// <returns>A new instance of the <see cref="MessageDelta"/> class.</returns>
|
||||
public MessageDelta(string stopReason, string stopSequence)
|
||||
{
|
||||
StopReason = stopReason;
|
||||
|
||||
@@ -2,8 +2,14 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a message_start event.
|
||||
/// </summary>
|
||||
public class MessageStartEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the message.
|
||||
/// </summary>
|
||||
public ChatResponse Message { get; init; } = new();
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -11,6 +17,11 @@ public class MessageStartEventData : EventData
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageStartEventData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <returns>A new instance of the <see cref="MessageStartEventData"/> class.</returns>
|
||||
public MessageStartEventData(ChatResponse message) : base(EventType.MessageStart)
|
||||
{
|
||||
Message = message;
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a message_stop event.
|
||||
/// </summary>
|
||||
public class MessageStopEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MessageStopEventData"/> class.
|
||||
/// </summary>
|
||||
/// <returns>A new instance of the <see cref="MessageStopEventData"/> class.</returns>
|
||||
public MessageStopEventData() : base(EventType.MessageStop)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents data for a ping event.
|
||||
/// </summary>
|
||||
public class PingEventData : EventData
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingEventData"/> class.
|
||||
/// </summary>
|
||||
/// <returns>A new instance of the <see cref="PingEventData"/> class.</returns>
|
||||
public PingEventData() : base(EventType.Ping)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,8 +2,14 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a text delta.
|
||||
/// </summary>
|
||||
public class TextDelta : ContentDelta
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the text.
|
||||
/// </summary>
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
[JsonConstructor]
|
||||
@@ -11,6 +17,11 @@ public class TextDelta : ContentDelta
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TextDelta"/> class.
|
||||
/// </summary>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <returns>A new instance of the <see cref="TextDelta"/> class.</returns>
|
||||
public TextDelta(string text) : base(ContentDeltaType.TextDelta)
|
||||
{
|
||||
Text = text;
|
||||
|
||||
Reference in New Issue
Block a user