Search in sources :

Example 31 with Shelf

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

the class SyncDeleteBook method syncDeleteBook.

public static void syncDeleteBook() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        DeleteBookRequest request = DeleteBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
        libraryServiceClient.deleteBook(request);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) DeleteBookRequest(com.google.example.library.v1.DeleteBookRequest)

Example 32 with Shelf

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

the class AsyncListShelves method asyncListShelves.

public static void asyncListShelves() 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();
        ApiFuture<Shelf> future = libraryServiceClient.listShelvesPagedCallable().futureCall(request);
        // Do something.
        for (Shelf element : future.get().iterateAll()) {
        // doThingsWith(element);
        }
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) ListShelvesRequest(com.google.example.library.v1.ListShelvesRequest)

Example 33 with Shelf

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

the class AsyncMergeShelves method asyncMergeShelves.

public static void asyncMergeShelves() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        MergeShelvesRequest request = MergeShelvesRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setOtherShelf(ShelfName.of("[SHELF_ID]").toString()).build();
        ApiFuture<Shelf> future = libraryServiceClient.mergeShelvesCallable().futureCall(request);
        // Do something.
        Shelf response = future.get();
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest)

Example 34 with Shelf

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

the class SyncMergeShelves method syncMergeShelves.

public static void syncMergeShelves() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        MergeShelvesRequest request = MergeShelvesRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setOtherShelf(ShelfName.of("[SHELF_ID]").toString()).build();
        Shelf response = libraryServiceClient.mergeShelves(request);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest)

Example 35 with Shelf

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

the class SyncMergeShelvesShelfnameShelfname method syncMergeShelvesShelfnameShelfname.

public static void syncMergeShelvesShelfnameShelfname() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        ShelfName name = ShelfName.of("[SHELF_ID]");
        ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
        Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) ShelfName(com.google.example.library.v1.ShelfName) Shelf(com.google.example.library.v1.Shelf)

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