Class ParticipantsClient (4.7.4)

public class ParticipantsClient implements BackgroundResource

Service Description: Service for managing Participants.

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:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ConversationName parent =
       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
   Participant participant = Participant.newBuilder().build();
   Participant response = participantsClient.createParticipant(parent, participant);
 }
 

Note: close() needs to be called on the ParticipantsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

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.

This class can be customized by passing in a custom instance of ParticipantsSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 ParticipantsSettings participantsSettings =
     ParticipantsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 ParticipantsSettings participantsSettings =
     ParticipantsSettings.newBuilder().setEndpoint(myEndpoint).build();
 ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 ParticipantsSettings participantsSettings =
     ParticipantsSettings.newBuilder()
         .setTransportChannelProvider(
             ParticipantsSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 ParticipantsClient participantsClient = ParticipantsClient.create(participantsSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ParticipantsClient

Implements

BackgroundResource

Static Methods

create()

public static final ParticipantsClient create()

Constructs an instance of ParticipantsClient with default settings.

Returns
TypeDescription
ParticipantsClient
Exceptions
TypeDescription
IOException

create(ParticipantsSettings settings)

public static final ParticipantsClient create(ParticipantsSettings settings)

Constructs an instance of ParticipantsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsParticipantsSettings
Returns
TypeDescription
ParticipantsClient
Exceptions
TypeDescription
IOException

create(ParticipantsStub stub)

public static final ParticipantsClient create(ParticipantsStub stub)

Constructs an instance of ParticipantsClient, using the given stub for making calls. This is for advanced usage - prefer using create(ParticipantsSettings).

Parameter
NameDescription
stubParticipantsStub
Returns
TypeDescription
ParticipantsClient

Constructors

ParticipantsClient(ParticipantsSettings settings)

protected ParticipantsClient(ParticipantsSettings settings)

Constructs an instance of ParticipantsClient, 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.

Parameter
NameDescription
settingsParticipantsSettings

ParticipantsClient(ParticipantsStub stub)

protected ParticipantsClient(ParticipantsStub stub)
Parameter
NameDescription
stubParticipantsStub

Methods

analyzeContent(AnalyzeContentRequest request)

public final AnalyzeContentResponse analyzeContent(AnalyzeContentRequest request)

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   AnalyzeContentRequest request =
       AnalyzeContentRequest.newBuilder()
           .setParticipant(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
           .setQueryParams(QueryParameters.newBuilder().build())
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .setCxParameters(Struct.newBuilder().build())
           .setMessageSendTime(Timestamp.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   AnalyzeContentResponse response = participantsClient.analyzeContent(request);
 }
 
Parameter
NameDescription
requestAnalyzeContentRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
AnalyzeContentResponse

analyzeContent(ParticipantName participant, EventInput eventInput)

public final AnalyzeContentResponse analyzeContent(ParticipantName participant, EventInput eventInput)

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName participant =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   EventInput eventInput = EventInput.newBuilder().build();
   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, eventInput);
 }
 
Parameters
NameDescription
participantParticipantName

Required. The name of the participant this text comes from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

eventInputEventInput

An input event to send to Dialogflow.

Returns
TypeDescription
AnalyzeContentResponse

analyzeContent(ParticipantName participant, TextInput textInput)

public final AnalyzeContentResponse analyzeContent(ParticipantName participant, TextInput textInput)

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName participant =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   TextInput textInput = TextInput.newBuilder().build();
   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, textInput);
 }
 
Parameters
NameDescription
participantParticipantName

Required. The name of the participant this text comes from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

textInputTextInput

The natural language text to be processed.

Returns
TypeDescription
AnalyzeContentResponse

analyzeContent(String participant, EventInput eventInput)

public final AnalyzeContentResponse analyzeContent(String participant, EventInput eventInput)

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String participant =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   EventInput eventInput = EventInput.newBuilder().build();
   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, eventInput);
 }
 
Parameters
NameDescription
participantString

Required. The name of the participant this text comes from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

