Skip to content

Commit

Permalink
fix: Fixed missing models when use IncludeTags.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 25, 2024
1 parent 950b789 commit 5b7324c
Show file tree
Hide file tree
Showing 469 changed files with 94,198 additions and 52,503 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ public static IEnumerable<OpenApiReference> GetReferences(
return schema.Value.Properties
.Where(static x => x.Value.Reference != null)
.Select(static x => x.Value.Reference)
.Concat(schema.Value.Items?.Reference != null
? schema.Value.Items.WithKey("empty").GetReferences().Concat(new[] { schema.Value.Items.Reference })
: [])
.Concat(schema.Value.Properties.SelectMany(GetReferences));
}

Expand Down Expand Up @@ -252,6 +255,10 @@ public static string[] FindAllModelsForTag(
.Concat(operations
.SelectMany(x => x.Value.Responses.Values)
.Select(x => x.Reference?.Id))
.Concat(operations
.SelectMany(x => x.Value.Responses.Values)
.SelectMany(x => x.Content.Values)
.Select(x => x.Schema.Reference?.Id))
.Where(x => x != null)
.ToArray()!;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//HintName: G.Api.g.cs

#nullable enable

namespace G
{
/// <summary>
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
public sealed partial class Api : global::System.IDisposable
{
private readonly global::System.Net.Http.HttpClient _httpClient;

public MigrationsClient Migrations => new MigrationsClient(_httpClient);

/// <summary>
/// Creates a new instance of the Api.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
public Api(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri("https://api.github.com");
}

/// <inheritdoc/>
public void Dispose()
{
_httpClient.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//HintName: G.MigrationsClient.MigrationsCancelImport.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Cancel an import
/// </summary>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsCancelImportAsync(
string owner,
string repo,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Delete,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/repos/{owner}/{repo}/import", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//HintName: G.MigrationsClient.MigrationsDeleteArchiveForAuthenticatedUser.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Delete a user migration archive
/// </summary>
/// <param name="migrationId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsDeleteArchiveForAuthenticatedUserAsync(
int migrationId,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Delete,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/user/migrations/{migrationId}/archive", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//HintName: G.MigrationsClient.MigrationsDeleteArchiveForOrg.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Delete an organization migration archive
/// </summary>
/// <param name="org"></param>
/// <param name="migrationId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsDeleteArchiveForOrgAsync(
string org,
int migrationId,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Delete,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/orgs/{org}/migrations/{migrationId}/archive", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//HintName: G.MigrationsClient.MigrationsDownloadArchiveForOrg.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Download an organization migration archive
/// </summary>
/// <param name="org"></param>
/// <param name="migrationId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsDownloadArchiveForOrgAsync(
string org,
int migrationId,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/orgs/{org}/migrations/{migrationId}/archive", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//HintName: G.MigrationsClient.MigrationsGetArchiveForAuthenticatedUser.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Download a user migration archive
/// </summary>
/// <param name="migrationId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsGetArchiveForAuthenticatedUserAsync(
int migrationId,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/user/migrations/{migrationId}/archive", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//HintName: G.MigrationsClient.MigrationsGetCommitAuthors.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Get commit authors
/// </summary>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="since"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsGetCommitAuthorsAsync(
string owner,
string repo,
int since,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/repos/{owner}/{repo}/import/authors?since={since}", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//HintName: G.MigrationsClient.MigrationsGetImportStatus.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Get an import status
/// </summary>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<Import> MigrationsGetImportStatusAsync(
string owner,
string repo,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/repos/{owner}/{repo}/import", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

return
global::Newtonsoft.Json.JsonConvert.DeserializeObject<Import>(content) ??
throw new global::System.InvalidOperationException("Response deserialization failed for \"{content}\" ");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//HintName: G.MigrationsClient.MigrationsGetLargeFiles.g.cs

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Get large files
/// </summary>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task MigrationsGetLargeFilesAsync(
string owner,
string repo,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/repos/{owner}/{repo}/import/large_files", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//HintName: G.MigrationsClient.MigrationsGetStatusForAuthenticatedUser.g.cs
using System.Linq;

#nullable enable

namespace G
{
public partial class MigrationsClient
{
/// <summary>
/// Get a user migration status
/// </summary>
/// <param name="migrationId"></param>
/// <param name="exclude"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<Migration> MigrationsGetStatusForAuthenticatedUserAsync(
int migrationId,
global::System.Collections.Generic.IList<string> exclude,
global::System.Threading.CancellationToken cancellationToken = default)
{
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri + $"/user/migrations/{migrationId}?{string.Join("&", exclude.Select(static x => $"exclude={x}"))}", global::System.UriKind.RelativeOrAbsolute));

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

return
global::Newtonsoft.Json.JsonConvert.DeserializeObject<Migration>(content) ??
throw new global::System.InvalidOperationException("Response deserialization failed for \"{content}\" ");
}
}
}
Loading

0 comments on commit 5b7324c

Please sign in to comment.