Example #1
0
        public async Task <IReadOnlyCollection <ContentInfo> > GetAllContentsAsync(string owner, string repoName, string path)
        {
            Ensure.ArgumentNotEmpty(owner, nameof(owner));
            Ensure.ArgumentNotEmpty(repoName, nameof(repoName));

            var url = GITHUB_CONTENT_URL
                      .Replace(UriParts.OWNER, owner)
                      .Replace(UriParts.REPO, repoName)
                      .Replace(UriParts.PATH, path);

            return((await HttpClient.GetJsonAsync <List <ContentInfo> >(url)).AsReadOnly());
        }
Example #2
0
        public async Task <File> GetFileContentAsync(string owner, string repoName, string path)
        {
            Ensure.ArgumentNotEmpty(owner, nameof(owner));
            Ensure.ArgumentNotEmpty(repoName, nameof(repoName));
            Ensure.ArgumentNotEmpty(path, nameof(path));

            var url = GITHUB_CONTENT_URL
                      .Replace(UriParts.OWNER, owner)
                      .Replace(UriParts.REPO, repoName)
                      .Replace(UriParts.PATH, path);

            var repoFileContent = await HttpClient.GetJsonAsync <File>(url);

            repoFileContent.Content = FromBase64String(repoFileContent.Content);
            return(repoFileContent);
        }