public override async Task <IEnumerable <IIssueTrackerIssue> > EnumerateIssuesAsync(IIssueSourceEnumerationContext context) { context.Log.LogDebug("Enumerating TFS issue source..."); var credentials = this.TryGetCredentials <TfsCredentials>(); var client = new TfsRestApi(credentials, context.Log); string wiql = this.GetWiql(context.Log); var workItems = await client.GetWorkItemsAsync(wiql).ConfigureAwait(false); return(from w in workItems select new TfsRestIssue(w)); }
public override async Task <IEnumerable <IIssueTrackerIssue> > EnumerateIssuesAsync(IIssueSourceEnumerationContext context) { GitLabCredentials credentials = null; if (context is IStandardContext stdcontext) { credentials = this.TryGetCredentials(stdcontext.EnvironmentId, stdcontext.ProjectId) as GitLabCredentials; } else { credentials = this.TryGetCredentials(); } if (credentials == null) { throw new InvalidOperationException("Credentials must be supplied to enumerate GitLab issues."); } string projectName = AH.CoalesceString(this.ProjectName, credentials.ProjectName); if (string.IsNullOrEmpty(projectName)) { throw new InvalidOperationException("A project name must be defined in either the issue source or associated GitLab credentials in order to enumerate GitLab issues."); } var client = new GitLabClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.GroupName); var filter = new GitLabIssueFilter { Milestone = this.MilestoneTitle, Labels = this.Labels, CustomFilterQueryString = this.CustomFilterQueryString }; var issues = await client.GetIssuesAsync(projectName, filter, CancellationToken.None).ConfigureAwait(false); return(from i in issues select new GitLabIssue(i)); }
public override async Task <IEnumerable <IIssueTrackerIssue> > EnumerateIssuesAsync(IIssueSourceEnumerationContext context) { var credentials = this.TryGetCredentials <GitHubCredentials>(); if (credentials == null) { throw new InvalidOperationException("Credentials must be supplied to enumerate GitHub issues."); } string repositoryName = AH.CoalesceString(this.RepositoryName, credentials.RepositoryName); if (string.IsNullOrEmpty(repositoryName)) { throw new InvalidOperationException("A repository name must be defined in either the issue source or associated GitHub credentials in order to enumerate GitHub issues."); } var client = new GitHubClient(credentials.ApiUrl, credentials.UserName, credentials.Password, credentials.OrganizationName); string ownerName = AH.CoalesceString(credentials.OrganizationName, credentials.UserName); var filter = new GitHubIssueFilter { Labels = this.Labels, CustomFilterQueryString = this.CustomFilterQueryString }; if (!string.IsNullOrEmpty(this.MilestoneTitle)) { int?milestoneId = await client.FindMilestoneAsync(this.MilestoneTitle, ownerName, repositoryName, CancellationToken.None).ConfigureAwait(false); if (milestoneId == null) { throw new InvalidOperationException($"Milestone '{this.MilestoneTitle}' not found in repository '{repositoryName}' owned by '{ownerName}'."); } filter.Milestone = milestoneId.ToString(); } else { filter.Milestone = "*"; } var issues = await client.GetIssuesAsync(ownerName, repositoryName, filter, CancellationToken.None).ConfigureAwait(false); return(from i in issues select new GitHubIssue(i)); }
public override async Task <IEnumerable <IIssueTrackerIssue> > EnumerateIssuesAsync(IIssueSourceEnumerationContext context) { var credentials = this.TryGetCredentials(); var filter = this.Filter ?? string.Empty; if (!string.IsNullOrEmpty(this.ReleaseNumber)) { filter = $"{filter} Fix version: {{{this.ReleaseNumber}}}"; } using (var client = new YouTrackClient(credentials)) { return(await client.IssuesByProjectAsync(this.ProjectName, filter).ConfigureAwait(false)); } }