Beispiel #1
0
        public async Task <bool> TestApiCredentials(string apiHost, string apiKey)
        {
            var apiClient = new TravisClient(apiHost, apiKey);

            var userResponse = await apiClient.GetUser();

            return(userResponse.Permissions.Read);
        }
Beispiel #2
0
        public async Task <Pipeline> FetchPipelineById(string apiHost, string apiKey, string apiProjectId, int pipelineId)
        {
            var apiClient = new TravisClient(apiHost, apiKey);

            var build = await apiClient.GetBuildById(pipelineId, true, true);

            return(MapBuildToPipeline(build));
        }
Beispiel #3
0
        public async Task <Pipeline> FetchPipeLineByBranch(string apiHost, string apiKey, string apiProjectId, string branchName)
        {
            var apiClient = new TravisClient(apiHost, apiKey);
            var branch    = await apiClient.GetBranch(apiProjectId, branchName);

            //TODO: branch last build may be null?
            return(await FetchPipelineById(apiHost, apiKey, apiProjectId, branch.LastBuild.Id));
        }
Beispiel #4
0
        public async Task <(IEnumerable <Pipeline> pipelines, int totalPages)> FetchNewestPipelines(string apiHost, string apiKey, string apiProjectId, int page, int perPage)
        {
            var apiClient = new TravisClient(apiHost, apiKey);

            var(builds, totalpages) = await apiClient.GetNewestBuilds(apiProjectId, page - 1, perPage, true, true, true);

            var fullInfoPipelines = builds.Select(MapBuildToPipeline);

            return(fullInfoPipelines, totalpages);
        }