/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.showcase.v1beta1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.BidiStreamingCallable;
import com.google.api.gax.rpc.ClientStreamingCallable;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import com.google.showcase.v1beta1.stub.MessagingStub;
import com.google.showcase.v1beta1.stub.MessagingStubSettings;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: A simple messaging service that implements chat rooms and profile posts.
 *
 * <p>This messaging service showcases the features that API clients generated by gapic-generators
 * implement.
 *
 * <p>This class provides the ability to make remote calls to the backing service through method
 * calls that map to API methods. Sample code to get started:
 *
 * <pre>{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * try (MessagingClient messagingClient = MessagingClient.create()) {
 *   String displayName = "displayName1714148973";
 *   String description = "description-1724546052";
 *   Room response = messagingClient.createRoom(displayName, description);
 * }
 * }</pre>
 *
 * <p>Note: close() needs to be called on the MessagingClient object to clean up resources such as
 * threads. In the example above, try-with-resources is used, which automatically calls close().
 *
 * <table>
 *    <caption>Methods</caption>
 *    <tr>
 *      <th>Method</th>
 *      <th>Description</th>
 *      <th>Method Variants</th>
 *    </tr>
 *    <tr>
 *      <td><p> CreateRoom</td>
 *      <td><p> Creates a room.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> createRoom(CreateRoomRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> createRoom(String displayName, String description)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> createRoomCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> GetRoom</td>
 *      <td><p> Retrieves the Room with the given resource name.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> getRoom(GetRoomRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> getRoom(RoomName name)
 *           <li><p> getRoom(String name)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> getRoomCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> UpdateRoom</td>
 *      <td><p> Updates a room.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> updateRoom(UpdateRoomRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> updateRoomCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> DeleteRoom</td>
 *      <td><p> Deletes a room and all of its blurbs.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> deleteRoom(DeleteRoomRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> deleteRoom(RoomName name)
 *           <li><p> deleteRoom(String name)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> deleteRoomCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> ListRooms</td>
 *      <td><p> Lists all chat rooms.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> listRooms(ListRoomsRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> listRoomsPagedCallable()
 *           <li><p> listRoomsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> CreateBlurb</td>
 *      <td><p> Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room. If the parent is a profile, the blurb is understood to be a post on the profile.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> createBlurb(CreateBlurbRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> createBlurb(ProfileName parent, UserName user, ByteString image)
 *           <li><p> createBlurb(ProfileName parent, UserName user, String text)
 *           <li><p> createBlurb(ProfileName parent, String user, ByteString image)
 *           <li><p> createBlurb(ProfileName parent, String user, String text)
 *           <li><p> createBlurb(RoomName parent, UserName user, ByteString image)
 *           <li><p> createBlurb(RoomName parent, UserName user, String text)
 *           <li><p> createBlurb(RoomName parent, String user, ByteString image)
 *           <li><p> createBlurb(RoomName parent, String user, String text)
 *           <li><p> createBlurb(String parent, UserName user, ByteString image)
 *           <li><p> createBlurb(String parent, UserName user, String text)
 *           <li><p> createBlurb(String parent, String user, ByteString image)
 *           <li><p> createBlurb(String parent, String user, String text)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> createBlurbCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> GetBlurb</td>
 *      <td><p> Retrieves the Blurb with the given resource name.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> getBlurb(GetBlurbRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> getBlurb(BlurbName name)
 *           <li><p> getBlurb(String name)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> getBlurbCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> UpdateBlurb</td>
 *      <td><p> Updates a blurb.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> updateBlurb(UpdateBlurbRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> updateBlurbCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> DeleteBlurb</td>
 *      <td><p> Deletes a blurb.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> deleteBlurb(DeleteBlurbRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> deleteBlurb(BlurbName name)
 *           <li><p> deleteBlurb(String name)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> deleteBlurbCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> ListBlurbs</td>
 *      <td><p> Lists blurbs for a specific chat room or user profile depending on the parent resource name.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> listBlurbs(ListBlurbsRequest request)
 *      </ul>
 *      <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
 *      <ul>
 *           <li><p> listBlurbs(ProfileName parent)
 *           <li><p> listBlurbs(RoomName parent)
 *           <li><p> listBlurbs(String parent)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> listBlurbsPagedCallable()
 *           <li><p> listBlurbsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> SearchBlurbs</td>
 *      <td><p> This method searches through all blurbs across all rooms and profiles for blurbs containing to words found in the query. Only posts that contain an exact match of a queried word will be returned.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> searchBlurbsAsync(SearchBlurbsRequest request)
 *      </ul>
 *      <p>Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.</p>
 *      <ul>
 *           <li><p> searchBlurbsAsync(ProfileName parent, String query)
 *           <li><p> searchBlurbsAsync(RoomName parent, String query)
 *           <li><p> searchBlurbsAsync(String parent, String query)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> searchBlurbsOperationCallable()
 *           <li><p> searchBlurbsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> StreamBlurbs</td>
 *      <td><p> This returns a stream that emits the blurbs that are created for a particular chat room or user profile.</td>
 *      <td>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> streamBlurbsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> SendBlurbs</td>
 *      <td><p> This is a stream to create multiple blurbs. If an invalid blurb is requested to be created, the stream will close with an error.</td>
 *      <td>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> sendBlurbsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> Connect</td>
 *      <td><p> This method starts a bidirectional stream that receives all blurbs that are being created after the stream has started and sends requests to create blurbs. If an invalid blurb is requested to be created, the stream will close with an error.</td>
 *      <td>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> connectCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> ListLocations</td>
 *      <td><p> Lists information about the supported locations for this service.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> listLocations(ListLocationsRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> listLocationsPagedCallable()
 *           <li><p> listLocationsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> GetLocation</td>
 *      <td><p> Gets information about a location.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> getLocation(GetLocationRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> getLocationCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> SetIamPolicy</td>
 *      <td><p> Sets the access control policy on the specified resource. Replaces any existing policy.
 * <p>  Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> setIamPolicy(SetIamPolicyRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> setIamPolicyCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> GetIamPolicy</td>
 *      <td><p> Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> getIamPolicy(GetIamPolicyRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> getIamPolicyCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *    <tr>
 *      <td><p> TestIamPermissions</td>
 *      <td><p> Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
 * <p>  Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.</td>
 *      <td>
 *      <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
 *      <ul>
 *           <li><p> testIamPermissions(TestIamPermissionsRequest request)
 *      </ul>
 *      <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
 *      <ul>
 *           <li><p> testIamPermissionsCallable()
 *      </ul>
 *       </td>
 *    </tr>
 *  </table>
 *
 * <p>See the individual methods for example code.
 *
 * <p>Many parameters require resource names to be formatted in a particular way. To assist with
 * these names, this class includes a format method for each type of name, and additionally a parse
 * method to extract the individual identifiers contained within names that are returned.
 *
 * <p>This class can be customized by passing in a custom instance of MessagingSettings to create().
 * For example:
 *
 * <p>To customize credentials:
 *
 * <pre>{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * MessagingSettings messagingSettings =
 *     MessagingSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
 * }</pre>
 *
 * <p>To customize the endpoint:
 *
 * <pre>{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * MessagingSettings messagingSettings =
 *     MessagingSettings.newBuilder().setEndpoint(myEndpoint).build();
 * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
 * }</pre>
 *
 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
 * the wire:
 *
 * <pre>{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * MessagingSettings messagingSettings = MessagingSettings.newHttpJsonBuilder().build();
 * MessagingClient messagingClient = MessagingClient.create(messagingSettings);
 * }</pre>
 *
 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
 */
@BetaApi
@Generated("by gapic-generator-java")
public class MessagingClient implements BackgroundResource {
  private final MessagingSettings settings;
  private final MessagingStub stub;
  private final OperationsClient httpJsonOperationsClient;
  private final com.google.longrunning.OperationsClient operationsClient;

  /** Constructs an instance of MessagingClient with default settings. */
  public static final MessagingClient create() throws IOException {
    return create(MessagingSettings.newBuilder().build());
  }

  /**
   * Constructs an instance of MessagingClient, using the given settings. The channels are created
   * based on the settings passed in, or defaults for any settings that are not set.
   */
  public static final MessagingClient create(MessagingSettings settings) throws IOException {
    return new MessagingClient(settings);
  }

  /**
   * Constructs an instance of MessagingClient, using the given stub for making calls. This is for
   * advanced usage - prefer using create(MessagingSettings).
   */
  public static final MessagingClient create(MessagingStub stub) {
    return new MessagingClient(stub);
  }

  /**
   * Constructs an instance of MessagingClient, using the given settings. This is protected so that
   * it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
   */
  protected MessagingClient(MessagingSettings settings) throws IOException {
    this.settings = settings;
    this.stub = ((MessagingStubSettings) settings.getStubSettings()).createStub();
    this.operationsClient =
        com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
    this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
  }

  protected MessagingClient(MessagingStub stub) {
    this.settings = null;
    this.stub = stub;
    this.operationsClient =
        com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
    this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
  }

  public final MessagingSettings getSettings() {
    return settings;
  }

  public MessagingStub getStub() {
    return stub;
  }

  /**
   * Returns the OperationsClient that can be used to query the status of a long-running operation
   * returned by another API method call.
   */
  public final com.google.longrunning.OperationsClient getOperationsClient() {
    return operationsClient;
  }

  /**
   * Returns the OperationsClient that can be used to query the status of a long-running operation
   * returned by another API method call.
   */
  @BetaApi
  public final OperationsClient getHttpJsonOperationsClient() {
    return httpJsonOperationsClient;
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a room.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String displayName = "displayName1714148973";
   *   String description = "description-1724546052";
   *   Room response = messagingClient.createRoom(displayName, description);
   * }
   * }</pre>
   *
   * @param displayName The human readable name of the chat room.
   * @param description The description of the chat room.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room createRoom(String displayName, String description) {
    CreateRoomRequest request =
        CreateRoomRequest.newBuilder()
            .setRoom(
                Room.newBuilder().setDisplayName(displayName).setDescription(description).build())
            .build();
    return createRoom(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a room.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   CreateRoomRequest request =
   *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
   *   Room response = messagingClient.createRoom(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room createRoom(CreateRoomRequest request) {
    return createRoomCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a room.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   CreateRoomRequest request =
   *       CreateRoomRequest.newBuilder().setRoom(Room.newBuilder().build()).build();
   *   ApiFuture<Room> future = messagingClient.createRoomCallable().futureCall(request);
   *   // Do something.
   *   Room response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<CreateRoomRequest, Room> createRoomCallable() {
    return stub.createRoomCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Room with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName name = RoomName.of("[ROOM]");
   *   Room response = messagingClient.getRoom(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested room.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room getRoom(RoomName name) {
    GetRoomRequest request =
        GetRoomRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    return getRoom(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Room with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String name = RoomName.of("[ROOM]").toString();
   *   Room response = messagingClient.getRoom(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested room.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room getRoom(String name) {
    GetRoomRequest request = GetRoomRequest.newBuilder().setName(name).build();
    return getRoom(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Room with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetRoomRequest request =
   *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
   *   Room response = messagingClient.getRoom(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room getRoom(GetRoomRequest request) {
    return getRoomCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Room with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetRoomRequest request =
   *       GetRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
   *   ApiFuture<Room> future = messagingClient.getRoomCallable().futureCall(request);
   *   // Do something.
   *   Room response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<GetRoomRequest, Room> getRoomCallable() {
    return stub.getRoomCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates a room.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   UpdateRoomRequest request =
   *       UpdateRoomRequest.newBuilder()
   *           .setRoom(Room.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Room response = messagingClient.updateRoom(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Room updateRoom(UpdateRoomRequest request) {
    return updateRoomCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates a room.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   UpdateRoomRequest request =
   *       UpdateRoomRequest.newBuilder()
   *           .setRoom(Room.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture<Room> future = messagingClient.updateRoomCallable().futureCall(request);
   *   // Do something.
   *   Room response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<UpdateRoomRequest, Room> updateRoomCallable() {
    return stub.updateRoomCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a room and all of its blurbs.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName name = RoomName.of("[ROOM]");
   *   messagingClient.deleteRoom(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested room.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteRoom(RoomName name) {
    DeleteRoomRequest request =
        DeleteRoomRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteRoom(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a room and all of its blurbs.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String name = RoomName.of("[ROOM]").toString();
   *   messagingClient.deleteRoom(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested room.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteRoom(String name) {
    DeleteRoomRequest request = DeleteRoomRequest.newBuilder().setName(name).build();
    deleteRoom(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a room and all of its blurbs.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   DeleteRoomRequest request =
   *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
   *   messagingClient.deleteRoom(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteRoom(DeleteRoomRequest request) {
    deleteRoomCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a room and all of its blurbs.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   DeleteRoomRequest request =
   *       DeleteRoomRequest.newBuilder().setName(RoomName.of("[ROOM]").toString()).build();
   *   ApiFuture<Empty> future = messagingClient.deleteRoomCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<DeleteRoomRequest, Empty> deleteRoomCallable() {
    return stub.deleteRoomCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists all chat rooms.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListRoomsRequest request =
   *       ListRoomsRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Room element : messagingClient.listRooms(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListRoomsPagedResponse listRooms(ListRoomsRequest request) {
    return listRoomsPagedCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists all chat rooms.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListRoomsRequest request =
   *       ListRoomsRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture<Room> future = messagingClient.listRoomsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Room element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListRoomsRequest, ListRoomsPagedResponse> listRoomsPagedCallable() {
    return stub.listRoomsPagedCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists all chat rooms.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListRoomsRequest request =
   *       ListRoomsRequest.newBuilder()
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListRoomsResponse response = messagingClient.listRoomsCallable().call(request);
   *     for (Room element : response.getRoomsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListRoomsRequest, ListRoomsResponse> listRoomsCallable() {
    return stub.listRoomsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   UserName user = UserName.of("[USER]");
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(ProfileName parent, UserName user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setImage(image)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   UserName user = UserName.of("[USER]");
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(ProfileName parent, UserName user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setText(text)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   String user = UserName.of("[USER]").toString();
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(ProfileName parent, String user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(Blurb.newBuilder().setUser(user).setImage(image).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   String user = UserName.of("[USER]").toString();
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(ProfileName parent, String user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(Blurb.newBuilder().setUser(user).setText(text).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   UserName user = UserName.of("[USER]");
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(RoomName parent, UserName user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setImage(image)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   UserName user = UserName.of("[USER]");
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(RoomName parent, UserName user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setText(text)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   String user = UserName.of("[USER]").toString();
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(RoomName parent, String user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(Blurb.newBuilder().setUser(user).setImage(image).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   String user = UserName.of("[USER]").toString();
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(RoomName parent, String user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setBlurb(Blurb.newBuilder().setUser(user).setText(text).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   UserName user = UserName.of("[USER]");
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(String parent, UserName user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent)
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setImage(image)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   UserName user = UserName.of("[USER]");
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(String parent, UserName user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent)
            .setBlurb(
                Blurb.newBuilder()
                    .setUser(user == null ? null : user.toString())
                    .setText(text)
                    .build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   String user = UserName.of("[USER]").toString();
   *   ByteString image = ByteString.EMPTY;
   *   Blurb response = messagingClient.createBlurb(parent, user, image);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param image The image content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(String parent, String user, ByteString image) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent)
            .setBlurb(Blurb.newBuilder().setUser(user).setImage(image).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   String user = UserName.of("[USER]").toString();
   *   String text = "text3556653";
   *   Blurb response = messagingClient.createBlurb(parent, user, text);
   * }
   * }</pre>
   *
   * @param parent The resource name of the chat room or user profile that this blurb will be tied
   *     to.
   * @param user The resource name of the blurb's author.
   * @param text The textual content of this blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(String parent, String user, String text) {
    CreateBlurbRequest request =
        CreateBlurbRequest.newBuilder()
            .setParent(parent)
            .setBlurb(Blurb.newBuilder().setUser(user).setText(text).build())
            .build();
    return createBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   CreateBlurbRequest request =
   *       CreateBlurbRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setBlurb(Blurb.newBuilder().build())
   *           .build();
   *   Blurb response = messagingClient.createBlurb(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb createBlurb(CreateBlurbRequest request) {
    return createBlurbCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Creates a blurb. If the parent is a room, the blurb is understood to be a message in that room.
   * If the parent is a profile, the blurb is understood to be a post on the profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   CreateBlurbRequest request =
   *       CreateBlurbRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setBlurb(Blurb.newBuilder().build())
   *           .build();
   *   ApiFuture<Blurb> future = messagingClient.createBlurbCallable().futureCall(request);
   *   // Do something.
   *   Blurb response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<CreateBlurbRequest, Blurb> createBlurbCallable() {
    return stub.createBlurbCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Blurb with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]");
   *   Blurb response = messagingClient.getBlurb(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb getBlurb(BlurbName name) {
    GetBlurbRequest request =
        GetBlurbRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    return getBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Blurb with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String name =
   *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
   *   Blurb response = messagingClient.getBlurb(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb getBlurb(String name) {
    GetBlurbRequest request = GetBlurbRequest.newBuilder().setName(name).build();
    return getBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Blurb with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetBlurbRequest request =
   *       GetBlurbRequest.newBuilder()
   *           .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .build();
   *   Blurb response = messagingClient.getBlurb(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb getBlurb(GetBlurbRequest request) {
    return getBlurbCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Retrieves the Blurb with the given resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetBlurbRequest request =
   *       GetBlurbRequest.newBuilder()
   *           .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .build();
   *   ApiFuture<Blurb> future = messagingClient.getBlurbCallable().futureCall(request);
   *   // Do something.
   *   Blurb response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<GetBlurbRequest, Blurb> getBlurbCallable() {
    return stub.getBlurbCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   UpdateBlurbRequest request =
   *       UpdateBlurbRequest.newBuilder()
   *           .setBlurb(Blurb.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Blurb response = messagingClient.updateBlurb(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Blurb updateBlurb(UpdateBlurbRequest request) {
    return updateBlurbCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Updates a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   UpdateBlurbRequest request =
   *       UpdateBlurbRequest.newBuilder()
   *           .setBlurb(Blurb.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture<Blurb> future = messagingClient.updateBlurbCallable().futureCall(request);
   *   // Do something.
   *   Blurb response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<UpdateBlurbRequest, Blurb> updateBlurbCallable() {
    return stub.updateBlurbCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]");
   *   messagingClient.deleteBlurb(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteBlurb(BlurbName name) {
    DeleteBlurbRequest request =
        DeleteBlurbRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String name =
   *       BlurbName.ofUserLegacyUserBlurbName("[USER]", "[LEGACY_USER]", "[BLURB]").toString();
   *   messagingClient.deleteBlurb(name);
   * }
   * }</pre>
   *
   * @param name The resource name of the requested blurb.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteBlurb(String name) {
    DeleteBlurbRequest request = DeleteBlurbRequest.newBuilder().setName(name).build();
    deleteBlurb(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   DeleteBlurbRequest request =
   *       DeleteBlurbRequest.newBuilder()
   *           .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .build();
   *   messagingClient.deleteBlurb(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final void deleteBlurb(DeleteBlurbRequest request) {
    deleteBlurbCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Deletes a blurb.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   DeleteBlurbRequest request =
   *       DeleteBlurbRequest.newBuilder()
   *           .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .build();
   *   ApiFuture<Empty> future = messagingClient.deleteBlurbCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<DeleteBlurbRequest, Empty> deleteBlurbCallable() {
    return stub.deleteBlurbCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param parent The resource name of the requested room or profile who blurbs to list.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListBlurbsPagedResponse listBlurbs(ProfileName parent) {
    ListBlurbsRequest request =
        ListBlurbsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
    return listBlurbs(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param parent The resource name of the requested room or profile who blurbs to list.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListBlurbsPagedResponse listBlurbs(RoomName parent) {
    ListBlurbsRequest request =
        ListBlurbsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
    return listBlurbs(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   for (Blurb element : messagingClient.listBlurbs(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param parent The resource name of the requested room or profile who blurbs to list.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListBlurbsPagedResponse listBlurbs(String parent) {
    ListBlurbsRequest request = ListBlurbsRequest.newBuilder().setParent(parent).build();
    return listBlurbs(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListBlurbsRequest request =
   *       ListBlurbsRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Blurb element : messagingClient.listBlurbs(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListBlurbsPagedResponse listBlurbs(ListBlurbsRequest request) {
    return listBlurbsPagedCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListBlurbsRequest request =
   *       ListBlurbsRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture<Blurb> future = messagingClient.listBlurbsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Blurb element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListBlurbsRequest, ListBlurbsPagedResponse> listBlurbsPagedCallable() {
    return stub.listBlurbsPagedCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists blurbs for a specific chat room or user profile depending on the parent resource name.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListBlurbsRequest request =
   *       ListBlurbsRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListBlurbsResponse response = messagingClient.listBlurbsCallable().call(request);
   *     for (Blurb element : response.getBlurbsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListBlurbsRequest, ListBlurbsResponse> listBlurbsCallable() {
    return stub.listBlurbsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ProfileName parent = ProfileName.of("[USER]");
   *   String query = "query107944136";
   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(parent, query).get();
   * }
   * }</pre>
   *
   * @param parent The rooms or profiles to search. If unset, `SearchBlurbs` will search all rooms
   *     and all profiles.
   * @param query The query used to search for blurbs containing to words of this string. Only posts
   *     that contain an exact match of a queried word will be returned.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<SearchBlurbsResponse, SearchBlurbsMetadata> searchBlurbsAsync(
      ProfileName parent, String query) {
    SearchBlurbsRequest request =
        SearchBlurbsRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setQuery(query)
            .build();
    return searchBlurbsAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   RoomName parent = RoomName.of("[ROOM]");
   *   String query = "query107944136";
   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(parent, query).get();
   * }
   * }</pre>
   *
   * @param parent The rooms or profiles to search. If unset, `SearchBlurbs` will search all rooms
   *     and all profiles.
   * @param query The query used to search for blurbs containing to words of this string. Only posts
   *     that contain an exact match of a queried word will be returned.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<SearchBlurbsResponse, SearchBlurbsMetadata> searchBlurbsAsync(
      RoomName parent, String query) {
    SearchBlurbsRequest request =
        SearchBlurbsRequest.newBuilder()
            .setParent(parent == null ? null : parent.toString())
            .setQuery(query)
            .build();
    return searchBlurbsAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   String parent = ProfileName.of("[USER]").toString();
   *   String query = "query107944136";
   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(parent, query).get();
   * }
   * }</pre>
   *
   * @param parent The rooms or profiles to search. If unset, `SearchBlurbs` will search all rooms
   *     and all profiles.
   * @param query The query used to search for blurbs containing to words of this string. Only posts
   *     that contain an exact match of a queried word will be returned.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<SearchBlurbsResponse, SearchBlurbsMetadata> searchBlurbsAsync(
      String parent, String query) {
    SearchBlurbsRequest request =
        SearchBlurbsRequest.newBuilder().setParent(parent).setQuery(query).build();
    return searchBlurbsAsync(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   SearchBlurbsRequest request =
   *       SearchBlurbsRequest.newBuilder()
   *           .setQuery("query107944136")
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   SearchBlurbsResponse response = messagingClient.searchBlurbsAsync(request).get();
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final OperationFuture<SearchBlurbsResponse, SearchBlurbsMetadata> searchBlurbsAsync(
      SearchBlurbsRequest request) {
    return searchBlurbsOperationCallable().futureCall(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   SearchBlurbsRequest request =
   *       SearchBlurbsRequest.newBuilder()
   *           .setQuery("query107944136")
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   OperationFuture<SearchBlurbsResponse, SearchBlurbsMetadata> future =
   *       messagingClient.searchBlurbsOperationCallable().futureCall(request);
   *   // Do something.
   *   SearchBlurbsResponse response = future.get();
   * }
   * }</pre>
   */
  public final OperationCallable<SearchBlurbsRequest, SearchBlurbsResponse, SearchBlurbsMetadata>
      searchBlurbsOperationCallable() {
    return stub.searchBlurbsOperationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method searches through all blurbs across all rooms and profiles for blurbs containing to
   * words found in the query. Only posts that contain an exact match of a queried word will be
   * returned.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   SearchBlurbsRequest request =
   *       SearchBlurbsRequest.newBuilder()
   *           .setQuery("query107944136")
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture<Operation> future = messagingClient.searchBlurbsCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<SearchBlurbsRequest, Operation> searchBlurbsCallable() {
    return stub.searchBlurbsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This returns a stream that emits the blurbs that are created for a particular chat room or user
   * profile.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   StreamBlurbsRequest request =
   *       StreamBlurbsRequest.newBuilder()
   *           .setName(ProfileName.of("[USER]").toString())
   *           .setExpireTime(Timestamp.newBuilder().build())
   *           .build();
   *   ServerStream<StreamBlurbsResponse> stream =
   *       messagingClient.streamBlurbsCallable().call(request);
   *   for (StreamBlurbsResponse response : stream) {
   *     // Do something when a response is received.
   *   }
   * }
   * }</pre>
   */
  public final ServerStreamingCallable<StreamBlurbsRequest, StreamBlurbsResponse>
      streamBlurbsCallable() {
    return stub.streamBlurbsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This is a stream to create multiple blurbs. If an invalid blurb is requested to be created, the
   * stream will close with an error.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ApiStreamObserver<CreateBlurbRequest> responseObserver =
   *       new ApiStreamObserver<CreateBlurbRequest>() {
   *         {@literal @}Override
   *         public void onNext(SendBlurbsResponse response) {
   *           // Do something when a response is received.
   *         }
   *
   *         {@literal @}Override
   *         public void onError(Throwable t) {
   *           // Add error-handling
   *         }
   *
   *         {@literal @}Override
   *         public void onCompleted() {
   *           // Do something when complete.
   *         }
   *       };
   *   ApiStreamObserver<CreateBlurbRequest> requestObserver =
   *       messagingClient.sendBlurbs().clientStreamingCall(responseObserver);
   *   CreateBlurbRequest request =
   *       CreateBlurbRequest.newBuilder()
   *           .setParent(ProfileName.of("[USER]").toString())
   *           .setBlurb(Blurb.newBuilder().build())
   *           .build();
   *   requestObserver.onNext(request);
   * }
   * }</pre>
   */
  public final ClientStreamingCallable<CreateBlurbRequest, SendBlurbsResponse>
      sendBlurbsCallable() {
    return stub.sendBlurbsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * This method starts a bidirectional stream that receives all blurbs that are being created after
   * the stream has started and sends requests to create blurbs. If an invalid blurb is requested to
   * be created, the stream will close with an error.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   BidiStream<ConnectRequest, StreamBlurbsResponse> bidiStream =
   *       messagingClient.connectCallable().call();
   *   ConnectRequest request = ConnectRequest.newBuilder().build();
   *   bidiStream.send(request);
   *   for (StreamBlurbsResponse response : bidiStream) {
   *     // Do something when a response is received.
   *   }
   * }
   * }</pre>
   */
  public final BidiStreamingCallable<ConnectRequest, StreamBlurbsResponse> connectCallable() {
    return stub.connectCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists information about the supported locations for this service.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Location element : messagingClient.listLocations(request).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
    return listLocationsPagedCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists information about the supported locations for this service.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture<Location> future = messagingClient.listLocationsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Location element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
      listLocationsPagedCallable() {
    return stub.listLocationsPagedCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Lists information about the supported locations for this service.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListLocationsResponse response = messagingClient.listLocationsCallable().call(request);
   *     for (Location element : response.getLocationsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }</pre>
   */
  public final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
    return stub.listLocationsCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Gets information about a location.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   *   Location response = messagingClient.getLocation(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Location getLocation(GetLocationRequest request) {
    return getLocationCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Gets information about a location.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   *   ApiFuture<Location> future = messagingClient.getLocationCallable().futureCall(request);
   *   // Do something.
   *   Location response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
    return stub.getLocationCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Sets the access control policy on the specified resource. Replaces any existing policy.
   *
   * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   SetIamPolicyRequest request =
   *       SetIamPolicyRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .setPolicy(Policy.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Policy response = messagingClient.setIamPolicy(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Policy setIamPolicy(SetIamPolicyRequest request) {
    return setIamPolicyCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Sets the access control policy on the specified resource. Replaces any existing policy.
   *
   * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   SetIamPolicyRequest request =
   *       SetIamPolicyRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .setPolicy(Policy.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture<Policy> future = messagingClient.setIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
    return stub.setIamPolicyCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Gets the access control policy for a resource. Returns an empty policy if the resource exists
   * and does not have a policy set.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetIamPolicyRequest request =
   *       GetIamPolicyRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .setOptions(GetPolicyOptions.newBuilder().build())
   *           .build();
   *   Policy response = messagingClient.getIamPolicy(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final Policy getIamPolicy(GetIamPolicyRequest request) {
    return getIamPolicyCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Gets the access control policy for a resource. Returns an empty policy if the resource exists
   * and does not have a policy set.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   GetIamPolicyRequest request =
   *       GetIamPolicyRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .setOptions(GetPolicyOptions.newBuilder().build())
   *           .build();
   *   ApiFuture<Policy> future = messagingClient.getIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
    return stub.getIamPolicyCallable();
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Returns permissions that a caller has on the specified resource. If the resource does not
   * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
   *
   * <p>Note: This operation is designed to be used for building permission-aware UIs and
   * command-line tools, not for authorization checking. This operation may "fail open" without
   * warning.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   TestIamPermissionsRequest request =
   *       TestIamPermissionsRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .addAllPermissions(new ArrayList<String>())
   *           .build();
   *   TestIamPermissionsResponse response = messagingClient.testIamPermissions(request);
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails
   */
  public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
    return testIamPermissionsCallable().call(request);
  }

  // AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Returns permissions that a caller has on the specified resource. If the resource does not
   * exist, this will return an empty set of permissions, not a `NOT_FOUND` error.
   *
   * <p>Note: This operation is designed to be used for building permission-aware UIs and
   * command-line tools, not for authorization checking. This operation may "fail open" without
   * warning.
   *
   * <p>Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (MessagingClient messagingClient = MessagingClient.create()) {
   *   TestIamPermissionsRequest request =
   *       TestIamPermissionsRequest.newBuilder()
   *           .setResource(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString())
   *           .addAllPermissions(new ArrayList<String>())
   *           .build();
   *   ApiFuture<TestIamPermissionsResponse> future =
   *       messagingClient.testIamPermissionsCallable().futureCall(request);
   *   // Do something.
   *   TestIamPermissionsResponse response = future.get();
   * }
   * }</pre>
   */
  public final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse>
      testIamPermissionsCallable() {
    return stub.testIamPermissionsCallable();
  }

  @Override
  public final void close() {
    stub.close();
  }

  @Override
  public void shutdown() {
    stub.shutdown();
  }

  @Override
  public boolean isShutdown() {
    return stub.isShutdown();
  }

  @Override
  public boolean isTerminated() {
    return stub.isTerminated();
  }

  @Override
  public void shutdownNow() {
    stub.shutdownNow();
  }

  @Override
  public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
    return stub.awaitTermination(duration, unit);
  }

  public static class ListRoomsPagedResponse
      extends AbstractPagedListResponse<
          ListRoomsRequest, ListRoomsResponse, Room, ListRoomsPage, ListRoomsFixedSizeCollection> {

    public static ApiFuture<ListRoomsPagedResponse> createAsync(
        PageContext<ListRoomsRequest, ListRoomsResponse, Room> context,
        ApiFuture<ListRoomsResponse> futureResponse) {
      ApiFuture<ListRoomsPage> futurePage =
          ListRoomsPage.createEmptyPage().createPageAsync(context, futureResponse);
      return ApiFutures.transform(
          futurePage, input -> new ListRoomsPagedResponse(input), MoreExecutors.directExecutor());
    }

    private ListRoomsPagedResponse(ListRoomsPage page) {
      super(page, ListRoomsFixedSizeCollection.createEmptyCollection());
    }
  }

  public static class ListRoomsPage
      extends AbstractPage<ListRoomsRequest, ListRoomsResponse, Room, ListRoomsPage> {

    private ListRoomsPage(
        PageContext<ListRoomsRequest, ListRoomsResponse, Room> context,
        ListRoomsResponse response) {
      super(context, response);
    }

    private static ListRoomsPage createEmptyPage() {
      return new ListRoomsPage(null, null);
    }

    @Override
    protected ListRoomsPage createPage(
        PageContext<ListRoomsRequest, ListRoomsResponse, Room> context,
        ListRoomsResponse response) {
      return new ListRoomsPage(context, response);
    }

    @Override
    public ApiFuture<ListRoomsPage> createPageAsync(
        PageContext<ListRoomsRequest, ListRoomsResponse, Room> context,
        ApiFuture<ListRoomsResponse> futureResponse) {
      return super.createPageAsync(context, futureResponse);
    }
  }

  public static class ListRoomsFixedSizeCollection
      extends AbstractFixedSizeCollection<
          ListRoomsRequest, ListRoomsResponse, Room, ListRoomsPage, ListRoomsFixedSizeCollection> {

    private ListRoomsFixedSizeCollection(List<ListRoomsPage> pages, int collectionSize) {
      super(pages, collectionSize);
    }

    private static ListRoomsFixedSizeCollection createEmptyCollection() {
      return new ListRoomsFixedSizeCollection(null, 0);
    }

    @Override
    protected ListRoomsFixedSizeCollection createCollection(
        List<ListRoomsPage> pages, int collectionSize) {
      return new ListRoomsFixedSizeCollection(pages, collectionSize);
    }
  }

  public static class ListBlurbsPagedResponse
      extends AbstractPagedListResponse<
          ListBlurbsRequest,
          ListBlurbsResponse,
          Blurb,
          ListBlurbsPage,
          ListBlurbsFixedSizeCollection> {

    public static ApiFuture<ListBlurbsPagedResponse> createAsync(
        PageContext<ListBlurbsRequest, ListBlurbsResponse, Blurb> context,
        ApiFuture<ListBlurbsResponse> futureResponse) {
      ApiFuture<ListBlurbsPage> futurePage =
          ListBlurbsPage.createEmptyPage().createPageAsync(context, futureResponse);
      return ApiFutures.transform(
          futurePage, input -> new ListBlurbsPagedResponse(input), MoreExecutors.directExecutor());
    }

    private ListBlurbsPagedResponse(ListBlurbsPage page) {
      super(page, ListBlurbsFixedSizeCollection.createEmptyCollection());
    }
  }

  public static class ListBlurbsPage
      extends AbstractPage<ListBlurbsRequest, ListBlurbsResponse, Blurb, ListBlurbsPage> {

    private ListBlurbsPage(
        PageContext<ListBlurbsRequest, ListBlurbsResponse, Blurb> context,
        ListBlurbsResponse response) {
      super(context, response);
    }

    private static ListBlurbsPage createEmptyPage() {
      return new ListBlurbsPage(null, null);
    }

    @Override
    protected ListBlurbsPage createPage(
        PageContext<ListBlurbsRequest, ListBlurbsResponse, Blurb> context,
        ListBlurbsResponse response) {
      return new ListBlurbsPage(context, response);
    }

    @Override
    public ApiFuture<ListBlurbsPage> createPageAsync(
        PageContext<ListBlurbsRequest, ListBlurbsResponse, Blurb> context,
        ApiFuture<ListBlurbsResponse> futureResponse) {
      return super.createPageAsync(context, futureResponse);
    }
  }

  public static class ListBlurbsFixedSizeCollection
      extends AbstractFixedSizeCollection<
          ListBlurbsRequest,
          ListBlurbsResponse,
          Blurb,
          ListBlurbsPage,
          ListBlurbsFixedSizeCollection> {

    private ListBlurbsFixedSizeCollection(List<ListBlurbsPage> pages, int collectionSize) {
      super(pages, collectionSize);
    }

    private static ListBlurbsFixedSizeCollection createEmptyCollection() {
      return new ListBlurbsFixedSizeCollection(null, 0);
    }

    @Override
    protected ListBlurbsFixedSizeCollection createCollection(
        List<ListBlurbsPage> pages, int collectionSize) {
      return new ListBlurbsFixedSizeCollection(pages, collectionSize);
    }
  }

  public static class ListLocationsPagedResponse
      extends AbstractPagedListResponse<
          ListLocationsRequest,
          ListLocationsResponse,
          Location,
          ListLocationsPage,
          ListLocationsFixedSizeCollection> {

    public static ApiFuture<ListLocationsPagedResponse> createAsync(
        PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
        ApiFuture<ListLocationsResponse> futureResponse) {
      ApiFuture<ListLocationsPage> futurePage =
          ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
      return ApiFutures.transform(
          futurePage,
          input -> new ListLocationsPagedResponse(input),
          MoreExecutors.directExecutor());
    }

    private ListLocationsPagedResponse(ListLocationsPage page) {
      super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
    }
  }

  public static class ListLocationsPage
      extends AbstractPage<
          ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {

    private ListLocationsPage(
        PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
        ListLocationsResponse response) {
      super(context, response);
    }

    private static ListLocationsPage createEmptyPage() {
      return new ListLocationsPage(null, null);
    }

    @Override
    protected ListLocationsPage createPage(
        PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
        ListLocationsResponse response) {
      return new ListLocationsPage(context, response);
    }

    @Override
    public ApiFuture<ListLocationsPage> createPageAsync(
        PageContext<ListLocationsRequest, ListLocationsResponse, Location> context,
        ApiFuture<ListLocationsResponse> futureResponse) {
      return super.createPageAsync(context, futureResponse);
    }
  }

  public static class ListLocationsFixedSizeCollection
      extends AbstractFixedSizeCollection<
          ListLocationsRequest,
          ListLocationsResponse,
          Location,
          ListLocationsPage,
          ListLocationsFixedSizeCollection> {

    private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) {
      super(pages, collectionSize);
    }

    private static ListLocationsFixedSizeCollection createEmptyCollection() {
      return new ListLocationsFixedSizeCollection(null, 0);
    }

    @Override
    protected ListLocationsFixedSizeCollection createCollection(
        List<ListLocationsPage> pages, int collectionSize) {
      return new ListLocationsFixedSizeCollection(pages, collectionSize);
    }
  }
}