eventInputEventInput

An input event to send to Dialogflow.

Returns
TypeDescription
AnalyzeContentResponse

analyzeContent(String participant, TextInput textInput)

public final AnalyzeContentResponse analyzeContent(String participant, TextInput textInput)

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String participant =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   TextInput textInput = TextInput.newBuilder().build();
   AnalyzeContentResponse response = participantsClient.analyzeContent(participant, textInput);
 }
 
Parameters
NameDescription
participantString

Required. The name of the participant this text comes from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

textInputTextInput

The natural language text to be processed.

Returns
TypeDescription
AnalyzeContentResponse

analyzeContentCallable()

public final UnaryCallable<AnalyzeContentRequest,AnalyzeContentResponse> analyzeContentCallable()

Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   AnalyzeContentRequest request =
       AnalyzeContentRequest.newBuilder()
           .setParticipant(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
           .setQueryParams(QueryParameters.newBuilder().build())
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .setCxParameters(Struct.newBuilder().build())
           .setMessageSendTime(Timestamp.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<AnalyzeContentResponse> future =
       participantsClient.analyzeContentCallable().futureCall(request);
   // Do something.
   AnalyzeContentResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AnalyzeContentRequest,AnalyzeContentResponse>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

compileSuggestion(CompileSuggestionRequest request) (deprecated)

public final CompileSuggestionResponse compileSuggestion(CompileSuggestionRequest request)

Deprecated. This method is deprecated and will be removed in the next major version update.

Deprecated. use SuggestArticles and SuggestFaqAnswers instead.

Gets suggestions for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   CompileSuggestionRequest request =
       CompileSuggestionRequest.newBuilder()
           .setParent("parent-995424086")
           .setLatestMessage("latestMessage-1424305536")
           .setContextSize(1116903569)
           .build();
   CompileSuggestionResponse response = participantsClient.compileSuggestion(request);
 }
 
Parameter
NameDescription
requestCompileSuggestionRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
CompileSuggestionResponse

compileSuggestionCallable() (deprecated)

public final UnaryCallable<CompileSuggestionRequest,CompileSuggestionResponse> compileSuggestionCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Deprecated. use SuggestArticles and SuggestFaqAnswers instead.

Gets suggestions for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   CompileSuggestionRequest request =
       CompileSuggestionRequest.newBuilder()
           .setParent("parent-995424086")
           .setLatestMessage("latestMessage-1424305536")
           .setContextSize(1116903569)
           .build();
   ApiFuture<CompileSuggestionResponse> future =
       participantsClient.compileSuggestionCallable().futureCall(request);
   // Do something.
   CompileSuggestionResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CompileSuggestionRequest,CompileSuggestionResponse>

createParticipant(ConversationName parent, Participant participant)

public final Participant createParticipant(ConversationName parent, Participant participant)

Creates a new participant in a conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ConversationName parent =
       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
   Participant participant = Participant.newBuilder().build();
   Participant response = participantsClient.createParticipant(parent, participant);
 }
 
Parameters
NameDescription
parentConversationName

Required. Resource identifier of the conversation adding the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.

participantParticipant

Required. The participant to create.

Returns
TypeDescription
Participant

createParticipant(CreateParticipantRequest request)

public final Participant createParticipant(CreateParticipantRequest request)

Creates a new participant in a conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   CreateParticipantRequest request =
       CreateParticipantRequest.newBuilder()
           .setParent(
               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
                   .toString())
           .setParticipant(Participant.newBuilder().build())
           .build();
   Participant response = participantsClient.createParticipant(request);
 }
 
Parameter
NameDescription
requestCreateParticipantRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Participant

createParticipant(String parent, Participant participant)

public final Participant createParticipant(String parent, Participant participant)

Creates a new participant in a conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String parent =
       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]").toString();
   Participant participant = Participant.newBuilder().build();
   Participant response = participantsClient.createParticipant(parent, participant);
 }
 
Parameters
NameDescription
parentString

