forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08-gists.linq
33 lines (27 loc) · 1.1 KB
/
08-gists.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<Query Kind="Program">
<NuGetReference>Octokit</NuGetReference>
<NuGetReference>Octokit.Reactive</NuGetReference>
<Namespace>Octokit</Namespace>
<Namespace>Octokit.Reactive</Namespace>
<Namespace>System</Namespace>
<Namespace>System.Reactive.Linq</Namespace>
<Namespace>System.Threading.Tasks</Namespace>
</Query>
async Task Main(string[] args)
{
var userName = string.Empty;
GitHubClient client = new GitHubClient(new Octokit.ProductHeaderValue("Octokit.Samples"));
userName = "naveensrinivasan";
client.Credentials = new Credentials(Util.GetPassword("github"));
var observableclient = new ObservableGitHubClient(client);
var gists = await observableclient.Gist.GetAllForUser(userName).Dump();
//Create A gist
var gist = new NewGist() { Description = "Gist from LinqPad", Public = true};
gist.Files.Add("test","Test file");
//Star a gist
var createdgist = await observableclient.Gist.Create(gist);
await observableclient.Gist.Star(createdgist.Id);
// Add a comment to the gist
var comment = await observableclient.Gist
.Comment.Create(createdgist.Id,"Comment from linqpad").Dump();
}