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 @@ -164,9 +164,9 @@ public static class AutoSDKConditionalRequests
{
send = send ?? throw new global::System.ArgumentNullException(nameof(send));
requestOptions = CloneRequestOptions(requestOptions);
if (!string.IsNullOrWhiteSpace(entityTag))
if (entityTag is { } nonEmptyEntityTag && !string.IsNullOrWhiteSpace(nonEmptyEntityTag))
{
requestOptions.Headers["If-None-Match"] = entityTag!;
requestOptions.Headers["If-None-Match"] = nonEmptyEntityTag;
}

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo);
}
else if (value.IsValue2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo);
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/libs/Replicate/Generated/Replicate.OneOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public bool TryPickValue1(
/// <summary>
///
/// </summary>
public T1 PickValue1() => IsValue1
? Value1!
public T1 PickValue1() => Value1 is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");

/// <summary>
Expand Down Expand Up @@ -78,8 +78,8 @@ public bool TryPickValue2(
/// <summary>
///
/// </summary>
public T2 PickValue2() => IsValue2
? Value2!
public T2 PickValue2() => Value2 is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
/// <summary>
///
Expand Down Expand Up @@ -176,13 +176,13 @@ public bool Validate()
Validate();
}

if (IsValue1 && value1 != null)
if (Value1 is { } __value0 && value1 != null)
{
return value1(Value1!);
return value1(__value0);
}
else if (IsValue2 && value2 != null)
else if (Value2 is { } __value1 && value2 != null)
{
return value2(Value2!);
return value2(__value1);
}

return default(TResult);
Expand All @@ -202,13 +202,13 @@ public void Match(
Validate();
}

if (IsValue1)
if (Value1 is { } __value0)
{
value1?.Invoke(Value1!);
value1?.Invoke(__value0);
}
else if (IsValue2)
else if (Value2 is { } __value1)
{
value2?.Invoke(Value2!);
value2?.Invoke(__value1);
}
}

Expand All @@ -225,13 +225,13 @@ public void Switch(
Validate();
}

if (IsValue1)
if (Value1 is { } __value0)
{
value1?.Invoke(Value1!);
value1?.Invoke(__value0);
}
else if (IsValue2)
else if (Value2 is { } __value1)
{
value2?.Invoke(Value2!);
value2?.Invoke(__value1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ partial void ProcessAccountGetResponseContent(
pathTemplate: "\"/account\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -224,7 +224,7 @@ partial void ProcessAccountGetResponseContent(
pathTemplate: "\"/account\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: __exception,
clientOptions: Options,
Expand Down Expand Up @@ -265,7 +265,7 @@ partial void ProcessAccountGetResponseContent(
pathTemplate: "\"/account\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -313,7 +313,7 @@ partial void ProcessAccountGetResponseContent(
pathTemplate: "\"/account\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand All @@ -335,7 +335,7 @@ partial void ProcessAccountGetResponseContent(
pathTemplate: "\"/account\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ partial void ProcessCollectionsGetResponseContent(
PrepareCollectionsGetRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
collectionSlug: collectionSlug!);
collectionSlug: collectionSlug);

return __httpRequest;
}
Expand All @@ -199,7 +199,7 @@ partial void ProcessCollectionsGetResponseContent(
pathTemplate: "$\"/collections/{collectionSlug}\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -233,7 +233,7 @@ partial void ProcessCollectionsGetResponseContent(
pathTemplate: "$\"/collections/{collectionSlug}\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: __exception,
clientOptions: Options,
Expand Down Expand Up @@ -274,7 +274,7 @@ partial void ProcessCollectionsGetResponseContent(
pathTemplate: "$\"/collections/{collectionSlug}\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -322,7 +322,7 @@ partial void ProcessCollectionsGetResponseContent(
pathTemplate: "$\"/collections/{collectionSlug}\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand All @@ -344,7 +344,7 @@ partial void ProcessCollectionsGetResponseContent(
pathTemplate: "$\"/collections/{collectionSlug}\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ partial void ProcessCollectionsListResponseContent(
pathTemplate: "\"/collections\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -232,7 +232,7 @@ partial void ProcessCollectionsListResponseContent(
pathTemplate: "\"/collections\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: __exception,
clientOptions: Options,
Expand Down Expand Up @@ -273,7 +273,7 @@ partial void ProcessCollectionsListResponseContent(
pathTemplate: "\"/collections\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -321,7 +321,7 @@ partial void ProcessCollectionsListResponseContent(
pathTemplate: "\"/collections\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand All @@ -343,7 +343,7 @@ partial void ProcessCollectionsListResponseContent(
pathTemplate: "\"/collections\"",
httpMethod: "GET",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ partial void ProcessDeploymentsCreateResponseContent(
pathTemplate: "\"/deployments\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -296,7 +296,7 @@ partial void ProcessDeploymentsCreateResponseContent(
pathTemplate: "\"/deployments\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: __exception,
clientOptions: Options,
Expand Down Expand Up @@ -337,7 +337,7 @@ partial void ProcessDeploymentsCreateResponseContent(
pathTemplate: "\"/deployments\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -385,7 +385,7 @@ partial void ProcessDeploymentsCreateResponseContent(
pathTemplate: "\"/deployments\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand All @@ -407,7 +407,7 @@ partial void ProcessDeploymentsCreateResponseContent(
pathTemplate: "\"/deployments\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down
Loading
Loading