public TreeClientTests()
    {
        _github = Helper.GetAuthenticatedClient();

        _fixture = _github.Git.Tree;

        _context = _github.CreateRepositoryContext("public-repo").Result;
    }
    public TreeClientTests()
    {
        _github = Helper.GetAuthenticatedClient();

        _fixture = _github.GitDatabase.Tree;

        _context = _github.CreateRepositoryContext("public-repo").Result;
    }
    public TreeClientTests()
    {
        _client = Helper.GetAuthenticatedClient();

        _fixture = _client.GitDatabase.Tree;

        var repoName = Helper.MakeNameWithTimestamp("public-repo");
        _repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
        _owner = _repository.Owner.Login;
    }
    public TreeClientTests()
    {
        _client = new GitHubClient(new ProductHeaderValue("OctokitTests"))
        {
            Credentials = Helper.Credentials
        };
        _fixture = _client.GitDatabase.Tree;

        var repoName = Helper.MakeNameWithTimestamp("public-repo");
        _repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
        _owner = _repository.Owner.Login;
    }
Esempio n. 5
0
    public TreeClientTests()
    {
        _client = Helper.GetAuthenticatedClient();

        _fixture = _client.GitDatabase.Tree;

        var repoName = Helper.MakeNameWithTimestamp("public-repo");

        _repository = _client.Repository.Create(new NewRepository {
            Name = repoName, AutoInit = true
        }).Result;
        _owner = _repository.Owner.Login;
    }
Esempio n. 6
0
        public GitHubApiRepositorySourceRepository(IGitHubClient gitHubClient, ITreesClient treesClient, IGraphQLClient graphQLClient, ILogger <GitHubApiRepositorySourceRepository> logger)
        {
            this.gitHubClient  = gitHubClient;
            this.treesClient   = treesClient;
            this.graphQLClient = graphQLClient;
            this.logger        = logger;

            this.githubAbuseRateLimitPolicy = Policy.Handle <GraphQLRequestException>(ex =>
                                                                                      ex.HttpStatusCode == System.Net.HttpStatusCode.Forbidden &&
                                                                                      ex.ResponseBody.Contains("You have triggered an abuse detection mechanism", StringComparison.OrdinalIgnoreCase))
                                              .WaitAndRetryAsync(5, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (exception, timespan) =>
            {
                logger.LogWarning($"GitHub abuse rate limit hit, waiting {timespan.TotalSeconds} seconds before trying again");
            });
        }
    public TreeClientTests()
    {
        _client = new GitHubClient(new ProductHeaderValue("OctokitTests"))
        {
            Credentials = Helper.Credentials
        };
        _fixture = _client.GitDatabase.Tree;

        var repoName = Helper.MakeNameWithTimestamp("public-repo");

        _repository = _client.Repository.Create(new NewRepository {
            Name = repoName, AutoInit = true
        }).Result;
        _owner = _repository.Owner.Login;
    }
Esempio n. 8
0
        public static async Task <string> GetFileShaAsync(
            this ITreesClient treesClient, string repoOwner, string repoName, string branch, string path)
        {
            string?      dirPath      = Path.GetDirectoryName(path)?.Replace("\\", "/");
            TreeResponse treeResponse = await treesClient.Get(repoOwner, repoName, HttpUtility.UrlEncode($"{branch}:{dirPath}"));

            string   fileName = Path.GetFileName(path);
            TreeItem?item     = treeResponse.Tree
                                .FirstOrDefault(item => string.Equals(item.Path, fileName, StringComparison.OrdinalIgnoreCase));

            if (item is null)
            {
                throw new InvalidOperationException(
                          $"Unable to find git tree data for path '{path}' in repo '{repoName}'.");
            }

            return(item.Sha);
        }
        public ObservableTreesClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client = client.Tree;
        }
        public ObservableTreesClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, "client");

            _client = client.GitDatabase.Tree;
        }
Esempio n. 11
0
        public ObservableTreesClient(IGitHubClient client)
        {
            Ensure.ArgumentNotNull(client, nameof(client));

            _client = client.Git.Tree;
        }