Search in sources :

Example 11 with Book

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

the class SyncMoveBookBooknameShelfname method syncMoveBookBooknameShelfname.

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

Example 12 with Book

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

the class SyncMoveBookBooknameString method syncMoveBookBooknameString.

public static void syncMoveBookBooknameString() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        BookName name = BookName.of("[SHELF]", "[BOOK]");
        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) BookName(com.google.example.library.v1.BookName)

Example 13 with Book

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

the class SyncMoveBookStringShelfname method syncMoveBookStringShelfname.

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

Example 14 with Book

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

the class AsyncUpdateBook method asyncUpdateBook.

public static void asyncUpdateBook() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        UpdateBookRequest request = UpdateBookRequest.newBuilder().setBook(Book.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
        ApiFuture<Book> future = libraryServiceClient.updateBookCallable().futureCall(request);
        // Do something.
        Book response = future.get();
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) UpdateBookRequest(com.google.example.library.v1.UpdateBookRequest) Book(com.google.example.library.v1.Book)

Example 15 with Book

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

the class AsyncDeleteBook method asyncDeleteBook.

public static void asyncDeleteBook() 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();
        ApiFuture<Empty> future = libraryServiceClient.deleteBookCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : Empty(com.google.protobuf.Empty) LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) DeleteBookRequest(com.google.example.library.v1.DeleteBookRequest)

Aggregations

Book (com.google.example.library.v1.Book)33 Test (org.junit.Test)25 LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)22 Book (student_arturs_melnikovs.lesson_10.level_02.Book)16 BookName (com.google.example.library.v1.BookName)12 AbstractMessage (com.google.protobuf.AbstractMessage)12 ShelfName (com.google.example.library.v1.ShelfName)9 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)7 StatusRuntimeException (io.grpc.StatusRuntimeException)7 MoveBookRequest (com.google.example.library.v1.MoveBookRequest)6 DeleteBookRequest (com.google.example.library.v1.DeleteBookRequest)5 Scanner (java.util.Scanner)5 CreateBookRequest (com.google.example.library.v1.CreateBookRequest)4 GetBookRequest (com.google.example.library.v1.GetBookRequest)4 Page (org.apache.wicket.Page)4 Book (org.apache.wicket.core.util.tester.apps_1.Book)4 WebPage (org.apache.wicket.markup.html.WebPage)4 AccessDeniedPage (org.apache.wicket.markup.html.pages.AccessDeniedPage)4 DummyPage (org.apache.wicket.resource.DummyPage)4 Book (org.apache.wicket.util.tester.apps_1.Book)4