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] authored and HavenDV committed Aug 9, 2024
1 parent 55cb884 commit 403c745
Show file tree
Hide file tree
Showing 23 changed files with 5,481 additions and 5,602 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ partial void ProcessCopilotUsageMetricsForEnterpriseResponseContent(
/// You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE<br/>
/// for all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,<br/>
/// and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.<br/>
/// The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,<br/>
/// The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,<br/>
/// and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,<br/>
/// they must have telemetry enabled in their IDE.<br/>
/// Only owners and billing managers can view Copilot usage metrics for the enterprise.<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

#nullable enable

namespace GitHub
{
public partial class CopilotClient
{
partial void PrepareCopilotUsageMetricsForEnterpriseTeamArguments(
global::System.Net.Http.HttpClient httpClient,
ref string enterprise,
ref string teamSlug,
ref string since,
ref string until,
ref int page,
ref int perPage);
partial void PrepareCopilotUsageMetricsForEnterpriseTeamRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string enterprise,
string teamSlug,
string since,
string until,
int page,
int perPage);
partial void ProcessCopilotUsageMetricsForEnterpriseTeamResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

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

/// <summary>
/// Get a summary of Copilot usage for an enterprise team<br/>
/// &gt; [!NOTE]<br/>
/// &gt; This endpoint is in beta and is subject to change.<br/>
/// You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE<br/>
/// for users within an enterprise team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.<br/>
/// See the response schema tab for detailed metrics definitions.<br/>
/// The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,<br/>
/// and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,<br/>
/// they must have telemetry enabled in their IDE.<br/>
/// &gt; [!NOTE]<br/>
/// &gt; This endpoint will only return results for a given day if the enterprise team had five or more members with active Copilot licenses, as evaluated at the end of that day.<br/>
/// Owners and billing managers for the enterprise that contains the enterprise team can view Copilot usage metrics for the enterprise team.<br/>
/// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// </summary>
/// <param name="enterprise"></param>
/// <param name="teamSlug"></param>
/// <param name="since"></param>
/// <param name="until"></param>
/// <param name="page">
/// Default Value: 1
/// </param>
/// <param name="perPage">
/// Default Value: 28
/// </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<global::System.Collections.Generic.IList<global::GitHub.CopilotUsageMetrics>> CopilotUsageMetricsForEnterpriseTeamAsync(
string enterprise,
string teamSlug,
string since,
string until,
int page,
int perPage,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: _httpClient);
PrepareCopilotUsageMetricsForEnterpriseTeamArguments(
httpClient: _httpClient,
enterprise: ref enterprise,
teamSlug: ref teamSlug,
since: ref since,
until: ref until,
page: ref page,
perPage: ref perPage);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/enterprises/{enterprise}/team/{teamSlug}/copilot/usage?since={since}&until={until}&page={page}&per_page={perPage}", global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareCopilotUsageMetricsForEnterpriseTeamRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
enterprise: enterprise,
teamSlug: teamSlug,
since: since,
until: until,
page: page,
perPage: perPage);

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

ProcessResponse(
client: _httpClient,
response: response);
ProcessCopilotUsageMetricsForEnterpriseTeamResponse(
httpClient: _httpClient,
httpResponseMessage: response);

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

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessCopilotUsageMetricsForEnterpriseTeamResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::GitHub.SourceGenerationContext.Default.IListCopilotUsageMetrics) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ partial void ProcessCopilotUsageMetricsForOrgResponseContent(
/// You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE<br/>
/// across an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.<br/>
/// See the response schema tab for detailed metrics definitions.<br/>
/// The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,<br/>
/// The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,<br/>
/// and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,<br/>
/// they must have telemetry enabled in their IDE.<br/>
/// Organization owners, and owners and billing managers of the parent enterprise, can view Copilot usage metrics.<br/>
Expand Down
6 changes: 6 additions & 0 deletions src/libs/GitHub/Generated/GitHub.Models.ApiOverview.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ public sealed partial class ApiOverview
[global::System.Text.Json.Serialization.JsonPropertyName("dependabot")]
public global::System.Collections.Generic.IList<string?>? Dependabot { get; set; }

/// <summary>
/// Example: [192.0.2.1]
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("copilot")]
public global::System.Collections.Generic.IList<string?>? Copilot { get; set; }

/// <summary>
///
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed partial class CopilotSeatDetails
/// The assignee that has been granted access to GitHub Copilot.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("assignee")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory3))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory1))]
[global::System.Text.Json.Serialization.JsonRequired]
public required object Assignee { get; set; }

Expand Down
220 changes: 0 additions & 220 deletions src/libs/GitHub/Generated/GitHub.Models.Organization.g.cs

This file was deleted.

Loading

0 comments on commit 403c745

Please sign in to comment.