-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathJsonConverters.CreateTranslationRequestResponseFormat.g.cs
More file actions
49 lines (44 loc) · 1.98 KB
/
JsonConverters.CreateTranslationRequestResponseFormat.g.cs
File metadata and controls
49 lines (44 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#nullable enable
namespace tryAGI.OpenAI.JsonConverters
{
/// <inheritdoc />
public sealed class CreateTranslationRequestResponseFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat>
{
/// <inheritdoc />
public override global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::tryAGI.OpenAI.CreateTranslationRequestResponseFormatExtensions.ToEnum(stringValue) ?? default;
}
break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}
return default;
}
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
writer.WriteStringValue(global::tryAGI.OpenAI.CreateTranslationRequestResponseFormatExtensions.ToValueString(value));
}
}
}