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 @@ -42,8 +42,8 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

global::Serper.BaseSearchRequest? value1 = default;
global::Serper.ScholarSearchRequestVariant2? value2 = default;
global::Serper.BaseSearchRequest? @base = default;
global::Serper.ScholarSearchRequestVariant2? scholarSearchRequestVariant2 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -52,7 +52,7 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -67,7 +67,7 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.ScholarSearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.ScholarSearchRequestVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.ScholarSearchRequestVariant2).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
scholarSearchRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -78,13 +78,13 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
}
}

if (value1 == null && value2 == null)
if (@base == null && scholarSearchRequestVariant2 == null)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -97,7 +97,7 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.ScholarSearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.ScholarSearchRequestVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.ScholarSearchRequestVariant2).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
scholarSearchRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -108,9 +108,9 @@ public class ScholarSearchRequestJsonConverter : global::System.Text.Json.Serial
}

var __value = new global::Serper.ScholarSearchRequest(
value1,
@base,

value2
scholarSearchRequestVariant2
);

return __value;
Expand All @@ -125,17 +125,17 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsValue1)
if (value.IsBase)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsScholarSearchRequestVariant2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.ScholarSearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.ScholarSearchRequestVariant2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.ScholarSearchRequestVariant2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ScholarSearchRequestVariant2!, typeInfo);
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/libs/Serper/Generated/Serper.JsonConverters.SearchRequest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

global::Serper.BaseSearchRequest? value1 = default;
global::Serper.SearchRequestVariant2? value2 = default;
global::Serper.BaseSearchRequest? @base = default;
global::Serper.SearchRequestVariant2? searchRequestVariant2 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -50,7 +50,7 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -65,7 +65,7 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.SearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.SearchRequestVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.SearchRequestVariant2).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
searchRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -76,13 +76,13 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
}
}

if (value1 == null && value2 == null)
if (@base == null && searchRequestVariant2 == null)
{
try
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -95,7 +95,7 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.SearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.SearchRequestVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.SearchRequestVariant2).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
searchRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -106,9 +106,9 @@ public class SearchRequestJsonConverter : global::System.Text.Json.Serialization
}

var __value = new global::Serper.SearchRequest(
value1,
@base,

value2
searchRequestVariant2
);

return __value;
Expand All @@ -123,17 +123,17 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsValue1)
if (value.IsBase)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.BaseSearchRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.BaseSearchRequest?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.BaseSearchRequest).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsSearchRequestVariant2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Serper.SearchRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Serper.SearchRequestVariant2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Serper.SearchRequestVariant2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.SearchRequestVariant2!, typeInfo);
}
}
}
Expand Down
74 changes: 37 additions & 37 deletions src/libs/Serper/Generated/Serper.Models.ScholarSearchRequest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ namespace Serper
///
/// </summary>
#if NET6_0_OR_GREATER
public global::Serper.BaseSearchRequest? Value1 { get; init; }
public global::Serper.BaseSearchRequest? Base { get; init; }
#else
public global::Serper.BaseSearchRequest? Value1 { get; }
public global::Serper.BaseSearchRequest? Base { get; }
#endif

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))]
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Base))]
#endif
public bool IsValue1 => Value1 != null;
public bool IsBase => Base != null;

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
public global::Serper.ScholarSearchRequestVariant2? Value2 { get; init; }
public global::Serper.ScholarSearchRequestVariant2? ScholarSearchRequestVariant2 { get; init; }
#else
public global::Serper.ScholarSearchRequestVariant2? Value2 { get; }
public global::Serper.ScholarSearchRequestVariant2? ScholarSearchRequestVariant2 { get; }
#endif

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ScholarSearchRequestVariant2))]
#endif
public bool IsValue2 => Value2 != null;
public bool IsScholarSearchRequestVariant2 => ScholarSearchRequestVariant2 != null;
/// <summary>
///
/// </summary>
Expand All @@ -50,14 +50,14 @@ namespace Serper
/// <summary>
///
/// </summary>
public static implicit operator global::Serper.BaseSearchRequest?(ScholarSearchRequest @this) => @this.Value1;
public static implicit operator global::Serper.BaseSearchRequest?(ScholarSearchRequest @this) => @this.Base;

/// <summary>
///
/// </summary>
public ScholarSearchRequest(global::Serper.BaseSearchRequest? value)
{
Value1 = value;
Base = value;
}

