- 2.59.0 (latest)
- 2.58.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.53.0
- 2.52.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.5
- 2.6.2
- 2.5.1
- 2.4.3
- 2.3.1
- 2.2.1
- 2.1.9
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:
- 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 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.
Implements
BackgroundResourceStatic Methods
create()
public static final DocumentServiceClient create()
Constructs an instance of DocumentServiceClient with default settings.
Returns | |
---|---|
Type | Description |
DocumentServiceClient |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | DocumentServiceSettings |
Returns | |
---|---|
Type | Description |
DocumentServiceClient |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
stub | DocumentServiceStub |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | DocumentServiceSettings |
DocumentServiceClient(DocumentServiceStub stub)
protected DocumentServiceClient(DocumentServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub | DocumentServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | BatchDeleteDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | String Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | DatasetSchemaName Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | GetDatasetSchemaRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | String Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | DatasetName Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | GetDocumentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | String Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final DocumentServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
DocumentServiceSettings |
getStub()
public DocumentServiceStub getStub()
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | DatasetName Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | ImportDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | String Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listDocuments(DatasetName dataset)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(DatasetName dataset)
Returns a list of documents present in the 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]");
for (DocumentMetadata element : documentServiceClient.listDocuments(dataset).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
dataset | DatasetName Required. The resource name of the dataset to be listed. Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(ListDocumentsRequest request)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(ListDocumentsRequest request)
Returns a list of documents present in the 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()) {
ListDocumentsRequest request =
ListDocumentsRequest.newBuilder()
.setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReturnTotalSize(true)
.setSkip(3532159)
.build();
for (DocumentMetadata element : documentServiceClient.listDocuments(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(String dataset)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(String dataset)
Returns a list of documents present in the 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();
for (DocumentMetadata element : documentServiceClient.listDocuments(dataset).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
dataset | String Required. The resource name of the dataset to be listed. Format: projects/{project}/locations/{location}/processors/{processor}/dataset |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocumentsCallable()
public final UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> listDocumentsCallable()
Returns a list of documents present in the 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()) {
ListDocumentsRequest request =
ListDocumentsRequest.newBuilder()
.setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReturnTotalSize(true)
.setSkip(3532159)
.build();
while (true) {
ListDocumentsResponse response =
documentServiceClient.listDocumentsCallable().call(request);
for (DocumentMetadata element : response.getDocumentMetadataList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> |
listDocumentsPagedCallable()
public final UnaryCallable<ListDocumentsRequest,DocumentServiceClient.ListDocumentsPagedResponse> listDocumentsPagedCallable()
Returns a list of documents present in the 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()) {
ListDocumentsRequest request =
ListDocumentsRequest.newBuilder()
.setDataset(DatasetName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReturnTotalSize(true)
.setSkip(3532159)
.build();
ApiFuture<DocumentMetadata> future =
documentServiceClient.listDocumentsPagedCallable().futureCall(request);
// Do something.
for (DocumentMetadata element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListDocumentsRequest,ListDocumentsPagedResponse> |
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 | |
---|---|
Name | Description |
request | com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
dataset | Dataset Required. The |
updateMask | FieldMask The update mask applies to the resource. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | UpdateDatasetRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
datasetSchema | DatasetSchema Required. The name field of the |
updateMask | FieldMask The update mask applies to the resource. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | UpdateDatasetSchemaRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
UnaryCallable<UpdateDatasetSchemaRequest,DatasetSchema> |