diff --git a/src/libs/Descript/Generated/Descript.DescriptClient.Constructors.Bearer.g.cs b/src/libs/Descript/Generated/Descript.DescriptClient.Constructors.Bearer.g.cs index 278ff02..a61df48 100644 --- a/src/libs/Descript/Generated/Descript.DescriptClient.Constructors.Bearer.g.cs +++ b/src/libs/Descript/Generated/Descript.DescriptClient.Constructors.Bearer.g.cs @@ -26,5 +26,6 @@ partial void Authorizing( ref string apiKey); partial void Authorized( global::System.Net.Http.HttpClient client); + } } \ No newline at end of file diff --git a/src/libs/Descript/Generated/Descript.Models.JobStatus.g.cs b/src/libs/Descript/Generated/Descript.Models.JobStatus.g.cs index 4bb29f3..0bb6a63 100644 --- a/src/libs/Descript/Generated/Descript.Models.JobStatus.g.cs +++ b/src/libs/Descript/Generated/Descript.Models.JobStatus.g.cs @@ -32,6 +32,19 @@ namespace Descript #endif public bool IsImportProjectMedia => ImportProjectMedia != null; + /// + /// + /// + public bool TryPickImportProjectMedia( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.ImportJobStatus? value) + { + value = ImportProjectMedia; + return IsImportProjectMedia; + } + /// /// Status of an Agent edit job /// @@ -49,6 +62,19 @@ namespace Descript #endif public bool IsAgent => Agent != null; + /// + /// + /// + public bool TryPickAgent( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.AgentJobStatus? value) + { + value = Agent; + return IsAgent; + } + /// /// Status of a publish job /// @@ -65,6 +91,19 @@ namespace Descript [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Publish))] #endif public bool IsPublish => Publish != null; + + /// + /// + /// + public bool TryPickPublish( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.PublishJobStatus? value) + { + value = Publish; + return IsPublish; + } /// /// /// @@ -166,9 +205,9 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? importProjectMedia = null, - global::System.Func? agent = null, - global::System.Func? publish = null, + global::System.Func? importProjectMedia = null, + global::System.Func? agent = null, + global::System.Func? publish = null, bool validate = true) { if (validate) @@ -196,9 +235,39 @@ public bool Validate() /// /// public void Match( - global::System.Action? importProjectMedia = null, - global::System.Action? agent = null, - global::System.Action? publish = null, + global::System.Action? importProjectMedia = null, + + global::System.Action? agent = null, + + global::System.Action? publish = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsImportProjectMedia) + { + importProjectMedia?.Invoke(ImportProjectMedia!); + } + else if (IsAgent) + { + agent?.Invoke(Agent!); + } + else if (IsPublish) + { + publish?.Invoke(Publish!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? importProjectMedia = null, + global::System.Action? agent = null, + global::System.Action? publish = null, bool validate = true) { if (validate) diff --git a/src/libs/Descript/Generated/Descript.Models.Result.g.cs b/src/libs/Descript/Generated/Descript.Models.Result.g.cs index 9cd5b57..aa7cbfd 100644 --- a/src/libs/Descript/Generated/Descript.Models.Result.g.cs +++ b/src/libs/Descript/Generated/Descript.Models.Result.g.cs @@ -31,6 +31,19 @@ namespace Descript #endif public bool IsSuccess => Success != null; + /// + /// + /// + public bool TryPickSuccess( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.ImportSuccessResult? value) + { + value = Success; + return IsSuccess; + } + /// /// Result when job failed completely /// @@ -47,6 +60,19 @@ namespace Descript [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Error))] #endif public bool IsError => Error != null; + + /// + /// + /// + public bool TryPickError( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.ImportErrorResult? value) + { + value = Error; + return IsError; + } /// /// /// @@ -126,8 +152,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? success = null, - global::System.Func? error = null, + global::System.Func? success = null, + global::System.Func? error = null, bool validate = true) { if (validate) @@ -151,8 +177,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? success = null, - global::System.Action? error = null, + global::System.Action? success = null, + + global::System.Action? error = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSuccess) + { + success?.Invoke(Success!); + } + else if (IsError) + { + error?.Invoke(Error!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? success = null, + global::System.Action? error = null, bool validate = true) { if (validate) diff --git a/src/libs/Descript/Generated/Descript.Models.Result2.g.cs b/src/libs/Descript/Generated/Descript.Models.Result2.g.cs index f6166b3..abf3320 100644 --- a/src/libs/Descript/Generated/Descript.Models.Result2.g.cs +++ b/src/libs/Descript/Generated/Descript.Models.Result2.g.cs @@ -31,6 +31,19 @@ namespace Descript #endif public bool IsSuccess => Success != null; + /// + /// + /// + public bool TryPickSuccess( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.AgentSuccessResult? value) + { + value = Success; + return IsSuccess; + } + /// /// Result when Agent edit failed /// @@ -47,6 +60,19 @@ namespace Descript [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Error))] #endif public bool IsError => Error != null; + + /// + /// + /// + public bool TryPickError( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.AgentErrorResult? value) + { + value = Error; + return IsError; + } /// /// /// @@ -126,8 +152,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? success = null, - global::System.Func? error = null, + global::System.Func? success = null, + global::System.Func? error = null, bool validate = true) { if (validate) @@ -151,8 +177,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? success = null, - global::System.Action? error = null, + global::System.Action? success = null, + + global::System.Action? error = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSuccess) + { + success?.Invoke(Success!); + } + else if (IsError) + { + error?.Invoke(Error!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? success = null, + global::System.Action? error = null, bool validate = true) { if (validate) diff --git a/src/libs/Descript/Generated/Descript.Models.Result3.g.cs b/src/libs/Descript/Generated/Descript.Models.Result3.g.cs index a70b40d..6823616 100644 --- a/src/libs/Descript/Generated/Descript.Models.Result3.g.cs +++ b/src/libs/Descript/Generated/Descript.Models.Result3.g.cs @@ -31,6 +31,19 @@ namespace Descript #endif public bool IsSuccess => Success != null; + /// + /// + /// + public bool TryPickSuccess( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.PublishSuccessResult? value) + { + value = Success; + return IsSuccess; + } + /// /// Result when publish failed /// @@ -47,6 +60,19 @@ namespace Descript [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Error))] #endif public bool IsError => Error != null; + + /// + /// + /// + public bool TryPickError( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Descript.PublishErrorResult? value) + { + value = Error; + return IsError; + } /// /// /// @@ -126,8 +152,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? success = null, - global::System.Func? error = null, + global::System.Func? success = null, + global::System.Func? error = null, bool validate = true) { if (validate) @@ -151,8 +177,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? success = null, - global::System.Action? error = null, + global::System.Action? success = null, + + global::System.Action? error = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsSuccess) + { + success?.Invoke(Success!); + } + else if (IsError) + { + error?.Invoke(Error!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? success = null, + global::System.Action? error = null, bool validate = true) { if (validate) diff --git a/src/libs/Descript/Generated/Descript.OneOf.3.g.cs b/src/libs/Descript/Generated/Descript.OneOf.3.g.cs index 5b0ec86..2cb3302 100644 --- a/src/libs/Descript/Generated/Descript.OneOf.3.g.cs +++ b/src/libs/Descript/Generated/Descript.OneOf.3.g.cs @@ -25,6 +25,19 @@ namespace Descript #endif public bool IsValue1 => Value1 != null; + /// + /// + /// + public bool TryPickValue1( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T1? value) + { + value = Value1; + return IsValue1; + } + /// /// /// @@ -42,6 +55,19 @@ namespace Descript #endif public bool IsValue2 => Value2 != null; + /// + /// + /// + public bool TryPickValue2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T2? value) + { + value = Value2; + return IsValue2; + } + /// /// /// @@ -58,6 +84,19 @@ namespace Descript [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value3))] #endif public bool IsValue3 => Value3 != null; + + /// + /// + /// + public bool TryPickValue3( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T3? value) + { + value = Value3; + return IsValue3; + } /// /// /// @@ -187,6 +226,36 @@ public bool Validate() /// public void Match( global::System.Action? value1 = null, + + global::System.Action? value2 = null, + + global::System.Action? 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!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? value1 = null, global::System.Action? value2 = null, global::System.Action? value3 = null, bool validate = true)