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 @@ -26,5 +26,6 @@ partial void Authorizing(
ref string apiKey);
partial void Authorized(
global::System.Net.Http.HttpClient client);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ namespace EachLabs
#endif
public bool IsWebhook => Webhook != null;

/// <summary>
///
/// </summary>
public bool TryPickWebhook(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::EachLabs.Webhook? value)
{
value = Webhook;
return IsWebhook;
}

/// <summary>
///
/// </summary>
Expand All @@ -42,6 +55,19 @@ namespace EachLabs
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(WebhookWithAttemptsVariant2))]
#endif
public bool IsWebhookWithAttemptsVariant2 => WebhookWithAttemptsVariant2 != null;

/// <summary>
///
/// </summary>
public bool TryPickWebhookWithAttemptsVariant2(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out global::EachLabs.WebhookWithAttemptsVariant2? value)
{
value = WebhookWithAttemptsVariant2;
return IsWebhookWithAttemptsVariant2;
}
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -118,8 +144,8 @@ public bool Validate()
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<global::EachLabs.Webhook?, TResult>? webhook = null,
global::System.Func<global::EachLabs.WebhookWithAttemptsVariant2?, TResult>? webhookWithAttemptsVariant2 = null,
global::System.Func<global::EachLabs.Webhook, TResult>? webhook = null,
global::System.Func<global::EachLabs.WebhookWithAttemptsVariant2, TResult>? webhookWithAttemptsVariant2 = null,
bool validate = true)
{
if (validate)
Expand All @@ -143,8 +169,32 @@ public bool Validate()
///
/// </summary>
public void Match(
global::System.Action<global::EachLabs.Webhook?>? webhook = null,
global::System.Action<global::EachLabs.WebhookWithAttemptsVariant2?>? webhookWithAttemptsVariant2 = null,
global::System.Action<global::EachLabs.Webhook>? webhook = null,

global::System.Action<global::EachLabs.WebhookWithAttemptsVariant2>? webhookWithAttemptsVariant2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsWebhook)
{
webhook?.Invoke(Webhook!);
}
else if (IsWebhookWithAttemptsVariant2)
{
webhookWithAttemptsVariant2?.Invoke(WebhookWithAttemptsVariant2!);
}
}

/// <summary>
///
/// </summary>
public void Switch(
global::System.Action<global::EachLabs.Webhook>? webhook = null,
global::System.Action<global::EachLabs.WebhookWithAttemptsVariant2>? webhookWithAttemptsVariant2 = null,
bool validate = true)
{
if (validate)
Expand Down
69 changes: 69 additions & 0 deletions src/libs/EachLabs/Generated/EachLabs.OneOf.3.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ namespace EachLabs
#endif
public bool IsValue1 => Value1 != null;

/// <summary>
///
/// </summary>
public bool TryPickValue1(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out T1? value)
{
value = Value1;
return IsValue1;
}

/// <summary>
///
/// </summary>
Expand All @@ -42,6 +55,19 @@ namespace EachLabs
#endif
public bool IsValue2 => Value2 != null;

/// <summary>
///
/// </summary>
public bool TryPickValue2(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out T2? value)
{
value = Value2;
return IsValue2;
}

/// <summary>
///
/// </summary>
Expand All @@ -58,6 +84,19 @@ namespace EachLabs
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value3))]
#endif
public bool IsValue3 => Value3 != null;

/// <summary>
///
/// </summary>
public bool TryPickValue3(
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out T3? value)
{
value = Value3;
return IsValue3;
}
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -187,6 +226,36 @@ public bool Validate()
/// </summary>
public void Match(
global::System.Action<T1>? value1 = null,

global::System.Action<T2>? value2 = null,

global::System.Action<T3>? value3 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
else if (IsValue3)
{
value3?.Invoke(Value3!);
}
}

/// <summary>
///
/// </summary>
public void Switch(
global::System.Action<T1>? value1 = null,
global::System.Action<T2>? value2 = null,
global::System.Action<T3>? value3 = null,
bool validate = true)
Expand Down