Class DocumentServiceClient (2.28.0)

public class DocumentServiceClient implements BackgroundResource

Service Description: Service to call Cloud DocumentAI to manage document collection (dataset).

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   DatasetName dataset = DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
   GetDocumentResponse response = documentServiceClient.getDocument(dataset);
 }
 

Note: close() needs to be called on the DocumentServiceClient 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 DocumentServiceSettings 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
 DocumentServiceSettings documentServiceSettings =
     DocumentServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DocumentServiceClient documentServiceClient =
     DocumentServiceClient.create(documentServiceSettings);
 

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
 DocumentServiceSettings documentServiceSettings =
     DocumentServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DocumentServiceClient documentServiceClient =
     DocumentServiceClient.create(documentServiceSettings);
 

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
 DocumentServiceSettings documentServiceSettings =
     DocumentServiceSettings.newHttpJsonBuilder().build();
 DocumentServiceClient documentServiceClient =
     DocumentServiceClient.create(documentServiceSettings);
 

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

Inheritance

java.lang.Object > DocumentServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final DocumentServiceClient create()

Constructs an instance of DocumentServiceClient with default settings.

Returns
TypeDescription
DocumentServiceClient
Exceptions
TypeDescription
IOException

create(DocumentServiceSettings settings)

public static final DocumentServiceClient create(DocumentServiceSettings settings)

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

create(DocumentServiceStub stub)

public static final DocumentServiceClient create(DocumentServiceStub stub)

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

Parameter
NameDescription
stubDocumentServiceStub
Returns
TypeDescription
DocumentServiceClient

Constructors

DocumentServiceClient(DocumentServiceSettings settings)

protected DocumentServiceClient(DocumentServiceSettings settings)

Constructs an instance of DocumentServiceClient, 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
settingsDocumentServiceSettings

DocumentServiceClient(DocumentServiceStub stub)

protected DocumentServiceClient(DocumentServiceStub stub)
Parameter
NameDescription
stubDocumentServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

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

batchDeleteDocumentsAsync(BatchDeleteDocumentsRequest request)

public final OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata> batchDeleteDocumentsAsync(BatchDeleteDocumentsRequest request)

Deletes a set of documents.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   BatchDeleteDocumentsRequest request =
       BatchDeleteDocumentsRequest.newBuilder()
           .setDataset("dataset1443214456")
           .setDatasetDocuments(BatchDatasetDocuments.newBuilder().build())
           .build();
   BatchDeleteDocumentsResponse response =
       documentServiceClient.batchDeleteDocumentsAsync(request).get();
 }
 
Parameter
NameDescription
requestBatchDeleteDocumentsRequest

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

Returns
TypeDescription
OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>

batchDeleteDocumentsAsync(String dataset)

public final OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata> batchDeleteDocumentsAsync(String dataset)

Deletes a set of documents.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   String dataset = "dataset1443214456";
   BatchDeleteDocumentsResponse response =
       documentServiceClient.batchDeleteDocumentsAsync(dataset).get();
 }
 
Parameter
NameDescription
datasetString

Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

Returns
TypeDescription
OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>

batchDeleteDocumentsCallable()

public final UnaryCallable<BatchDeleteDocumentsRequest,Operation> batchDeleteDocumentsCallable()

Deletes a set of documents.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   BatchDeleteDocumentsRequest request =
       BatchDeleteDocumentsRequest.newBuilder()
           .setDataset("dataset1443214456")
           .setDatasetDocuments(BatchDatasetDocuments.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       documentServiceClient.batchDeleteDocumentsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BatchDeleteDocumentsRequest,Operation>

batchDeleteDocumentsOperationCallable()

public final OperationCallable<BatchDeleteDocumentsRequest,BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata> batchDeleteDocumentsOperationCallable()

Deletes a set of documents.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   BatchDeleteDocumentsRequest request =
       BatchDeleteDocumentsRequest.newBuilder()
           .setDataset("dataset1443214456")
           .setDatasetDocuments(BatchDatasetDocuments.newBuilder().build())
           .build();
   OperationFuture<BatchDeleteDocumentsResponse, BatchDeleteDocumentsMetadata> future =
       documentServiceClient.batchDeleteDocumentsOperationCallable().futureCall(request);
   // Do something.
   BatchDeleteDocumentsResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<BatchDeleteDocumentsRequest,BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>

close()

public final void close()

getDatasetSchema(DatasetSchemaName name)

public final DatasetSchema getDatasetSchema(DatasetSchemaName name)

Gets the DatasetSchema of a Dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   DatasetSchemaName name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
   DatasetSchema response = documentServiceClient.getDatasetSchema(name);
 }
 
Parameter
NameDescription
nameDatasetSchemaName

Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema

Returns
TypeDescription
DatasetSchema

getDatasetSchema(GetDatasetSchemaRequest request)

public final DatasetSchema getDatasetSchema(GetDatasetSchemaRequest request)

