{"id":21408547,"url":"https://github.com/octokit/dotnet-sdk","last_synced_at":"2025-04-10T20:22:29.219Z","repository":{"id":209942748,"uuid":"725320049","full_name":"octokit/dotnet-sdk","owner":"octokit","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-04T00:25:46.000Z","size":7129,"stargazers_count":51,"open_issues_count":11,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-07-05T16:32:22.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/octokit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"Docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"Docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-29T22:32:46.000Z","updated_at":"2024-08-02T20:00:17.877Z","dependencies_parsed_at":"2024-01-11T01:36:32.006Z","dependency_job_id":"7e87852c-581e-4db1-b723-6fe6717b620b","html_url":"https://github.com/octokit/dotnet-sdk","commit_stats":null,"previous_names":["octokit/dotnet-sdk"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octokit%2Fdotnet-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octokit%2Fdotnet-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octokit%2Fdotnet-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octokit%2Fdotnet-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octokit","download_url":"https://codeload.github.com/octokit/dotnet-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430835,"owners_count":20937873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T17:17:02.367Z","updated_at":"2025-04-10T20:22:29.198Z","avatar_url":"https://github.com/octokit.png","language":"C#","funding_links":[],"categories":["EF Core Providers Connectors"],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e This SDK is not yet stable. Breaking changes may occur at any time.\n\n# Octokit: .NET SDK\n\n[![Build and test .NET SDK](https://github.com/octokit/dotnet-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/octokit/dotnet-sdk/actions/workflows/build.yml) [![CodeQL](https://github.com/octokit/dotnet-sdk/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/octokit/dotnet-sdk/actions/workflows/github-code-scanning/codeql) [![Publish Release to NuGet](https://github.com/octokit/dotnet-sdk/actions/workflows/publish.yml/badge.svg)](https://github.com/octokit/dotnet-sdk/actions/workflows/publish.yml)\n\nAn \"alpha\" version of a generated .NET SDK in C# for GitHub's standard GitHub.com product, generated from [GitHub's OpenAPI spec](https://github.com/github/rest-api-description), built on [Kiota](https://github.com/microsoft/kiota). View on [NuGet](https://www.nuget.org/packages/GitHub.Octokit.SDK/).\n\nYou may also want:\n\n- .NET\n\t- For the standard GitHub.com product\n\t\t- [dotnet-sdk repository](https://github.com/octokit/dotnet-sdk)\n\t\t- [NuGet link](https://www.nuget.org/packages/GitHub.Octokit.SDK)\n\t- For GitHub Enterprise Cloud\n\t\t- [dotnet-sdk-enterprise-cloud repository](https://github.com/octokit/dotnet-sdk-enterprise-cloud)\n\t\t- [NuGet link](https://www.nuget.org/packages/GitHub.Octokit.GHEC.SDK/)\n\t- For GitHub Enterprise Server\n\t\t- [dotnet-sdk-enterprise-server repository](https://github.com/octokit/dotnet-sdk-enterprise-server)\n\t\t- [NuGet link](https://www.nuget.org/packages?q=GitHub.Octokit.GHES.SDK)\n\t- For our classic non-generated, hand-maintained Octokit.net project\n\t\t- [Octokit.net repository](https://github.com/octokit/octokit.net)\n\t\t- [NuGet link](https://www.nuget.org/packages/Octokit/)\n- Go\n\t- For the standard GitHub.com product\n\t\t- [go-sdk repository](https://github.com/octokit/go-sdk)\n\t\t- [pkg.go.dev docs link](https://pkg.go.dev/github.com/octokit/go-sdk)\n\t- For GitHub Enterprise Cloud\n\t\t- [go-sdk-enterprise-cloud repository](https://github.com/octokit/go-sdk-enterprise-cloud)\n\t\t- [pkg.go.dev docs link](https://pkg.go.dev/github.com/octokit/go-sdk-enterprise-cloud)\n\t- For GitHub Enterprise Server\n\t\t- [go-sdk-enterprise-server repository](https://github.com/octokit/go-sdk-enterprise-server)\n\t\t- [pkg.go.dev docs link](https://pkg.go.dev/github.com/octokit/go-sdk-enterprise-server)\n- [source-generator](https://github.com/octokit/source-generator) (the repository that creates these generated SDKs)\n\t- Contributions to this repository should take place in source-generator instead, as they'll be distributed here through mechanisms there.\n- For why we're building generative SDKs, see [Why a generated SDK?](#why-a-generated-sdk) below\n\n## How do I use it?\n\n### Installation\n\nTo install the package, you can use either of the following options:\n\n- In Visual Studio, from the Package Explorer, search for `GitHub.Octokit.SDK`, or\n- Type `Install-Package GitHub.Octokit.SDK` into the Package Manager Console, or\n- Type `dotnet add ./path/to/myproject.csproj package GitHub.Octokit.SDK` in a terminal (replace `./path/to/myproject.csproj` by the path to the _*.csproj_ file you want to add the dependency)\n\n### Make your first request\n\n```csharp\nusing GitHub;\nusing GitHub.Octokit.Client;\nusing GitHub.Octokit.Client.Authentication;\n\nvar tokenProvider = new TokenProvider(Environment.GetEnvironmentVariable(\"GITHUB_TOKEN\") ?? \"\");\nvar adapter = RequestAdapter.Create(new TokenAuthProvider(tokenProvider));\nawait MakeRequest(new GitHubClient(adapter));\n\ntry\n{\n\tvar response = await gitHubClient.Repositories.GetAsync();\n\tresponse?.ForEach(repo =\u003e Console.WriteLine(repo.FullName));\n}\ncatch (Exception e)\n{\n\tConsole.WriteLine(e.Message);\n}\n```\n\n#### Custom configuration for requests \n\n```csharp\nusing GitHub;\nusing GitHub.Octokit.Client;\nusing GitHub.Octokit.Client.Authentication;\n\nvar tokenProvider = new TokenProvider(Environment.GetEnvironmentVariable(\"GITHUB_TOKEN\") ?? \"\");\n\nvar adapter = new ClientFactory()\n\t.WithAuthenticationProvider(new TokenAuthProvider(tokenProvider))\n\t.WithUserAgent(\"my-app\", \"1.0.0\")\n\t.WithRequestTimeout(TimeSpan.FromSeconds(100))\n\t.WithBaseUrl(\"https://api.github.com\")\n\t.Build();\n\ntry\n{\n\tvar response = await gitHubClient.Repositories.GetAsync();\n\tresponse?.ForEach(repo =\u003e Console.WriteLine(repo.FullName));\n}\ncatch (Exception e)\n{\n\tConsole.WriteLine(e.Message);\n}\n```\n\n### Authentication\n\nThis 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.\n\nIn order to use either type of Personal Access token, you can use the `TokenAuthProvider` constructor option when constructing a new token provider, like so:\n\n```csharp\n    var tokenProvider = new TokenProvider(Environment.GetEnvironmentVariable(\"GITHUB_TOKEN\") ?? \"\");\n    var adapter = RequestAdapter.Create(new TokenAuthProvider(tokenProvider));\n    var gitHubClient = new GitHubClient(adapter);\n```\n\nIn order to authenticate as a GitHub App, you can use the `AppInstallationAuthProvider` constructor option:\n\n```csharp\n    var githubAppTokenProvider = new GitHubAppTokenProvider();\n    var rsa = RSA.Create();\n    rsa.ImportFromPem(PRIVATE_KEY_PATH);\n\n    var aiAccessTokenProvider = new AppInstallationTokenProvider(CLIENT_ID, rsa, INSTALLATION_ID, githubAppTokenProvider);\n    var aiAdapter = RequestAdapter.Create(new AppInstallationAuthProvider(aiAccessTokenProvider));\n    var aiGitHubClient = new GitHubClient(aiAdapter);\n```\n\nTo see more detailed examples, view [the cli/ directory in this repo](cli/).\n\n⚠️ **Note**: There are [three types](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/about-authentication-with-a-github-app) of GitHub App authentication:\n1. [As the App itself (meta endpoints)](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28)\n1. [As an App installation](https://docs.github.com/en/rest/authentication/endpoints-available-for-github-app-installation-access-tokens?apiVersion=2022-11-28)\n1. On behalf of a user\n\nAuthenticating on behalf of a user is not supported in an SDK, as it requires a UI authentication flow with redirects. This SDK supports authenticating as the App itself and as an App installation.\n\nNote that the SDK **does not yet** support authenticating as the App itself and as an App installation using the same client transparently to the user. Authenticating as the App itself requires [creating a JSON Web Token (JWT)](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app) and using that as token authentication. For helpers to create and sign a JWT in .NET, you may use the helpers in the `GitHubAppTokenProvider` [class](src/Client/Authentication/GitHubAppTokenProvider.cs).\n\n## Why a generated SDK?\n\nPlease 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/).\n\n## Why .NET?\n\nWe have a substantial userbase that uses .NET and we wanted them to get access to our generated SDK as early as possible.\n\n## How can I report on my experience or issues with the SDK?\n\nPlease use this project's [issues](https://github.com/octokit/dotnet-sdk/issues)!\n\n## Source organization\n\nCurrently this project is fairly simple (we hope it can stay that way).  All of the package based source is contained in the `GitHub` folder.\n\n - **Authentication** - everything related to authenticating requests\n - **Client** - the logic for constructing the plumbing to interact with the GitHub API\n - **Middleware** - this represents object and handlers that can mutate the request and are \"injected\" into the request/response flow.\n - **Octokit** - types which represent request/response objects\n\n## Testing\n\n- Run tests: `dotnet test`\n- Generate test coverage: `dotnet test -p:CollectCoverage=true -p:CoverletOutput=coverage/ -p:CoverletOutputFormat=opencover -p:ExcludeByFile=\"$(pwd)/src/GitHub/**/*.cs\"`\n- Generate test report: `dotnet reportgenerator -targetdir:$(pwd)/test/coverage/Report/ -reports:$(pwd)/test/coverage/coverage.opencover.xml`\n    - Note that this requires installing [ReportGenerator](https://github.com/danielpalme/ReportGenerator), whose installation instructions can be found [here](https://github.com/danielpalme/ReportGenerator?tab=readme-ov-file#install-the-package-matching-your-platform-and-needs)\n    - We're using the `dotnet-reportgenerator-globaltool`, so follow that set of installation instructions\n- 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\n\n## More details on this SDK and repo\n\n- [Code of conduct](Docs/CODE_OF_CONDUCT.md)\n- [Contributing](Docs/CONTRIBUTING.md)\n- [Releases](Docs/RELEASES.md)\n- [Incidents and security](Docs/SECURITY.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctokit%2Fdotnet-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctokit%2Fdotnet-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctokit%2Fdotnet-sdk/lists"}