Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 36 additions & 18 deletions src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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);

}
}

Expand Down
41 changes: 25 additions & 16 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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;
}
}
}
Expand Down
41 changes: 25 additions & 16 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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;
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ partial void ProcessGetArticlesResponseContent(
try
{
__response.EnsureSuccessStatusCode();

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList<global::Forem.ArticleIndex>), JsonSerializerContext) as global::System.Collections.Generic.IList<global::Forem.ArticleIndex> ??
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,
Expand All @@ -190,18 +194,24 @@ partial void ProcessGetArticlesResponseContent(
h => h.Value),
};
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList<global::Forem.ArticleIndex>), JsonSerializerContext) as global::System.Collections.Generic.IList<global::Forem.ArticleIndex> ??
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<global::Forem.ArticleIndex>), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList<global::Forem.ArticleIndex> ??
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,
Expand All @@ -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<global::Forem.ArticleIndex>), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList<global::Forem.ArticleIndex> ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
Expand Down
Loading
Loading