Search in sources :

Example 26 with Shelf

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

the class SyncMergeShelvesStringShelfname method syncMergeShelvesStringShelfname.

public static void syncMergeShelvesStringShelfname() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        String name = ShelfName.of("[SHELF_ID]").toString();
        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)

Example 27 with Shelf

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

the class SyncMergeShelvesStringString method syncMergeShelvesStringString.

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

Example 28 with Shelf

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

the class AsyncMoveBook method asyncMoveBook.

public static void asyncMoveBook() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        MoveBookRequest request = MoveBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).setOtherShelfName(ShelfName.of("[SHELF_ID]").toString()).build();
        ApiFuture<Book> future = libraryServiceClient.moveBookCallable().futureCall(request);
        // Do something.
        Book response = future.get();
    }
}
Also used : MoveBookRequest(com.google.example.library.v1.MoveBookRequest) LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Book(com.google.example.library.v1.Book)

Example 29 with Shelf

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

the class SyncMoveBook method syncMoveBook.

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

Example 30 with Shelf

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

the class SyncMoveBookStringString method syncMoveBookStringString.

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

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