/// <summary>
Expand All @@ -68,72 +68,72 @@ public ScholarSearchRequest(global::Serper.BaseSearchRequest? value)
/// <summary>
///
/// </summary>
public static implicit operator global::Serper.ScholarSearchRequestVariant2?(ScholarSearchRequest @this) => @this.Value2;
public static implicit operator global::Serper.ScholarSearchRequestVariant2?(ScholarSearchRequest @this) => @this.ScholarSearchRequestVariant2;

/// <summary>
///
/// </summary>
public ScholarSearchRequest(global::Serper.ScholarSearchRequestVariant2? value)
{
Value2 = value;
ScholarSearchRequestVariant2 = value;
}

/// <summary>
///
/// </summary>
public ScholarSearchRequest(
global::Serper.BaseSearchRequest? value1,
global::Serper.ScholarSearchRequestVariant2? value2
global::Serper.BaseSearchRequest? @base,
global::Serper.ScholarSearchRequestVariant2? scholarSearchRequestVariant2
)
{
Value1 = value1;
Value2 = value2;
Base = @base;
ScholarSearchRequestVariant2 = scholarSearchRequestVariant2;
}

/// <summary>
///
/// </summary>
public object? Object =>
Value2 as object ??
Value1 as object
ScholarSearchRequestVariant2 as object ??
Base as object
;

/// <summary>
///
/// </summary>
public override string? ToString() =>
Value1?.ToString() ??
Value2?.ToString()
Base?.ToString() ??
ScholarSearchRequestVariant2?.ToString()
;

/// <summary>
///
/// </summary>
public bool Validate()
{
return IsValue1 && IsValue2;
return IsBase && IsScholarSearchRequestVariant2;
}

/// <summary>
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<global::Serper.BaseSearchRequest?, TResult>? value1 = null,
global::System.Func<global::Serper.ScholarSearchRequestVariant2?, TResult>? value2 = null,
global::System.Func<global::Serper.BaseSearchRequest?, TResult>? @base = null,
global::System.Func<global::Serper.ScholarSearchRequestVariant2?, TResult>? scholarSearchRequestVariant2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1 && value1 != null)
if (IsBase && @base != null)
{
return value1(Value1!);
return @base(Base!);
}
else if (IsValue2 && value2 != null)
else if (IsScholarSearchRequestVariant2 && scholarSearchRequestVariant2 != null)
{
return value2(Value2!);
return scholarSearchRequestVariant2(ScholarSearchRequestVariant2!);
}

return default(TResult);
Expand All @@ -143,22 +143,22 @@ public bool Validate()
///
/// </summary>
public void Match(
global::System.Action<global::Serper.BaseSearchRequest?>? value1 = null,
global::System.Action<global::Serper.ScholarSearchRequestVariant2?>? value2 = null,
global::System.Action<global::Serper.BaseSearchRequest?>? @base = null,
global::System.Action<global::Serper.ScholarSearchRequestVariant2?>? scholarSearchRequestVariant2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
if (IsBase)
{
value1?.Invoke(Value1!);
@base?.Invoke(Base!);
}
else if (IsValue2)
else if (IsScholarSearchRequestVariant2)
{
value2?.Invoke(Value2!);
scholarSearchRequestVariant2?.Invoke(ScholarSearchRequestVariant2!);
}
}

Expand All @@ -169,9 +169,9 @@ public override int GetHashCode()
{
var fields = new object?[]
{
Value1,
Base,
typeof(global::Serper.BaseSearchRequest),
Value2,
ScholarSearchRequestVariant2,
typeof(global::Serper.ScholarSearchRequestVariant2),
};
const int offset = unchecked((int)2166136261);
Expand All @@ -189,8 +189,8 @@ static int HashCodeAggregator(int hashCode, object? value) => value == null
public bool Equals(ScholarSearchRequest other)
{
return
global::System.Collections.Generic.EqualityComparer<global::Serper.BaseSearchRequest?>.Default.Equals(Value1, other.Value1) &&
global::System.Collections.Generic.EqualityComparer<global::Serper.ScholarSearchRequestVariant2?>.Default.Equals(Value2, other.Value2)
global::System.Collections.Generic.EqualityComparer<global::Serper.BaseSearchRequest?>.Default.Equals(Base, other.Base) &&
global::System.Collections.Generic.EqualityComparer<global::Serper.ScholarSearchRequestVariant2?>.Default.Equals(ScholarSearchRequestVariant2, other.ScholarSearchRequestVariant2)
;
}

Expand Down
Loading