Class SynonymSetServiceClient (0.31.0)

GitHub RepositoryProduct Reference

Service Description: A Service that manage/custom customer specified SynonymSets.

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 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 

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

Methods
MethodDescriptionMethod Variants

CreateSynonymSet

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSynonymSet(CreateSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createSynonymSet(LocationName parent, SynonymSet synonymSet)

  • createSynonymSet(String parent, SynonymSet synonymSet)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createSynonymSetCallable()

GetSynonymSet

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getSynonymSet(GetSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getSynonymSet(SynonymSetName name)

  • getSynonymSet(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getSynonymSetCallable()

UpdateSynonymSet

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSynonymSet(UpdateSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

  • updateSynonymSet(String name, SynonymSet synonymSet)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateSynonymSetCallable()

DeleteSynonymSet

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteSynonymSet(DeleteSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteSynonymSet(SynonymSetName name)

  • deleteSynonymSet(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteSynonymSetCallable()

ListSynonymSets

Returns all SynonymSets (for all contexts) for the specified location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listSynonymSets(ListSynonymSetsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listSynonymSets(LocationName parent)

  • listSynonymSets(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listSynonymSetsPagedCallable()

  • listSynonymSetsCallable()

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 SynonymSetServiceSettings to create(). For example:

To customize credentials:


 // 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
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

To customize the endpoint:


 // 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
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

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


 // 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
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newHttpJsonBuilder().build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

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

Inheritance

java.lang.Object > SynonymSetServiceClient

Static Methods

create()

public static final SynonymSetServiceClient create()

Constructs an instance of SynonymSetServiceClient with default settings.

Returns
TypeDescription
SynonymSetServiceClient
Exceptions
TypeDescription
IOException

create(SynonymSetServiceSettings settings)

public static final SynonymSetServiceClient create(SynonymSetServiceSettings settings)

Constructs an instance of SynonymSetServiceClient, 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
settingsSynonymSetServiceSettings
Returns
TypeDescription
SynonymSetServiceClient
Exceptions
TypeDescription
IOException

create(SynonymSetServiceStub stub)

public static final SynonymSetServiceClient create(SynonymSetServiceStub stub)

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

Parameter
NameDescription
stubSynonymSetServiceStub
Returns
TypeDescription
SynonymSetServiceClient

Constructors

SynonymSetServiceClient(SynonymSetServiceSettings settings)

protected SynonymSetServiceClient(SynonymSetServiceSettings settings)

Constructs an instance of SynonymSetServiceClient, 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
settingsSynonymSetServiceSettings

SynonymSetServiceClient(SynonymSetServiceStub stub)

protected SynonymSetServiceClient(SynonymSetServiceStub stub)
Parameter
NameDescription
stubSynonymSetServiceStub

Methods

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()

createSynonymSet(CreateSynonymSetRequest request)

public final SynonymSet createSynonymSet(CreateSynonymSetRequest request)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   CreateSynonymSetRequest request =
       CreateSynonymSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(request);
 }
 
Parameter
NameDescription
requestCreateSynonymSetRequest

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

Returns
TypeDescription
SynonymSet

createSynonymSet(LocationName parent, SynonymSet synonymSet)

public final SynonymSet createSynonymSet(LocationName parent, SynonymSet synonymSet)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 
Parameters
NameDescription
parentLocationName

Required. The parent name. Format: projects/{project_number}/locations/{location}.

synonymSetSynonymSet

Required. The synonymSet to be created for a context

Returns
TypeDescription
SynonymSet

createSynonymSet(String parent, SynonymSet synonymSet)

public final SynonymSet createSynonymSet(String parent, SynonymSet synonymSet)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 
Parameters
NameDescription
parentString

Required. The parent name. Format: projects/{project_number}/locations/{location}.

synonymSetSynonymSet

Required. The synonymSet to be created for a context

Returns
TypeDescription
SynonymSet

createSynonymSetCallable()

public final UnaryCallable<CreateSynonymSetRequest,SynonymSet> createSynonymSetCallable()

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   CreateSynonymSetRequest request =
       CreateSynonymSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.createSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateSynonymSetRequest,SynonymSet>

deleteSynonymSet(DeleteSynonymSetRequest request)

public final void deleteSynonymSet(DeleteSynonymSetRequest request)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   DeleteSynonymSetRequest request =
       DeleteSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   synonymSetServiceClient.deleteSynonymSet(request);
 }
 
Parameter
NameDescription
requestDeleteSynonymSetRequest

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

deleteSynonymSet(SynonymSetName name)

public final void deleteSynonymSet(SynonymSetName name)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   synonymSetServiceClient.deleteSynonymSet(name);
 }
 
Parameter
NameDescription
nameSynonymSetName

Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

deleteSynonymSet(String name)

public final void deleteSynonymSet(String name)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   synonymSetServiceClient.deleteSynonymSet(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

deleteSynonymSetCallable()

public final UnaryCallable<DeleteSynonymSetRequest,Empty> deleteSynonymSetCallable()

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   DeleteSynonymSetRequest request =
       DeleteSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   ApiFuture<Empty> future =
       synonymSetServiceClient.deleteSynonymSetCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteSynonymSetRequest,Empty>

getSettings()

public final SynonymSetServiceSettings getSettings()
Returns
TypeDescription
SynonymSetServiceSettings

getStub()

public SynonymSetServiceStub getStub()
Returns
TypeDescription
SynonymSetServiceStub

getSynonymSet(GetSynonymSetRequest request)

public final SynonymSet getSynonymSet(GetSynonymSetRequest request)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   GetSynonymSetRequest request =
       GetSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   SynonymSet response = synonymSetServiceClient.getSynonymSet(request);
 }
 
Parameter
NameDescription
requestGetSynonymSetRequest

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

Returns
TypeDescription
SynonymSet

getSynonymSet(SynonymSetName name)

public final SynonymSet getSynonymSet(SynonymSetName name)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   SynonymSet response = synonymSetServiceClient.getSynonymSet(name);
 }
 
Parameter
NameDescription
nameSynonymSetName

Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

Returns
TypeDescription
SynonymSet

getSynonymSet(String name)

public final SynonymSet getSynonymSet(String name)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   SynonymSet response = synonymSetServiceClient.getSynonymSet(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

Returns
TypeDescription
SynonymSet

getSynonymSetCallable()

public final UnaryCallable<GetSynonymSetRequest,SynonymSet> getSynonymSetCallable()

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   GetSynonymSetRequest request =
       GetSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.getSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetSynonymSetRequest,SynonymSet>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listSynonymSets(ListSynonymSetsRequest request)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(ListSynonymSetsRequest request)

Returns all SynonymSets (for all contexts) for the specified location.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListSynonymSetsRequest

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

Returns
TypeDescription
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSets(LocationName parent)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(LocationName parent)

Returns all SynonymSets (for all contexts) for the specified location.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The parent name. Format: projects/{project_number}/locations/{location}.

Returns
TypeDescription
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSets(String parent)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(String parent)

Returns all SynonymSets (for all contexts) for the specified location.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The parent name. Format: projects/{project_number}/locations/{location}.

Returns
TypeDescription
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSetsCallable()

public final UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsResponse> listSynonymSetsCallable()

Returns all SynonymSets (for all contexts) for the specified location.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListSynonymSetsResponse response =
         synonymSetServiceClient.listSynonymSetsCallable().call(request);
     for (SynonymSet element : response.getSynonymSetsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsResponse>

listSynonymSetsPagedCallable()

public final UnaryCallable<ListSynonymSetsRequest,SynonymSetServiceClient.ListSynonymSetsPagedResponse> listSynonymSetsPagedCallable()

Returns all SynonymSets (for all contexts) for the specified location.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.listSynonymSetsPagedCallable().futureCall(request);
   // Do something.
   for (SynonymSet element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

public final SynonymSet updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(name, synonymSet);
 }
 
Parameters
NameDescription
nameSynonymSetName

Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

synonymSetSynonymSet

Required. The synonymSet to be updated for the customer

Returns
TypeDescription
SynonymSet

updateSynonymSet(UpdateSynonymSetRequest request)

public final SynonymSet updateSynonymSet(UpdateSynonymSetRequest request)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   UpdateSynonymSetRequest request =
       UpdateSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(request);
 }
 
Parameter
NameDescription
requestUpdateSynonymSetRequest

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

Returns
TypeDescription
SynonymSet

updateSynonymSet(String name, SynonymSet synonymSet)

public final SynonymSet updateSynonymSet(String name, SynonymSet synonymSet)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(name, synonymSet);
 }
 
Parameters
NameDescription
nameString

Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

synonymSetSynonymSet

Required. The synonymSet to be updated for the customer

Returns
TypeDescription
SynonymSet

updateSynonymSetCallable()

public final UnaryCallable<UpdateSynonymSetRequest,SynonymSet> updateSynonymSetCallable()

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample 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 (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   UpdateSynonymSetRequest request =
       UpdateSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.updateSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateSynonymSetRequest,SynonymSet>