Search in sources :

Example 16 with Shelf

use of com.google.example.library.v1.Shelf 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;
            }
        }
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) ListShelvesResponse(com.google.example.library.v1.ListShelvesResponse) ListShelvesRequest(com.google.example.library.v1.ListShelvesRequest)

Example 17 with Shelf

use of com.google.example.library.v1.Shelf 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();
    }
}
Also used : GetBookRequest(com.google.example.library.v1.GetBookRequest) LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Book(com.google.example.library.v1.Book)

Example 18 with Shelf

use of com.google.example.library.v1.Shelf 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();
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) GetShelfRequest(com.google.example.library.v1.GetShelfRequest) Shelf(com.google.example.library.v1.Shelf)

Example 19 with Shelf

use of com.google.example.library.v1.Shelf in project gapic-generator-java by googleapis.

the class SyncGetBook method syncGetBook.

public static void syncGetBook() 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();
        Book response = libraryServiceClient.getBook(request);
    }
}
Also used : GetBookRequest(com.google.example.library.v1.GetBookRequest) LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Book(com.google.example.library.v1.Book)

Example 20 with Shelf

use of com.google.example.library.v1.Shelf in project gapic-generator-java by googleapis.

the class SyncGetBookBookname method syncGetBookBookname.

public static void syncGetBookBookname() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        BookName name = BookName.of("[SHELF]", "[BOOK]");
        Book response = libraryServiceClient.getBook(name);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Book(com.google.example.library.v1.Book) BookName(com.google.example.library.v1.BookName)

Aggregations

LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)27 Shelf (com.google.example.library.v1.Shelf)23 Test (org.junit.Test)23 Book (com.google.example.library.v1.Book)19 AbstractMessage (com.google.protobuf.AbstractMessage)18 ShelfName (com.google.example.library.v1.ShelfName)14 BookName (com.google.example.library.v1.BookName)12 MergeShelvesRequest (com.google.example.library.v1.MergeShelvesRequest)6 MoveBookRequest (com.google.example.library.v1.MoveBookRequest)6 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)5 DeleteBookRequest (com.google.example.library.v1.DeleteBookRequest)5 StatusRuntimeException (io.grpc.StatusRuntimeException)5 GetBookRequest (com.google.example.library.v1.GetBookRequest)4 GetShelfRequest (com.google.example.library.v1.GetShelfRequest)4 ListShelvesRequest (com.google.example.library.v1.ListShelvesRequest)3 CreateBookRequest (com.google.example.library.v1.CreateBookRequest)2 CreateShelfRequest (com.google.example.library.v1.CreateShelfRequest)2 DeleteShelfRequest (com.google.example.library.v1.DeleteShelfRequest)2 ListShelvesResponse (com.google.example.library.v1.ListShelvesResponse)2 Empty (com.google.protobuf.Empty)2