public async Task <GitRemoteRepository> GetAsync( Guid serviceId, string id, CancellationToken cancellationToken) { IGitRemoteClient client = await CreateClient(serviceId, cancellationToken); return(await client.GetAsync(serviceId, id, cancellationToken)); }
public async Task <byte[]?> GetFileContentAsync( Guid serviceId, string id, string path, CancellationToken cancellationToken) { IGitRemoteClient client = await CreateClient(serviceId, cancellationToken); return(await client.GetFileContentAsync(serviceId, id, path, cancellationToken)); }
public async Task <IEnumerable <GitRemoteCommit> > GetLastCommitsAsync( Guid serviceId, string id, int top, CancellationToken cancellationToken) { IGitRemoteClient client = await CreateClient(serviceId, cancellationToken); return(await client.GetLastCommitsAsync( serviceId, id, top, cancellationToken)); }
public async Task <GitRemoteRepository?> GetByRemoteReferenceAsync( Guid serviceId, IGitRemoteReference reference, string name, CancellationToken cancellationToken) { IGitRemoteClient client = await CreateClient(serviceId, cancellationToken); return(await client.GetByRemoteReference( serviceId, reference, name, cancellationToken)); }
public async Task <IEnumerable <GitRemoteRepository> > SearchAsync( SearchGitRepositoryRequest request, CancellationToken cancellationToken) { IEnumerable <IConnectedService> services = await _connectedServiceManager .GetServicesByFeatureAsync( ConnectedServiceFeature.GitRemoteRepository, cancellationToken); if (request.Services is { } s&& s.Any()) { services = services.Where(x => s.Contains(x.Type)); } var repositories = new List <GitRemoteRepository>(); var searchTasks = new List <Task <IEnumerable <GitRemoteRepository> > >(); foreach (IConnectedService service in services) { IGitRemoteClient client = _clients .Single(x => x.ConnectedServiceType == service.Type); searchTasks.Add(client.SearchAsync( service.Id, request.Term, cancellationToken)); } try { await Task.WhenAll(searchTasks); } catch (Exception ex) { Log.Error(ex, "Search Repository error"); } return(searchTasks .Where(x => x.IsCompletedSuccessfully) .SelectMany(x => x.Result)); }