Gets the DatasetSchema of a Dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetDatasetSchemaRequest request =
       GetDatasetSchemaRequest.newBuilder()
           .setName(DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .setVisibleFieldsOnly(true)
           .build();
   DatasetSchema response = documentServiceClient.getDatasetSchema(request);
 }
 
Parameter
NameDescription
requestGetDatasetSchemaRequest

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

Returns
TypeDescription
DatasetSchema

getDatasetSchema(String name)

public final DatasetSchema getDatasetSchema(String name)

Gets the DatasetSchema of a Dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   String name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
   DatasetSchema response = documentServiceClient.getDatasetSchema(name);
 }
 
Parameter
NameDescription
nameString

Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema

Returns
TypeDescription
DatasetSchema

getDatasetSchemaCallable()

public final UnaryCallable<GetDatasetSchemaRequest,DatasetSchema> getDatasetSchemaCallable()

Gets the DatasetSchema of a Dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetDatasetSchemaRequest request =
       GetDatasetSchemaRequest.newBuilder()
           .setName(DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .setVisibleFieldsOnly(true)
           .build();
   ApiFuture<DatasetSchema> future =
       documentServiceClient.getDatasetSchemaCallable().futureCall(request);
   // Do something.
   DatasetSchema response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetDatasetSchemaRequest,DatasetSchema>

getDocument(DatasetName dataset)

public final GetDocumentResponse getDocument(DatasetName dataset)

Returns relevant fields present in the requested document.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   DatasetName dataset = DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
   GetDocumentResponse response = documentServiceClient.getDocument(dataset);
 }
 
Parameter
NameDescription
datasetDatasetName

Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset

Returns
TypeDescription
GetDocumentResponse

getDocument(GetDocumentRequest request)

public final GetDocumentResponse getDocument(GetDocumentRequest request)

Returns relevant fields present in the requested document.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetDocumentRequest request =
       GetDocumentRequest.newBuilder()
           .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .setDocumentId(DocumentId.newBuilder().build())
           .setReadMask(FieldMask.newBuilder().build())
           .setPageRange(DocumentPageRange.newBuilder().build())
           .build();
   GetDocumentResponse response = documentServiceClient.getDocument(request);
 }
 
Parameter
NameDescription
requestGetDocumentRequest

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

Returns
TypeDescription
GetDocumentResponse

getDocument(String dataset)

public final GetDocumentResponse getDocument(String dataset)

Returns relevant fields present in the requested document.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   String dataset = DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
   GetDocumentResponse response = documentServiceClient.getDocument(dataset);
 }
 
Parameter
NameDescription
datasetString

Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset

Returns
TypeDescription
GetDocumentResponse

getDocumentCallable()

public final UnaryCallable<GetDocumentRequest,GetDocumentResponse> getDocumentCallable()

Returns relevant fields present in the requested document.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetDocumentRequest request =
       GetDocumentRequest.newBuilder()
           .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .setDocumentId(DocumentId.newBuilder().build())
           .setReadMask(FieldMask.newBuilder().build())
           .setPageRange(DocumentPageRange.newBuilder().build())
           .build();
   ApiFuture<GetDocumentResponse> future =
       documentServiceClient.getDocumentCallable().futureCall(request);
   // Do something.
   GetDocumentResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetDocumentRequest,GetDocumentResponse>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = documentServiceClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = documentServiceClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final DocumentServiceSettings getSettings()
Returns
TypeDescription
DocumentServiceSettings

getStub()

public DocumentServiceStub getStub()
Returns
TypeDescription
DocumentServiceStub

importDocumentsAsync(DatasetName dataset)

public final OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsAsync(DatasetName dataset)

Import documents into a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   DatasetName dataset = DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
   ImportDocumentsResponse response = documentServiceClient.importDocumentsAsync(dataset).get();
 }
 
Parameter
NameDescription
datasetDatasetName

Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

Returns
TypeDescription
OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>

importDocumentsAsync(ImportDocumentsRequest request)

public final OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsAsync(ImportDocumentsRequest request)

Import documents into a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ImportDocumentsRequest request =
       ImportDocumentsRequest.newBuilder()
           .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .addAllBatchDocumentsImportConfigs(
               new ArrayList<ImportDocumentsRequest.BatchDocumentsImportConfig>())
           .build();
   ImportDocumentsResponse response = documentServiceClient.importDocumentsAsync(request).get();
 }
 
Parameter
NameDescription
requestImportDocumentsRequest

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

Returns
TypeDescription
OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>

importDocumentsAsync(String dataset)

public final OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsAsync(String dataset)

Import documents into a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   String dataset = DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
   ImportDocumentsResponse response = documentServiceClient.importDocumentsAsync(dataset).get();
 }
 
Parameter
NameDescription
datasetString

Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

Returns
TypeDescription
OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>

importDocumentsCallable()

public final UnaryCallable<ImportDocumentsRequest,Operation> importDocumentsCallable()

