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

Changes in generated code #16

Merged
merged 2 commits into from
Aug 15, 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
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
> [!IMPORTANT]
> This SDK is not yet stable. Breaking changes may occur at any time.

# Octokit: .NET SDK

[![Build and test .NET SDK](https:/octokit/dotnet-sdk/actions/workflows/build.yml/badge.svg)](https:/octokit/dotnet-sdk/actions/workflows/build.yml) [![CodeQL](https:/octokit/dotnet-sdk/actions/workflows/github-code-scanning/codeql/badge.svg)](https:/octokit/dotnet-sdk/actions/workflows/github-code-scanning/codeql) [![Publish Release to NuGet](https:/octokit/dotnet-sdk/actions/workflows/publish.yml/badge.svg)](https:/octokit/dotnet-sdk/actions/workflows/publish.yml)
[![Build and test .NET SDK](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/build.yml/badge.svg)](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/build.yml) [![CodeQL](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/github-code-scanning/codeql/badge.svg)](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/github-code-scanning/codeql) [![Publish Release to NuGet](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/publish.yml/badge.svg)](https:/octokit/dotnet-sdk-enterprise-cloud/actions/workflows/publish.yml)

An "alpha" version of a generated .NET SDK in C# for GitHub's Enterprise Cloud product, generated from [GitHub's OpenAPI spec](https:/github/rest-api-description), built on [Kiota](https:/microsoft/kiota). View on [NuGet](https://www.nuget.org/packages/GitHub.Octokit.SDK/).

