-
Notifications
You must be signed in to change notification settings - Fork 60.6k
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
Add a guide on how to use the .NET Octokit SDK #29537
Conversation
Automatically generated comment ℹ️This comment is automatically generated and will be overwritten every time changes are committed to this branch. The table contains an overview of files in the Content directory changesYou may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.
fpt: Free, Pro, Team |
|
@Manas-Kenge Thank you for this PR! 🎉 We really appreciate your willingness to take on these I'll get this triaged for review! ⚡ |
|
Thanks for this PR! For this issue, we'd especially like to cover every thing that the JavaScript guide covers. (You can find the raw text of the JavaScript guide here, and you may find it helpful to copy that guide and just replace the JavaScripts-specific parts with .NET.) |
|
This PR has been automatically closed because there has been no response to to our request for more information from the original author. Please reach out if you have the information we requested, or open a new issue to describing your changes. Then we can begin the review process. |
|
@Manas-Kenge Stalebot closed this out due to non activity. If you are still up for making the suggested edits above, we'd love to add this to our docs. Let us know if you have any questions. We are happy to reopen this when/if you are able to work on it again 💖 |
|
@cmwilson21 I am sorry I was busy with some other work. I would like to work on this issue again. Can you reopen this so I can make the suggested changes. |
|
@Manas-Kenge No problem! Thanks for responding! Reopening now and we are looking forward to working with you on this 👍 |
|
@Manas-Kenge Please give us an |
|
@cmwilson21 I have tried to make this similar to the JavaScript guide. Let me know if there are any additions required. |
|
@cmwilson21 Can you please review this once again? |
|
@Manas-Kenge Thanks for the ping! It's on the board and will be reviewed soon ✨ |
|
Thanks for these updates @Manas-Kenge ! It looks like there are still some unresolved review comments above (you may need to click the "Load more..." link to show hidden items). Can you please make sure that those comments are all addressed and then mark them as resolved? It also looks like there are some linting errors (https://github.com/github/docs/actions/runs/7616854806/job/20744567275?pr=29537). Can you resolve them or us know if you need help resolving them? Once that is done, let us know and we'll ping the SME for another round of review. |
|
This PR has been automatically closed because there has been no response to to our request for more information from the original author. Please reach out if you have the information we requested, or open a new issue to describing your changes. Then we can begin the review process. |
|
@Manas-Kenge Hello! 👋 Would you like us to keep this PR open? We're happy to do so if you wish to continue working on this 💛 |
|
@nguyenalex836 Can you please get someone to review this once? |
|
@Manas-Kenge I've added this to our team's board to be reviewed 💛 |
|
(Internal note: Asked here about the failing |
|
Thanks for the ping that this is ready for re-review! I'll ask our SME team for another review. (Internal note: Asked here.) |
|
Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done another review pass here. There are changes that need to be made and checks that need to be passing before this can be considered for merging.
|
|
||
| ## Prerequisites | ||
|
|
||
| This guide assumes that you are familiar with .NET development and the {% data variables.product.company_short %} REST API. For more information about the REST API, see [AUTOTITLE](/rest/guides/getting-started-with-the-rest-api). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skedwards88 above on line 17, the PR uses "GitHub" directly, whereas here the PR uses {% data variables.product.company_short %}. Is there a policy on consistency here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we should be using {% data variables.product.company_short %} instead of GitHub, but this isn't strongly enforced.
| using System; | ||
| using Octokit; | ||
|
|
||
| var github = new GitHubClient(new ProductHeaderValue("MyApp")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a constructor that takes credentials in as a parameter; can we use that instead of doing modifying credentials after instantiation?
|
|
||
| var github = new GitHubClient(new ProductHeaderValue("YourAppName")) | ||
| { | ||
| Credentials = new Credentials("YOUR-TOKEN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment above.
| Console.WriteLine($"The status of the response is: {response.StatusCode}"); | ||
| Console.WriteLine($"The request URL was: {response.ApiUrl}"); | ||
| Console.WriteLine($"The x-ratelimit-remaining response header is: {response.Headers["x-ratelimit-remaining"]}"); | ||
| Console.WriteLine($"The issue title is: {((dynamic)response.Data).title}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You marked this as resolved but I didn't see an explanation. Why is dynamic required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamic in this context allows access to properties of the response without knowing its actual type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand what the dynamic keyword does. I'm curious why it's an appropriate choice in a best practices documentation over using a type.
|
|
||
| ## Example script | ||
|
|
||
| Here is a full example script that uses Octokit.net. The script imports `Octokit` and creates a new instance of `Octokit`. If you want to authenticate with a {% data variables.product.prodname_github_app %} instead of a {% data variables.product.pat_generic %}, you need to create a GitHubApp instance and use a JWT (JSON Web Token) for authentication. For more information, see "[Authenticating with a {% data variables.product.prodname_github_app %}](#authenticating-with-a-github-app)." in this guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe here what this code is doing and why? What is the regex for? Why the need for multiple helper methods for a simple example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, I made it complicated. I used regex to determine whether any of the changed files match a certain pattern or are located within a specific directory, allowing to decide what actions to take based on the file paths.
| @@ -0,0 +1,378 @@ | |||
| --- | |||
| title: Scripting with the REST API and .NET | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C# is not a scripting language without using an add-on like MSFT's C# REPL, the interactive window, or dotnet-script. Please change the language throughout this document and the link(s) to it, perhaps to something like "application" or "program".
|
This PR has been automatically closed because there has been no response to to our request for more information from the original author. Please reach out if you have the information we requested, or open a new issue to describing your changes. Then we can begin the review process. |
|
@Manas-Kenge Hello! 👋 Please let us know if you are still working on this PR, and would like us to reopen 💛 |
Why:
Closes: #23845
What's being changed (if available, include any code snippets, screenshots, or gifs):
Added a file on how to use the .NET Octokit SDK
Check off the following:
I have reviewed my changes in staging, available via the View deployment link in this PR's timeline.
datadirectory.For content changes, I have completed the self-review checklist.