예제 #1
0
        public async Task<TreeResponse> GetTree(string treeSha)
        {
            var treesClient = new TreesClient(apiConn);
            var tree = await treesClient.Get(Config.GitHubOwner, Config.GitHubRepo, treeSha);

            return tree;
        }
예제 #2
0
        /// <summary>
        /// Create a new instance of the GitHub API v3 client using the specified connection.
        /// </summary>
        /// <param name="connection">The underlying <seealso cref="IConnection"/> used to make requests</param>
        public GitHubClient(IConnection connection)
        {
            Ensure.ArgumentNotNull(connection, "connection");

            Connection = connection;
            var apiConnection = new ApiConnection(connection);

            Authorization = new AuthorizationsClient(apiConnection);
            Activity      = new ActivitiesClient(apiConnection);
            Blob          = new BlobsClient(apiConnection);
            Issue         = new IssuesClient(apiConnection);
            Miscellaneous = new MiscellaneousClient(connection);
            Notification  = new NotificationsClient(apiConnection);
            Organization  = new OrganizationsClient(apiConnection);
            Repository    = new RepositoriesClient(apiConnection);
            Release       = new ReleasesClient(apiConnection);
            User          = new UsersClient(apiConnection);
            SshKey        = new SshKeysClient(apiConnection);
            GitDatabase   = new GitDatabaseClient(apiConnection);
            Tree          = new TreesClient(apiConnection);
        }
예제 #3
0
        public async Task SaveAllItemsFromTree(TreeItem subTree)
        {
            var treesClient = new TreesClient(apiConn);
            var tree = await treesClient.Get(Config.GitHubOwner, Config.GitHubRepo, subTree.Sha);
            LocalFileCache local = new LocalFileCache();
            foreach (var item in tree.Tree.Where(x => local.LocalItemExists(subTree.Path, x.Path) == false))
            {
                var blob = await GetBlobContents(item.Sha);

                local.SaveLocalItem(new DiskSaveItem { FileContents = Convert.FromBase64String(blob.Content), SubDirectory = subTree.Path, FileName = item.Path });
            }
        }
예제 #4
0
        /// <summary>
        /// Create a new instance of the GitHub API v3 client using the specified connection.
        /// </summary>
        /// <param name="connection">The underlying <seealso cref="IConnection"/> used to make requests</param>
        public GitHubClient(IConnection connection)
        {
            Ensure.ArgumentNotNull(connection, "connection");

            Connection = connection;
            var apiConnection = new ApiConnection(connection);
            Authorization = new AuthorizationsClient(apiConnection);
            Activity = new ActivitiesClient(apiConnection);
            Issue = new IssuesClient(apiConnection);
            Miscellaneous = new MiscellaneousClient(connection);
            Notification = new NotificationsClient(apiConnection);
            Organization = new OrganizationsClient(apiConnection);
            Repository = new RepositoriesClient(apiConnection);
            Gist = new GistsClient(apiConnection);
            Release = new ReleasesClient(apiConnection);
            User = new UsersClient(apiConnection);
            SshKey = new SshKeysClient(apiConnection);
            GitDatabase = new GitDatabaseClient(apiConnection);
            Tree = new TreesClient(apiConnection);
            Search = new SearchClient(apiConnection);
        }