@Generated(value="by gapic-generator-java") public class DocumentServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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()) {
DocumentName name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
Document response = documentServiceClient.getDocument(name);
}
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().
| Method | Description | Method Variants |
|---|---|---|
GetDocument |
Gets a [Document][google.cloud.discoveryengine.v1.Document]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDocuments |
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDocument |
Creates a [Document][google.cloud.discoveryengine.v1.Document]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDocument |
Updates a [Document][google.cloud.discoveryengine.v1.Document]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDocument |
Deletes a [Document][google.cloud.discoveryengine.v1.Document]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportDocuments |
Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s. Request processing may be synchronous. Non-existing items are created. Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
PurgeDocuments |
Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a branch. This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments]. To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchGetDocumentsMetadata |
Gets index freshness metadata for [Document][google.cloud.discoveryengine.v1.Document]s. Supported for website search only. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
DocumentServiceClient.ListDocumentsFixedSizeCollection |
static class |
DocumentServiceClient.ListDocumentsPage |
static class |
DocumentServiceClient.ListDocumentsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
DocumentServiceClient(DocumentServiceSettings settings)
Constructs an instance of DocumentServiceClient, using the given settings.
|
protected |
DocumentServiceClient(DocumentServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
BatchGetDocumentsMetadataResponse |
batchGetDocumentsMetadata(BatchGetDocumentsMetadataRequest request)
Gets index freshness metadata for [Document][google.cloud.discoveryengine.v1.Document]s.
|
BatchGetDocumentsMetadataResponse |
batchGetDocumentsMetadata(BranchName parent)
Gets index freshness metadata for [Document][google.cloud.discoveryengine.v1.Document]s.
|
BatchGetDocumentsMetadataResponse |
batchGetDocumentsMetadata(String parent)
Gets index freshness metadata for [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.rpc.UnaryCallable<BatchGetDocumentsMetadataRequest,BatchGetDocumentsMetadataResponse> |
batchGetDocumentsMetadataCallable()
Gets index freshness metadata for [Document][google.cloud.discoveryengine.v1.Document]s.
|
void |
close() |
static DocumentServiceClient |
create()
Constructs an instance of DocumentServiceClient with default settings.
|
static DocumentServiceClient |
create(DocumentServiceSettings settings)
Constructs an instance of DocumentServiceClient, using the given settings.
|
static DocumentServiceClient |
create(DocumentServiceStub stub)
Constructs an instance of DocumentServiceClient, using the given stub for making calls.
|
Document |
createDocument(BranchName parent,
Document document,
String documentId)
Creates a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
createDocument(CreateDocumentRequest request)
Creates a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
createDocument(String parent,
Document document,
String documentId)
Creates a [Document][google.cloud.discoveryengine.v1.Document].
|
com.google.api.gax.rpc.UnaryCallable<CreateDocumentRequest,Document> |
createDocumentCallable()
Creates a [Document][google.cloud.discoveryengine.v1.Document].
|
void |
deleteDocument(DeleteDocumentRequest request)
Deletes a [Document][google.cloud.discoveryengine.v1.Document].
|
void |
deleteDocument(DocumentName name)
Deletes a [Document][google.cloud.discoveryengine.v1.Document].
|
void |
deleteDocument(String name)
Deletes a [Document][google.cloud.discoveryengine.v1.Document].
|
com.google.api.gax.rpc.UnaryCallable<DeleteDocumentRequest,com.google.protobuf.Empty> |
deleteDocumentCallable()
Deletes a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
getDocument(DocumentName name)
Gets a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
getDocument(GetDocumentRequest request)
Gets a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
getDocument(String name)
Gets a [Document][google.cloud.discoveryengine.v1.Document].
|
com.google.api.gax.rpc.UnaryCallable<GetDocumentRequest,Document> |
getDocumentCallable()
Gets a [Document][google.cloud.discoveryengine.v1.Document].
|
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.
|
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.
|
DocumentServiceSettings |
getSettings() |
DocumentServiceStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> |
importDocumentsAsync(ImportDocumentsRequest request)
Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.Operation> |
importDocumentsCallable()
Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.rpc.OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> |
importDocumentsOperationCallable()
Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(BranchName parent)
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
|
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(ListDocumentsRequest request)
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
|
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(String parent)
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> |
listDocumentsCallable()
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,DocumentServiceClient.ListDocumentsPagedResponse> |
listDocumentsPagedCallable()
Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.
|
com.google.api.gax.longrunning.OperationFuture<PurgeDocumentsResponse,PurgeDocumentsMetadata> |
purgeDocumentsAsync(PurgeDocumentsRequest request)
Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a
branch.
|
com.google.api.gax.rpc.UnaryCallable<PurgeDocumentsRequest,com.google.longrunning.Operation> |
purgeDocumentsCallable()
Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a
branch.
|
com.google.api.gax.rpc.OperationCallable<PurgeDocumentsRequest,PurgeDocumentsResponse,PurgeDocumentsMetadata> |
purgeDocumentsOperationCallable()
Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a
branch.
|
void |
shutdown() |
void |
shutdownNow() |
Document |
updateDocument(Document document,
com.google.protobuf.FieldMask updateMask)
Updates a [Document][google.cloud.discoveryengine.v1.Document].
|
Document |
updateDocument(UpdateDocumentRequest request)
Updates a [Document][google.cloud.discoveryengine.v1.Document].
|
com.google.api.gax.rpc.UnaryCallable<UpdateDocumentRequest,Document> |
updateDocumentCallable()
Updates a [Document][google.cloud.discoveryengine.v1.Document].
|
protected DocumentServiceClient(DocumentServiceSettings settings) throws IOException
IOExceptionprotected DocumentServiceClient(DocumentServiceStub stub)
public static final DocumentServiceClient create() throws IOException
IOExceptionpublic static final DocumentServiceClient create(DocumentServiceSettings settings) throws IOException
IOExceptionpublic static final DocumentServiceClient create(DocumentServiceStub stub)
public final DocumentServiceSettings getSettings()
public DocumentServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final Document getDocument(DocumentName name)
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()) {
DocumentName name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
Document response = documentServiceClient.getDocument(name);
}
name - Required. Full resource name of
[Document][google.cloud.discoveryengine.v1.Document], such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Document getDocument(String name)
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 =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString();
Document response = documentServiceClient.getDocument(name);
}
name - Required. Full resource name of
[Document][google.cloud.discoveryengine.v1.Document], such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Document getDocument(GetDocumentRequest request)
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()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
Document response = documentServiceClient.getDocument(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetDocumentRequest,Document> getDocumentCallable()
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()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
ApiFuture<Document> future = documentServiceClient.getDocumentCallable().futureCall(request);
// Do something.
Document response = future.get();
}
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(BranchName parent)
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()) {
BranchName parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
for (Document element : documentServiceClient.listDocuments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
Use `default_branch` as the branch ID, to list documents under the default branch.
If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a `PERMISSION_DENIED` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(String parent)
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 parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString();
for (Document element : documentServiceClient.listDocuments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
Use `default_branch` as the branch ID, to list documents under the default branch.
If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a `PERMISSION_DENIED` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(ListDocumentsRequest request)
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Document element : documentServiceClient.listDocuments(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,DocumentServiceClient.ListDocumentsPagedResponse> listDocumentsPagedCallable()
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Document> future =
documentServiceClient.listDocumentsPagedCallable().futureCall(request);
// Do something.
for (Document element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> listDocumentsCallable()
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListDocumentsResponse response =
documentServiceClient.listDocumentsCallable().call(request);
for (Document element : response.getDocumentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Document createDocument(BranchName parent, Document document, String documentId)
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()) {
BranchName parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
Document document = Document.newBuilder().build();
String documentId = "documentId-814940266";
Document response = documentServiceClient.createDocument(parent, document, documentId);
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.document - Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.documentId - Required. The ID to use for the
[Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of
the [Document.name][google.cloud.discoveryengine.v1.Document.name].
If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an `ALREADY_EXISTS` error is returned.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Document createDocument(String parent, Document document, String documentId)
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 parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString();
Document document = Document.newBuilder().build();
String documentId = "documentId-814940266";
Document response = documentServiceClient.createDocument(parent, document, documentId);
}
parent - Required. The parent resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.document - Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.documentId - Required. The ID to use for the
[Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of
the [Document.name][google.cloud.discoveryengine.v1.Document.name].
If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an `ALREADY_EXISTS` error is returned.
This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Document createDocument(CreateDocumentRequest request)
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()) {
CreateDocumentRequest request =
CreateDocumentRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setDocument(Document.newBuilder().build())
.setDocumentId("documentId-814940266")
.build();
Document response = documentServiceClient.createDocument(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateDocumentRequest,Document> createDocumentCallable()
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()) {
CreateDocumentRequest request =
CreateDocumentRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setDocument(Document.newBuilder().build())
.setDocumentId("documentId-814940266")
.build();
ApiFuture<Document> future =
documentServiceClient.createDocumentCallable().futureCall(request);
// Do something.
Document response = future.get();
}
public final Document updateDocument(Document document, com.google.protobuf.FieldMask updateMask)
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()) {
Document document = Document.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Document response = documentServiceClient.updateDocument(document, updateMask);
}
document - Required. The document to update/create.
If the caller does not have permission to update the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [Document][google.cloud.discoveryengine.v1.Document] to update does not exist and [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] is not set, a `NOT_FOUND` error is returned.
updateMask - Indicates which fields in the provided imported 'document' to update. If not
set, by default updates all fields.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Document updateDocument(UpdateDocumentRequest request)
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()) {
UpdateDocumentRequest request =
UpdateDocumentRequest.newBuilder()
.setDocument(Document.newBuilder().build())
.setAllowMissing(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Document response = documentServiceClient.updateDocument(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateDocumentRequest,Document> updateDocumentCallable()
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()) {
UpdateDocumentRequest request =
UpdateDocumentRequest.newBuilder()
.setDocument(Document.newBuilder().build())
.setAllowMissing(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Document> future =
documentServiceClient.updateDocumentCallable().futureCall(request);
// Do something.
Document response = future.get();
}
public final void deleteDocument(DocumentName name)
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()) {
DocumentName name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
documentServiceClient.deleteDocument(name);
}
name - Required. Full resource name of
[Document][google.cloud.discoveryengine.v1.Document], such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteDocument(String name)
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 =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString();
documentServiceClient.deleteDocument(name);
}
name - Required. Full resource name of
[Document][google.cloud.discoveryengine.v1.Document], such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a `PERMISSION_DENIED` error is returned.
If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a `NOT_FOUND` error is returned.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteDocument(DeleteDocumentRequest request)
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()) {
DeleteDocumentRequest request =
DeleteDocumentRequest.newBuilder()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
documentServiceClient.deleteDocument(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteDocumentRequest,com.google.protobuf.Empty> deleteDocumentCallable()
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()) {
DeleteDocumentRequest request =
DeleteDocumentRequest.newBuilder()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
ApiFuture<Empty> future = documentServiceClient.deleteDocumentCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsAsync(ImportDocumentsRequest request)
Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setErrorConfig(ImportErrorConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
ImportDocumentsResponse response = documentServiceClient.importDocumentsAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsOperationCallable()
Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setErrorConfig(ImportErrorConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
OperationFuture<ImportDocumentsResponse, ImportDocumentsMetadata> future =
documentServiceClient.importDocumentsOperationCallable().futureCall(request);
// Do something.
ImportDocumentsResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.Operation> importDocumentsCallable()
Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.
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()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setErrorConfig(ImportErrorConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
ApiFuture<Operation> future =
documentServiceClient.importDocumentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PurgeDocumentsResponse,PurgeDocumentsMetadata> purgeDocumentsAsync(PurgeDocumentsRequest request)
This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.
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()) {
PurgeDocumentsRequest request =
PurgeDocumentsRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setFilter("filter-1274492040")
.setErrorConfig(PurgeErrorConfig.newBuilder().build())
.setForce(true)
.build();
PurgeDocumentsResponse response = documentServiceClient.purgeDocumentsAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<PurgeDocumentsRequest,PurgeDocumentsResponse,PurgeDocumentsMetadata> purgeDocumentsOperationCallable()
This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.
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()) {
PurgeDocumentsRequest request =
PurgeDocumentsRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setFilter("filter-1274492040")
.setErrorConfig(PurgeErrorConfig.newBuilder().build())
.setForce(true)
.build();
OperationFuture<PurgeDocumentsResponse, PurgeDocumentsMetadata> future =
documentServiceClient.purgeDocumentsOperationCallable().futureCall(request);
// Do something.
PurgeDocumentsResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<PurgeDocumentsRequest,com.google.longrunning.Operation> purgeDocumentsCallable()
This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].
To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.
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()) {
PurgeDocumentsRequest request =
PurgeDocumentsRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setFilter("filter-1274492040")
.setErrorConfig(PurgeErrorConfig.newBuilder().build())
.setForce(true)
.build();
ApiFuture<Operation> future =
documentServiceClient.purgeDocumentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final BatchGetDocumentsMetadataResponse batchGetDocumentsMetadata(BranchName parent)
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()) {
BranchName parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
BatchGetDocumentsMetadataResponse response =
documentServiceClient.batchGetDocumentsMetadata(parent);
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final BatchGetDocumentsMetadataResponse batchGetDocumentsMetadata(String parent)
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 parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString();
BatchGetDocumentsMetadataResponse response =
documentServiceClient.batchGetDocumentsMetadata(parent);
}
parent - Required. The parent branch resource name, such as
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final BatchGetDocumentsMetadataResponse batchGetDocumentsMetadata(BatchGetDocumentsMetadataRequest request)
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()) {
BatchGetDocumentsMetadataRequest request =
BatchGetDocumentsMetadataRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setMatcher(BatchGetDocumentsMetadataRequest.Matcher.newBuilder().build())
.build();
BatchGetDocumentsMetadataResponse response =
documentServiceClient.batchGetDocumentsMetadata(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<BatchGetDocumentsMetadataRequest,BatchGetDocumentsMetadataResponse> batchGetDocumentsMetadataCallable()
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()) {
BatchGetDocumentsMetadataRequest request =
BatchGetDocumentsMetadataRequest.newBuilder()
.setParent(
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString())
.setMatcher(BatchGetDocumentsMetadataRequest.Matcher.newBuilder().build())
.build();
ApiFuture<BatchGetDocumentsMetadataResponse> future =
documentServiceClient.batchGetDocumentsMetadataCallable().futureCall(request);
// Do something.
BatchGetDocumentsMetadataResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.