Class SynonymSetServiceClient
- java.lang.Object
-
- com.google.cloud.contentwarehouse.v1.SynonymSetServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class SynonymSetServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- 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.
- 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.
- 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 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SynonymSetServiceClient.ListSynonymSetsFixedSizeCollection
static class
SynonymSetServiceClient.ListSynonymSetsPage
static class
SynonymSetServiceClient.ListSynonymSetsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
SynonymSetServiceClient(SynonymSetServiceStub stub)
protected
SynonymSetServiceClient(SynonymSetServiceSettings settings)
Constructs an instance of SynonymSetServiceClient, using the given settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static SynonymSetServiceClient
create()
Constructs an instance of SynonymSetServiceClient with default settings.static SynonymSetServiceClient
create(SynonymSetServiceStub stub)
Constructs an instance of SynonymSetServiceClient, using the given stub for making calls.static SynonymSetServiceClient
create(SynonymSetServiceSettings settings)
Constructs an instance of SynonymSetServiceClient, using the given settings.SynonymSet
createSynonymSet(CreateSynonymSetRequest request)
Creates a SynonymSet for a single context.SynonymSet
createSynonymSet(LocationName parent, SynonymSet synonymSet)
Creates a SynonymSet for a single context.SynonymSet
createSynonymSet(String parent, SynonymSet synonymSet)
Creates a SynonymSet for a single context.com.google.api.gax.rpc.UnaryCallable<CreateSynonymSetRequest,SynonymSet>
createSynonymSetCallable()
Creates a SynonymSet for a single context.void
deleteSynonymSet(DeleteSynonymSetRequest request)
Deletes a SynonymSet for a given context.void
deleteSynonymSet(SynonymSetName name)
Deletes a SynonymSet for a given context.void
deleteSynonymSet(String name)
Deletes a SynonymSet for a given context.com.google.api.gax.rpc.UnaryCallable<DeleteSynonymSetRequest,com.google.protobuf.Empty>
deleteSynonymSetCallable()
Deletes a SynonymSet for a given context.SynonymSetServiceSettings
getSettings()
SynonymSetServiceStub
getStub()
SynonymSet
getSynonymSet(GetSynonymSetRequest request)
Gets a SynonymSet for a particular context.SynonymSet
getSynonymSet(SynonymSetName name)
Gets a SynonymSet for a particular context.SynonymSet
getSynonymSet(String name)
Gets a SynonymSet for a particular context.com.google.api.gax.rpc.UnaryCallable<GetSynonymSetRequest,SynonymSet>
getSynonymSetCallable()
Gets a SynonymSet for a particular context.boolean
isShutdown()
boolean
isTerminated()
SynonymSetServiceClient.ListSynonymSetsPagedResponse
listSynonymSets(ListSynonymSetsRequest request)
Returns all SynonymSets (for all contexts) for the specified location.SynonymSetServiceClient.ListSynonymSetsPagedResponse
listSynonymSets(LocationName parent)
Returns all SynonymSets (for all contexts) for the specified location.SynonymSetServiceClient.ListSynonymSetsPagedResponse
listSynonymSets(String parent)
Returns all SynonymSets (for all contexts) for the specified location.com.google.api.gax.rpc.UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsResponse>
listSynonymSetsCallable()
Returns all SynonymSets (for all contexts) for the specified location.com.google.api.gax.rpc.UnaryCallable<ListSynonymSetsRequest,SynonymSetServiceClient.ListSynonymSetsPagedResponse>
listSynonymSetsPagedCallable()
Returns all SynonymSets (for all contexts) for the specified location.void
shutdown()
void
shutdownNow()
SynonymSet
updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)
Remove the existing SynonymSet for the context and replaces it with a new one.SynonymSet
updateSynonymSet(UpdateSynonymSetRequest request)
Remove the existing SynonymSet for the context and replaces it with a new one.SynonymSet
updateSynonymSet(String name, SynonymSet synonymSet)
Remove the existing SynonymSet for the context and replaces it with a new one.com.google.api.gax.rpc.UnaryCallable<UpdateSynonymSetRequest,SynonymSet>
updateSynonymSetCallable()
Remove the existing SynonymSet for the context and replaces it with a new one.
-
-
-
Constructor Detail
-
SynonymSetServiceClient
protected SynonymSetServiceClient(SynonymSetServiceSettings settings) throws IOException
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.- Throws:
IOException
-
SynonymSetServiceClient
protected SynonymSetServiceClient(SynonymSetServiceStub stub)
-
-
Method Detail
-
create
public static final SynonymSetServiceClient create() throws IOException
Constructs an instance of SynonymSetServiceClient with default settings.- Throws:
IOException
-
create
public static final SynonymSetServiceClient create(SynonymSetServiceSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final SynonymSetServiceSettings getSettings()
-
getStub
public SynonymSetServiceStub getStub()
-
createSynonymSet
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:
parent
- Required. The parent name. Format: projects/{project_number}/locations/{location}.synonymSet
- Required. The synonymSet to be created for a context- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createSynonymSet
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:
parent
- Required. The parent name. Format: projects/{project_number}/locations/{location}.synonymSet
- Required. The synonymSet to be created for a context- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createSynonymSet
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); }
- Parameters:
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
-
createSynonymSetCallable
public final com.google.api.gax.rpc.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(); }
-
getSynonymSet
public final SynonymSet getSynonymSet(SynonymSetName name)
Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not existSample 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); }
- Parameters:
name
- Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getSynonymSet
public final SynonymSet getSynonymSet(String name)
Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not existSample 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); }
- Parameters:
name
- Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getSynonymSet
public final SynonymSet getSynonymSet(GetSynonymSetRequest request)
Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not existSample 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); }
- Parameters:
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
-
getSynonymSetCallable
public final com.google.api.gax.rpc.UnaryCallable<GetSynonymSetRequest,SynonymSet> getSynonymSetCallable()
Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not existSample 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(); }
-
updateSynonymSet
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:
name
- Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.synonymSet
- Required. The synonymSet to be updated for the customer- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSynonymSet
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:
name
- Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.synonymSet
- Required. The synonymSet to be updated for the customer- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSynonymSet
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); }
- Parameters:
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
-
updateSynonymSetCallable
public final com.google.api.gax.rpc.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(); }
-
deleteSynonymSet
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); }
- Parameters:
name
- Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteSynonymSet
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); }
- Parameters:
name
- Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteSynonymSet
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); }
- Parameters:
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
-
deleteSynonymSetCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteSynonymSetRequest,com.google.protobuf.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(); }
-
listSynonymSets
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); } }
- Parameters:
parent
- Required. The parent name. Format: projects/{project_number}/locations/{location}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSynonymSets
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); } }
- Parameters:
parent
- Required. The parent name. Format: projects/{project_number}/locations/{location}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSynonymSets
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); } }
- Parameters:
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
-
listSynonymSetsPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listSynonymSetsCallable
public final com.google.api.gax.rpc.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; } } }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-