openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
achandmsft-patch-1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Images/GeneratedImageCollection.cs

56lines · 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[CodeGenType("ImagesResponse")]
11[CodeGenSuppress("Data")]
12[CodeGenSuppress("Created")]
13[CodeGenSuppress(nameof(GeneratedImageCollection))]
14[CodeGenSuppress(nameof(GeneratedImageCollection), typeof(DateTimeOffset))]
15[CodeGenSuppress(nameof(GeneratedImageCollection), typeof(DateTimeOffset), typeof(IDictionary<string, BinaryData>))]
16public partial class GeneratedImageCollection : ReadOnlyCollection<GeneratedImage>
17{
18 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
19 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
20 /// <param name="created"></param>
21 /// <param name="data"></param>
22 /// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
23 internal GeneratedImageCollection(DateTimeOffset created, IEnumerable<GeneratedImage> data)
24 : base([.. data])
25 {
26 Argument.AssertNotNull(data, nameof(data));
27
28 CreatedAt = created;
29 }
30
31 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
32 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/>. </summary>
33 /// <param name="created"></param>
34 /// <param name="data"></param>
35 /// <param name="serializedAdditionalRawData"> Keeps track of any properties unknown to the library. </param>
36 internal GeneratedImageCollection(DateTimeOffset created, IReadOnlyList<GeneratedImage> data, IDictionary<string, BinaryData> serializedAdditionalRawData)
37 : base([.. data])
38 {
39 CreatedAt = created;
40 SerializedAdditionalRawData = serializedAdditionalRawData;
41 }
42
43 // CUSTOM: Set the inherited Items property via the base constructor in favor of the suppressed Data property.
44 /// <summary> Initializes a new instance of <see cref="GeneratedImageCollection"/> for deserialization. </summary>
45 internal GeneratedImageCollection()
46 : base([])
47 {
48 }
49
50 // CUSTOM: Renamed.
51 /// <summary>
52 /// The timestamp at which the result image was generated.
53 /// </summary>
54 [CodeGenMember("Created")]
55 public DateTimeOffset CreatedAt { get; }
56}