public async Task <IEnumerable <GitCommitRef> > GetLastCommitsAsync( Guid serviceId, Guid repositoryId, string branch, int top = 10, CancellationToken cancellationToken = default) { AzureDevOpsConnectedService service = await ClientFactory.ConnectAsync( serviceId, cancellationToken); GitHttpClient client = ClientFactory.CreateClient <GitHttpClient>(serviceId); return(await client.GetCommitsAsync( service.DefaultProject, repositoryId, new GitQueryCommitsCriteria() { ItemVersion = new GitVersionDescriptor() { VersionType = GitVersionType.Branch, VersionOptions = GitVersionOptions.None, Version = branch }, IncludeLinks = true }, top : top, cancellationToken : cancellationToken) .ConfigureAwait(false)); }
public async Task <IEnumerable <GitRepository> > GetAllAsync( Guid serviceId, CancellationToken cancellationToken) { AzureDevOpsConnectedService service = await ClientFactory.ConnectAsync( serviceId, cancellationToken); GitHttpClient client = ClientFactory .CreateClient <GitHttpClient>(serviceId); return(await client.GetRepositoriesAsync( service.DefaultProject, cancellationToken : cancellationToken)); }
private Pipeline ToPipeline( AzureDevOpsConnectedService service, BuildDefinition pipeline) { return(new Pipeline { Id = pipeline.Id.ToString(), Type = "AzureDevOps_Pipeline", Name = pipeline.Name, ServiceId = service.Id, WebUrl = pipeline.Links.GetLink("web"), Properties = new List <PipelineProperty> { new("ProjectId", pipeline.Project.Id.ToString()) } });
public async Task <GitRemoteRepository?> GetByRemoteReference( Guid serviceId, IGitRemoteReference reference, string name, CancellationToken cancellationToken) { if (reference is AzureDevOpsGitRemoteReference adoRef) { AzureDevOpsConnectedService service = await ClientFactory.ConnectAsync( serviceId, cancellationToken); GitHttpClient client = ClientFactory.CreateClient <GitHttpClient>(serviceId); GitRepository?repo = await client.GetRepositoryAsync( adoRef.Project, name, cancellationToken : cancellationToken); if (repo is { })
public async Task <IEnumerable <BuildDefinition> > GetPipelinesByRepositoryAsync( Guid serviceId, Guid repositoryId, CancellationToken cancellationToken) { AzureDevOpsConnectedService service = await ClientFactory.ConnectAsync( serviceId, cancellationToken); BuildHttpClient client = ClientFactory.CreateClient <BuildHttpClient>(serviceId); IPagedList <BuildDefinition> pipelines = await client .GetFullDefinitionsAsync2( project : service.DefaultProject, repositoryType : "TfsGit", repositoryId : repositoryId.ToString(), cancellationToken : cancellationToken); return(pipelines.ToList()); }