Exemple #1
0
        public async Task <IEnumerable <GitlabCommit> > GetCommitsOfProject(string projectId, string branchName,
                                                                            DateTimeOffset since)
        {
            //формат даты: YYYY-MM-DDTHH:MM:SSZ, например 2020-07-22T17:40:00Z
            var url = $"https://{_domainName}/api/v4/projects/{projectId}/repository/commits" +
                      $"?since={since:s}Z" +
                      $"&ref_name={branchName}";
            var request = new HttpRequestMessage(HttpMethod.Get, url);

            request.Headers.Add("PRIVATE-TOKEN", _personalAccessToken);

            using var response = await _client.SendAsync(request);

            var json = await response.Content.ReadAsStringAsync();

            return(_jsonConverter.ConvertJsonToCommits(json));
        }