From 3d45036c94dba96613a7c40a2fd0a19180a23d46 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Jun 2025 01:43:34 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Forem.ArticlesClient.CreateArticle.g.cs | 54 +++++++++----- .../Forem.ArticlesClient.GetArticleById.g.cs | 41 ++++++----- ...Forem.ArticlesClient.GetArticleByPath.g.cs | 41 ++++++----- .../Forem.ArticlesClient.GetArticles.g.cs | 32 ++++----- ...orem.ArticlesClient.GetLatestArticles.g.cs | 32 ++++----- ...rem.ArticlesClient.GetUserAllArticles.g.cs | 49 +++++++------ .../Forem.ArticlesClient.GetUserArticles.g.cs | 49 +++++++------ ...ticlesClient.GetUserPublishedArticles.g.cs | 49 +++++++------ ...clesClient.GetUserUnpublishedArticles.g.cs | 49 +++++++------ ...Forem.ArticlesClient.UnpublishArticle.g.cs | 54 +++++++++----- .../Forem.ArticlesClient.UpdateArticle.g.cs | 71 +++++++++++++------ .../Forem.CommentsClient.GetCommentById.g.cs | 37 ++++++---- ...CommentsClient.GetCommentsByArticleId.g.cs | 49 +++++++------ ...rem.DisplayAdsClient.CreateDisplayAds.g.cs | 58 +++++++++------ .../Forem.DisplayAdsClient.GetDisplayAds.g.cs | 49 +++++++------ ...em.DisplayAdsClient.GetDisplayAdsById.g.cs | 54 +++++++++----- ...em.DisplayAdsClient.PutDisplayAdsById.g.cs | 58 +++++++++------ ...yAdsClient.PutDisplayAdsByIdUnpublish.g.cs | 54 +++++++++----- .../Forem/Generated/Forem.Exceptions.g.cs | 4 +- ...em.FollowedTagsClient.GetFollowedTags.g.cs | 49 +++++++------ .../Forem.FollowersClient.GetFollowers.g.cs | 49 +++++++------ ...em.OrganizationsClient.GetOrgArticles.g.cs | 49 +++++++------ ...Forem.OrganizationsClient.GetOrgUsers.g.cs | 49 +++++++------ ...m.OrganizationsClient.GetOrganization.g.cs | 41 ++++++----- .../Forem.PagesClient.CreatePages.g.cs | 54 +++++++++----- .../Forem.PagesClient.DeletePagesById.g.cs | 66 ++++++++++------- .../Generated/Forem.PagesClient.GetPages.g.cs | 32 ++++----- .../Forem.PagesClient.GetPagesById.g.cs | 32 ++++----- .../Forem.PagesClient.PutPagesById.g.cs | 66 ++++++++++------- ...castEpisodesClient.GetPodcastEpisodes.g.cs | 49 +++++++------ ...m.ProfileImagesClient.GetProfileImage.g.cs | 41 ++++++----- ...Forem.ReactionsClient.CreateReactions.g.cs | 37 ++++++---- ...ReactionsClient.CreateReactionsToggle.g.cs | 37 ++++++---- ...orem.ReadinglistClient.GetReadinglist.g.cs | 49 +++++++------ .../Generated/Forem.TagsClient.GetTags.g.cs | 32 ++++----- .../Generated/Forem.UsersClient.GetUser.g.cs | 24 +++---- .../Forem.UsersClient.GetUserMe.g.cs | 41 ++++++----- ...orem.UsersClient.PostAdminUsersCreate.g.cs | 54 +++++++++----- .../Forem.UsersClient.SuspendUser.g.cs | 54 +++++++++----- .../Forem.UsersClient.UnpublishUser.g.cs | 54 +++++++++----- .../Generated/Forem.VideosClient.Videos.g.cs | 32 ++++----- 41 files changed, 1149 insertions(+), 726 deletions(-) diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs index 5ac0cbd..5f2fad5 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs @@ -93,17 +93,26 @@ partial void ProcessCreateArticleResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -117,17 +126,26 @@ partial void ProcessCreateArticleResponse( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -154,8 +172,9 @@ partial void ProcessCreateArticleResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -169,15 +188,21 @@ partial void ProcessCreateArticleResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -190,13 +215,6 @@ partial void ProcessCreateArticleResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs index 25b6ec3..79b0a68 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs @@ -89,17 +89,26 @@ partial void ProcessGetArticleByIdResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -130,8 +139,10 @@ partial void ProcessGetArticleByIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -145,16 +156,22 @@ partial void ProcessGetArticleByIdResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -167,14 +184,6 @@ partial void ProcessGetArticleByIdResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs index f1cfc46..0a2e868 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs @@ -95,17 +95,26 @@ partial void ProcessGetArticleByPathResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -136,8 +145,10 @@ partial void ProcessGetArticleByPathResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -151,16 +162,22 @@ partial void ProcessGetArticleByPathResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -173,14 +190,6 @@ partial void ProcessGetArticleByPathResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs index adaf88c..5c835ef 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs @@ -175,8 +175,12 @@ partial void ProcessGetArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,18 +194,24 @@ partial void ProcessGetArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,16 +224,6 @@ partial void ProcessGetArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetLatestArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetLatestArticles.g.cs index b705168..bed83d5 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetLatestArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetLatestArticles.g.cs @@ -121,8 +121,12 @@ partial void ProcessGetLatestArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -136,18 +140,24 @@ partial void ProcessGetLatestArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -160,16 +170,6 @@ partial void ProcessGetLatestArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserAllArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserAllArticles.g.cs index 889d846..34c532d 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserAllArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserAllArticles.g.cs @@ -107,17 +107,26 @@ partial void ProcessGetUserAllArticlesResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -148,8 +157,12 @@ partial void ProcessGetUserAllArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -163,18 +176,24 @@ partial void ProcessGetUserAllArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -187,16 +206,6 @@ partial void ProcessGetUserAllArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserArticles.g.cs index c3b8d13..3ae79aa 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserArticles.g.cs @@ -106,17 +106,26 @@ partial void ProcessGetUserArticlesResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -147,8 +156,12 @@ partial void ProcessGetUserArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -162,18 +175,24 @@ partial void ProcessGetUserArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -186,16 +205,6 @@ partial void ProcessGetUserArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserPublishedArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserPublishedArticles.g.cs index af7b9b2..f628c4c 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserPublishedArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserPublishedArticles.g.cs @@ -106,17 +106,26 @@ partial void ProcessGetUserPublishedArticlesResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -147,8 +156,12 @@ partial void ProcessGetUserPublishedArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -162,18 +175,24 @@ partial void ProcessGetUserPublishedArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -186,16 +205,6 @@ partial void ProcessGetUserPublishedArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserUnpublishedArticles.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserUnpublishedArticles.g.cs index 43eae44..4d7dfe5 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserUnpublishedArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.GetUserUnpublishedArticles.g.cs @@ -106,17 +106,26 @@ partial void ProcessGetUserUnpublishedArticlesResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -147,8 +156,12 @@ partial void ProcessGetUserUnpublishedArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -162,18 +175,24 @@ partial void ProcessGetUserUnpublishedArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -186,16 +205,6 @@ partial void ProcessGetUserUnpublishedArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.UnpublishArticle.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.UnpublishArticle.g.cs index 2b7ec97..69aa84e 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.UnpublishArticle.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.UnpublishArticle.g.cs @@ -98,17 +98,26 @@ partial void ProcessUnpublishArticleResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -122,17 +131,26 @@ partial void ProcessUnpublishArticleResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -159,8 +177,9 @@ partial void ProcessUnpublishArticleResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -174,15 +193,21 @@ partial void ProcessUnpublishArticleResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -195,13 +220,6 @@ partial void ProcessUnpublishArticleResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.ArticlesClient.UpdateArticle.g.cs b/src/libs/Forem/Generated/Forem.ArticlesClient.UpdateArticle.g.cs index 261c61d..5572bca 100644 --- a/src/libs/Forem/Generated/Forem.ArticlesClient.UpdateArticle.g.cs +++ b/src/libs/Forem/Generated/Forem.ArticlesClient.UpdateArticle.g.cs @@ -99,17 +99,26 @@ partial void ProcessUpdateArticleResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -123,17 +132,26 @@ partial void ProcessUpdateArticleResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -147,17 +165,26 @@ partial void ProcessUpdateArticleResponse( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -184,8 +211,9 @@ partial void ProcessUpdateArticleResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,15 +227,21 @@ partial void ProcessUpdateArticleResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -220,13 +254,6 @@ partial void ProcessUpdateArticleResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } diff --git a/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentById.g.cs b/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentById.g.cs index 41729c7..046cd56 100644 --- a/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentById.g.cs +++ b/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentById.g.cs @@ -86,17 +86,26 @@ partial void ProcessGetCommentByIdResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -123,8 +132,9 @@ partial void ProcessGetCommentByIdResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -138,15 +148,21 @@ partial void ProcessGetCommentByIdResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -159,13 +175,6 @@ partial void ProcessGetCommentByIdResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentsByArticleId.g.cs b/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentsByArticleId.g.cs index f3e4ead..1ee07ca 100644 --- a/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentsByArticleId.g.cs +++ b/src/libs/Forem/Generated/Forem.CommentsClient.GetCommentsByArticleId.g.cs @@ -100,17 +100,26 @@ partial void ProcessGetCommentsByArticleIdResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -141,8 +150,12 @@ partial void ProcessGetCommentsByArticleIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -156,18 +169,24 @@ partial void ProcessGetCommentsByArticleIdResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -180,16 +199,6 @@ partial void ProcessGetCommentsByArticleIdResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.DisplayAdsClient.CreateDisplayAds.g.cs b/src/libs/Forem/Generated/Forem.DisplayAdsClient.CreateDisplayAds.g.cs index 3ed1eea..5522cd7 100644 --- a/src/libs/Forem/Generated/Forem.DisplayAdsClient.CreateDisplayAds.g.cs +++ b/src/libs/Forem/Generated/Forem.DisplayAdsClient.CreateDisplayAds.g.cs @@ -97,17 +97,26 @@ partial void ProcessCreateDisplayAdsResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -121,17 +130,26 @@ partial void ProcessCreateDisplayAdsResponseContent( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -162,8 +180,10 @@ partial void ProcessCreateDisplayAdsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -177,16 +197,22 @@ partial void ProcessCreateDisplayAdsResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -199,14 +225,6 @@ partial void ProcessCreateDisplayAdsResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } diff --git a/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAds.g.cs b/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAds.g.cs index a4f0688..9d78e36 100644 --- a/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAds.g.cs +++ b/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAds.g.cs @@ -83,17 +83,26 @@ partial void ProcessGetDisplayAdsResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -124,8 +133,12 @@ partial void ProcessGetDisplayAdsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -139,18 +152,24 @@ partial void ProcessGetDisplayAdsResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -163,16 +182,6 @@ partial void ProcessGetDisplayAdsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAdsById.g.cs b/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAdsById.g.cs index 8b1ef5e..675b806 100644 --- a/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAdsById.g.cs +++ b/src/libs/Forem/Generated/Forem.DisplayAdsClient.GetDisplayAdsById.g.cs @@ -84,17 +84,26 @@ partial void ProcessGetDisplayAdsByIdResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -108,17 +117,26 @@ partial void ProcessGetDisplayAdsByIdResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -145,8 +163,9 @@ partial void ProcessGetDisplayAdsByIdResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -160,15 +179,21 @@ partial void ProcessGetDisplayAdsByIdResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -181,13 +206,6 @@ partial void ProcessGetDisplayAdsByIdResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsById.g.cs b/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsById.g.cs index db8dfc4..6dc2f29 100644 --- a/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsById.g.cs +++ b/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsById.g.cs @@ -103,17 +103,26 @@ partial void ProcessPutDisplayAdsByIdResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -127,17 +136,26 @@ partial void ProcessPutDisplayAdsByIdResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -168,8 +186,10 @@ partial void ProcessPutDisplayAdsByIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -183,16 +203,22 @@ partial void ProcessPutDisplayAdsByIdResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -205,14 +231,6 @@ partial void ProcessPutDisplayAdsByIdResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } diff --git a/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsByIdUnpublish.g.cs b/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsByIdUnpublish.g.cs index f046571..cb42807 100644 --- a/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsByIdUnpublish.g.cs +++ b/src/libs/Forem/Generated/Forem.DisplayAdsClient.PutDisplayAdsByIdUnpublish.g.cs @@ -84,17 +84,26 @@ partial void ProcessPutDisplayAdsByIdUnpublishResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -108,17 +117,26 @@ partial void ProcessPutDisplayAdsByIdUnpublishResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -145,8 +163,9 @@ partial void ProcessPutDisplayAdsByIdUnpublishResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -160,15 +179,21 @@ partial void ProcessPutDisplayAdsByIdUnpublishResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -181,13 +206,6 @@ partial void ProcessPutDisplayAdsByIdUnpublishResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.Exceptions.g.cs b/src/libs/Forem/Generated/Forem.Exceptions.g.cs index f4d9d65..c30296e 100644 --- a/src/libs/Forem/Generated/Forem.Exceptions.g.cs +++ b/src/libs/Forem/Generated/Forem.Exceptions.g.cs @@ -43,7 +43,7 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. /// The HTTP status code of the response. - public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) + public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) { StatusCode = statusCode; } @@ -83,7 +83,7 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. /// The HTTP status code of the response. - public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) + public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) { } } diff --git a/src/libs/Forem/Generated/Forem.FollowedTagsClient.GetFollowedTags.g.cs b/src/libs/Forem/Generated/Forem.FollowedTagsClient.GetFollowedTags.g.cs index 3be24f2..2551d58 100644 --- a/src/libs/Forem/Generated/Forem.FollowedTagsClient.GetFollowedTags.g.cs +++ b/src/libs/Forem/Generated/Forem.FollowedTagsClient.GetFollowedTags.g.cs @@ -83,17 +83,26 @@ partial void ProcessGetFollowedTagsResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -124,8 +133,12 @@ partial void ProcessGetFollowedTagsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -139,18 +152,24 @@ partial void ProcessGetFollowedTagsResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -163,16 +182,6 @@ partial void ProcessGetFollowedTagsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.FollowersClient.GetFollowers.g.cs b/src/libs/Forem/Generated/Forem.FollowersClient.GetFollowers.g.cs index f62847e..9d77397 100644 --- a/src/libs/Forem/Generated/Forem.FollowersClient.GetFollowers.g.cs +++ b/src/libs/Forem/Generated/Forem.FollowersClient.GetFollowers.g.cs @@ -112,17 +112,26 @@ partial void ProcessGetFollowersResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -153,8 +162,12 @@ partial void ProcessGetFollowersResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -168,18 +181,24 @@ partial void ProcessGetFollowersResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -192,16 +211,6 @@ partial void ProcessGetFollowersResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgArticles.g.cs b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgArticles.g.cs index 88a8ccd..0e2fd7c 100644 --- a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgArticles.g.cs +++ b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgArticles.g.cs @@ -110,17 +110,26 @@ partial void ProcessGetOrgArticlesResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -151,8 +160,12 @@ partial void ProcessGetOrgArticlesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -166,18 +179,24 @@ partial void ProcessGetOrgArticlesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -190,16 +209,6 @@ partial void ProcessGetOrgArticlesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgUsers.g.cs b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgUsers.g.cs index 099e899..62f8ce1 100644 --- a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgUsers.g.cs +++ b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrgUsers.g.cs @@ -110,17 +110,26 @@ partial void ProcessGetOrgUsersResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -151,8 +160,12 @@ partial void ProcessGetOrgUsersResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -166,18 +179,24 @@ partial void ProcessGetOrgUsersResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -190,16 +209,6 @@ partial void ProcessGetOrgUsersResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrganization.g.cs b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrganization.g.cs index 5e8f47a..1691b59 100644 --- a/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrganization.g.cs +++ b/src/libs/Forem/Generated/Forem.OrganizationsClient.GetOrganization.g.cs @@ -89,17 +89,26 @@ partial void ProcessGetOrganizationResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -130,8 +139,10 @@ partial void ProcessGetOrganizationResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -145,16 +156,22 @@ partial void ProcessGetOrganizationResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -167,14 +184,6 @@ partial void ProcessGetOrganizationResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.PagesClient.CreatePages.g.cs b/src/libs/Forem/Generated/Forem.PagesClient.CreatePages.g.cs index d7a0816..92fbcfa 100644 --- a/src/libs/Forem/Generated/Forem.PagesClient.CreatePages.g.cs +++ b/src/libs/Forem/Generated/Forem.PagesClient.CreatePages.g.cs @@ -92,17 +92,26 @@ partial void ProcessCreatePagesResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -116,17 +125,26 @@ partial void ProcessCreatePagesResponse( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -153,8 +171,9 @@ partial void ProcessCreatePagesResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -168,15 +187,21 @@ partial void ProcessCreatePagesResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -189,13 +214,6 @@ partial void ProcessCreatePagesResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } diff --git a/src/libs/Forem/Generated/Forem.PagesClient.DeletePagesById.g.cs b/src/libs/Forem/Generated/Forem.PagesClient.DeletePagesById.g.cs index b3f113d..fe89c02 100644 --- a/src/libs/Forem/Generated/Forem.PagesClient.DeletePagesById.g.cs +++ b/src/libs/Forem/Generated/Forem.PagesClient.DeletePagesById.g.cs @@ -89,17 +89,26 @@ partial void ProcessDeletePagesByIdResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -113,17 +122,26 @@ partial void ProcessDeletePagesByIdResponseContent( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -154,8 +172,12 @@ partial void ProcessDeletePagesByIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -169,18 +191,24 @@ partial void ProcessDeletePagesByIdResponseContent( h => h.Value), }; } - - return - global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -193,16 +221,6 @@ partial void ProcessDeletePagesByIdResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.PagesClient.GetPages.g.cs b/src/libs/Forem/Generated/Forem.PagesClient.GetPages.g.cs index 7412ea8..a53bffd 100644 --- a/src/libs/Forem/Generated/Forem.PagesClient.GetPages.g.cs +++ b/src/libs/Forem/Generated/Forem.PagesClient.GetPages.g.cs @@ -100,8 +100,12 @@ partial void ProcessGetPagesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -115,18 +119,24 @@ partial void ProcessGetPagesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -139,16 +149,6 @@ partial void ProcessGetPagesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.PagesClient.GetPagesById.g.cs b/src/libs/Forem/Generated/Forem.PagesClient.GetPagesById.g.cs index 6ecdfe7..392f6f2 100644 --- a/src/libs/Forem/Generated/Forem.PagesClient.GetPagesById.g.cs +++ b/src/libs/Forem/Generated/Forem.PagesClient.GetPagesById.g.cs @@ -106,8 +106,12 @@ partial void ProcessGetPagesByIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -121,18 +125,24 @@ partial void ProcessGetPagesByIdResponseContent( h => h.Value), }; } - - return - global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -145,16 +155,6 @@ partial void ProcessGetPagesByIdResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.PagesClient.PutPagesById.g.cs b/src/libs/Forem/Generated/Forem.PagesClient.PutPagesById.g.cs index a927bbe..5b9c2f5 100644 --- a/src/libs/Forem/Generated/Forem.PagesClient.PutPagesById.g.cs +++ b/src/libs/Forem/Generated/Forem.PagesClient.PutPagesById.g.cs @@ -103,17 +103,26 @@ partial void ProcessPutPagesByIdResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -127,17 +136,26 @@ partial void ProcessPutPagesByIdResponseContent( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -168,8 +186,12 @@ partial void ProcessPutPagesByIdResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -183,18 +205,24 @@ partial void ProcessPutPagesByIdResponseContent( h => h.Value), }; } - - return - global::Forem.Page.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -207,16 +235,6 @@ partial void ProcessPutPagesByIdResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Forem.Page.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Forem/Generated/Forem.PodcastEpisodesClient.GetPodcastEpisodes.g.cs b/src/libs/Forem/Generated/Forem.PodcastEpisodesClient.GetPodcastEpisodes.g.cs index 33e01a4..4247077 100644 --- a/src/libs/Forem/Generated/Forem.PodcastEpisodesClient.GetPodcastEpisodes.g.cs +++ b/src/libs/Forem/Generated/Forem.PodcastEpisodesClient.GetPodcastEpisodes.g.cs @@ -113,17 +113,26 @@ partial void ProcessGetPodcastEpisodesResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -154,8 +163,12 @@ partial void ProcessGetPodcastEpisodesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -169,18 +182,24 @@ partial void ProcessGetPodcastEpisodesResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -193,16 +212,6 @@ partial void ProcessGetPodcastEpisodesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.ProfileImagesClient.GetProfileImage.g.cs b/src/libs/Forem/Generated/Forem.ProfileImagesClient.GetProfileImage.g.cs index 594273f..6e0d58c 100644 --- a/src/libs/Forem/Generated/Forem.ProfileImagesClient.GetProfileImage.g.cs +++ b/src/libs/Forem/Generated/Forem.ProfileImagesClient.GetProfileImage.g.cs @@ -90,17 +90,26 @@ partial void ProcessGetProfileImageResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -131,8 +140,10 @@ partial void ProcessGetProfileImageResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -146,16 +157,22 @@ partial void ProcessGetProfileImageResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -168,14 +185,6 @@ partial void ProcessGetProfileImageResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactions.g.cs b/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactions.g.cs index 44a699b..95d9868 100644 --- a/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactions.g.cs +++ b/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactions.g.cs @@ -103,17 +103,26 @@ partial void ProcessCreateReactionsResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -140,8 +149,9 @@ partial void ProcessCreateReactionsResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -155,15 +165,21 @@ partial void ProcessCreateReactionsResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -176,13 +192,6 @@ partial void ProcessCreateReactionsResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactionsToggle.g.cs b/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactionsToggle.g.cs index 284e2df..b6a4e33 100644 --- a/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactionsToggle.g.cs +++ b/src/libs/Forem/Generated/Forem.ReactionsClient.CreateReactionsToggle.g.cs @@ -103,17 +103,26 @@ partial void ProcessCreateReactionsToggleResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -140,8 +149,9 @@ partial void ProcessCreateReactionsToggleResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -155,15 +165,21 @@ partial void ProcessCreateReactionsToggleResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -176,13 +192,6 @@ partial void ProcessCreateReactionsToggleResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.ReadinglistClient.GetReadinglist.g.cs b/src/libs/Forem/Generated/Forem.ReadinglistClient.GetReadinglist.g.cs index 029aba8..0302ac3 100644 --- a/src/libs/Forem/Generated/Forem.ReadinglistClient.GetReadinglist.g.cs +++ b/src/libs/Forem/Generated/Forem.ReadinglistClient.GetReadinglist.g.cs @@ -104,17 +104,26 @@ partial void ProcessGetReadinglistResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -145,8 +154,12 @@ partial void ProcessGetReadinglistResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -160,18 +173,24 @@ partial void ProcessGetReadinglistResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -184,16 +203,6 @@ partial void ProcessGetReadinglistResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.TagsClient.GetTags.g.cs b/src/libs/Forem/Generated/Forem.TagsClient.GetTags.g.cs index aac1b0c..760ecd0 100644 --- a/src/libs/Forem/Generated/Forem.TagsClient.GetTags.g.cs +++ b/src/libs/Forem/Generated/Forem.TagsClient.GetTags.g.cs @@ -122,8 +122,12 @@ partial void ProcessGetTagsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -137,18 +141,24 @@ partial void ProcessGetTagsResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -161,16 +171,6 @@ partial void ProcessGetTagsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Forem/Generated/Forem.UsersClient.GetUser.g.cs b/src/libs/Forem/Generated/Forem.UsersClient.GetUser.g.cs index c015f19..2374cf5 100644 --- a/src/libs/Forem/Generated/Forem.UsersClient.GetUser.g.cs +++ b/src/libs/Forem/Generated/Forem.UsersClient.GetUser.g.cs @@ -108,8 +108,10 @@ partial void ProcessGetUserResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -123,16 +125,22 @@ partial void ProcessGetUserResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -145,14 +153,6 @@ partial void ProcessGetUserResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.UsersClient.GetUserMe.g.cs b/src/libs/Forem/Generated/Forem.UsersClient.GetUserMe.g.cs index 2038494..818d5e9 100644 --- a/src/libs/Forem/Generated/Forem.UsersClient.GetUserMe.g.cs +++ b/src/libs/Forem/Generated/Forem.UsersClient.GetUserMe.g.cs @@ -83,17 +83,26 @@ partial void ProcessGetUserMeResponseContent( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -124,8 +133,10 @@ partial void ProcessGetUserMeResponseContent( try { __response.EnsureSuccessStatusCode(); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -139,16 +150,22 @@ partial void ProcessGetUserMeResponseContent( h => h.Value), }; } - - return __content; } else { try { __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return __content; } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -161,14 +178,6 @@ partial void ProcessGetUserMeResponseContent( h => h.Value), }; } - - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; } } } diff --git a/src/libs/Forem/Generated/Forem.UsersClient.PostAdminUsersCreate.g.cs b/src/libs/Forem/Generated/Forem.UsersClient.PostAdminUsersCreate.g.cs index 8abf9be..6b293c8 100644 --- a/src/libs/Forem/Generated/Forem.UsersClient.PostAdminUsersCreate.g.cs +++ b/src/libs/Forem/Generated/Forem.UsersClient.PostAdminUsersCreate.g.cs @@ -93,17 +93,26 @@ partial void ProcessPostAdminUsersCreateResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -117,17 +126,26 @@ partial void ProcessPostAdminUsersCreateResponse( if ((int)__response.StatusCode == 422) { string? __content_422 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_422 = null; + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Forem.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -154,8 +172,9 @@ partial void ProcessPostAdminUsersCreateResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -169,15 +188,21 @@ partial void ProcessPostAdminUsersCreateResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -190,13 +215,6 @@ partial void ProcessPostAdminUsersCreateResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } diff --git a/src/libs/Forem/Generated/Forem.UsersClient.SuspendUser.g.cs b/src/libs/Forem/Generated/Forem.UsersClient.SuspendUser.g.cs index 9bbf9af..4f111c5 100644 --- a/src/libs/Forem/Generated/Forem.UsersClient.SuspendUser.g.cs +++ b/src/libs/Forem/Generated/Forem.UsersClient.SuspendUser.g.cs @@ -89,17 +89,26 @@ partial void ProcessSuspendUserResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -113,17 +122,26 @@ partial void ProcessSuspendUserResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -150,8 +168,9 @@ partial void ProcessSuspendUserResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -165,15 +184,21 @@ partial void ProcessSuspendUserResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -186,13 +211,6 @@ partial void ProcessSuspendUserResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.UsersClient.UnpublishUser.g.cs b/src/libs/Forem/Generated/Forem.UsersClient.UnpublishUser.g.cs index d7802d8..e80c596 100644 --- a/src/libs/Forem/Generated/Forem.UsersClient.UnpublishUser.g.cs +++ b/src/libs/Forem/Generated/Forem.UsersClient.UnpublishUser.g.cs @@ -93,17 +93,26 @@ partial void ProcessUnpublishUserResponse( if ((int)__response.StatusCode == 401) { string? __content_401 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_401 = null; + try { - __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_401 = __ex; } throw new global::Forem.ApiException( message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, statusCode: __response.StatusCode) { ResponseBody = __content_401, @@ -117,17 +126,26 @@ partial void ProcessUnpublishUserResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; - if (ReadResponseAsString) + global::System.Exception? __exception_404 = null; + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Forem.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -154,8 +172,9 @@ partial void ProcessUnpublishUserResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -169,15 +188,21 @@ partial void ProcessUnpublishUserResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -190,13 +215,6 @@ partial void ProcessUnpublishUserResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Forem/Generated/Forem.VideosClient.Videos.g.cs b/src/libs/Forem/Generated/Forem.VideosClient.Videos.g.cs index bd20291..0db0daf 100644 --- a/src/libs/Forem/Generated/Forem.VideosClient.Videos.g.cs +++ b/src/libs/Forem/Generated/Forem.VideosClient.Videos.g.cs @@ -122,8 +122,12 @@ partial void ProcessVideosResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -137,18 +141,24 @@ partial void ProcessVideosResponseContent( h => h.Value), }; } - - return - global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Forem.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -161,16 +171,6 @@ partial void ProcessVideosResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } }