Beispiel #1
0
        public async Task <GitCommitListApiResponse> GetCommitList(
            string repositoryId,
            DateTime?fromDate = null,
            DateTime?toDate   = null,
            string branch     = null)
        {
            var query = "?" + (fromDate != null ? $"fromDate={fromDate.Value:yyyy-MM-dd}&" : null)
                        + (toDate != null ? $"toDate={toDate.Value:yyyy-MM-dd}&" : null)
                        + (!string.IsNullOrWhiteSpace(branch) ? $"branch={branch}&" : null)
                        + "api-version=3.0";

            var url = $"DefaultCollection/_apis/git/repositories/{repositoryId}/commits{query}";

            return(await _apiClient.GetList <GitCommitListApiResponse, GitCommitApiResponse>(url, CacheDuration.Short));
        }