Github存储库详细信息和回购ID [英] Github Repository Details with Repo ID
问题描述
我为Github使用了Octokit Nuget Package。我需要根据附件中的数据得到结果
我使用以下方法获取Repository的详细信息
p> public JsonResult GetRepositoryDeatil(long id)
{
var client = new GitHubClient(new ProductHeaderValue(demo ));
var tokenAuth =新的凭证(xxxxxxx); //注意:不是真正的令牌
client.Credentials = tokenAuth;
var content = client.Repository.Content.GetAllContents(id).Result;
列表< RepositoryContent> objRepositoryContentList = content.ToList();
返回Json(objRepositoryContentList,JsonRequestBehavior.AllowGet);
}
输出JSON可以在以下链接中查看输出JSON
我无法获取提交详细信息,但只有目录或文件的细节。请提示。
感谢。
对于给定的分支,以及已经改变的文件:
var currentCommit = await client.Repository.Commit.Get(id, 主);
var commitMessage = currentCommit.Commit.Message;
var files = currentCommit.Files;
时间戳记埋藏在作者和提交者字段中,但当前不存在于C#库中。
I am using Octokit Nuget Package for Github. I need to get the result as per the figure attached
I am using the following method for getting details of the Repository
public JsonResult GetRepositoryDeatil(long id)
{
var client = new GitHubClient(new ProductHeaderValue("demo"));
var tokenAuth = new Credentials("xxxxxxx"); // NOTE: not real token
client.Credentials = tokenAuth;
var content = client.Repository.Content.GetAllContents(id).Result;
List<RepositoryContent> objRepositoryContentList = content.ToList();
return Json(objRepositoryContentList, JsonRequestBehavior.AllowGet);
}
Output JSON can be viewed at the following link Output JSON
I am not able to get the commit details but only the directory or the file detail. Please suggest.
Thanks.
To get the current commit for a given branch, and the files that have changed:
var currentCommit = await client.Repository.Commit.Get(id, "master");
var commitMessage = currentCommit.Commit.Message;
var files = currentCommit.Files;
The timestamp is buried in the author and committer fields, but aren't surfaced in the C# library currently.
这篇关于Github存储库详细信息和回购ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!