Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:@coderabbitai #60

Merged
merged 1 commit into from
Nov 12, 2024
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
20 changes: 18 additions & 2 deletions src/libs/Forem/Generated/Forem.ArticlesClient.CreateArticle.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ partial void ProcessCreateArticleResponse(
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Forem.ApiException"></exception>
public async global::System.Threading.Tasks.Task CreateArticleAsync(
global::Forem.Article request,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -85,7 +85,23 @@ partial void ProcessCreateArticleResponse(
ProcessCreateArticleResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
__response.EnsureSuccessStatusCode();
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
}

/// <summary>
Expand Down
99 changes: 82 additions & 17 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleById.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ partial void ProcessGetArticleByIdResponseContent(
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Forem.ApiException"></exception>
public async global::System.Threading.Tasks.Task<string> GetArticleByIdAsync(
int id,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -81,28 +81,93 @@ partial void ProcessGetArticleByIdResponseContent(
ProcessGetArticleByIdResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Article Not Found
if ((int)__response.StatusCode == 404)
{
string? __content_404 = null;
if (ReadResponseAsString)
{
__content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
else
{
var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
}

var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticleByIdResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_404,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

try
if (ReadResponseAsString)
{
__response.EnsureSuccessStatusCode();
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticleByIdResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return __content;
}
catch (global::System.Net.Http.HttpRequestException __ex)
else
{
throw new global::System.InvalidOperationException(__content, __ex);
}
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return __content;
using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

var __responseValue = await global::System.Text.Json.JsonSerializer.DeserializeAsync(__responseStream, typeof(string), JsonSerializerContext).ConfigureAwait(false) as string;

return
__responseValue ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
99 changes: 82 additions & 17 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticleByPath.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ partial void ProcessGetArticleByPathResponseContent(
/// <param name="username"></param>
/// <param name="slug"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Forem.ApiException"></exception>
public async global::System.Threading.Tasks.Task<string> GetArticleByPathAsync(
string username,
string slug,
Expand Down Expand Up @@ -87,28 +87,93 @@ partial void ProcessGetArticleByPathResponseContent(
ProcessGetArticleByPathResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Article Not Found
if ((int)__response.StatusCode == 404)
{
string? __content_404 = null;
if (ReadResponseAsString)
{
__content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
else
{
var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
}

var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticleByPathResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_404,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

try
if (ReadResponseAsString)
{
__response.EnsureSuccessStatusCode();
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticleByPathResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return __content;
}
catch (global::System.Net.Http.HttpRequestException __ex)
else
{
throw new global::System.InvalidOperationException(__content, __ex);
}
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return __content;
using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

var __responseValue = await global::System.Text.Json.JsonSerializer.DeserializeAsync(__responseStream, typeof(string), JsonSerializerContext).ConfigureAwait(false) as string;

return
__responseValue ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
79 changes: 60 additions & 19 deletions src/libs/Forem/Generated/Forem.ArticlesClient.GetArticles.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ partial void ProcessGetArticlesResponseContent(
/// <param name="top"></param>
/// <param name="collectionId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Forem.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IList<global::Forem.ArticleIndex>> GetArticlesAsync(
int? page = default,
int? perPage = default,
Expand Down Expand Up @@ -151,29 +151,70 @@ partial void ProcessGetArticlesResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response);

var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
if (ReadResponseAsString)
{
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticlesResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);
ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetArticlesResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
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}\" ");
}
catch (global::System.Net.Http.HttpRequestException __ex)
else
{
throw new global::System.InvalidOperationException(__content, __ex);
}
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Forem.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

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}\" ");
var __responseValue = await global::System.Text.Json.JsonSerializer.DeserializeAsync(__responseStream, typeof(global::System.Collections.Generic.IList<global::Forem.ArticleIndex>), JsonSerializerContext).ConfigureAwait(false) as global::System.Collections.Generic.IList<global::Forem.ArticleIndex>;

return
__responseValue ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
Loading
Loading