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
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public partial interface IProjectAutomationsClient
global::System.Guid projectAutomationId,
string? name = default,
string? description = default,
global::Braintrust.OneOf<global::Braintrust.PatchProjectAutomationConfigVariant1, global::Braintrust.PatchProjectAutomationConfigVariant2, global::Braintrust.PatchProjectAutomationConfigVariant3, global::Braintrust.PatchProjectAutomationConfigVariant4, global::Braintrust.PatchProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig, object>? config = default,
global::Braintrust.OneOf<global::Braintrust.PatchProjectAutomationConfigVariant1, global::Braintrust.PatchProjectAutomationConfigVariant2, global::Braintrust.PatchProjectAutomationConfigVariant3, global::Braintrust.PatchProjectAutomationConfigVariant4, global::Braintrust.PatchProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig, global::Braintrust.TopicDigestAutomationConfig, object>? config = default,
global::Braintrust.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial interface IProjectAutomationsClient
global::System.Threading.Tasks.Task<global::Braintrust.ProjectAutomation> PostProjectAutomationAsync(
global::System.Guid projectId,
string name,
global::Braintrust.OneOf<global::Braintrust.CreateProjectAutomationConfigVariant1, global::Braintrust.CreateProjectAutomationConfigVariant2, global::Braintrust.CreateProjectAutomationConfigVariant3, global::Braintrust.CreateProjectAutomationConfigVariant4, global::Braintrust.CreateProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig> config,
global::Braintrust.OneOf<global::Braintrust.CreateProjectAutomationConfigVariant1, global::Braintrust.CreateProjectAutomationConfigVariant2, global::Braintrust.CreateProjectAutomationConfigVariant3, global::Braintrust.CreateProjectAutomationConfigVariant4, global::Braintrust.CreateProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig, global::Braintrust.TopicDigestAutomationConfig> config,
string? description = default,
global::Braintrust.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial interface IProjectAutomationsClient
global::System.Threading.Tasks.Task<global::Braintrust.ProjectAutomation> PutProjectAutomationAsync(
global::System.Guid projectId,
string name,
global::Braintrust.OneOf<global::Braintrust.CreateProjectAutomationConfigVariant1, global::Braintrust.CreateProjectAutomationConfigVariant2, global::Braintrust.CreateProjectAutomationConfigVariant3, global::Braintrust.CreateProjectAutomationConfigVariant4, global::Braintrust.CreateProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig> config,
global::Braintrust.OneOf<global::Braintrust.CreateProjectAutomationConfigVariant1, global::Braintrust.CreateProjectAutomationConfigVariant2, global::Braintrust.CreateProjectAutomationConfigVariant3, global::Braintrust.CreateProjectAutomationConfigVariant4, global::Braintrust.CreateProjectAutomationConfigVariant5, global::Braintrust.TopicAutomationConfig, global::Braintrust.TopicDigestAutomationConfig> config,
string? description = default,
global::Braintrust.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Braintrust.JsonConverters
{
/// <inheritdoc />
public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Json.Serialization.JsonConverter<global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6>>
public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6, T7, T8> : global::System.Text.Json.Serialization.JsonConverter<global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6, T7, T8>>
{
/// <inheritdoc />
public override global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6> Read(
public override global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6, T7, T8> Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
Expand Down Expand Up @@ -92,6 +92,28 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}
}
var __score6 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(T7), options);
if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object)
{
foreach (var __prop in __ti.Properties)
{
if (__jsonProps.Contains(__prop.Name)) __score6++;
}
}
}
var __score7 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(T8), options);
if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object)
{
foreach (var __prop in __ti.Properties)
{
if (__jsonProps.Contains(__prop.Name)) __score7++;
}
}
}
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
Expand All @@ -100,13 +122,17 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
if (__score3 > __bestScore) { __bestScore = __score3; __bestIndex = 3; }
if (__score4 > __bestScore) { __bestScore = __score4; __bestIndex = 4; }
if (__score5 > __bestScore) { __bestScore = __score5; __bestIndex = 5; }
if (__score6 > __bestScore) { __bestScore = __score6; __bestIndex = 6; }
if (__score7 > __bestScore) { __bestScore = __score7; __bestIndex = 7; }

T1? value1 = default;
T2? value2 = default;
T3? value3 = default;
T4? value4 = default;
T5? value5 = default;
T6? value6 = default;
T7? value7 = default;
T8? value8 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand Down Expand Up @@ -210,9 +236,43 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
{
}
}

else if (__bestIndex == 6)
{
try
{

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

else if (__bestIndex == 7)
{
try
{

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

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -229,7 +289,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -246,7 +306,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -263,7 +323,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -280,7 +340,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -297,7 +357,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null)
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{
Expand All @@ -314,7 +374,41 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
}
}

var __value = new global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6>(
if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{

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

if (value1 == null && value2 == null && value3 == null && value4 == null && value5 == null && value6 == null && value7 == null && value8 == null)
{
try
{

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

var __value = new global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6, T7, T8>(
value1,

value2,
Expand All @@ -325,7 +419,11 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js

value5,

value6
value6,

value7,

value8
);

return __value;
Expand All @@ -334,7 +432,7 @@ public class OneOfJsonConverter<T1, T2, T3, T4, T5, T6> : global::System.Text.Js
/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6> value,
global::Braintrust.OneOf<T1, T2, T3, T4, T5, T6, T7, T8> value,
global::System.Text.Json.JsonSerializerOptions options)
{
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
Expand Down Expand Up @@ -376,6 +474,18 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T6).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value6!, typeInfo);
}
else if (value.IsValue7)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T7), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T7?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T7).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value7!, typeInfo);
}
else if (value.IsValue8)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T8), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T8?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T8).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value8!, typeInfo);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Braintrust.JsonConverters
{
/// <inheritdoc />
public sealed class TopicDigestAutomationConfigActionTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Braintrust.TopicDigestAutomationConfigActionType>
{
/// <inheritdoc />
public override global::Braintrust.TopicDigestAutomationConfigActionType 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::Braintrust.TopicDigestAutomationConfigActionTypeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Braintrust.TopicDigestAutomationConfigActionType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Braintrust.TopicDigestAutomationConfigActionType);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Braintrust.TopicDigestAutomationConfigActionType value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Braintrust.TopicDigestAutomationConfigActionTypeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Braintrust.JsonConverters
{
/// <inheritdoc />
public sealed class TopicDigestAutomationConfigActionTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Braintrust.TopicDigestAutomationConfigActionType?>
{
/// <inheritdoc />
public override global::Braintrust.TopicDigestAutomationConfigActionType? 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::Braintrust.TopicDigestAutomationConfigActionTypeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Braintrust.TopicDigestAutomationConfigActionType)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Braintrust.TopicDigestAutomationConfigActionType?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Braintrust.TopicDigestAutomationConfigActionType? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Braintrust.TopicDigestAutomationConfigActionTypeExtensions.ToValueString(value.Value));
}
}
}
}
Loading