- 0.49.0 (latest)
- 0.48.0
- 0.47.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
GitHub Repository | Product Reference |
Service Description: Service for ingesting Document information of the customer's website.
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. |
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 Documents. |
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. |
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. |
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. |
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 Documents. Request processing may be synchronous. Non-existing items will be created. Note: It is possible for a subset of the Documents 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 Documents in a branch. This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments. To get a list of the Documents to be deleted, set 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.
|
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.
Static Methods
create()
public static final DocumentServiceClient create()
Constructs an instance of DocumentServiceClient with default settings.
Returns | |
---|---|
Type | Description |
DocumentServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(DocumentServiceSettings settings)
public static final DocumentServiceClient create(DocumentServiceSettings settings)
Constructs an instance of DocumentServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | DocumentServiceSettings |
Returns | |
---|---|
Type | Description |
DocumentServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(DocumentServiceStub stub)
public static final DocumentServiceClient create(DocumentServiceStub stub)
Constructs an instance of DocumentServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DocumentServiceSettings).
Parameter | |
---|---|
Name | Description |
stub | DocumentServiceStub |
Returns | |
---|---|
Type | Description |
DocumentServiceClient |
Constructors
DocumentServiceClient(DocumentServiceSettings settings)
protected DocumentServiceClient(DocumentServiceSettings settings)
Constructs an instance of DocumentServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings | DocumentServiceSettings |
DocumentServiceClient(DocumentServiceStub stub)
protected DocumentServiceClient(DocumentServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub | DocumentServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createDocument(BranchName parent, Document document, String documentId)
public final Document createDocument(BranchName parent, Document document, String documentId)
Creates a 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()) {
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);
}
Parameters | |
---|---|
Name | Description |
parent | BranchName Required. The parent resource name, such as
|
document | Document Required. The Document to create. |
documentId | String Required. The ID to use for the Document, which will become the final component of the Document.name. If the caller does not have permission to create the
Document, regardless of whether or not it
exists, a This field must be unique among all
Documents with the same
parent. Otherwise, an
This field must conform to RFC-1034 standard with
a length limit of 63 characters. Otherwise, an |
Returns | |
---|---|
Type | Description |
Document |
createDocument(CreateDocumentRequest request)
public final Document createDocument(CreateDocumentRequest request)
Creates a 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()) {
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);
}
Parameter | |
---|---|
Name | Description |
request | CreateDocumentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Document |
createDocument(String parent, Document document, String documentId)
public final Document createDocument(String parent, Document document, String documentId)
Creates a 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 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);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The parent resource name, such as
|
document | Document Required. The Document to create. |
documentId | String Required. The ID to use for the Document, which will become the final component of the Document.name. If the caller does not have permission to create the
Document, regardless of whether or not it
exists, a This field must be unique among all
Documents with the same
parent. Otherwise, an
This field must conform to RFC-1034 standard with
a length limit of 63 characters. Otherwise, an |
Returns | |
---|---|
Type | Description |
Document |
createDocumentCallable()
public final UnaryCallable<CreateDocumentRequest,Document> createDocumentCallable()
Creates a 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateDocumentRequest,Document> |
deleteDocument(DeleteDocumentRequest request)
public final void deleteDocument(DeleteDocumentRequest request)
Deletes a 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()) {
DeleteDocumentRequest request =
DeleteDocumentRequest.newBuilder()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
documentServiceClient.deleteDocument(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteDocumentRequest The request object containing all of the parameters for the API call. |
deleteDocument(DocumentName name)
public final void deleteDocument(DocumentName name)
Deletes a 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()) {
DocumentName name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
documentServiceClient.deleteDocument(name);
}
Parameter | |
---|---|
Name | Description |
name | DocumentName Required. Full resource name of
Document, such as
If the caller does not have permission to delete the
Document, regardless of whether or not it
exists, a If the Document to delete does not
exist, a |
deleteDocument(String name)
public final void deleteDocument(String name)
Deletes a 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 name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString();
documentServiceClient.deleteDocument(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Full resource name of
Document, such as
If the caller does not have permission to delete the
Document, regardless of whether or not it
exists, a If the Document to delete does not
exist, a |
deleteDocumentCallable()
public final UnaryCallable<DeleteDocumentRequest,Empty> deleteDocumentCallable()
Deletes a 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteDocumentRequest,Empty> |
getDocument(DocumentName name)
public final Document getDocument(DocumentName name)
Gets a 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()) {
DocumentName name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
Document response = documentServiceClient.getDocument(name);
}
Parameter | |
---|---|
Name | Description |
name | DocumentName Required. Full resource name of
Document, such as
If the caller does not have permission to access the
Document, regardless of whether or not it
exists, a If the requested Document does not
exist, a |
Returns | |
---|---|
Type | Description |
Document |
getDocument(GetDocumentRequest request)
public final Document getDocument(GetDocumentRequest request)
Gets a 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()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
Document response = documentServiceClient.getDocument(request);
}
Parameter | |
---|---|
Name | Description |
request | GetDocumentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Document |
getDocument(String name)
public final Document getDocument(String name)
Gets a 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 name =
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString();
Document response = documentServiceClient.getDocument(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Full resource name of
Document, such as
If the caller does not have permission to access the
Document, regardless of whether or not it
exists, a If the requested Document does not
exist, a |
Returns | |
---|---|
Type | Description |
Document |
getDocumentCallable()
public final UnaryCallable<GetDocumentRequest,Document> getDocumentCallable()
Gets a 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()
.setName(
DocumentName.ofProjectLocationDataStoreBranchDocumentName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]")
.toString())
.build();
ApiFuture<Document> future = documentServiceClient.getDocumentCallable().futureCall(request);
// Do something.
Document response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetDocumentRequest,Document> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final DocumentServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
DocumentServiceSettings |
getStub()
public DocumentServiceStub getStub()
Returns | |
---|---|
Type | Description |
DocumentServiceStub |
importDocumentsAsync(ImportDocumentsRequest request)
public final OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsAsync(ImportDocumentsRequest request)
Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.
Note: It is possible for a subset of the Documents 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())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
ImportDocumentsResponse response = documentServiceClient.importDocumentsAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | ImportDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ImportDocumentsResponse,ImportDocumentsMetadata> |
importDocumentsCallable()
public final UnaryCallable<ImportDocumentsRequest,Operation> importDocumentsCallable()
Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.
Note: It is possible for a subset of the Documents 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())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
ApiFuture<Operation> future =
documentServiceClient.importDocumentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ImportDocumentsRequest,Operation> |
importDocumentsOperationCallable()
public final OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> importDocumentsOperationCallable()
Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.
Note: It is possible for a subset of the Documents 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())
.setAutoGenerateIds(true)
.setIdField("idField1629396127")
.build();
OperationFuture<ImportDocumentsResponse, ImportDocumentsMetadata> future =
documentServiceClient.importDocumentsOperationCallable().futureCall(request);
// Do something.
ImportDocumentsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<ImportDocumentsRequest,ImportDocumentsResponse,ImportDocumentsMetadata> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listDocuments(BranchName parent)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(BranchName parent)
Gets a list 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()) {
BranchName parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
for (Document element : documentServiceClient.listDocuments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | BranchName Required. The parent branch resource name, such as
If the caller does not have permission to list
Documents under this branch, regardless of
whether or not this branch exists, a |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(ListDocumentsRequest request)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(ListDocumentsRequest request)
Gets a list 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()) {
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocuments(String parent)
public final DocumentServiceClient.ListDocumentsPagedResponse listDocuments(String parent)
Gets a list 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 parent =
BranchName.ofProjectLocationDataStoreBranchName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]")
.toString();
for (Document element : documentServiceClient.listDocuments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent branch resource name, such as
If the caller does not have permission to list
Documents under this branch, regardless of
whether or not this branch exists, a |
Returns | |
---|---|
Type | Description |
DocumentServiceClient.ListDocumentsPagedResponse |
listDocumentsCallable()
public final UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> listDocumentsCallable()
Gets a list 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()) {
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> |
listDocumentsPagedCallable()
public final UnaryCallable<ListDocumentsRequest,DocumentServiceClient.ListDocumentsPagedResponse> listDocumentsPagedCallable()
Gets a list 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()) {
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListDocumentsRequest,ListDocumentsPagedResponse> |
purgeDocumentsAsync(PurgeDocumentsRequest request)
public final OperationFuture<PurgeDocumentsResponse,PurgeDocumentsMetadata> purgeDocumentsAsync(PurgeDocumentsRequest request)
Permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set 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();
}
Parameter | |
---|---|
Name | Description |
request | PurgeDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<PurgeDocumentsResponse,PurgeDocumentsMetadata> |
purgeDocumentsCallable()
public final UnaryCallable<PurgeDocumentsRequest,Operation> purgeDocumentsCallable()
Permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set 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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<PurgeDocumentsRequest,Operation> |
purgeDocumentsOperationCallable()
public final OperationCallable<PurgeDocumentsRequest,PurgeDocumentsResponse,PurgeDocumentsMetadata> purgeDocumentsOperationCallable()
Permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set 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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<PurgeDocumentsRequest,PurgeDocumentsResponse,PurgeDocumentsMetadata> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateDocument(Document document, FieldMask updateMask)
public final Document updateDocument(Document document, FieldMask updateMask)
Updates a 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()) {
Document document = Document.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Document response = documentServiceClient.updateDocument(document, updateMask);
}
Parameters | |
---|---|
Name | Description |
document | Document Required. The document to update/create. If the caller does not have permission to update the
Document, regardless of whether or not it
exists, a If the Document to update does not
exist and
allow_missing
is not set, a |
updateMask | FieldMask Indicates which fields in the provided imported 'document' to update. If not set, will by default update all fields. |
Returns | |
---|---|
Type | Description |
Document |
updateDocument(UpdateDocumentRequest request)
public final Document updateDocument(UpdateDocumentRequest request)
Updates a 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()) {
UpdateDocumentRequest request =
UpdateDocumentRequest.newBuilder()
.setDocument(Document.newBuilder().build())
.setAllowMissing(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Document response = documentServiceClient.updateDocument(request);
}
Parameter | |
---|---|
Name | Description |
request | UpdateDocumentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Document |
updateDocumentCallable()
public final UnaryCallable<UpdateDocumentRequest,Document> updateDocumentCallable()
Updates a 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateDocumentRequest,Document> |