use of net.nemerosa.ontrack.extension.api.model.BuildDiffRequest in project ontrack by nemerosa.
the class GitChangeLogBranchGraphQLFieldContributor method gitChangeLogFetcher.
private DataFetcher gitChangeLogFetcher() {
return fetcher(Branch.class, (DataFetchingEnvironment environment, Branch branch) -> {
String from = GraphqlUtils.getStringArgument(environment, "from").orElseThrow(() -> new IllegalStateException("From argument is required."));
String to = GraphqlUtils.getStringArgument(environment, "to").orElseThrow(() -> new IllegalStateException("To argument is required."));
Build fromBuild = structureService.findBuildByName(branch.getProject().getName(), branch.getName(), from).orElseThrow(() -> new BuildNotFoundException(branch.getProject().getName(), branch.getName(), from));
Build toBuild = structureService.findBuildByName(branch.getProject().getName(), branch.getName(), to).orElseThrow(() -> new BuildNotFoundException(branch.getProject().getName(), branch.getName(), to));
return gitService.changeLog(new BuildDiffRequest(fromBuild.getId(), toBuild.getId()));
});
}
Aggregations