public async Task <IEnumerable <string> > GetSuggestionsAsync(IComponentConfiguration config) { var credentialName = config["CredentialName"]; if (string.IsNullOrEmpty(credentialName)) { return(Enumerable.Empty <string>()); } var projectName = config["ProjectName"]; if (string.IsNullOrEmpty(projectName)) { return(Enumerable.Empty <string>()); } var buildConfigurationName = config["BuildConfigurationName"]; if (string.IsNullOrEmpty(projectName)) { return(Enumerable.Empty <string>()); } var credentials = ResourceCredentials.Create <TeamCityCredentials>(credentialName); using (var client = new TeamCityWebClient(credentials)) { return(await client.GetBuildNumbersAsync(projectName, buildConfigurationName).ConfigureAwait(false)); } }
public override async Task <IEnumerable <string> > EnumerateValuesAsync(ValueEnumerationContext context) { var credentials = ResourceCredentials.Create <TeamCityCredentials>(this.CredentialName); using (var client = new TeamCityWebClient(credentials)) { return(await client.GetBuildNumbersAsync(this.ProjectName, this.BuildConfigurationName).ConfigureAwait(false)); } }