Exemplo n.º 1
0
        /// <summary>
        /// Returns the total commit counts for the owner and total commit counts in total.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="repositoryName">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        /// <returns>Returns <see cref="Participation"/>from oldest week to now</returns>
        public async Task <Participation> GetParticipation(string owner, string repositoryName, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");

            var endpoint = "/repos/{0}/{1}/stats/participation".FormatUri(owner, repositoryName);
            var result   = await ApiConnection.GetQueuedOperation <Participation>(endpoint, cancellationToken);

            return(result.FirstOrDefault());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a list of the number of commits per hour in each day
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="repositoryName">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        /// <returns>Returns commit counts per hour in each day</returns>
        public async Task <PunchCard> GetPunchCard(string owner, string repositoryName, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");

            var endpoint      = "/repos/{0}/{1}/stats/punch_card".FormatUri(owner, repositoryName);
            var punchCardData = await ApiConnection.GetQueuedOperation <int[]>(endpoint, cancellationToken);

            return(new PunchCard(punchCardData));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the last year of commit activity grouped by week.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="repositoryName">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        /// <returns>The last year of  <see cref="CommitActivity"/></returns>
        public async Task <CommitActivity> GetCommitActivity(string owner, string repositoryName, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");

            var endpoint = "/repos/{0}/{1}/stats/commit_activity".FormatUri(owner, repositoryName);
            var activity = await ApiConnection.GetQueuedOperation <IEnumerable <WeeklyCommitActivity> >(endpoint, cancellationToken);

            return(new CommitActivity(activity));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="repositoryName">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        /// <returns>Returns a weekly aggregate of the number additions and deletion</returns>
        public async Task <CodeFrequency> GetCodeFrequency(string owner, string repositoryName, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");

            var endpoint       = "/repos/{0}/{1}/stats/code_frequency".FormatUri(owner, repositoryName);
            var rawFrequencies = await ApiConnection.GetQueuedOperation <IEnumerable <long[]> >(endpoint, cancellationToken);

            return(new CodeFrequency(rawFrequencies));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns the total commit counts for the owner and total commit counts in total.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        public async Task <Participation> GetParticipation(string owner, string name, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            var result = await ApiConnection.GetQueuedOperation <Participation>(
                ApiUrls.StatsParticipation(owner, name), cancellationToken).ConfigureAwait(false);

            return(result.FirstOrDefault());
        }
Exemplo n.º 6
0
        /// <summary>
        /// Returns the last year of commit activity grouped by week.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        public async Task <CommitActivity> GetCommitActivity(string owner, string name, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            var activity = await ApiConnection.GetQueuedOperation <WeeklyCommitActivity>(
                ApiUrls.StatsCommitActivity(owner, name), cancellationToken).ConfigureAwait(false);

            return(new CommitActivity(activity));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Returns a list of the number of commits per hour in each day
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        public async Task <PunchCard> GetPunchCard(string owner, string name, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            var punchCardData = await ApiConnection.GetQueuedOperation <int[]>(
                ApiUrls.StatsPunchCard(owner, name), cancellationToken).ConfigureAwait(false);

            return(new PunchCard(punchCardData));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
        public async Task <CodeFrequency> GetCodeFrequency(string owner, string name, CancellationToken cancellationToken)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            var rawFrequencies = await ApiConnection.GetQueuedOperation <long[]>(
                ApiUrls.StatsCodeFrequency(owner, name), cancellationToken).ConfigureAwait(false);

            return(new CodeFrequency(rawFrequencies));
        }
Exemplo n.º 9
0
 /// <summary>
 /// Returns a list of <see cref="Contributor"/> for the given repository
 /// </summary>
 /// <param name="repositoryId">The Id of the repository</param>
 /// <param name="cancellationToken">A token used to cancel this potentially long running request</param>
 public Task <IReadOnlyList <Contributor> > GetContributors(long repositoryId, CancellationToken cancellationToken)
 {
     return(ApiConnection.GetQueuedOperation <Contributor>(ApiUrls.StatsContributors(repositoryId), cancellationToken));
 }
        public async Task <PunchCard> GetPunchCard(long repositoryId, CancellationToken cancellationToken)
        {
            var punchCardData = await ApiConnection.GetQueuedOperation <int[]>(ApiUrls.StatsPunchCard(repositoryId), cancellationToken).ConfigureAwait(false);

            return(new PunchCard(punchCardData));
        }
        public async Task <Participation> GetParticipation(long repositoryId, CancellationToken cancellationToken)
        {
            var result = await ApiConnection.GetQueuedOperation <Participation>(ApiUrls.StatsParticipation(repositoryId), cancellationToken).ConfigureAwait(false);

            return(result.FirstOrDefault());
        }
        public async Task <CodeFrequency> GetCodeFrequency(long repositoryId, CancellationToken cancellationToken)
        {
            var rawFrequencies = await ApiConnection.GetQueuedOperation <long[]>(ApiUrls.StatsCodeFrequency(repositoryId), cancellationToken).ConfigureAwait(false);

            return(new CodeFrequency(rawFrequencies));
        }
        public async Task <CommitActivity> GetCommitActivity(long repositoryId, CancellationToken cancellationToken)
        {
            var activity = await ApiConnection.GetQueuedOperation <WeeklyCommitActivity>(ApiUrls.StatsCommitActivity(repositoryId), cancellationToken).ConfigureAwait(false);

            return(new CommitActivity(activity));
        }