2024-06-27 23:26:53 -05:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace AnthropicClient.Models;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-07-03 16:57:27 -05:00
|
|
|
/// Represents part of the content of a message.
|
2024-06-27 23:26:53 -05:00
|
|
|
/// </summary>
|
|
|
|
|
public abstract class Content
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the type of the content.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Type { get; init; } = string.Empty;
|
2024-08-15 23:04:45 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the cache control to be used for the content.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonPropertyName("cache_control")]
|
2024-08-17 17:56:07 -05:00
|
|
|
public CacheControl? CacheControl { get; set; }
|
2024-06-27 23:26:53 -05:00
|
|
|
|
|
|
|
|
[JsonConstructor]
|
|
|
|
|
internal Content()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="Content"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type">The type of the content.</param>
|
|
|
|
|
/// <returns>A new instance of the <see cref="Content"/> class.</returns>
|
|
|
|
|
protected Content(string type)
|
|
|
|
|
{
|
|
|
|
|
Type = type;
|
|
|
|
|
}
|
2024-08-15 23:04:45 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="Content"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type">The type of the content.</param>
|
|
|
|
|
/// <param name="cacheControl">The cache control to be used for the content.</param>
|
|
|
|
|
/// <returns>A new instance of the <see cref="Content"/> class.</returns>
|
|
|
|
|
protected Content(string type, CacheControl cacheControl)
|
|
|
|
|
{
|
|
|
|
|
Type = type;
|
|
|
|
|
CacheControl = cacheControl;
|
|
|
|
|
}
|
2024-06-27 23:26:53 -05:00
|
|
|
}
|