openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Files/OpenAIFileInfoCollection.cs
75lines · modecode
| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Collections.ObjectModel; |
| 4 | |
| 5 | namespace OpenAI.Files; |
| 6 | |
| 7 | [CodeGenModel("ListFilesResponse")] |
| 8 | [CodeGenSuppress("Data")] |
| 9 | [CodeGenSuppress(nameof(OpenAIFileInfoCollection))] |
| 10 | [CodeGenSuppress(nameof(OpenAIFileInfoCollection), typeof(IReadOnlyList<OpenAIFileInfo>), typeof(InternalListFilesResponseObject))] |
| 11 | public partial class OpenAIFileInfoCollection : ReadOnlyCollection<OpenAIFileInfo> |
| 12 | { |
| 13 | // CUSTOM: Made private. This property does not add value in the context of a strongly-typed class. |
| 14 | /// <summary> Gets the object. </summary> |
| 15 | private InternalListFilesResponseObject Object { get; } = InternalListFilesResponseObject.List; |
| 16 | |
| 17 | // CUSTOM: Recovered this field. See https://github.com/Azure/autorest.csharp/issues/4636. |
| 18 | /// <summary> |
| 19 | /// Keeps track of any properties unknown to the library. |
| 20 | /// <para> |
| 21 | /// To assign an object to the value of this property use <see cref="BinaryData.FromObjectAsJson{T}(T, System.Text.Json.JsonSerializerOptions?)"/>. |
| 22 | /// </para> |
| 23 | /// <para> |
| 24 | /// To assign an already formatted json string to this property use <see cref="BinaryData.FromString(string)"/>. |
| 25 | /// </para> |
| 26 | /// <para> |
| 27 | /// Examples: |
| 28 | /// <list type="bullet"> |
| 29 | /// <item> |
| 30 | /// <term>BinaryData.FromObjectAsJson("foo")</term> |
| 31 | /// <description>Creates a payload of "foo".</description> |
| 32 | /// </item> |
| 33 | /// <item> |
| 34 | /// <term>BinaryData.FromString("\"foo\"")</term> |
| 35 | /// <description>Creates a payload of "foo".</description> |
| 36 | /// </item> |
| 37 | /// <item> |
| 38 | /// <term>BinaryData.FromObjectAsJson(new { key = "value" })</term> |
| 39 | /// <description>Creates a payload of { "key": "value" }.</description> |
| 40 | /// </item> |
| 41 | /// <item> |
| 42 | /// <term>BinaryData.FromString("{\"key\": \"value\"}")</term> |
| 43 | /// <description>Creates a payload of { "key": "value" }.</description> |
| 44 | /// </item> |
| 45 | /// </list> |
| 46 | /// </para> |
| 47 | /// </summary> |
| 48 | private IDictionary<string, BinaryData> _serializedAdditionalRawData; |
| 49 | |
| 50 | /// <summary> Initializes a new instance of <see cref="OpenAIFileInfoCollection"/>. </summary> |
| 51 | /// <param name="data"></param> |
| 52 | /// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception> |
| 53 | internal OpenAIFileInfoCollection(IEnumerable<OpenAIFileInfo> data) |
| 54 | : base([.. data]) |
| 55 | { |
| 56 | Argument.AssertNotNull(data, nameof(data)); |
| 57 | } |
| 58 | |
| 59 | /// <summary> Initializes a new instance of <see cref="OpenAIFileInfoCollection"/>. </summary> |
| 60 | /// <param name="data"></param> |
| 61 | /// <param name="object"></param> |
| 62 | /// <param name="serializedAdditionalRawData"> Keeps track of any properties unknown to the library. </param> |
| 63 | internal OpenAIFileInfoCollection(IReadOnlyList<OpenAIFileInfo> data, InternalListFilesResponseObject @object, IDictionary<string, BinaryData> serializedAdditionalRawData) |
| 64 | : base([.. data]) |
| 65 | { |
| 66 | Object = @object; |
| 67 | _serializedAdditionalRawData = serializedAdditionalRawData; |
| 68 | } |
| 69 | |
| 70 | /// <summary> Initializes a new instance of <see cref="OpenAIFileInfoCollection"/> for deserialization. </summary> |
| 71 | internal OpenAIFileInfoCollection() |
| 72 | : base([]) |
| 73 | { |
| 74 | } |
| 75 | } |