mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
Merge pull request #921 from naveensrinivasan/samples
Adds octokit samples
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<description>@description@</description>
|
||||
<releaseNotes>@releaseNotes@</releaseNotes>
|
||||
<copyright>Copyright GitHub 2013</copyright>
|
||||
<tags>GitHub API Octokit</tags>
|
||||
<tags>GitHub API Octokit linqpad-samples</tags>
|
||||
@dependencies@
|
||||
</metadata>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<description>@description@</description>
|
||||
<releaseNotes>@releaseNotes@</releaseNotes>
|
||||
<copyright>Copyright GitHub 2013</copyright>
|
||||
<tags>GitHub API Octokit</tags>
|
||||
<tags>GitHub API Octokit linqpad-samples</tags>
|
||||
<dependencies>
|
||||
<group>
|
||||
<dependency id="Microsoft.Net.Http" />
|
||||
@@ -30,4 +30,4 @@
|
||||
<frameworkAssembly assemblyName="System.Net.Http" targetFramework="net45, netcore45" />
|
||||
</frameworkAssemblies>
|
||||
</metadata>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
25
build.fsx
25
build.fsx
@@ -20,8 +20,10 @@ let buildDir = "./Octokit/bin"
|
||||
let reactiveBuildDir = "./Octokit.Reactive/bin"
|
||||
let testResultsDir = "./testresults"
|
||||
let packagingRoot = "./packaging/"
|
||||
let samplesDir = "./samples"
|
||||
let packagingDir = packagingRoot @@ "octokit"
|
||||
let reactivePackagingDir = packagingRoot @@ "octokit.reactive"
|
||||
let linqPadDir = "./tools/LINQPad"
|
||||
|
||||
let releaseNotes =
|
||||
ReadFile "ReleaseNotes.md"
|
||||
@@ -123,11 +125,24 @@ Target "SourceLink" (fun _ ->
|
||||
)
|
||||
)
|
||||
|
||||
Target "ValidateLINQPadSamples"(fun _ ->
|
||||
directoryInfo(samplesDir @@ "linqpad-samples")
|
||||
|> filesInDir
|
||||
|> Array.map(fun f -> f.FullName)
|
||||
|> Seq.iter (fun sample ->
|
||||
let result = ExecProcess (fun info ->
|
||||
info.FileName <- linqPadDir @@ "lprun.exe"
|
||||
info.Arguments <- " -compileonly " + sample) (TimeSpan.FromMinutes 5.0)
|
||||
if result <> 0 then failwithf "lprun.exe returned with a non-zero exit code for %s" sample
|
||||
)
|
||||
)
|
||||
|
||||
Target "CreateOctokitPackage" (fun _ ->
|
||||
let net45Dir = packagingDir @@ "lib/net45/"
|
||||
let netcore45Dir = packagingDir @@ "lib/netcore45/"
|
||||
let portableDir = packagingDir @@ "lib/portable-net45+wp80+win+wpa81/"
|
||||
CleanDirs [net45Dir; netcore45Dir; portableDir]
|
||||
let linqpadSamplesDir = packagingDir @@ "linqpad-samples"
|
||||
CleanDirs [net45Dir; netcore45Dir; portableDir;linqpadSamplesDir]
|
||||
|
||||
CopyFile net45Dir (buildDir @@ "Release/Net45/Octokit.dll")
|
||||
CopyFile net45Dir (buildDir @@ "Release/Net45/Octokit.XML")
|
||||
@@ -138,6 +153,7 @@ Target "CreateOctokitPackage" (fun _ ->
|
||||
CopyFile portableDir (buildDir @@ "Release/Portable/Octokit.dll")
|
||||
CopyFile portableDir (buildDir @@ "Release/Portable/Octokit.XML")
|
||||
CopyFile portableDir (buildDir @@ "Release/Portable/Octokit.pdb")
|
||||
CopyDir packagingDir "./samples" allFiles
|
||||
CopyFiles packagingDir ["LICENSE.txt"; "README.md"; "ReleaseNotes.md"]
|
||||
|
||||
NuGet (fun p ->
|
||||
@@ -156,7 +172,8 @@ Target "CreateOctokitPackage" (fun _ ->
|
||||
|
||||
Target "CreateOctokitReactivePackage" (fun _ ->
|
||||
let net45Dir = reactivePackagingDir @@ "lib/net45/"
|
||||
CleanDirs [net45Dir]
|
||||
let linqpadSamplesDir = reactivePackagingDir @@ "linqpad-samples"
|
||||
CleanDirs [net45Dir;linqpadSamplesDir]
|
||||
|
||||
CopyFile net45Dir (reactiveBuildDir @@ "Release/Net45/Octokit.Reactive.dll")
|
||||
CopyFile net45Dir (reactiveBuildDir @@ "Release/Net45/Octokit.Reactive.XML")
|
||||
@@ -184,9 +201,11 @@ Target "Default" DoNothing
|
||||
|
||||
Target "CreatePackages" DoNothing
|
||||
|
||||
|
||||
"Clean"
|
||||
==> "AssemblyInfo"
|
||||
==> "CheckProjects"
|
||||
==> "ValidateLINQPadSamples"
|
||||
==> "BuildApp"
|
||||
|
||||
"Clean"
|
||||
@@ -205,8 +224,10 @@ Target "CreatePackages" DoNothing
|
||||
|
||||
"SourceLink"
|
||||
==> "CreatePackages"
|
||||
|
||||
"CreateOctokitPackage"
|
||||
==> "CreatePackages"
|
||||
|
||||
"CreateOctokitReactivePackage"
|
||||
==> "CreatePackages"
|
||||
|
||||
|
||||
32
samples/linqpad-samples/1-introducing-octokit.linq
Normal file
32
samples/linqpad-samples/1-introducing-octokit.linq
Normal file
@@ -0,0 +1,32 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System.Reactive.Linq</Namespace>
|
||||
<Namespace>System.Threading.Tasks</Namespace>
|
||||
</Query>
|
||||
|
||||
async Task Main(string[] args)
|
||||
{
|
||||
var owner = string.Empty;
|
||||
var reponame = string.Empty;
|
||||
|
||||
owner = "octokit";
|
||||
reponame = "octokit.net";
|
||||
|
||||
var client = new GitHubClient(new Octokit.ProductHeaderValue("octokit.samples"));
|
||||
|
||||
var repository = await client.Repository.Get(owner, reponame);
|
||||
|
||||
Console.WriteLine(String.Format("Octokit.net can be found at {0}\n", repository.HtmlUrl));
|
||||
|
||||
Console.WriteLine("It currently has {0} watchers and {1} forks\n",
|
||||
repository.StargazersCount,
|
||||
repository.ForksCount);
|
||||
|
||||
Console.WriteLine("It has {0} open issues\n", repository.OpenIssuesCount);
|
||||
|
||||
Console.WriteLine("And GitHub thinks it is a {0} project", repository.Language);
|
||||
|
||||
}
|
||||
61
samples/linqpad-samples/10-search-issues.linq
Normal file
61
samples/linqpad-samples/10-search-issues.linq
Normal file
@@ -0,0 +1,61 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</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 owner = string.Empty;
|
||||
var reponame = string.Empty;
|
||||
|
||||
//Search Issues with xamarin keyword and get the results
|
||||
GitHubClient client = new GitHubClient(
|
||||
new Octokit.ProductHeaderValue("Octokit.samples"));
|
||||
owner = "octokit";
|
||||
reponame = "octokit.net";
|
||||
|
||||
// or if you don't want to give an app your creds
|
||||
// you can use a token from an OAuth app
|
||||
// Here is the URL to get tokens https://github.com/settings/tokens
|
||||
// and save the token using Util.SetPassword("github","CHANGETHIS")
|
||||
client.Credentials = new Credentials(Util.GetPassword("github"));
|
||||
|
||||
|
||||
var issue = new SearchIssuesRequest("xamarin");
|
||||
issue.Repos.Add(owner,reponame);
|
||||
issue.SortField = IssueSearchSort.Updated;
|
||||
var searchresults = await client.Search.SearchIssues(issue);
|
||||
|
||||
//For every issue get the comments for it
|
||||
var commentsclient = client.Issue.Comment;
|
||||
var comments = searchresults.Items.Select(async i =>
|
||||
new { IssueNumber = i.Number,
|
||||
Comments = await commentsclient
|
||||
.GetAllForIssue(owner, reponame, i.Number)});
|
||||
|
||||
var issueComments = await Task.WhenAll( comments);
|
||||
|
||||
|
||||
//Combine the comments with Issue and then dump it.
|
||||
searchresults.Items.Select(i => new
|
||||
{
|
||||
Number = Util.RawHtml(new XElement("a",
|
||||
new XAttribute("href", i.HtmlUrl.ToString()), i.Number)),
|
||||
i.Title,
|
||||
i.Body,
|
||||
i.State,
|
||||
Comments = issueComments.FirstOrDefault(c => c.IssueNumber == i.Number)
|
||||
.Comments.Select(c =>
|
||||
new { User = c.User.Id,
|
||||
Name = c.User.Login,
|
||||
Content = c.Body,
|
||||
Date = c.CreatedAt,
|
||||
Id = c.Id, c.Body})
|
||||
} ).Dump();
|
||||
}
|
||||
41
samples/linqpad-samples/2-releases.linq
Normal file
41
samples/linqpad-samples/2-releases.linq
Normal file
@@ -0,0 +1,41 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System.Net</Namespace>
|
||||
<Namespace>System.Threading.Tasks</Namespace>
|
||||
</Query>
|
||||
|
||||
async Task Main(string[] args)
|
||||
{
|
||||
var owner = string.Empty;
|
||||
var reponame = string.Empty;
|
||||
|
||||
owner = "octokit";
|
||||
reponame = "octokit.net";
|
||||
|
||||
var client = new GitHubClient(new Octokit.ProductHeaderValue("octokit.samples"));
|
||||
|
||||
//Get releases for the octokit
|
||||
var releases = await client.Release.GetAll(owner, reponame);
|
||||
releases.Select(r => new { r.Name, r.Body }).Dump("Releases");
|
||||
|
||||
//Don't want draft release and because we are using reactive the first one is the latest one.
|
||||
var latestrelease = releases.First(r => r.Draft == false).Dump("Latest Octokit");
|
||||
|
||||
//Gets the assets for the latest relase
|
||||
var assets = await client.Release.GetAllAssets(owner,reponame,latestrelease.Id);
|
||||
assets.Dump("Assets");
|
||||
var latestreleaseassetid = assets.First(a => a.Name.Contains("Reactive")).Id;
|
||||
var asset = await client.Release.GetAsset(owner,reponame,latestreleaseassetid);
|
||||
asset.DownloadCount.Dump("Download Count for this release");
|
||||
|
||||
//Download the release
|
||||
var wc = new WebClient();
|
||||
var filename = Path.Combine( Path.GetTempPath(),"Octokit-Reactive.nupkg");
|
||||
await wc.DownloadFileTaskAsync(asset.BrowserDownloadUrl,filename);
|
||||
filename.Dump();
|
||||
}
|
||||
|
||||
// Define other methods and classes here
|
||||
30
samples/linqpad-samples/3-browse-repositories.linq
Normal file
30
samples/linqpad-samples/3-browse-repositories.linq
Normal file
@@ -0,0 +1,30 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</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";
|
||||
// basic authentication
|
||||
//client.Credentials = new Credentials("username", "password");
|
||||
|
||||
// or if you don't want to give an app your creds
|
||||
// you can use a token from an OAuth app
|
||||
// Here is the URL to get tokens https://github.com/settings/tokens
|
||||
// and save the token using Util.SetPassword("github","CHANGETHIS")
|
||||
client.Credentials = new Credentials(Util.GetPassword("github"));
|
||||
|
||||
var repositories = await client.Repository.GetAllForUser(userName);
|
||||
repositories.Select(r => new { r.Name }).Dump(userName + "Repos");
|
||||
|
||||
// and then fetch the repositories for the current user
|
||||
var repos = await client.Repository.GetAllForCurrent();
|
||||
repos.Select(r => r.Name).Dump("Your Repos");
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System</Namespace>
|
||||
<Namespace>System.Reactive.Linq</Namespace>
|
||||
<Namespace>Octokit.Reactive</Namespace>
|
||||
</Query>
|
||||
|
||||
void Main(string[] args)
|
||||
{
|
||||
var owner = string.Empty;
|
||||
|
||||
owner = "octokit";
|
||||
|
||||
var client = new ObservableGitHubClient(new Octokit.ProductHeaderValue("Octokit.samples"));
|
||||
client.Repository.GetAllForUser(owner).Select(r => r.Name).Dump();
|
||||
}
|
||||
35
samples/linqpad-samples/5-interact-with-git-database.linq
Normal file
35
samples/linqpad-samples/5-interact-with-git-database.linq
Normal file
@@ -0,0 +1,35 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System.Threading.Tasks</Namespace>
|
||||
</Query>
|
||||
|
||||
async Task Main(string[] args)
|
||||
{
|
||||
var owner = string.Empty;
|
||||
var reponame = string.Empty;
|
||||
|
||||
GitHubClient client = new GitHubClient(new Octokit.ProductHeaderValue("Octokit.samples"));
|
||||
|
||||
owner = "octokit";
|
||||
reponame = "octokit.net";
|
||||
|
||||
|
||||
var releases = await client.Release.GetAll(owner, reponame);
|
||||
|
||||
// we have to build up this tag because release tags
|
||||
// are just lightweight tags. you can read more about
|
||||
// the differences between lightweight tags and annotated tags
|
||||
// here: http://git-scm.com/book/en/Git-Basics-Tagging#Creating-Tags
|
||||
|
||||
// we can fetch the tag for this release
|
||||
var reference = "tags/" + releases[0].TagName;
|
||||
var tag = await client.GitDatabase.Reference.Get(owner, reponame, reference);
|
||||
tag.Dump();
|
||||
|
||||
// and we can fetch the commit associated with this release
|
||||
var commit = await client.GitDatabase.Commit.Get(owner, reponame, tag.Object.Sha);
|
||||
commit.Dump();
|
||||
}
|
||||
91
samples/linqpad-samples/6-create-repository.linq
Normal file
91
samples/linqpad-samples/6-create-repository.linq
Normal file
@@ -0,0 +1,91 @@
|
||||
<Query Kind="Program">
|
||||
<Reference><RuntimeDirectory>\System.Net.Http.dll</Reference>
|
||||
<Reference><RuntimeDirectory>\System.Runtime.dll</Reference>
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System.Net.Http.Headers</Namespace>
|
||||
<Namespace>System.Reactive.Linq</Namespace>
|
||||
<Namespace>System.Threading.Tasks</Namespace>
|
||||
</Query>
|
||||
|
||||
async Task Main(string[] args)
|
||||
{
|
||||
var owner = string.Empty;
|
||||
var reponame = string.Empty;
|
||||
|
||||
GitHubClient client = new GitHubClient(
|
||||
new Octokit.ProductHeaderValue("Octokit.samples"));
|
||||
|
||||
owner = "naveensrinivasan";
|
||||
reponame = "my-awesome-repo-" + Environment.TickCount;
|
||||
// or if you don't want to give an app your creds
|
||||
// you can use a token from an OAuth app
|
||||
// Here is the URL to get tokens https://github.com/settings/tokens
|
||||
// and save the token using Util.SetPassword("github","CHANGETHIS")
|
||||
client.Credentials = new Credentials(Util.GetPassword("github"));
|
||||
|
||||
|
||||
var email = "person@cooldomain.com";
|
||||
|
||||
// 1 - create a repository through the API
|
||||
var newRepo = new NewRepository(reponame)
|
||||
{
|
||||
AutoInit = true // very helpful!
|
||||
};
|
||||
|
||||
var repository = await client.Repository.Create(newRepo);
|
||||
Console.WriteLine("Browse the repository at: " + repository.HtmlUrl);
|
||||
|
||||
// 2 - create a blob containing the contents of our README
|
||||
var newBlob = new NewBlob() {
|
||||
Content = "#MY AWESOME REPO\rthis is some code\rI made it on: "
|
||||
+ DateTime.Now.ToString(),
|
||||
Encoding = EncodingType.Utf8
|
||||
};
|
||||
|
||||
var createdBlob = await client.GitDatabase.Blob
|
||||
.Create(owner, reponame, newBlob);
|
||||
createdBlob.Dump();
|
||||
|
||||
// 3 - create a tree which represents just the README file
|
||||
var newTree = new NewTree();
|
||||
newTree.Tree.Add(new NewTreeItem() {
|
||||
Path = "README.md",
|
||||
Mode = Octokit.FileMode.File,
|
||||
Sha = createdBlob.Sha,
|
||||
Type = TreeType.Blob
|
||||
});
|
||||
|
||||
var createdTree = await client.GitDatabase.Tree
|
||||
.Create(owner, reponame, newTree);
|
||||
|
||||
createdTree.Dump();
|
||||
|
||||
// 4 - this commit should build on the current master branch
|
||||
var master = await client.GitDatabase.Reference
|
||||
.Get(owner, reponame, "heads/master");
|
||||
|
||||
var newCommit = new NewCommit(
|
||||
"Hello World!",
|
||||
createdTree.Sha,
|
||||
new[] { master.Object.Sha })
|
||||
{ Author = new SignatureResponse(owner,email,DateTime.UtcNow)};
|
||||
|
||||
var createdCommit = await client.GitDatabase.Commit
|
||||
.Create(owner, reponame, newCommit);
|
||||
|
||||
createdCommit.Dump();
|
||||
|
||||
// 5 - create a reference for the master branch
|
||||
var updateReference = new ReferenceUpdate(createdCommit.Sha);
|
||||
var updatedReference = await client.GitDatabase
|
||||
.Reference.Update(owner, reponame, "heads/master", updateReference);
|
||||
updatedReference.Dump();
|
||||
|
||||
// Deleting a repository requires admin access.
|
||||
//If OAuth is used, the `delete_repo` scope is required.
|
||||
await client.Repository.Delete(owner, reponame);
|
||||
"Repo Clean up!".Dump(reponame + " has been deleted");
|
||||
}
|
||||
31
samples/linqpad-samples/7-search-for-repos.linq
Normal file
31
samples/linqpad-samples/7-search-for-repos.linq
Normal file
@@ -0,0 +1,31 @@
|
||||
<Query Kind="Program">
|
||||
<Reference><RuntimeDirectory>\System.Net.Http.dll</Reference>
|
||||
<Reference><RuntimeDirectory>\System.Runtime.dll</Reference>
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</NuGetReference>
|
||||
<Namespace>System.Reactive.Linq</Namespace>
|
||||
<Namespace>System.Net.Http.Headers</Namespace>
|
||||
<Namespace>Octokit</Namespace>
|
||||
<Namespace>System.Threading.Tasks</Namespace>
|
||||
</Query>
|
||||
|
||||
async Task Main(string[] args)
|
||||
{
|
||||
//This makes discovering code fun!!
|
||||
var client = new GitHubClient(new Octokit.ProductHeaderValue("octokit"));
|
||||
var gorepos = await client.Search.SearchRepo(new SearchRepositoriesRequest()
|
||||
{Language = Language.Go});
|
||||
|
||||
gorepos.Items.OrderByDescending (i => i.CreatedAt)
|
||||
.OrderByDescending (i => i.StargazersCount)
|
||||
.Take(50)
|
||||
.Select (i => new {
|
||||
Name = i.Name,
|
||||
Description = i.Description ,
|
||||
LastUpdated = i.UpdatedAt,
|
||||
Url = i.HtmlUrl,
|
||||
WatchCount = i.StargazersCount
|
||||
})
|
||||
.Dump();
|
||||
}
|
||||
34
samples/linqpad-samples/8-gists.linq
Normal file
34
samples/linqpad-samples/8-gists.linq
Normal file
@@ -0,0 +1,34 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</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();
|
||||
}
|
||||
32
samples/linqpad-samples/9-issues.linq
Normal file
32
samples/linqpad-samples/9-issues.linq
Normal file
@@ -0,0 +1,32 @@
|
||||
<Query Kind="Program">
|
||||
<NuGetReference>Octokit</NuGetReference>
|
||||
<NuGetReference>Octokit.Reactive</NuGetReference>
|
||||
<NuGetReference>Rx-Main</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"));
|
||||
|
||||
IIssuesClient issuesclient = client.Issue;
|
||||
var myissues = await issuesclient.GetAllForCurrent();
|
||||
myissues.Select(m => new { m.Title, m.Body}).Dump();
|
||||
|
||||
//var issue = new NewIssue("Test");
|
||||
|
||||
//var newissue = await issuesclient.Create(owner,reponame,new NewIssue("Test"));
|
||||
//
|
||||
//newissue.Dump();
|
||||
|
||||
var allissues = await issuesclient.GetAllForRepository("octokit", "octokit.net");
|
||||
allissues.Select(a => new { a.Title, a.Body}).Dump();
|
||||
|
||||
}
|
||||
BIN
tools/LINQPad/LINQPad.exe
Normal file
BIN
tools/LINQPad/LINQPad.exe
Normal file
Binary file not shown.
16
tools/LINQPad/LINQPad.exe.config
Normal file
16
tools/LINQPad/LINQPad.exe.config
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<legacyUnhandledExceptionPolicy enabled="1" />
|
||||
<loadFromRemoteSources enabled="true" />
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="ngen001" />
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
BIN
tools/LINQPad/lprun.exe
Normal file
BIN
tools/LINQPad/lprun.exe
Normal file
Binary file not shown.
16
tools/LINQPad/lprun.exe.config
Normal file
16
tools/LINQPad/lprun.exe.config
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<legacyUnhandledExceptionPolicy enabled="1" />
|
||||
<loadFromRemoteSources enabled="true" />
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="ngen001" />
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user