Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 17, 2024
1 parent 40bc641 commit 70d8ab1
Show file tree
Hide file tree
Showing 146 changed files with 18,956 additions and 7,449 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@

#nullable enable

namespace GitHub
{
public partial class CodeScanningClient
{
partial void PrepareCodeScanningCreateAutofixArguments(
global::System.Net.Http.HttpClient httpClient,
ref string owner,
ref string repo,
ref int alertNumber);
partial void PrepareCodeScanningCreateAutofixRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string owner,
string repo,
int alertNumber);
partial void ProcessCodeScanningCreateAutofixResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessCodeScanningCreateAutofixResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Create an autofix for a code scanning alert<br/>
/// Creates an autofix for a code scanning alert.<br/>
/// If a new autofix is to be created as a result of this request or is currently being generated, then this endpoint will return a 202 Accepted response.<br/>
/// If an autofix already exists for a given alert, then this endpoint will return a 200 OK response.<br/>
/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
/// </summary>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="alertNumber">
/// The security alert number.<br/>
/// Included only in responses
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::GitHub.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::GitHub.CodeScanningAutofix> CodeScanningCreateAutofixAsync(
string owner,
string repo,
int alertNumber,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
PrepareCodeScanningCreateAutofixArguments(
httpClient: HttpClient,
owner: ref owner,
repo: ref repo,
alertNumber: ref alertNumber);

var __pathBuilder = new PathBuilder(
path: $"/repos/{owner}/{repo}/code-scanning/alerts/{alertNumber}/autofix",
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
__httpRequest.Version = global::System.Net.HttpVersion.Version11;
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif

PrepareRequest(
client: HttpClient,
request: __httpRequest);
PrepareCodeScanningCreateAutofixRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
owner: owner,
repo: repo,
alertNumber: alertNumber);

using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: HttpClient,
response: __response);
ProcessCodeScanningCreateAutofixResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Bad Request
if ((int)__response.StatusCode == 400)
{
string? __content_400 = null;
global::GitHub.BasicError? __value_400 = null;
if (ReadResponseAsString)
{
__content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_400 = global::GitHub.BasicError.FromJson(__content_400, JsonSerializerContext);
}
else
{
var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_400 = await global::GitHub.BasicError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::GitHub.ApiException<global::GitHub.BasicError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_400,
ResponseObject = __value_400,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Response if the repository is archived, if GitHub Advanced Security is not enabled for this repository or if rate limit is exceeded
if ((int)__response.StatusCode == 403)
{
string? __content_403 = null;
global::GitHub.BasicError? __value_403 = null;
if (ReadResponseAsString)
{
__content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_403 = global::GitHub.BasicError.FromJson(__content_403, JsonSerializerContext);
}
else
{
var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_403 = await global::GitHub.BasicError.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::GitHub.ApiException<global::GitHub.BasicError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
ResponseObject = __value_403,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Resource not found
if ((int)__response.StatusCode == 404)
{
string? __content_404 = null;
global::GitHub.BasicError? __value_404 = null;
if (ReadResponseAsString)
{
__content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_404 = global::GitHub.BasicError.FromJson(__content_404, JsonSerializerContext);
}
else
{
var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_404 = await global::GitHub.BasicError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::GitHub.ApiException<global::GitHub.BasicError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_404,
ResponseObject = __value_404,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
//
if ((int)__response.StatusCode == 422)
{
string? __content_422 = null;
if (ReadResponseAsString)
{
__content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
else
{
var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
}

throw new global::GitHub.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_422,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Service unavailable
if ((int)__response.StatusCode == 503)
{
string? __content_503 = null;
global::GitHub.CodeScanningCreateAutofixResponse? __value_503 = null;
if (ReadResponseAsString)
{
__content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_503 = global::GitHub.CodeScanningCreateAutofixResponse.FromJson(__content_503, JsonSerializerContext);
}
else
{
var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_503 = await global::GitHub.CodeScanningCreateAutofixResponse.FromJsonStreamAsync(__contentStream_503, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::GitHub.ApiException<global::GitHub.CodeScanningCreateAutofixResponse>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_503,
ResponseObject = __value_503,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

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

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

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::GitHub.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::GitHub.CodeScanningAutofix.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
else
{
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::GitHub.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 __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

return
await global::GitHub.CodeScanningAutofix.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
Loading

0 comments on commit 70d8ab1

Please sign in to comment.