Import documents into a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ImportDocumentsRequest request =
       ImportDocumentsRequest.newBuilder()
           .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .addAllBatchDocumentsImportConfigs(
               new ArrayList<ImportDocumentsRequest.BatchDocumentsImportConfig>())
           .build();
   ApiFuture<Operation> future =
       documentServiceClient.importDocumentsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ImportDocumentsRequest,Operation>

importDocumentsOperationCallable()

public final OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsOperationCallable()

Import documents into a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ImportDocumentsRequest request =
       ImportDocumentsRequest.newBuilder()
           .setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
           .addAllBatchDocumentsImportConfigs(
               new ArrayList<ImportDocumentsRequest.BatchDocumentsImportConfig>())
           .build();
   OperationFuture<ImportDocumentsResponse, ImportDocumentsMetadata> future =
       documentServiceClient.importDocumentsOperationCallable().futureCall(request);
   // Do something.
   ImportDocumentsResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listLocations(ListLocationsRequest request)

public final DocumentServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : documentServiceClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
DocumentServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response =
         documentServiceClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,DocumentServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       documentServiceClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateDatasetAsync(Dataset dataset, FieldMask updateMask)

public final OperationFuture<Dataset,UpdateDatasetOperationMetadata> updateDatasetAsync(Dataset dataset, FieldMask updateMask)

Updates metadata associated with a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   Dataset dataset = Dataset.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Dataset response = documentServiceClient.updateDatasetAsync(dataset, updateMask).get();
 }
 
Parameters
NameDescription
datasetDataset

Required. The name field of the Dataset is used to identify the resource to be updated.

updateMaskFieldMask

The update mask applies to the resource.

Returns
TypeDescription
OperationFuture<Dataset,UpdateDatasetOperationMetadata>

updateDatasetAsync(UpdateDatasetRequest request)

public final OperationFuture<Dataset,UpdateDatasetOperationMetadata> updateDatasetAsync(UpdateDatasetRequest request)

Updates metadata associated with a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   UpdateDatasetRequest request =
       UpdateDatasetRequest.newBuilder()
           .setDataset(Dataset.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Dataset response = documentServiceClient.updateDatasetAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateDatasetRequest

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

Returns
TypeDescription
OperationFuture<Dataset,UpdateDatasetOperationMetadata>

updateDatasetCallable()

public final UnaryCallable<UpdateDatasetRequest,Operation> updateDatasetCallable()

Updates metadata associated with a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   UpdateDatasetRequest request =
       UpdateDatasetRequest.newBuilder()
           .setDataset(Dataset.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       documentServiceClient.updateDatasetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateDatasetRequest,Operation>

updateDatasetOperationCallable()

public final OperationCallable<UpdateDatasetRequest,Dataset,UpdateDatasetOperationMetadata> updateDatasetOperationCallable()

Updates metadata associated with a dataset.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   UpdateDatasetRequest request =
       UpdateDatasetRequest.newBuilder()
           .setDataset(Dataset.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   OperationFuture<Dataset, UpdateDatasetOperationMetadata> future =
       documentServiceClient.updateDatasetOperationCallable().futureCall(request);
   // Do something.
   Dataset response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateDatasetRequest,Dataset,UpdateDatasetOperationMetadata>

updateDatasetSchema(DatasetSchema datasetSchema, FieldMask updateMask)

public final DatasetSchema updateDatasetSchema(DatasetSchema datasetSchema, FieldMask updateMask)

Updates a DatasetSchema.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   DatasetSchema datasetSchema = DatasetSchema.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   DatasetSchema response = documentServiceClient.updateDatasetSchema(datasetSchema, updateMask);
 }
 
Parameters
NameDescription
datasetSchemaDatasetSchema

Required. The name field of the DatasetSchema is used to identify the resource to be updated.

updateMaskFieldMask

The update mask applies to the resource.

Returns
TypeDescription
DatasetSchema

updateDatasetSchema(UpdateDatasetSchemaRequest request)

public final DatasetSchema updateDatasetSchema(UpdateDatasetSchemaRequest request)

Updates a DatasetSchema.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   UpdateDatasetSchemaRequest request =
       UpdateDatasetSchemaRequest.newBuilder()
           .setDatasetSchema(DatasetSchema.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   DatasetSchema response = documentServiceClient.updateDatasetSchema(request);
 }
 
Parameter
NameDescription
requestUpdateDatasetSchemaRequest

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

Returns
TypeDescription
DatasetSchema

updateDatasetSchemaCallable()

public final UnaryCallable<UpdateDatasetSchemaRequest,DatasetSchema> updateDatasetSchemaCallable()

Updates a DatasetSchema.

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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
   UpdateDatasetSchemaRequest request =
       UpdateDatasetSchemaRequest.newBuilder()
           .setDatasetSchema(DatasetSchema.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<DatasetSchema> future =
       documentServiceClient.updateDatasetSchemaCallable().futureCall(request);
   // Do something.
   DatasetSchema response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateDatasetSchemaRequest,DatasetSchema>