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 csharp hint to code blocks #1791

Merged
merged 1 commit into from
Apr 4, 2018
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
4 changes: 2 additions & 2 deletions docs/git-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Tags can be created through the GitHub API

```
```csharp
var tag = new NewTag {
Message = "Tagging a new release of Octokit",
Tag = "v1.0.0",
Expand All @@ -23,6 +23,6 @@ Console.WriteLine("Created a tag for {0} at {1}", result.Tag, result.Sha);

Or you can fetch an existing tag from the API:

```
```csharp
var tag = await client.Git.Tags.Get("octokit", "octokit.net", "v1.0.0");
```
16 changes: 8 additions & 8 deletions docs/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ If you want to view all assigned, open issues against repositories you belong to
(either you own them, or you belong to a team or organization), use this
method:

```
```csharp
var issues = await client.Issue.GetAllForCurrent();
```

If you want to skip organization repositories, you can instead use this
rather verbose method:

```
```csharp
var issues = await client.Issue.GetAllForOwnedAndMemberRepositories();
```

If you know the specific repository, just invoke that:

```
```csharp
var issuesForOctokit = await client.Issue.GetAllForRepository("octokit", "octokit.net");
```

Expand All @@ -41,7 +41,7 @@ The simplest request is `IssueRequest` which has these options:

For example, this is how you could find all issues updated in the past two weeks:

```
```csharp
var recently = new IssueRequest
{
Filter = IssueFilter.All,
Expand All @@ -60,7 +60,7 @@ var issues = await client.Issue.GetAllForCurrent(recently);

For example, to find all issues which need to be prioritized:

```
```csharp
var shouldPrioritize = new RepositoryIssueRequest
{
Assignee = "none",
Expand All @@ -74,7 +74,7 @@ var issues = await client.Issue.GetAllForRepository("octokit", "octokit.net", sh

At a minimum, you need to specify the title:

```
```csharp
var client = new GitHubClient(....); // More on GitHubClient can be found in "Getting Started"
var createIssue = new NewIssue("this thing doesn't work");
var issue = await client.Issue.Create("owner", "name", createIssue);
Expand All @@ -99,13 +99,13 @@ sections for more details.
You can either hold the new issue in memory, or use the id to fetch the issue
later:

```
```csharp
var issue = await client.Issue.Get("octokit", "octokit.net", 405);
```

With this issue, you can transform it into an `IssueUpdate` using the extension method:

```
```csharp
var update = issue.ToUpdate();
```

Expand Down
8 changes: 5 additions & 3 deletions docs/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Labels are appended using the method `NewIssue.Labels.Add(x)`.

Example:

var myNewIssue = new NewIssue("Issue with dropdown menu");
myNewIssue.Labels.Add("bug");

```csharp
var myNewIssue = new NewIssue("Issue with dropdown menu");
myNewIssue.Labels.Add("bug");
```

The default labels that come with every repository are:
- bug
- duplicate
Expand Down
12 changes: 6 additions & 6 deletions docs/oauth-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Then click "Register application", and you'll get your client id and client secr

We'll use these in a few places, so define these as private fields:

```
```csharp
var clientId = "some-id-here";
var clientSecret = "some-id-here";
var client = new GitHubClient(new ProductHeaderValue("my-cool-app"));
```

To start the authentication flow, you need to craft a URL indicating your application needs to authenticate on behalf of the current user.

```
```csharp
// NOTE: this is not required, but highly recommended!
// ask the ASP.NET Membership provider to generate a random value
// and store it in the current user's session
Expand All @@ -51,7 +51,7 @@ Scopes are keys which specify the permissions the application needs. If you don'

Once the user has been navigated to the URL above and clicked "Authorize Application", you will receive a callback at the default Callback URL for your application. If you require a more flexible URL, you can override this by specifying a different URL when creating the request.

```
```csharp
var request = new OauthLoginRequest(clientId)
{
// other parameters
Expand All @@ -63,7 +63,7 @@ The callback will have two parameters, the code generated by the GitHub API and

With this code you can then request an access token by providing your client secret. This doesn't require any user interaction, so it can be done in the background.

```
```csharp
public async Task<ActionResult> Authorize(string code, string state)
{
if (String.IsNullOrEmpty(code))
Expand All @@ -83,7 +83,7 @@ public async Task<ActionResult> Authorize(string code, string state)

And now you have an access token, you can set up your credentials to use this token:

```
```csharp
// repositories which include public and private repositories.
public async Task<ActionResult> Index()
{
Expand All @@ -97,4 +97,4 @@ public async Task<ActionResult> Index()

/* TODO: all the rest of the webapp */
}
```
```
8 changes: 4 additions & 4 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To retrieve all releases for a repository:

```
```csharp
var releases = client.Repository.Release.GetAll("octokit", "octokit.net");
var latest = releases[0];
Console.WriteLine(
Expand All @@ -17,7 +17,7 @@ Console.WriteLine(

To create a new release you must have a corresponding tag in the repository. See the `git-database.md` docs for details.

```
```csharp
var newRelease = new NewRelease("v1.0.0");
newRelease.Name = "Version One Point Oh";
newRelease.Body = "**This** is some *Markdown*";
Expand All @@ -34,7 +34,7 @@ Note that the `Draft` flag is used to indicate when a release should be publishe

Once the release is ready for the public, you can apply an update to the release:

```
```csharp
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
var updateRelease = release.ToUpdate();
updateRelease.Draft = false;
Expand All @@ -47,7 +47,7 @@ var result = await client.Repository.Release.Edit("octokit", "octokit.net", 1, u

If you have any assets to include with the release, you can upload them after creating the release:

```
```csharp
var archiveContents = await File.OpenRead("output.zip"); // TODO: better sample
var assetUpload = new ReleaseAssetUpload()
{
Expand Down