Search in sources :

Example 1 with DeleteShelfRequest

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

the class LibraryServiceClient method deleteShelf.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a shelf. Returns NOT_FOUND if the shelf does not exist.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * // This snippet has been automatically generated for illustrative purposes only.
 * // It may require modifications to work in your environment.
 * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
 *   String name = ShelfName.of("[SHELF_ID]").toString();
 *   libraryServiceClient.deleteShelf(name);
 * }
 * }</pre>
 *
 * @param name The name of the shelf to delete.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteShelf(String name) {
    DeleteShelfRequest request = DeleteShelfRequest.newBuilder().setName(name).build();
    deleteShelf(request);
}
Also used : DeleteShelfRequest(com.google.example.library.v1.DeleteShelfRequest)

Example 2 with DeleteShelfRequest

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

the class LibraryServiceClient method deleteShelf.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a shelf. Returns NOT_FOUND if the shelf does not exist.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * // This snippet has been automatically generated for illustrative purposes only.
 * // It may require modifications to work in your environment.
 * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
 *   ShelfName name = ShelfName.of("[SHELF_ID]");
 *   libraryServiceClient.deleteShelf(name);
 * }
 * }</pre>
 *
 * @param name The name of the shelf to delete.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteShelf(ShelfName name) {
    DeleteShelfRequest request = DeleteShelfRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteShelf(request);
}
Also used : DeleteShelfRequest(com.google.example.library.v1.DeleteShelfRequest)

Example 3 with DeleteShelfRequest

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

the class AsyncDeleteShelf method asyncDeleteShelf.

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

Example 4 with DeleteShelfRequest

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

the class SyncDeleteShelf method syncDeleteShelf.

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

Example 5 with DeleteShelfRequest

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

the class LibraryServiceClientTest method deleteShelfTest2.

@Test
public void deleteShelfTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockLibraryService.addResponse(expectedResponse);
    String name = "name3373707";
    client.deleteShelf(name);
    List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteShelfRequest actualRequest = ((DeleteShelfRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteShelfRequest(com.google.example.library.v1.DeleteShelfRequest) Test(org.junit.Test)

Aggregations

DeleteShelfRequest (com.google.example.library.v1.DeleteShelfRequest)6 Empty (com.google.protobuf.Empty)3 LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 ShelfName (com.google.example.library.v1.ShelfName)1