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 <GitRepository> GetByIdAsync( Guid serviceId, Guid id, CancellationToken cancellationToken) { await ClientFactory.ConnectAsync( serviceId, cancellationToken); GitHttpClient client = ClientFactory.CreateClient <GitHttpClient>(serviceId); return(await client.GetRepositoryAsync( repositoryId : id, cancellationToken)); }
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)); }
static async Task Main(string[] args) { string host = "127.0.0.1"; int port = 8080; Server server = new Server(); server.Register <IArith>(new Arith()); _ = Task.Run(async() => { try { await server.ServeAsync(host, port); } catch (Exception e) { Console.WriteLine("RPC Server exit with exception {0}", e.ToString()); } }); ClientFactory clientFactory = new ClientFactory(); clientFactory.Register(typeof(IArith)); clientFactory.Finish(); Client client = await clientFactory.ConnectAsync(host, port); IArith service = client.Get <IArith>(); Args arg = new Args { A = 9, B = 9, }; int result = await service.Multiply(arg); Console.WriteLine($"{arg.A} * {arg.B} = {result}"); int result2 = await service.Add(arg); Console.WriteLine($"{arg.A} + {arg.B} = {result2}"); await client.StopAsync(); }
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()); }