Search in sources :

Example 11 with Shelf

use of com.google.example.library.v1.Shelf 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 12 with Shelf

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

the class AsyncCreateShelf method asyncCreateShelf.

public static void asyncCreateShelf() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        CreateShelfRequest request = CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
        ApiFuture<Shelf> future = libraryServiceClient.createShelfCallable().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) CreateShelfRequest(com.google.example.library.v1.CreateShelfRequest)

Example 13 with Shelf

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

the class SyncCreateShelfShelf method syncCreateShelfShelf.

public static void syncCreateShelfShelf() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        Shelf shelf = Shelf.newBuilder().build();
        Shelf response = libraryServiceClient.createShelf(shelf);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf)

Example 14 with Shelf

use of com.google.example.library.v1.Shelf 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)

Example 15 with Shelf

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

the class SyncDeleteBookBookname method syncDeleteBookBookname.

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