openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.1.0-beta.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/Images/GeneratedImageCollection.cs

88lines · modeblame

9f9f2936Jose Arriaga Maldonado2 years ago1using System;
2using System.Collections.Generic;
3using System.Collections.ObjectModel;
4
5namespace OpenAI.Images;
6
7/// <summary>
8/// Represents an image generation response payload that contains information for multiple generated images.
9/// </summary>
10[CodeGenModel("ImagesResponse")]
11[CodeGenSuppress("Data")]
2ab1a942Jose Arriaga Maldonado1 years ago12[CodeGenSuppress("Created")]
9f9f2936Jose Arriaga Maldonado2 years ago13[CodeGenSuppress(nameof(GeneratedImageCollection))]
14[CodeGenSuppress(nameof(GeneratedImageCollection), typeof(DateTimeOffset), typeof(IReadOnlyList<GeneratedImage>))]
15public partial class GeneratedImageCollection : ReadOnlyCollection<GeneratedImage>
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>
19fc7d54Jose Arriaga Maldonado2 years ago48private IDictionary<string, BinaryData> SerializedAdditionalRawData;
9f9f2936Jose Arriaga Maldonado2 years ago49
50// CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
51/// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
52/// <param name="created"></param>
53/// <param name="data"></param>
54/// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
55internal GeneratedImageCollection(DateTimeOffset created, IEnumerable<GeneratedImage> data)
56: base([.. data])
57{
58Argument.AssertNotNull(data, nameof(data));
59
60CreatedAt = created;
61}
62
63// CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
64/// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
65/// <param name="created"></param>
66/// <param name="data"></param>
67/// <param name="serializedAdditionalRawData"> Keeps track of any properties unknown to the library. </param>
68internal GeneratedImageCollection(DateTimeOffset created, IReadOnlyList<GeneratedImage> data, IDictionary<string, BinaryData> serializedAdditionalRawData)
69: base([.. data])
70{
71CreatedAt = created;
19fc7d54Jose Arriaga Maldonado2 years ago72SerializedAdditionalRawData = serializedAdditionalRawData;
9f9f2936Jose Arriaga Maldonado2 years ago73}
74
75// CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
76/// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/> for deserialization. </summary>
77internal GeneratedImageCollection()
78: base([])
79{
80}
81
82// CUSTOM: Renamed.
83/// <summary>
84/// The timestamp at which the result image was generated.
85/// </summary>
86[CodeGenMember("Created")]
87public DateTimeOffset CreatedAt { get; }
88}