Skip to content

Commit c985b7b

Browse files
github-actions[bot]HavenDV
authored andcommitted
feat: Updated OpenAPI spec
1 parent 7411c67 commit c985b7b

File tree

63 files changed

+3438
-1569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3438
-1569
lines changed

src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseFormat.Json.g.cs renamed to src/libs/tryAGI.OpenAI/Generated/AllOf.2.Json.g.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace tryAGI.OpenAI
44
{
5-
public readonly partial struct ResponseFormat
5+
public readonly partial struct AllOf<T1, T2>
66
{
77
/// <summary>
88
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
@@ -34,14 +34,14 @@ public string ToJson(
3434
/// <summary>
3535
/// Deserializes a JSON string using the provided JsonSerializerContext.
3636
/// </summary>
37-
public static global::tryAGI.OpenAI.ResponseFormat? FromJson(
37+
public static global::tryAGI.OpenAI.AllOf<T1, T2>? FromJson(
3838
string json,
3939
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
4040
{
4141
return global::System.Text.Json.JsonSerializer.Deserialize(
4242
json,
43-
typeof(global::tryAGI.OpenAI.ResponseFormat),
44-
jsonSerializerContext) as global::tryAGI.OpenAI.ResponseFormat?;
43+
typeof(global::tryAGI.OpenAI.AllOf<T1, T2>),
44+
jsonSerializerContext) as global::tryAGI.OpenAI.AllOf<T1, T2>?;
4545
}
4646

4747
/// <summary>
@@ -51,26 +51,26 @@ public string ToJson(
5151
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
5252
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
5353
#endif
54-
public static global::tryAGI.OpenAI.ResponseFormat? FromJson(
54+
public static global::tryAGI.OpenAI.AllOf<T1, T2>? FromJson(
5555
string json,
5656
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
5757
{
58-
return global::System.Text.Json.JsonSerializer.Deserialize<global::tryAGI.OpenAI.ResponseFormat>(
58+
return global::System.Text.Json.JsonSerializer.Deserialize<global::tryAGI.OpenAI.AllOf<T1, T2>>(
5959
json,
6060
jsonSerializerOptions);
6161
}
6262

6363
/// <summary>
6464
/// Deserializes a JSON stream using the provided JsonSerializerContext.
6565
/// </summary>
66-
public static async global::System.Threading.Tasks.ValueTask<global::tryAGI.OpenAI.ResponseFormat?> FromJsonStreamAsync(
66+
public static async global::System.Threading.Tasks.ValueTask<global::tryAGI.OpenAI.AllOf<T1, T2>?> FromJsonStreamAsync(
6767
global::System.IO.Stream jsonStream,
6868
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
6969
{
7070
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
7171
jsonStream,
72-
typeof(global::tryAGI.OpenAI.ResponseFormat),
73-
jsonSerializerContext).ConfigureAwait(false)) as global::tryAGI.OpenAI.ResponseFormat?;
72+
typeof(global::tryAGI.OpenAI.AllOf<T1, T2>),
73+
jsonSerializerContext).ConfigureAwait(false)) as global::tryAGI.OpenAI.AllOf<T1, T2>?;
7474
}
7575

7676
/// <summary>
@@ -80,11 +80,11 @@ public string ToJson(
8080
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
8181
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
8282
#endif
83-
public static global::System.Threading.Tasks.ValueTask<global::tryAGI.OpenAI.ResponseFormat?> FromJsonStreamAsync(
83+
public static global::System.Threading.Tasks.ValueTask<global::tryAGI.OpenAI.AllOf<T1, T2>?> FromJsonStreamAsync(
8484
global::System.IO.Stream jsonStream,
8585
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
8686
{
87-
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::tryAGI.OpenAI.ResponseFormat?>(
87+
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::tryAGI.OpenAI.AllOf<T1, T2>?>(
8888
jsonStream,
8989
jsonSerializerOptions);
9090
}
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
2+
#nullable enable
3+
4+
namespace tryAGI.OpenAI
5+
{
6+
/// <summary>
7+
///
8+
/// </summary>
9+
public readonly partial struct AllOf<T1, T2> : global::System.IEquatable<AllOf<T1, T2>>
10+
{
11+
/// <summary>
12+
///
13+
/// </summary>
14+
#if NET6_0_OR_GREATER
15+
public T1? Value1 { get; init; }
16+
#else
17+
public T1? Value1 { get; }
18+
#endif
19+
20+
/// <summary>
21+
///
22+
/// </summary>
23+
#if NET6_0_OR_GREATER
24+
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))]
25+
#endif
26+
public bool IsValue1 => Value1 != null;
27+
28+
/// <summary>
29+
///
30+
/// </summary>
31+
public static implicit operator AllOf<T1, T2>(T1 value) => new AllOf<T1, T2>(value);
32+
33+
/// <summary>
34+
///
35+
/// </summary>
36+
public static implicit operator T1?(AllOf<T1, T2> @this) => @this.Value1;
37+
38+
/// <summary>
39+
///
40+
/// </summary>
41+
public AllOf(T1? value)
42+
{
43+
Value1 = value;
44+
}
45+
46+
/// <summary>
47+
///
48+
/// </summary>
49+
#if NET6_0_OR_GREATER
50+
public T2? Value2 { get; init; }
51+
#else
52+
public T2? Value2 { get; }
53+
#endif
54+
55+
/// <summary>
56+
///
57+
/// </summary>
58+
#if NET6_0_OR_GREATER
59+
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
60+
#endif
61+
public bool IsValue2 => Value2 != null;
62+
63+
/// <summary>
64+
///
65+
/// </summary>
66+
public static implicit operator AllOf<T1, T2>(T2 value) => new AllOf<T1, T2>(value);
67+
68+
/// <summary>
69+
///
70+
/// </summary>
71+
public static implicit operator T2?(AllOf<T1, T2> @this) => @this.Value2;
72+
73+
/// <summary>
74+
///
75+
/// </summary>
76+
public AllOf(T2? value)
77+
{
78+
Value2 = value;
79+
}
80+
81+
/// <summary>
82+
///
83+
/// </summary>
84+
public AllOf(
85+
T1? value1,
86+
T2? value2
87+
)
88+
{
89+
Value1 = value1;
90+
Value2 = value2;
91+
}
92+
93+
/// <summary>
94+
///
95+
/// </summary>
96+
public object? Object =>
97+
Value2 as object ??
98+
Value1 as object
99+
;
100+
101+
/// <summary>
102+
///
103+
/// </summary>
104+
public bool Validate()
105+
{
106+
return IsValue1 && IsValue2;
107+
}
108+
109+
/// <summary>
110+
///
111+
/// </summary>
112+
public TResult? Match<TResult>(
113+
global::System.Func<T1, TResult>? value1 = null,
114+
global::System.Func<T2, TResult>? value2 = null,
115+
bool validate = true)
116+
{
117+
if (validate)
118+
{
119+
Validate();
120+
}
121+
122+
if (IsValue1 && value1 != null)
123+
{
124+
return value1(Value1!);
125+
}
126+
else if (IsValue2 && value2 != null)
127+
{
128+
return value2(Value2!);
129+
}
130+
131+
return default(TResult);
132+
}
133+
134+
/// <summary>
135+
///
136+
/// </summary>
137+
public void Match(
138+
global::System.Action<T1>? value1 = null,
139+
global::System.Action<T2>? value2 = null,
140+
bool validate = true)
141+
{
142+
if (validate)
143+
{
144+
Validate();
145+
}
146+
147+
if (IsValue1)
148+
{
149+
value1?.Invoke(Value1!);
150+
}
151+
else if (IsValue2)
152+
{
153+
value2?.Invoke(Value2!);
154+
}
155+
}
156+
157+
/// <summary>
158+
///
159+
/// </summary>
160+
public override int GetHashCode()
161+
{
162+
var fields = new object?[]
163+
{
164+
Value1,
165+
typeof(T1),
166+
Value2,
167+
typeof(T2),
168+
};
169+
const int offset = unchecked((int)2166136261);
170+
const int prime = 16777619;
171+
static int HashCodeAggregator(int hashCode, object? value) => value == null
172+
? (hashCode ^ 0) * prime
173+
: (hashCode ^ value.GetHashCode()) * prime;
174+
175+
return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator);
176+
}
177+
178+
/// <summary>
179+
///
180+
/// </summary>
181+
public bool Equals(AllOf<T1, T2> other)
182+
{
183+
return
184+
global::System.Collections.Generic.EqualityComparer<T1?>.Default.Equals(Value1, other.Value1) &&
185+
global::System.Collections.Generic.EqualityComparer<T2?>.Default.Equals(Value2, other.Value2)
186+
;
187+
}
188+
189+
/// <summary>
190+
///
191+
/// </summary>
192+
public static bool operator ==(AllOf<T1, T2> obj1, AllOf<T1, T2> obj2)
193+
{
194+
return global::System.Collections.Generic.EqualityComparer<AllOf<T1, T2>>.Default.Equals(obj1, obj2);
195+
}
196+
197+
/// <summary>
198+
///
199+
/// </summary>
200+
public static bool operator !=(AllOf<T1, T2> obj1, AllOf<T1, T2> obj2)
201+
{
202+
return !(obj1 == obj2);
203+
}
204+
205+
/// <summary>
206+
///
207+
/// </summary>
208+
public override bool Equals(object? obj)
209+
{
210+
return obj is AllOf<T1, T2> o && Equals(o);
211+
}
212+
}
213+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#nullable enable
2+
3+
namespace tryAGI.OpenAI.JsonConverters
4+
{
5+
/// <inheritdoc />
6+
public class AllOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization.JsonConverter<global::tryAGI.OpenAI.AllOf<T1, T2>>
7+
{
8+
/// <inheritdoc />
9+
public override global::tryAGI.OpenAI.AllOf<T1, T2> Read(
10+
ref global::System.Text.Json.Utf8JsonReader reader,
11+
global::System.Type typeToConvert,
12+
global::System.Text.Json.JsonSerializerOptions options)
13+
{
14+
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
15+
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");
16+
17+
var
18+
readerCopy = reader;
19+
T1? value1 = default;
20+
try
21+
{
22+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1> ??
23+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
24+
value1 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
25+
}
26+
catch (global::System.Text.Json.JsonException)
27+
{
28+
}
29+
30+
readerCopy = reader;
31+
T2? value2 = default;
32+
try
33+
{
34+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2> ??
35+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
36+
value2 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
37+
}
38+
catch (global::System.Text.Json.JsonException)
39+
{
40+
}
41+
42+
var result = new global::tryAGI.OpenAI.AllOf<T1, T2>(
43+
value1,
44+
value2
45+
);
46+
47+
if (value1 != null)
48+
{
49+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1> ??
50+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
51+
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
52+
}
53+
else if (value2 != null)
54+
{
55+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2> ??
56+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
57+
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
58+
}
59+
60+
return result;
61+
}
62+
63+
/// <inheritdoc />
64+
public override void Write(
65+
global::System.Text.Json.Utf8JsonWriter writer,
66+
global::tryAGI.OpenAI.AllOf<T1, T2> value,
67+
global::System.Text.Json.JsonSerializerOptions options)
68+
{
69+
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
70+
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");
71+
72+
if (value.IsValue1)
73+
{
74+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1?> ??
75+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
76+
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo);
77+
}
78+
else if (value.IsValue2)
79+
{
80+
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2?> ??
81+
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
82+
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2, typeInfo);
83+
}
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)