use of com.google.startupos.common.firestore.FirestoreProtoClient in project startup-os by google.
the class CiTaskTool method run.
void run() {
client = new FirestoreProtoClient(authService.getProjectId(), authService.getToken());
int id = 100;
client.setProtoDocument(ReviewerConstants.CI_REQUESTS_PATH + "/" + id, CiRequest.newBuilder().setDiffId(id).addTarget(Target.newBuilder().setRepo(Repo.newBuilder().setId("startup-os").setUrl("https://github.com/google/startup-os").build()).setCommitId("5b599dd74f58ff5716520db5f724fdf7a75ca419").build()).build());
System.exit(0);
}
use of com.google.startupos.common.firestore.FirestoreProtoClient in project startup-os by google.
the class CodeReviewService method getDiff.
@Override
public void getDiff(DiffRequest request, StreamObserver<Protos.Diff> responseObserver) {
checkAuth();
FirestoreProtoClient client = new FirestoreProtoClient(authService.getProjectId(), authService.getToken());
Diff diff = (Diff) client.getProtoDocument(ReviewerConstants.DIFF_COLLECTION, String.valueOf(request.getDiffId()), Diff.newBuilder());
responseObserver.onNext(diff);
responseObserver.onCompleted();
}
use of com.google.startupos.common.firestore.FirestoreProtoClient in project startup-os by google.
the class CodeReviewService method getAvailableDiffNumber.
// TODO: fix concurrency issues (if two different call method at same time)
// could be done by wrapping in a transaction
@Override
public void getAvailableDiffNumber(Empty request, StreamObserver<DiffNumberResponse> responseObserver) {
checkAuth();
FirestoreProtoClient client = new FirestoreProtoClient(authService.getProjectId(), authService.getToken());
try {
DiffNumberResponse diffNumberResponse = (DiffNumberResponse) client.getProtoDocument(ReviewerConstants.LAST_DIFF_NUMBER_DOCUMENT, DiffNumberResponse.newBuilder());
diffNumberResponse = diffNumberResponse.toBuilder().setLastDiffId(diffNumberResponse.getLastDiffId() + 1).build();
client.setProtoDocument(ReviewerConstants.LAST_DIFF_NUMBER_DOCUMENT, diffNumberResponse);
responseObserver.onNext(diffNumberResponse);
} catch (Exception e) {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
throw e;
}
responseObserver.onCompleted();
}
Aggregations