Beispiel #1
0
        public static async Task <BlobFile> GetReadMeFile(string repoName)
        {
            RepoContents repoContents = await GetRepoRootObjectAsync(repoName);

            Tree tree = repoContents.tree.FirstOrDefault(x => x.path == "README.md");

            string fileSha = tree.sha;

            return(await GetBlobFileFromRepo(fileSha, repoName));
        }
Beispiel #2
0
        private static async Task <RepoContents> GetRepoRootObjectAsync(string repoName)
        {
            RepoContents rootObject = new RepoContents();
            ///repos/LBHMKeyworth/mktest1/git/trees/master
            HttpResponseMessage response = await client.GetAsync($"repos/{repoOwner}/{repoName}/git/trees/master");

            response.EnsureSuccessStatusCode();
            if (response.IsSuccessStatusCode)
            {
                rootObject = await response.Content.ReadAsAsync <RepoContents>();
            }
            // return URI of the created resource.
            return(rootObject);
        }