Class DocumentServiceClient
- java.lang.Object
-
- com.google.cloud.documentai.v1beta3.DocumentServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class DocumentServiceClient extends Object implements com.google.api.gax.core.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDocumentServiceClient.ListLocationsFixedSizeCollectionstatic classDocumentServiceClient.ListLocationsPagestatic classDocumentServiceClient.ListLocationsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protectedDocumentServiceClient(DocumentServiceSettings settings)Constructs an instance of DocumentServiceClient, using the given settings.protectedDocumentServiceClient(DocumentServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long duration, TimeUnit unit)com.google.api.gax.longrunning.OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>batchDeleteDocumentsAsync(BatchDeleteDocumentsRequest request)Deletes a set of documents.com.google.api.gax.longrunning.OperationFuture<BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>batchDeleteDocumentsAsync(String dataset)Deletes a set of documents.com.google.api.gax.rpc.UnaryCallable<BatchDeleteDocumentsRequest,com.google.longrunning.Operation>batchDeleteDocumentsCallable()Deletes a set of documents.com.google.api.gax.rpc.OperationCallable<BatchDeleteDocumentsRequest,BatchDeleteDocumentsResponse,BatchDeleteDocumentsMetadata>batchDeleteDocumentsOperationCallable()Deletes a set of documents.voidclose()static DocumentServiceClientcreate()Constructs an instance of DocumentServiceClient with default settings.static DocumentServiceClientcreate(DocumentServiceSettings settings)Constructs an instance of DocumentServiceClient, using the given settings.static DocumentServiceClientcreate(DocumentServiceStub stub)Constructs an instance of DocumentServiceClient, using the given stub for making calls.DatasetSchemagetDatasetSchema(DatasetSchemaName name)Gets the `DatasetSchema` of a `Dataset`.DatasetSchemagetDatasetSchema(GetDatasetSchemaRequest request)Gets the `DatasetSchema` of a `Dataset`.DatasetSchemagetDatasetSchema(String name)Gets the `DatasetSchema` of a `Dataset`.com.google.api.gax.rpc.UnaryCallable<GetDatasetSchemaRequest,DatasetSchema>getDatasetSchemaCallable()Gets the `DatasetSchema` of a `Dataset`.GetDocumentResponsegetDocument(DatasetName dataset)Returns relevant fields present in the requested document.GetDocumentResponsegetDocument(GetDocumentRequest request)Returns relevant fields present in the requested document.GetDocumentResponsegetDocument(String dataset)Returns relevant fields present in the requested document.com.google.api.gax.rpc.UnaryCallable<GetDocumentRequest,GetDocumentResponse>getDocumentCallable()Returns relevant fields present in the requested document.com.google.api.gax.httpjson.longrunning.OperationsClientgetHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.com.google.cloud.location.LocationgetLocation(com.google.cloud.location.GetLocationRequest request)Gets information about a location.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>getLocationCallable()Gets information about a location.com.google.longrunning.OperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.DocumentServiceSettingsgetSettings()DocumentServiceStubgetStub()com.google.api.gax.longrunning.OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>importDocumentsAsync(DatasetName dataset)Import documents into a dataset.com.google.api.gax.longrunning.OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>importDocumentsAsync(ImportDocumentsRequest request)Import documents into a dataset.com.google.api.gax.longrunning.OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata>importDocumentsAsync(String dataset)Import documents into a dataset.com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.Operation>importDocumentsCallable()Import documents into a dataset.com.google.api.gax.rpc.OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata>importDocumentsOperationCallable()Import documents into a dataset.booleanisShutdown()booleanisTerminated()DocumentServiceClient.ListLocationsPagedResponselistLocations(com.google.cloud.location.ListLocationsRequest request)Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>listLocationsCallable()Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,DocumentServiceClient.ListLocationsPagedResponse>listLocationsPagedCallable()Lists information about the supported locations for this service.voidshutdown()voidshutdownNow()com.google.api.gax.longrunning.OperationFuture<Dataset,UpdateDatasetOperationMetadata>updateDatasetAsync(Dataset dataset, com.google.protobuf.FieldMask updateMask)Updates metadata associated with a dataset.com.google.api.gax.longrunning.OperationFuture<Dataset,UpdateDatasetOperationMetadata>updateDatasetAsync(UpdateDatasetRequest request)Updates metadata associated with a dataset.com.google.api.gax.rpc.UnaryCallable<UpdateDatasetRequest,com.google.longrunning.Operation>updateDatasetCallable()Updates metadata associated with a dataset.com.google.api.gax.rpc.OperationCallable<UpdateDatasetRequest,Dataset,UpdateDatasetOperationMetadata>updateDatasetOperationCallable()Updates metadata associated with a dataset.DatasetSchemaupdateDatasetSchema(DatasetSchema datasetSchema, com.google.protobuf.FieldMask updateMask)Updates a `DatasetSchema`.DatasetSchemaupdateDatasetSchema(UpdateDatasetSchemaRequest request)Updates a `DatasetSchema`.com.google.api.gax.rpc.UnaryCallable<UpdateDatasetSchemaRequest,DatasetSchema>updateDatasetSchemaCallable()Updates a `DatasetSchema`.
-
-
-
Constructor Detail
-
DocumentServiceClient
protected DocumentServiceClient(DocumentServiceSettings settings) throws IOException
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.- Throws:
IOException
-
DocumentServiceClient
protected DocumentServiceClient(DocumentServiceStub stub)
-
-
Method Detail
-
create
public static final DocumentServiceClient create() throws IOException
Constructs an instance of DocumentServiceClient with default settings.- Throws:
IOException
-
create
public static final DocumentServiceClient create(DocumentServiceSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final DocumentServiceSettings getSettings()
-
getStub
public DocumentServiceStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
updateDatasetAsync
public final com.google.api.gax.longrunning.OperationFuture<Dataset,UpdateDatasetOperationMetadata> updateDatasetAsync(Dataset dataset, com.google.protobuf.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:
dataset- Required. The `name` field of the `Dataset` is used to identify the resource to be updated.updateMask- The update mask applies to the resource.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateDatasetAsync
public final com.google.api.gax.longrunning.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(); }- 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
-
updateDatasetOperationCallable
public final com.google.api.gax.rpc.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(); }
-
updateDatasetCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateDatasetRequest,com.google.longrunning.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(); }
-
importDocumentsAsync
public final com.google.api.gax.longrunning.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(); }- Parameters:
dataset- Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
importDocumentsAsync
public final com.google.api.gax.longrunning.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(); }- Parameters:
dataset- Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
importDocumentsAsync
public final com.google.api.gax.longrunning.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(); }- 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
-
importDocumentsOperationCallable
public final com.google.api.gax.rpc.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(); }
-
importDocumentsCallable
public final com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.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(); }
-
getDocument
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); }- Parameters:
dataset- Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getDocument
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); }- Parameters:
dataset- Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getDocument
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); }- 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
-
getDocumentCallable
public final com.google.api.gax.rpc.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(); }
-
batchDeleteDocumentsAsync
public final com.google.api.gax.longrunning.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(); }- Parameters:
dataset- Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
batchDeleteDocumentsAsync
public final com.google.api.gax.longrunning.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(); }- 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
-
batchDeleteDocumentsOperationCallable
public final com.google.api.gax.rpc.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(); }
-
batchDeleteDocumentsCallable
public final com.google.api.gax.rpc.UnaryCallable<BatchDeleteDocumentsRequest,com.google.longrunning.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(); }
-
getDatasetSchema
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); }- Parameters:
name- Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getDatasetSchema
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); }- Parameters:
name- Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getDatasetSchema
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); }- 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
-
getDatasetSchemaCallable
public final com.google.api.gax.rpc.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(); }
-
updateDatasetSchema
public final DatasetSchema updateDatasetSchema(DatasetSchema datasetSchema, com.google.protobuf.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:
datasetSchema- Required. The name field of the `DatasetSchema` is used to identify the resource to be updated.updateMask- The update mask applies to the resource.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateDatasetSchema
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); }- 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
-
updateDatasetSchemaCallable
public final com.google.api.gax.rpc.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(); }
-
listLocations
public final DocumentServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.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); } }- 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
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.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); } }
-
listLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.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); }- 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
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.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(); }
-
close
public final void close()
- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-
-