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

Add a guide on how to use the .NET Octokit SDK #29537

Closed
wants to merge 18 commits into from

Conversation

Manas-Kenge
Copy link
Contributor

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.

    • For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the data directory.
  • For content changes, I have completed the self-review checklist.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Oct 28, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2023

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 that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You 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.

Source Preview Production What Changed
rest/guides/index.md fpt
ghec
ghes@ 3.11 3.10 3.9 3.8
fpt
ghec
ghes@ 3.11 3.10 3.9 3.8
New file: rest/guides/scripting-with-the-rest-api-and-net.md fpt
ghec
ghes@ 3.11 3.10 3.9 3.8
fpt
ghec
ghes@ 3.11 3.10 3.9 3.8

fpt: Free, Pro, Team
ghec: GitHub Enterprise Cloud
ghes: GitHub Enterprise Server

@cmwilson21
Copy link
Contributor

@Manas-Kenge Thank you for this PR! 🎉

We really appreciate your willingness to take on these help wanted issues! 💪

I'll get this triaged for review! ⚡

@cmwilson21 cmwilson21 added content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review rest Content related to rest - overview. and removed triage Do not begin working on this issue until triaged by the team labels Oct 30, 2023
@lecoursen lecoursen added the hacktoberfest-accepted We might not merge this PR before Nov 1st, but it's a wonderful Hacktoberfest contribution! label Oct 31, 2023
@skedwards88
Copy link
Contributor

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.)

@skedwards88 skedwards88 added more-information-needed More information is needed to complete review and removed waiting for review Issue/PR is waiting for a writer's review labels Oct 31, 2023
@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Nov 7, 2023
Copy link
Contributor

github-actions bot commented Nov 7, 2023

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.

@github-actions github-actions bot closed this Nov 7, 2023
@cmwilson21
Copy link
Contributor

@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 💖

@Manas-Kenge
Copy link
Contributor Author

@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.

@cmwilson21
Copy link
Contributor

@Manas-Kenge No problem! Thanks for responding! Reopening now and we are looking forward to working with you on this 👍

@cmwilson21 cmwilson21 reopened this Nov 9, 2023
@github-actions github-actions bot added triage Do not begin working on this issue until triaged by the team and removed stale There is no recent activity on this issue or pull request labels Nov 9, 2023
@cmwilson21
Copy link
Contributor

@Manas-Kenge Please give us an @mention ping when this ready for review again 👍

@cmwilson21 cmwilson21 removed the triage Do not begin working on this issue until triaged by the team label Nov 10, 2023
@Manas-Kenge
Copy link
Contributor Author

@cmwilson21 I have tried to make this similar to the JavaScript guide. Let me know if there are any additions required.

@Manas-Kenge
Copy link
Contributor Author

@cmwilson21 Can you please review this once again?

@cmwilson21
Copy link
Contributor

@Manas-Kenge Thanks for the ping! It's on the board and will be reviewed soon ✨

@cmwilson21 cmwilson21 removed the more-information-needed More information is needed to complete review label Nov 13, 2023
@skedwards88
Copy link
Contributor

skedwards88 commented Jan 22, 2024

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.

@github-actions github-actions bot removed the stale There is no recent activity on this issue or pull request label Jan 22, 2024
@nguyenalex836 nguyenalex836 removed the triage Do not begin working on this issue until triaged by the team label Jan 25, 2024
@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

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.

@github-actions github-actions bot closed this Feb 2, 2024
@nguyenalex836
Copy link
Contributor

@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 💛

@Manas-Kenge
Copy link
Contributor Author

@nguyenalex836 Can you please get someone to review this once?

@nguyenalex836 nguyenalex836 added waiting for review Issue/PR is waiting for a writer's review and removed more-information-needed More information is needed to complete review stale There is no recent activity on this issue or pull request labels Feb 2, 2024
@nguyenalex836
Copy link
Contributor

@Manas-Kenge I've added this to our team's board to be reviewed 💛

@nguyenalex836 nguyenalex836 reopened this Feb 2, 2024
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Feb 2, 2024
@skedwards88
Copy link
Contributor

(Internal note: Asked here about the failing Check unallowed file changes check)

@skedwards88
Copy link
Contributor

skedwards88 commented Feb 2, 2024

Thanks for the ping that this is ready for re-review! I'll ask our SME team for another review. (Internal note: Asked here.)

@skedwards88 skedwards88 added needs SME This proposal needs review from a subject matter expert and removed SME reviewed An SME has reviewed this issue/PR labels Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert 👀

Copy link
Member

@kfcampbell kfcampbell left a 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).
Copy link
Member

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?

Copy link
Contributor

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"));
Copy link
Member

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")
Copy link
Member

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}");
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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".

@skedwards88 skedwards88 added SME reviewed An SME has reviewed this issue/PR more-information-needed More information is needed to complete review and removed needs SME This proposal needs review from a subject matter expert labels Feb 6, 2024
@nguyenalex836 nguyenalex836 removed the triage Do not begin working on this issue until triaged by the team label Feb 7, 2024
@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Feb 21, 2024
Copy link
Contributor

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.

@github-actions github-actions bot closed this Feb 21, 2024
@nguyenalex836
Copy link
Contributor

@Manas-Kenge Hello! 👋 Please let us know if you are still working on this PR, and would like us to reopen 💛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team hacktoberfest-accepted We might not merge this PR before Nov 1st, but it's a wonderful Hacktoberfest contribution! more-information-needed More information is needed to complete review rest Content related to rest - overview. SME reviewed An SME has reviewed this issue/PR stale There is no recent activity on this issue or pull request waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a guide on how to use the .NET Octokit SDK
8 participants