Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Models/ListResponse.cs
T
Reuben BondandGitHub 33f84f9ed2 .NET: Improve fidelity of OpenAI Responses server and add Conversations (#1907)
* Improve fidelity of OpenAI Responses server and add Conversations

* Merge

* nit

* Undo prior change

* Undo prior change

* Review feedback

* Review feedback

* Fix test

* Use simpler JsonDocument approach for polymorphic deserialization

* More review feedback

* dotnet format
2025-11-05 18:46:19 +00:00

46 lines
1.3 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.Hosting.OpenAI.Models;
/// <summary>
/// Generic list response for paginated results.
/// Used across the OpenAI API for listing resources.
/// </summary>
internal sealed class ListResponse<T>
{
/// <summary>
/// The object type, always "list".
/// </summary>
[JsonPropertyName("object")]
[SuppressMessage("Naming", "CA1720:Identifiers should not match keywords", Justification = "Matches OpenAI API specification")]
public string Object => "list";
/// <summary>
/// The list of items.
/// </summary>
[JsonPropertyName("data")]
public required List<T> Data { get; init; }
/// <summary>
/// The ID of the first item in the list.
/// </summary>
[JsonPropertyName("first_id")]
public string? FirstId { get; init; }
/// <summary>
/// The ID of the last item in the list.
/// </summary>
[JsonPropertyName("last_id")]
public string? LastId { get; init; }
/// <summary>
/// Whether there are more items available.
/// </summary>
[JsonPropertyName("has_more")]
public required bool HasMore { get; init; }
}