blob: 5f6b4e5651a34de7b73f40d6dda35ce13e8a59dc [file] [log] [blame]
package org.eclipse.fx.travisci.client;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;
import org.eclipse.fx.travisci.client.entities.Build;
public interface BuildsEndpoint extends Endpoint {
public static class BuildsQuery {
public final List<String> ids;
public final Long repositoryId;
public final String slug;
public final String number;
public final String afterNumber;
// eventType
private BuildsQuery(List<String> ids, Long repositoryId, String slug, String number, String afterNumber) {
super();
this.ids = ids == null ? Collections.emptyList() : Collections.unmodifiableList(ids);
this.repositoryId = repositoryId;
this.slug = slug;
this.number = number;
this.afterNumber = afterNumber;
}
public static BuildsQuery byId(String id) {
return byIds(Collections.singletonList(id));
}
public static BuildsQuery byIds(List<String> ids) {
return new BuildsQuery(ids, null, null, null, null);
}
public static BuildsQuery byRepositoryId(long repositoryId, String number, String afterNumber) {
return new BuildsQuery(null, repositoryId, null, number, afterNumber);
}
public static BuildsQuery byRepositoryId(long repositoryId) {
return byRepositoryId(repositoryId, null, null);
}
public static BuildsQuery bySlug(String slug) {
return new BuildsQuery(null, null, slug, null, null);
}
}
public Stream<Build> getBuilds(BuildsQuery query);
public void getBuilds(BuildsQuery query, Consumer<Stream<Build>> successConsumer, Consumer<Throwable> errorConsumer);
public void cancel(long buildId);
public void restart(long buildId);
}