use of com.google.cloud.example.library.v1.LibraryServiceClient in project gapic-generator-java by googleapis.
the class AsyncListBooksPaged method asyncListBooksPaged.
public static void asyncListBooksPaged() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
ListBooksRequest request = ListBooksRequest.newBuilder().setParent(ShelfName.of("[SHELF_ID]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
while (true) {
ListBooksResponse response = libraryServiceClient.listBooksCallable().call(request);
for (Book element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
use of com.google.cloud.example.library.v1.LibraryServiceClient in project gapic-generator-java by googleapis.
the class AsyncListShelvesPaged method asyncListShelvesPaged.
public static void asyncListShelvesPaged() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
ListShelvesRequest request = ListShelvesRequest.newBuilder().setPageSize(883849137).setPageToken("pageToken873572522").build();
while (true) {
ListShelvesResponse response = libraryServiceClient.listShelvesCallable().call(request);
for (Shelf element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
use of com.google.cloud.example.library.v1.LibraryServiceClient in project gapic-generator-java by googleapis.
the class AsyncGetBook method asyncGetBook.
public static void asyncGetBook() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
GetBookRequest request = GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
ApiFuture<Book> future = libraryServiceClient.getBookCallable().futureCall(request);
// Do something.
Book response = future.get();
}
}
use of com.google.cloud.example.library.v1.LibraryServiceClient in project gapic-generator-java by googleapis.
the class AsyncGetShelf method asyncGetShelf.
public static void asyncGetShelf() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
GetShelfRequest request = GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
ApiFuture<Shelf> future = libraryServiceClient.getShelfCallable().futureCall(request);
// Do something.
Shelf response = future.get();
}
}
use of com.google.cloud.example.library.v1.LibraryServiceClient in project gapic-generator-java by googleapis.
the class SyncCreateSetCredentialsProvider method syncCreateSetCredentialsProvider.
public static void syncCreateSetCredentialsProvider() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
LibraryServiceSettings libraryServiceSettings = LibraryServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)).build();
LibraryServiceClient libraryServiceClient = LibraryServiceClient.create(libraryServiceSettings);
}
Aggregations