Search in sources :

Example 1 with LibraryServiceClient

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

the class SyncUpdateBook method syncUpdateBook.

public static void syncUpdateBook() 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();
        Book response = libraryServiceClient.updateBook(request);
    }
}
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 2 with LibraryServiceClient

use of com.google.cloud.example.library.v1.LibraryServiceClient 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 3 with LibraryServiceClient

use of com.google.cloud.example.library.v1.LibraryServiceClient 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 4 with LibraryServiceClient

use of com.google.cloud.example.library.v1.LibraryServiceClient 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 5 with LibraryServiceClient

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

Aggregations

LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)43 Book (com.google.example.library.v1.Book)19 Shelf (com.google.example.library.v1.Shelf)14 ShelfName (com.google.example.library.v1.ShelfName)8 BookName (com.google.example.library.v1.BookName)4 LibraryServiceSettings (com.google.cloud.example.library.v1.LibraryServiceSettings)2 CreateBookRequest (com.google.example.library.v1.CreateBookRequest)2 DeleteBookRequest (com.google.example.library.v1.DeleteBookRequest)2 DeleteShelfRequest (com.google.example.library.v1.DeleteShelfRequest)2 GetBookRequest (com.google.example.library.v1.GetBookRequest)2 GetShelfRequest (com.google.example.library.v1.GetShelfRequest)2 ListBooksRequest (com.google.example.library.v1.ListBooksRequest)2 ListShelvesRequest (com.google.example.library.v1.ListShelvesRequest)2 MergeShelvesRequest (com.google.example.library.v1.MergeShelvesRequest)2 MoveBookRequest (com.google.example.library.v1.MoveBookRequest)2 UpdateBookRequest (com.google.example.library.v1.UpdateBookRequest)2 Empty (com.google.protobuf.Empty)2 CreateShelfRequest (com.google.example.library.v1.CreateShelfRequest)1 ListBooksResponse (com.google.example.library.v1.ListBooksResponse)1 ListShelvesResponse (com.google.example.library.v1.ListShelvesResponse)1