diff --git a/src/AnthropicClient/Models/AnthropicEvent.cs b/src/AnthropicClient/Models/AnthropicEvent.cs index 2205fd3..c738e35 100644 --- a/src/AnthropicClient/Models/AnthropicEvent.cs +++ b/src/AnthropicClient/Models/AnthropicEvent.cs @@ -2,9 +2,19 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents an event from the Anthropic API. +/// public class AnthropicEvent { + /// + /// The type of the event. + /// public string Type { get; init; } = string.Empty; + + /// + /// The data associated with the event. + /// public EventData Data { get; init; } = default!; [JsonConstructor] @@ -12,6 +22,12 @@ public class AnthropicEvent { } + /// + /// Initializes a new instance of the class. + /// + /// The type of the event. + /// The data associated with the event. + /// A new instance of the class. public AnthropicEvent(string type, EventData data) { Type = type; diff --git a/src/AnthropicClient/Models/ContentDelta.cs b/src/AnthropicClient/Models/ContentDelta.cs index fbc0484..0d23d02 100644 --- a/src/AnthropicClient/Models/ContentDelta.cs +++ b/src/AnthropicClient/Models/ContentDelta.cs @@ -1,9 +1,20 @@ namespace AnthropicClient.Models; +/// +/// Represents a content delta. +/// public abstract class ContentDelta { + /// + /// Gets the type of the content delta. + /// public string Type { get; init; } + /// + /// Initializes a new instance of the class. + /// + /// The type of the content delta. + /// A new instance of the class. protected ContentDelta(string type) { Type = type; diff --git a/src/AnthropicClient/Models/ContentDeltaEventData.cs b/src/AnthropicClient/Models/ContentDeltaEventData.cs index 4439a8e..625ca64 100644 --- a/src/AnthropicClient/Models/ContentDeltaEventData.cs +++ b/src/AnthropicClient/Models/ContentDeltaEventData.cs @@ -2,9 +2,19 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for a content_block_delta event. +/// public class ContentDeltaEventData : EventData { + /// + /// Gets the index of the content block. + /// public int Index { get; init; } + + /// + /// Gets the content delta. + /// public ContentDelta Delta { get; init; } = default!; [JsonConstructor] @@ -12,6 +22,12 @@ public class ContentDeltaEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The index of the content block. + /// The content delta. + /// A new instance of the class. public ContentDeltaEventData(int index, ContentDelta delta) : base(EventType.ContentBlockDelta) { Index = index; diff --git a/src/AnthropicClient/Models/ContentDeltaType.cs b/src/AnthropicClient/Models/ContentDeltaType.cs index b5096f3..00c86a7 100644 --- a/src/AnthropicClient/Models/ContentDeltaType.cs +++ b/src/AnthropicClient/Models/ContentDeltaType.cs @@ -1,7 +1,17 @@ namespace AnthropicClient.Models; +/// +/// Provides constants for content delta types. +/// public static class ContentDeltaType { + /// + /// The text_delta. + /// public const string TextDelta = "text_delta"; + + /// + /// The input_json_delta. + /// public const string JsonDelta = "input_json_delta"; } \ No newline at end of file diff --git a/src/AnthropicClient/Models/ContentStartEventData.cs b/src/AnthropicClient/Models/ContentStartEventData.cs index ed2c9cf..0acecb7 100644 --- a/src/AnthropicClient/Models/ContentStartEventData.cs +++ b/src/AnthropicClient/Models/ContentStartEventData.cs @@ -2,10 +2,19 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for a content_block_start event. +/// public class ContentStartEventData : EventData { + /// + /// Gets the index of the content block. + /// public int Index { get; init; } + /// + /// Gets the content block. + /// [JsonPropertyName("content_block")] public Content ContentBlock { get; init; } = default!; @@ -14,6 +23,12 @@ public class ContentStartEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The index of the content block. + /// The content block. + /// A new instance of the class. public ContentStartEventData(int index, Content contentBlock) : base(EventType.ContentBlockStart) { Index = index; diff --git a/src/AnthropicClient/Models/ContentStopEventData.cs b/src/AnthropicClient/Models/ContentStopEventData.cs index b0ac609..56ef10b 100644 --- a/src/AnthropicClient/Models/ContentStopEventData.cs +++ b/src/AnthropicClient/Models/ContentStopEventData.cs @@ -2,8 +2,14 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for a content_block_stop event. +/// public class ContentStopEventData : EventData { + /// + /// Gets the index of the content block. + /// public int Index { get; init; } [JsonConstructor] @@ -11,6 +17,11 @@ public class ContentStopEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The index of the content block. + /// A new instance of the class. public ContentStopEventData(int index) : base(EventType.ContentBlockStop) { Index = index; diff --git a/src/AnthropicClient/Models/ErrorEventData.cs b/src/AnthropicClient/Models/ErrorEventData.cs index a0b0af2..d465571 100644 --- a/src/AnthropicClient/Models/ErrorEventData.cs +++ b/src/AnthropicClient/Models/ErrorEventData.cs @@ -2,8 +2,14 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for an error event. +/// public class ErrorEventData : EventData { + /// + /// Gets the error. + /// public Error Error { get; init; } = default!; [JsonConstructor] @@ -11,6 +17,11 @@ public class ErrorEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The error. + /// A new instance of the class. public ErrorEventData(Error error) : base(EventType.Error) { Error = error; diff --git a/src/AnthropicClient/Models/EventData.cs b/src/AnthropicClient/Models/EventData.cs index d40914a..5f58b44 100644 --- a/src/AnthropicClient/Models/EventData.cs +++ b/src/AnthropicClient/Models/EventData.cs @@ -1,9 +1,20 @@ namespace AnthropicClient.Models; +/// +/// Represents data for an event. +/// public abstract class EventData { + /// + /// Gets the type of the event. + /// public string Type { get; init; } + /// + /// Initializes a new instance of the class. + /// + /// The type of the event. + /// A new instance of the class. protected EventData(string type) { Type = type; diff --git a/src/AnthropicClient/Models/EventType.cs b/src/AnthropicClient/Models/EventType.cs index 48c652f..fef6447 100644 --- a/src/AnthropicClient/Models/EventType.cs +++ b/src/AnthropicClient/Models/EventType.cs @@ -1,14 +1,52 @@ namespace AnthropicClient.Models; +/// +/// Provides constants for event types. +/// public static class EventType { + /// + /// Represents the error event type. + /// public const string Error = "error"; + + /// + /// Represents the ping event type. + /// public const string Ping = "ping"; + + /// + /// Represents the message_start event type. + /// public const string MessageStart = "message_start"; + + /// + /// Represents the message_delta event type. + /// public const string MessageDelta = "message_delta"; + + /// + /// Represents the message_stop event type. + /// public const string MessageStop = "message_stop"; + + /// + /// Represents the message_complete event type. + /// public const string MessageComplete = "message_complete"; + + /// + /// Represents the content_block_start event type. + /// public const string ContentBlockStart = "content_block_start"; + + /// + /// Represents the content_block_delta event type. + /// public const string ContentBlockDelta = "content_block_delta"; + + /// + /// Represents the content_block_stop event type. + /// public const string ContentBlockStop = "content_block_stop"; } \ No newline at end of file diff --git a/src/AnthropicClient/Models/JsonDelta.cs b/src/AnthropicClient/Models/JsonDelta.cs index 80c8b00..f0c9749 100644 --- a/src/AnthropicClient/Models/JsonDelta.cs +++ b/src/AnthropicClient/Models/JsonDelta.cs @@ -2,8 +2,14 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents a JSON delta. +/// public class JsonDelta : ContentDelta { + /// + /// Gets the partial JSON. + /// [JsonPropertyName("partial_json")] public string PartialJson { get; init; } = string.Empty; @@ -12,6 +18,11 @@ public class JsonDelta : ContentDelta { } + /// + /// Initializes a new instance of the class. + /// + /// The partial JSON. + /// A new instance of the class. public JsonDelta(string partialJson) : base(ContentDeltaType.JsonDelta) { PartialJson = partialJson; diff --git a/src/AnthropicClient/Models/MessageCompleteEventData.cs b/src/AnthropicClient/Models/MessageCompleteEventData.cs index bdd62df..1b694aa 100644 --- a/src/AnthropicClient/Models/MessageCompleteEventData.cs +++ b/src/AnthropicClient/Models/MessageCompleteEventData.cs @@ -1,10 +1,26 @@ namespace AnthropicClient.Models; +/// +/// Represents data for the message_complete event. +/// public class MessageCompleteEventData : EventData { + /// + /// Gets the anthropic headers. + /// public AnthropicHeaders Headers { get; init; } + + /// + /// Gets the chat response message. + /// public ChatResponse Message { get; init; } + /// + /// Initializes a new instance of the class. + /// + /// The chat response message. + /// The anthropic headers. + /// A new instance of the class. public MessageCompleteEventData(ChatResponse message, AnthropicHeaders headers) : base(EventType.MessageComplete) { Message = message; diff --git a/src/AnthropicClient/Models/MessageDeltaEventData.cs b/src/AnthropicClient/Models/MessageDeltaEventData.cs index b150d2e..5bc1c67 100644 --- a/src/AnthropicClient/Models/MessageDeltaEventData.cs +++ b/src/AnthropicClient/Models/MessageDeltaEventData.cs @@ -2,9 +2,19 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for a message_delta event. +/// public class MessageDeltaEventData : EventData { + /// + /// Gets the message delta. + /// public MessageDelta Delta { get; init; } = new(); + + /// + /// Gets the chat usage. + /// public ChatUsage Usage { get; init; } = new(); [JsonConstructor] @@ -12,6 +22,12 @@ public class MessageDeltaEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The message delta. + /// The chat usage. + /// A new instance of the class. public MessageDeltaEventData(MessageDelta delta, ChatUsage usage) : base(EventType.MessageDelta) { Delta = delta; @@ -19,11 +35,20 @@ public class MessageDeltaEventData : EventData } } +/// +/// Represents a message delta. +/// public class MessageDelta { + /// + /// Gets the stop reason. + /// [JsonPropertyName("stop_reason")] public string StopReason { get; init; } = string.Empty; + /// + /// Gets the stop sequence. + /// [JsonPropertyName("stop_sequence")] public string StopSequence { get; init; } = string.Empty; @@ -32,6 +57,12 @@ public class MessageDelta { } + /// + /// Initializes a new instance of the class. + /// + /// The stop reason. + /// The stop sequence. + /// A new instance of the class. public MessageDelta(string stopReason, string stopSequence) { StopReason = stopReason; diff --git a/src/AnthropicClient/Models/MessageStartEventData.cs b/src/AnthropicClient/Models/MessageStartEventData.cs index ccf5c18..f095332 100644 --- a/src/AnthropicClient/Models/MessageStartEventData.cs +++ b/src/AnthropicClient/Models/MessageStartEventData.cs @@ -2,8 +2,14 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents data for a message_start event. +/// public class MessageStartEventData : EventData { + /// + /// Gets the message. + /// public ChatResponse Message { get; init; } = new(); [JsonConstructor] @@ -11,6 +17,11 @@ public class MessageStartEventData : EventData { } + /// + /// Initializes a new instance of the class. + /// + /// The message. + /// A new instance of the class. public MessageStartEventData(ChatResponse message) : base(EventType.MessageStart) { Message = message; diff --git a/src/AnthropicClient/Models/MessageStopEventData.cs b/src/AnthropicClient/Models/MessageStopEventData.cs index ed781e6..fac7dd1 100644 --- a/src/AnthropicClient/Models/MessageStopEventData.cs +++ b/src/AnthropicClient/Models/MessageStopEventData.cs @@ -1,7 +1,14 @@ namespace AnthropicClient.Models; +/// +/// Represents data for a message_stop event. +/// public class MessageStopEventData : EventData { + /// + /// Initializes a new instance of the class. + /// + /// A new instance of the class. public MessageStopEventData() : base(EventType.MessageStop) { } diff --git a/src/AnthropicClient/Models/PingEventData.cs b/src/AnthropicClient/Models/PingEventData.cs index e288154..425571d 100644 --- a/src/AnthropicClient/Models/PingEventData.cs +++ b/src/AnthropicClient/Models/PingEventData.cs @@ -1,7 +1,14 @@ namespace AnthropicClient.Models; +/// +/// Represents data for a ping event. +/// public class PingEventData : EventData { + /// + /// Initializes a new instance of the class. + /// + /// A new instance of the class. public PingEventData() : base(EventType.Ping) { } diff --git a/src/AnthropicClient/Models/TextDelta.cs b/src/AnthropicClient/Models/TextDelta.cs index 0768ca2..54dbfd7 100644 --- a/src/AnthropicClient/Models/TextDelta.cs +++ b/src/AnthropicClient/Models/TextDelta.cs @@ -2,8 +2,14 @@ using System.Text.Json.Serialization; namespace AnthropicClient.Models; +/// +/// Represents a text delta. +/// public class TextDelta : ContentDelta { + /// + /// Gets the text. + /// public string Text { get; set; } = string.Empty; [JsonConstructor] @@ -11,6 +17,11 @@ public class TextDelta : ContentDelta { } + /// + /// Initializes a new instance of the class. + /// + /// The text. + /// A new instance of the class. public TextDelta(string text) : base(ContentDeltaType.TextDelta) { Text = text;