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 @@ -33,9 +33,6 @@ public partial interface ISubpackageIntelligenceClient
/// <param name="mediaType">
/// Explicit media type (auto-detected if not provided)
/// </param>
/// <param name="json">
/// Return structured fields instead of prose. Default false for audio/video, true for images.
/// </param>
/// <param name="callbackUrl">
/// URL that receives the final intelligence payload via HTTP POST. When present, the request runs asynchronously and returns 202 Accepted.
/// </param>
Expand All @@ -47,7 +44,6 @@ public partial interface ISubpackageIntelligenceClient
string? url = default,
global::System.Guid? detectId = default,
global::ResembleAI.IntelligencePostRequestBodyContentApplicationJsonSchemaMediaType? mediaType = default,
bool? json = default,
string? callbackUrl = default,
global::ResembleAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");


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>();
Expand All @@ -24,45 +23,55 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc
foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject())
{
__jsonProps.Add(__jsonProp.Name);
}
}

var __score0 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(string), options);
if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object)
{
foreach (var __prop in __ti.Properties)
if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
if (__jsonProps.Contains(__prop.Name)) __score0++;
foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject())
{
__jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name);
}
}

}
}

var __score0 = 0;
var __score1 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(object), 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)) __score1++;
}
}
}
if (__jsonProps.Contains("abnormalities")) __score1++;
if (__jsonProps.Contains("context")) __score1++;
if (__jsonProps.Contains("dialect")) __score1++;
if (__jsonProps.Contains("digitally_altered")) __score1++;
if (__jsonProps.Contains("digitally_altered.alterations")) __score1++;
if (__jsonProps.Contains("digitally_altered.confidence")) __score1++;
if (__jsonProps.Contains("digitally_altered.detected")) __score1++;
if (__jsonProps.Contains("emotion")) __score1++;
if (__jsonProps.Contains("fraud")) __score1++;
if (__jsonProps.Contains("fraud.confidence")) __score1++;
if (__jsonProps.Contains("fraud.reasoning")) __score1++;
if (__jsonProps.Contains("fraud.type")) __score1++;
if (__jsonProps.Contains("language")) __score1++;
if (__jsonProps.Contains("liveness")) __score1++;
if (__jsonProps.Contains("liveness.assessment")) __score1++;
if (__jsonProps.Contains("liveness.confidence")) __score1++;
if (__jsonProps.Contains("liveness.indicators")) __score1++;
if (__jsonProps.Contains("message")) __score1++;
if (__jsonProps.Contains("misinformation")) __score1++;
if (__jsonProps.Contains("speaker_info")) __score1++;
if (__jsonProps.Contains("speaking_style")) __score1++;
if (__jsonProps.Contains("transcription")) __score1++;
if (__jsonProps.Contains("translation")) __score1++;
var __bestScore = 0;
var __bestIndex = -1;
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

string? detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1 = default;
object? detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2 = default;
global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1? detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -74,15 +83,13 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc
{
}
}

else if (__bestIndex == 1)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -93,11 +100,10 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc
}
}

if (detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1 == null && detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2 == null)
if (detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1 == null && detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1 == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -111,10 +117,9 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc

try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1).Name}");
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -127,7 +132,7 @@ public class DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDesc
var __value = new global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription(
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1,

detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2
detectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1
);

return __value;
Expand All @@ -148,11 +153,11 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant1!, typeInfo);
}
else if (value.IsDetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2)
else if (value.IsDetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionVariant2!, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescription1!, typeInfo);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionOneOf1FraudType? 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::ResembleAI.DetectPostResponsesContentApplicationJsonSchemaItemIntelligenceDescriptionOneOf1FraudTypeExtensions.ToValueString(value.Value));
}
}
}
}
Loading