Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/libs/Runway/Generated/Runway.JsonConverters.AnyOf2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}

readerCopy = reader;
T2? value2 = default;
Expand All @@ -38,6 +41,9 @@ public class AnyOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}

var __value = new global::Runway.AnyOf<T1, T2>(
value1,
Expand Down
107 changes: 78 additions & 29 deletions src/libs/Runway/Generated/Runway.JsonConverters.Character.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,91 @@ public class CharacterJsonConverter : global::System.Text.Json.Serialization.Jso
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

var
readerCopy = reader;
global::Runway.RequestActTwoCharacterCharacterImage? image = default;
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterImage), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterImage> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterImage).Name}");
image = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
}
catch (global::System.Text.Json.JsonException)
using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader);
var __rawJson = __jsonDocument.RootElement.GetRawText();
var __jsonProps = new global::System.Collections.Generic.HashSet<string>();
if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject())
{
__jsonProps.Add(__jsonProp.Name);
}
}

readerCopy = reader;
var __score0 = 0;
if (__jsonProps.Contains("type")) __score0++;
if (__jsonProps.Contains("uri")) __score0++;
var __score1 = 0;
if (__jsonProps.Contains("type")) __score1++;
if (__jsonProps.Contains("uri")) __score1++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

global::Runway.RequestActTwoCharacterCharacterImage? image = default;
global::Runway.RequestActTwoCharacterCharacterVideo? video = default;
try
if (__bestIndex >= 0)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
if (__bestIndex == 0)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterImage), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterImage> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterImage).Name}");
image = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
else if (__bestIndex == 1)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
}
catch (global::System.Text.Json.JsonException)

if (image == null && video == null)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterImage), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterImage> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterImage).Name}");
image = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}

try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}

var __value = new global::Runway.Character(
Expand All @@ -46,19 +108,6 @@ public class CharacterJsonConverter : global::System.Text.Json.Serialization.Jso
video
);

if (image != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterImage), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterImage> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterImage).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
else if (video != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestActTwoCharacterCharacterVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestActTwoCharacterCharacterVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestActTwoCharacterCharacterVideo).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

return __value;
}

Expand Down
107 changes: 78 additions & 29 deletions src/libs/Runway/Generated/Runway.JsonConverters.Media.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,91 @@ public class MediaJsonConverter : global::System.Text.Json.Serialization.JsonCon
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

var
readerCopy = reader;
global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio? audio = default;
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio).Name}");
audio = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
}
catch (global::System.Text.Json.JsonException)
using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader);
var __rawJson = __jsonDocument.RootElement.GetRawText();
var __jsonProps = new global::System.Collections.Generic.HashSet<string>();
if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject())
{
__jsonProps.Add(__jsonProp.Name);
}
}

readerCopy = reader;
var __score0 = 0;
if (__jsonProps.Contains("type")) __score0++;
if (__jsonProps.Contains("uri")) __score0++;
var __score1 = 0;
if (__jsonProps.Contains("type")) __score1++;
if (__jsonProps.Contains("uri")) __score1++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio? audio = default;
global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo? video = default;
try
if (__bestIndex >= 0)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo);
if (__bestIndex == 0)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio).Name}");
audio = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
else if (__bestIndex == 1)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}
}
catch (global::System.Text.Json.JsonException)

if (audio == null && video == null)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio).Name}");
audio = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}

try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo).Name}");
video = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
}
catch (global::System.InvalidOperationException)
{
}
}

var __value = new global::Runway.Media(
Expand All @@ -46,19 +108,6 @@ public class MediaJsonConverter : global::System.Text.Json.Serialization.JsonCon
video
);

if (audio != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechAudio).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
else if (video != null)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Runway.RequestElevenMultilingualStsV2MediaSpeechToSpeechVideo).Name}");
_ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

return __value;
}

Expand Down
Loading