Skip to content

Commit

Permalink
gapic: Add checkForUpdates method to the Client interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-clayton committed Aug 3, 2017
1 parent a827788 commit 07bd109
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gapic/src/main/com/google/gapid/server/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.gapid.models.Strings;
import com.google.gapid.proto.log.Log;
import com.google.gapid.proto.service.Service;
import com.google.gapid.proto.service.Service.CheckForUpdatesRequest;
import com.google.gapid.proto.service.Service.ExportCaptureRequest;
import com.google.gapid.proto.service.Service.FollowRequest;
import com.google.gapid.proto.service.Service.GetAvailableStringTablesRequest;
Expand All @@ -33,6 +34,7 @@
import com.google.gapid.proto.service.Service.GetStringTableRequest;
import com.google.gapid.proto.service.Service.ImportCaptureRequest;
import com.google.gapid.proto.service.Service.LoadCaptureRequest;
import com.google.gapid.proto.service.Service.Release;
import com.google.gapid.proto.service.Service.ServerInfo;
import com.google.gapid.proto.service.Service.SetRequest;
import com.google.gapid.proto.service.Service.Value;
Expand Down Expand Up @@ -67,6 +69,15 @@ public ListenableFuture<ServerInfo> getSeverInfo() {
);
}

public ListenableFuture<Release> checkForUpdates(boolean includePrereleases) {
LOG.log(FINE, "RPC->checkForUpdates()");
return Futures.transformAsync(
client.checkForUpdates(CheckForUpdatesRequest.newBuilder()
.setIncludePrereleases(includePrereleases).build()),
in -> Futures.immediateFuture(throwIfError(in.getRelease(), in.getError()))
);
}

public ListenableFuture<Value> get(Path.Any path) {
LOG.log(FINE, "RPC->get({0})", path);
return Futures.transformAsync(
Expand Down
2 changes: 2 additions & 0 deletions gapic/src/main/com/google/gapid/server/GapidClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface GapidClient {
public ListenableFuture<Void> ping();
public ListenableFuture<Service.GetServerInfoResponse> getServerInfo(
Service.GetServerInfoRequest request);
public ListenableFuture<Service.CheckForUpdatesResponse> checkForUpdates(
Service.CheckForUpdatesRequest request);
public ListenableFuture<Service.GetResponse> get(Service.GetRequest request);
public ListenableFuture<Service.SetResponse> set(Service.SetRequest request);
public ListenableFuture<Service.FollowResponse> follow(Service.FollowRequest request);
Expand Down
6 changes: 6 additions & 0 deletions gapic/src/main/com/google/gapid/server/GapidClientGrpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public ListenableFuture<Service.GetServerInfoResponse> getServerInfo(
return client.getServerInfo(request);
}

@Override
public ListenableFuture<Service.CheckForUpdatesResponse> checkForUpdates(
Service.CheckForUpdatesRequest request) {
return client.checkForUpdates(request);
}

@Override
public ListenableFuture<Service.GetResponse> get(Service.GetRequest request) {
return client.get(request);
Expand Down

0 comments on commit 07bd109

Please sign in to comment.