openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Images/GeneratedImageCollection.cs

87lines · modecode

1using 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")]
12[CodeGenSuppress(nameof(GeneratedImageCollection))]
13[CodeGenSuppress(nameof(GeneratedImageCollection), typeof(DateTimeOffset), typeof(IReadOnlyList<GeneratedImage>))]
14public partial class GeneratedImageCollection : ReadOnlyCollection<GeneratedImage>
15{
16 // CUSTOM: Recovered this field. See https://github.com/Azure/autorest.csharp/issues/4636.
17 /// <summary>
18 /// Keeps track of any properties unknown to the library.
19 /// <para>
20 /// To assign an object to the value of this property use <see cref="BinaryData.FromObjectAsJson{T}(T, System.Text.Json.JsonSerializerOptions?)"/>.
21 /// </para>
22 /// <para>
23 /// To assign an already formatted json string to this property use <see cref="BinaryData.FromString(string)"/>.
24 /// </para>
25 /// <para>
26 /// Examples:
27 /// <list type="bullet">
28 /// <item>
29 /// <term>BinaryData.FromObjectAsJson("foo")</term>
30 /// <description>Creates a payload of "foo".</description>
31 /// </item>
32 /// <item>
33 /// <term>BinaryData.FromString("\"foo\"")</term>
34 /// <description>Creates a payload of "foo".</description>
35 /// </item>
36 /// <item>
37 /// <term>BinaryData.FromObjectAsJson(new { key = "value" })</term>
38 /// <description>Creates a payload of { "key": "value" }.</description>
39 /// </item>
40 /// <item>
41 /// <term>BinaryData.FromString("{\"key\": \"value\"}")</term>
42 /// <description>Creates a payload of { "key": "value" }.</description>
43 /// </item>
44 /// </list>
45 /// </para>
46 /// </summary>
47 private IDictionary<string, BinaryData> _serializedAdditionalRawData;
48
49 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
50 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
51 /// <param name="created"></param>
52 /// <param name="data"></param>
53 /// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
54 internal GeneratedImageCollection(DateTimeOffset created, IEnumerable<GeneratedImage> data)
55 : base([.. data])
56 {
57 Argument.AssertNotNull(data, nameof(data));
58
59 CreatedAt = created;
60 }
61
62 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
63 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
64 /// <param name="created"></param>
65 /// <param name="data"></param>
66 /// <param name="serializedAdditionalRawData"> Keeps track of any properties unknown to the library. </param>
67 internal GeneratedImageCollection(DateTimeOffset created, IReadOnlyList<GeneratedImage> data, IDictionary<string, BinaryData> serializedAdditionalRawData)
68 : base([.. data])
69 {
70 CreatedAt = created;
71 _serializedAdditionalRawData = serializedAdditionalRawData;
72 }
73
74 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
75 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/> for deserialization. </summary>
76 internal GeneratedImageCollection()
77 : base([])
78 {
79 }
80
81 // CUSTOM: Renamed.
82 /// <summary>
83 /// The timestamp at which the result image was generated.
84 /// </summary>
85 [CodeGenMember("Created")]
86 public DateTimeOffset CreatedAt { get; }
87}