首页 > 解决方案 > 使用 octokit 从分支检索内容

问题描述

我最近开始使用 octokit 库从 github 存储库中检索数据。

我可以形成一个搜索请求,例如

   var request = new SearchCodeRequest("ValueSets", "xyzconnect", "projectA")
        {
            // we can restrict search to the file, path or search both
            In = new[] {  CodeInQualifier.Path },
        };

   var result = await client.Search.SearchCode(request);

或直接使用检索

   var xsx1 = await client.Repository.Content.GetAllContents(repository.Id, "ValueSets");

当我使用默认分支(通常是主分支)时,这很好用,但是如何对其他分支执行相同的功能?

编辑

因此,要从分支获取内容,您可以使用 API

   var xsx2 = await client.Repository.Content.GetAllContentsByRef(repository.Id, "ValueSets","develop");

标签: c#octokit.net

解决方案


推荐阅读