Required. Resource identifier of the conversation adding the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.

participantParticipant

Required. The participant to create.

Returns
TypeDescription
Participant

createParticipantCallable()

public final UnaryCallable<CreateParticipantRequest,Participant> createParticipantCallable()

Creates a new participant in a conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   CreateParticipantRequest request =
       CreateParticipantRequest.newBuilder()
           .setParent(
               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
                   .toString())
           .setParticipant(Participant.newBuilder().build())
           .build();
   ApiFuture<Participant> future =
       participantsClient.createParticipantCallable().futureCall(request);
   // Do something.
   Participant response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateParticipantRequest,Participant>

getParticipant(GetParticipantRequest request)

public final Participant getParticipant(GetParticipantRequest request)

Retrieves a conversation participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   GetParticipantRequest request =
       GetParticipantRequest.newBuilder()
           .setName(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .build();
   Participant response = participantsClient.getParticipant(request);
 }
 
Parameter
NameDescription
requestGetParticipantRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Participant

getParticipant(ParticipantName name)

public final Participant getParticipant(ParticipantName name)

Retrieves a conversation participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName name =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   Participant response = participantsClient.getParticipant(name);
 }
 
Parameter
NameDescription
nameParticipantName

Required. The name of the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
Participant

getParticipant(String name)

public final Participant getParticipant(String name)