Expand All @@ -12,11 +15,13 @@ You may also want:
- [NuGet link](https://www.nuget.org/packages/GitHub.Octokit.SDK)
- For GitHub Enterprise Cloud
- [dotnet-sdk-enterprise-cloud repository](https:/octokit/dotnet-sdk-enterprise-cloud)
- [NuGet link](https://www.nuget.org/packages/GitHub.Octokit.GHEC.SDK/)
- For GitHub Enterprise Server
- [dotnet-sdk-enterprise-server repository](https:/octokit/dotnet-sdk-enterprise-server)
- [NuGet link](https://www.nuget.org/packages?q=GitHub.Octokit.GHES.SDK)
- For our classic non-generated, hand-maintained Octokit.net project
- [Octokit.net repository](https:/octokit/octokit.net)
- For why we're building generative SDKs, see [Why a generated SDK?](#why-a-generated-sdk) below
- [NuGet link](https://www.nuget.org/packages/Octokit/)
- Go
- For the standard GitHub.com product
- [go-sdk repository](https:/octokit/go-sdk)
Expand All @@ -29,6 +34,7 @@ You may also want:
- [pkg.go.dev docs link](https://pkg.go.dev/github.com/octokit/go-sdk-enterprise-server)
- [source-generator](https:/octokit/source-generator) (the repository that creates these generated SDKs)
- Contributions to this repository should take place in source-generator instead, as they'll be distributed here through mechanisms there.
- For why we're building generative SDKs, see [Why a generated SDK?](#why-a-generated-sdk) below

## How do I use it?

Expand Down Expand Up @@ -59,9 +65,6 @@ foreach (var pullRequest in pullRequests)
}
```

> [!IMPORTANT]
> This SDK is not yet stable. Breaking changes may occur at any time.

### Authentication

This SDK supports [Personal Access Tokens (classic)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic), [fine-grained Personal Access Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#fine-grained-personal-access-tokens), and [GitHub Apps](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/about-authentication-with-a-github-app) authentication.
Expand Down Expand Up @@ -99,9 +102,7 @@ Note that the SDK **does not yet** support authenticating as the App itself and

## Why a generated SDK?

We want to...
1. provide 100% coverage of the API in our SDK
1. use this as a building block for future SDK tooling
Please take a moment and head over to the GitHub blog to read more about the [why's and how's behind our move to Generative SDKs](https://github.blog/news-insights/product-news/our-move-to-generated-sdks/).

## Why .NET?

Expand All @@ -127,7 +128,7 @@ Currently this project is fairly simple (we hope it can stay that way). All of
- Generate test report: `dotnet reportgenerator -targetdir:$(pwd)/test/coverage/Report/ -reports:$(pwd)/test/coverage/coverage.opencover.xml`
- Note that this requires installing [ReportGenerator](https:/danielpalme/ReportGenerator), whose installation instructions can be found [here](https:/danielpalme/ReportGenerator?tab=readme-ov-file#install-the-package-matching-your-platform-and-needs)
- We're using the `dotnet-reportgenerator-globaltool`, so follow that set of installation instructions
- The test report can be viewed by opening the generated report file (logged to CLI output, something like `/path/to/your/repo/dotnet-sdk/test/coverage/Report/index.html`) in a browser
- The test report can be viewed by opening the generated report file (logged to CLI output, something like `/path/to/your/repo/dotnet-sdk-enterprise-cloud/test/coverage/Report/index.html`) in a browser

## More details on this SDK and repo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public UsageRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base
{
}
/// <summary>
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// API method documentation <see href="https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-enterprise-members" />
/// </summary>
/// <returns>A List&lt;CopilotUsageMetrics&gt;</returns>
Expand Down Expand Up @@ -62,7 +62,7 @@ public async Task<List<CopilotUsageMetrics>> GetAsync(Action<RequestConfiguratio
return collectionResult?.ToList();
}
/// <summary>
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// </summary>
/// <returns>A <see cref="RequestInformation"/></returns>
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
Expand Down Expand Up @@ -90,7 +90,7 @@ public UsageRequestBuilder WithUrl(string rawUrl)
return new UsageRequestBuilder(rawUrl, RequestAdapter);
}
/// <summary>
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// &gt; [!NOTE]&gt; This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only owners and billing managers can view Copilot usage metrics for the enterprise.OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
/// </summary>
public class UsageRequestBuilderGetQueryParameters
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public async Task<ResourceDeleteResponse> DeleteAsync(ResourceDeleteRequestBody
/// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
/// <exception cref="BasicError">When receiving a 400 status code</exception>
/// <exception cref="BasicError">When receiving a 403 status code</exception>
/// <exception cref="BasicError">When receiving a 409 status code</exception>
/// <exception cref="BasicError">When receiving a 500 status code</exception>
/// <exception cref="Resource503Error">When receiving a 503 status code</exception>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
Expand All @@ -89,6 +90,7 @@ public async Task<ResourcePostResponse> PostAsync(ResourcePostRequestBody body,
{
{"400", BasicError.CreateFromDiscriminatorValue},
{"403", BasicError.CreateFromDiscriminatorValue},
{"409", BasicError.CreateFromDiscriminatorValue},
{"500", BasicError.CreateFromDiscriminatorValue},
{"503", Resource503Error.CreateFromDiscriminatorValue},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// <auto-generated/>
using GitHub.Enterprises.Item.Team.Item.Copilot.Usage;
using Microsoft.Kiota.Abstractions;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System;
namespace GitHub.Enterprises.Item.Team.Item.Copilot {
/// <summary>
/// Builds and executes requests for operations under \enterprises\{enterprise}\team\{team_slug}\copilot
/// </summary>
public class CopilotRequestBuilder : BaseRequestBuilder
{
/// <summary>The usage property</summary>
public UsageRequestBuilder Usage
{
get => new UsageRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>
/// Instantiates a new <see cref="CopilotRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="pathParameters">Path parameters for the request</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public CopilotRequestBuilder(Dictionary<string, object> pathParameters, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/enterprises/{enterprise}/team/{team_slug}/copilot", pathParameters)
{
}
/// <summary>
/// Instantiates a new <see cref="CopilotRequestBuilder"/> and sets the default values.
/// </summary>
/// <param name="rawUrl">The raw URL to use for the request builder.</param>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public CopilotRequestBuilder(string rawUrl, IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}/enterprises/{enterprise}/team/{team_slug}/copilot", rawUrl)
{
}
}
}
Loading
Loading