Retrieves a conversation participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String name =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   Participant response = participantsClient.getParticipant(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the participant. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
Participant

getParticipantCallable()

public final UnaryCallable<GetParticipantRequest,Participant> getParticipantCallable()

Retrieves a conversation participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   GetParticipantRequest request =
       GetParticipantRequest.newBuilder()
           .setName(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .build();
   ApiFuture<Participant> future =
       participantsClient.getParticipantCallable().futureCall(request);
   // Do something.
   Participant response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetParticipantRequest,Participant>

getSettings()

public final ParticipantsSettings getSettings()
Returns
TypeDescription
ParticipantsSettings

getStub()

public ParticipantsStub getStub()
Returns
TypeDescription
ParticipantsStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listParticipants(ConversationName parent)

public final ParticipantsClient.ListParticipantsPagedResponse listParticipants(ConversationName parent)

Returns the list of all participants in the specified conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ConversationName parent =
       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]");
   for (Participant element : participantsClient.listParticipants(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentConversationName

Required. The conversation to list all participants from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.

Returns
TypeDescription
ParticipantsClient.ListParticipantsPagedResponse

listParticipants(ListParticipantsRequest request)

public final ParticipantsClient.ListParticipantsPagedResponse listParticipants(ListParticipantsRequest request)

Returns the list of all participants in the specified conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListParticipantsRequest request =
       ListParticipantsRequest.newBuilder()
           .setParent(
               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Participant element : participantsClient.listParticipants(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListParticipantsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ParticipantsClient.ListParticipantsPagedResponse

listParticipants(String parent)

public final ParticipantsClient.ListParticipantsPagedResponse listParticipants(String parent)

Returns the list of all participants in the specified conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String parent =
       ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]").toString();
   for (Participant element : participantsClient.listParticipants(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The conversation to list all participants from. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>.

Returns
TypeDescription
ParticipantsClient.ListParticipantsPagedResponse

listParticipantsCallable()

public final UnaryCallable<ListParticipantsRequest,ListParticipantsResponse> listParticipantsCallable()

Returns the list of all participants in the specified conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListParticipantsRequest request =
       ListParticipantsRequest.newBuilder()
           .setParent(
               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListParticipantsResponse response =
         participantsClient.listParticipantsCallable().call(request);
     for (Participant element : response.getParticipantsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListParticipantsRequest,ListParticipantsResponse>

listParticipantsPagedCallable()

public final UnaryCallable<ListParticipantsRequest,ParticipantsClient.ListParticipantsPagedResponse> listParticipantsPagedCallable()

Returns the list of all participants in the specified conversation.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListParticipantsRequest request =
       ListParticipantsRequest.newBuilder()
           .setParent(
               ConversationName.ofProjectConversationName("[PROJECT]", "[CONVERSATION]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Participant> future =
       participantsClient.listParticipantsPagedCallable().futureCall(request);
   // Do something.
   for (Participant element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListParticipantsRequest,ListParticipantsPagedResponse>

listSuggestions(ListSuggestionsRequest request) (deprecated)

public final ParticipantsClient.ListSuggestionsPagedResponse listSuggestions(ListSuggestionsRequest request)

Deprecated. This method is deprecated and will be removed in the next major version update.

Deprecated: Use inline suggestion, event based suggestion or Suggestion* API instead. See HumanAgentAssistantConfig.name for more details. Removal Date: 2020-09-01.

Retrieves suggestions for live agents.

This method should be used by human agent client software to fetch auto generated suggestions in real-time, while the conversation with an end user is in progress. The functionality is implemented in terms of the list pagination design pattern. The client app should use the next_page_token field to fetch the next batch of suggestions. suggestions are sorted by create_time in descending order. To fetch latest suggestion, just set page_size to 1. To fetch new suggestions without duplication, send request with filter create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListSuggestionsRequest request =
       ListSuggestionsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   for (Suggestion element : participantsClient.listSuggestions(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListSuggestionsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ParticipantsClient.ListSuggestionsPagedResponse

listSuggestionsCallable() (deprecated)

public final UnaryCallable<ListSuggestionsRequest,ListSuggestionsResponse> listSuggestionsCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Deprecated: Use inline suggestion, event based suggestion or Suggestion* API instead. See HumanAgentAssistantConfig.name for more details. Removal Date: 2020-09-01.

Retrieves suggestions for live agents.

This method should be used by human agent client software to fetch auto generated suggestions in real-time, while the conversation with an end user is in progress. The functionality is implemented in terms of the list pagination design pattern. The client app should use the next_page_token field to fetch the next batch of suggestions. suggestions are sorted by create_time in descending order. To fetch latest suggestion, just set page_size to 1. To fetch new suggestions without duplication, send request with filter create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListSuggestionsRequest request =
       ListSuggestionsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   while (true) {
     ListSuggestionsResponse response =
         participantsClient.listSuggestionsCallable().call(request);
     for (Suggestion element : response.getSuggestionsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListSuggestionsRequest,ListSuggestionsResponse>

listSuggestionsPagedCallable() (deprecated)

public final UnaryCallable<ListSuggestionsRequest,ParticipantsClient.ListSuggestionsPagedResponse> listSuggestionsPagedCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Deprecated: Use inline suggestion, event based suggestion or Suggestion* API instead. See HumanAgentAssistantConfig.name for more details. Removal Date: 2020-09-01.

Retrieves suggestions for live agents.

This method should be used by human agent client software to fetch auto generated suggestions in real-time, while the conversation with an end user is in progress. The functionality is implemented in terms of the list pagination design pattern. The client app should use the next_page_token field to fetch the next batch of suggestions. suggestions are sorted by create_time in descending order. To fetch latest suggestion, just set page_size to 1. To fetch new suggestions without duplication, send request with filter create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ListSuggestionsRequest request =
       ListSuggestionsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<Suggestion> future =
       participantsClient.listSuggestionsPagedCallable().futureCall(request);
   // Do something.
   for (Suggestion element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListSuggestionsRequest,ListSuggestionsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

streamingAnalyzeContentCallable()

public final BidiStreamingCallable<StreamingAnalyzeContentRequest,StreamingAnalyzeContentResponse> streamingAnalyzeContentCallable()

Adds a text (e.g., chat) or audio (e.g., phone recording) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST).

The top-level message sent to the client by the server is StreamingAnalyzeContentResponse. Multiple response messages can be returned in order. The first one or more messages contain the recognition_result field. Each result represents a more complete transcript of what the user said. The next message contains the reply_text field, and potentially the reply_audio and/or the automated_agent_reply fields.

Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   BidiStream<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse> bidiStream =
       participantsClient.streamingAnalyzeContentCallable().call();
   StreamingAnalyzeContentRequest request =
       StreamingAnalyzeContentRequest.newBuilder()
           .setParticipant(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setReplyAudioConfig(OutputAudioConfig.newBuilder().build())
           .setQueryParams(QueryParameters.newBuilder().build())
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .setCxParameters(Struct.newBuilder().build())
           .setEnablePartialAutomatedAgentReply(true)
           .build();
   bidiStream.send(request);
   for (StreamingAnalyzeContentResponse response : bidiStream) {
     // Do something when a response is received.
   }
 }
 
Returns
TypeDescription
BidiStreamingCallable<StreamingAnalyzeContentRequest,StreamingAnalyzeContentResponse>

suggestArticles(ParticipantName parent)

public final SuggestArticlesResponse suggestArticles(ParticipantName parent)

Gets suggested articles for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName parent =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   SuggestArticlesResponse response = participantsClient.suggestArticles(parent);
 }
 
Parameter
NameDescription
parentParticipantName

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestArticlesResponse

suggestArticles(SuggestArticlesRequest request)

public final SuggestArticlesResponse suggestArticles(SuggestArticlesRequest request)

Gets suggested articles for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestArticlesRequest request =
       SuggestArticlesRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .build();
   SuggestArticlesResponse response = participantsClient.suggestArticles(request);
 }
 
Parameter
NameDescription
requestSuggestArticlesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
SuggestArticlesResponse

suggestArticles(String parent)

public final SuggestArticlesResponse suggestArticles(String parent)

Gets suggested articles for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String parent =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   SuggestArticlesResponse response = participantsClient.suggestArticles(parent);
 }
 
Parameter
NameDescription
parentString

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestArticlesResponse

suggestArticlesCallable()

public final UnaryCallable<SuggestArticlesRequest,SuggestArticlesResponse> suggestArticlesCallable()

Gets suggested articles for a participant based on specific historical messages.

Note that ListSuggestions will only list the auto-generated suggestions, while CompileSuggestion will try to compile suggestion based on the provided conversation context in the real time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestArticlesRequest request =
       SuggestArticlesRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .build();
   ApiFuture<SuggestArticlesResponse> future =
       participantsClient.suggestArticlesCallable().futureCall(request);
   // Do something.
   SuggestArticlesResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SuggestArticlesRequest,SuggestArticlesResponse>

suggestFaqAnswers(ParticipantName parent)

public final SuggestFaqAnswersResponse suggestFaqAnswers(ParticipantName parent)

Gets suggested faq answers for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName parent =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(parent);
 }
 
Parameter
NameDescription
parentParticipantName

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestFaqAnswersResponse

suggestFaqAnswers(SuggestFaqAnswersRequest request)

public final SuggestFaqAnswersResponse suggestFaqAnswers(SuggestFaqAnswersRequest request)

Gets suggested faq answers for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestFaqAnswersRequest request =
       SuggestFaqAnswersRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .build();
   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(request);
 }
 
Parameter
NameDescription
requestSuggestFaqAnswersRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
SuggestFaqAnswersResponse

suggestFaqAnswers(String parent)

public final SuggestFaqAnswersResponse suggestFaqAnswers(String parent)

Gets suggested faq answers for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String parent =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   SuggestFaqAnswersResponse response = participantsClient.suggestFaqAnswers(parent);
 }
 
Parameter
NameDescription
parentString

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestFaqAnswersResponse

suggestFaqAnswersCallable()

public final UnaryCallable<SuggestFaqAnswersRequest,SuggestFaqAnswersResponse> suggestFaqAnswersCallable()

Gets suggested faq answers for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestFaqAnswersRequest request =
       SuggestFaqAnswersRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .setAssistQueryParams(AssistQueryParameters.newBuilder().build())
           .build();
   ApiFuture<SuggestFaqAnswersResponse> future =
       participantsClient.suggestFaqAnswersCallable().futureCall(request);
   // Do something.
   SuggestFaqAnswersResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SuggestFaqAnswersRequest,SuggestFaqAnswersResponse>

suggestSmartReplies(ParticipantName parent)

public final SuggestSmartRepliesResponse suggestSmartReplies(ParticipantName parent)

Gets smart replies for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   ParticipantName parent =
       ParticipantName.ofProjectConversationParticipantName(
           "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]");
   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(parent);
 }
 
Parameter
NameDescription
parentParticipantName

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestSmartRepliesResponse

suggestSmartReplies(SuggestSmartRepliesRequest request)

public final SuggestSmartRepliesResponse suggestSmartReplies(SuggestSmartRepliesRequest request)

Gets smart replies for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestSmartRepliesRequest request =
       SuggestSmartRepliesRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setCurrentTextInput(TextInput.newBuilder().build())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .build();
   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(request);
 }
 
Parameter
NameDescription
requestSuggestSmartRepliesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
SuggestSmartRepliesResponse

suggestSmartReplies(String parent)

public final SuggestSmartRepliesResponse suggestSmartReplies(String parent)

Gets smart replies for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   String parent =
       ParticipantName.ofProjectConversationParticipantName(
               "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
           .toString();
   SuggestSmartRepliesResponse response = participantsClient.suggestSmartReplies(parent);
 }
 
Parameter
NameDescription
parentString

Required. The name of the participant to fetch suggestion for. Format: projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/participants/<Participant ID>.

Returns
TypeDescription
SuggestSmartRepliesResponse

suggestSmartRepliesCallable()

public final UnaryCallable<SuggestSmartRepliesRequest,SuggestSmartRepliesResponse> suggestSmartRepliesCallable()

Gets smart replies for a participant based on specific historical messages.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   SuggestSmartRepliesRequest request =
       SuggestSmartRepliesRequest.newBuilder()
           .setParent(
               ParticipantName.ofProjectConversationParticipantName(
                       "[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]")
                   .toString())
           .setCurrentTextInput(TextInput.newBuilder().build())
           .setLatestMessage(
               MessageName.ofProjectConversationMessageName(
                       "[PROJECT]", "[CONVERSATION]", "[MESSAGE]")
                   .toString())
           .setContextSize(1116903569)
           .build();
   ApiFuture<SuggestSmartRepliesResponse> future =
       participantsClient.suggestSmartRepliesCallable().futureCall(request);
   // Do something.
   SuggestSmartRepliesResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SuggestSmartRepliesRequest,SuggestSmartRepliesResponse>

updateParticipant(Participant participant, FieldMask updateMask)

public final Participant updateParticipant(Participant participant, FieldMask updateMask)

Updates the specified participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   Participant participant = Participant.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Participant response = participantsClient.updateParticipant(participant, updateMask);
 }
 
Parameters
NameDescription
participantParticipant

Required. The participant to update.

updateMaskFieldMask

Required. The mask to specify which fields to update.

Returns
TypeDescription
Participant

updateParticipant(UpdateParticipantRequest request)

public final Participant updateParticipant(UpdateParticipantRequest request)

Updates the specified participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   UpdateParticipantRequest request =
       UpdateParticipantRequest.newBuilder()
           .setParticipant(Participant.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Participant response = participantsClient.updateParticipant(request);
 }
 
Parameter
NameDescription
requestUpdateParticipantRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Participant

updateParticipantCallable()

public final UnaryCallable<UpdateParticipantRequest,Participant> updateParticipantCallable()

Updates the specified participant.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ParticipantsClient participantsClient = ParticipantsClient.create()) {
   UpdateParticipantRequest request =
       UpdateParticipantRequest.newBuilder()
           .setParticipant(Participant.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Participant> future =
       participantsClient.updateParticipantCallable().futureCall(request);
   // Do something.
   Participant response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateParticipantRequest,Participant>