@Generated(value="by gapic-generator") @BetaApi public class DocumentsClient 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:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
Document response = documentsClient.getDocument(name);
}
Note: close() needs to be called on the documentsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 DocumentsSettings to create(). For example:
To customize credentials:
DocumentsSettings documentsSettings =
DocumentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DocumentsClient documentsClient =
DocumentsClient.create(documentsSettings);
To customize the endpoint:
DocumentsSettings documentsSettings =
DocumentsSettings.newBuilder().setEndpoint(myEndpoint).build();
DocumentsClient documentsClient =
DocumentsClient.create(documentsSettings);
Modifier and Type | Class and Description |
---|---|
static class |
DocumentsClient.ListDocumentsFixedSizeCollection |
static class |
DocumentsClient.ListDocumentsPage |
static class |
DocumentsClient.ListDocumentsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
DocumentsClient(DocumentsSettings settings)
Constructs an instance of DocumentsClient, using the given settings.
|
protected |
DocumentsClient(DocumentsStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static DocumentsClient |
create()
Constructs an instance of DocumentsClient with default settings.
|
static DocumentsClient |
create(DocumentsSettings settings)
Constructs an instance of DocumentsClient, using the given settings.
|
static DocumentsClient |
create(DocumentsStub stub)
Constructs an instance of DocumentsClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> |
createDocumentAsync(CreateDocumentRequest request)
Creates a new document.
|
com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> |
createDocumentAsync(KnowledgeBaseName parent,
Document document)
Creates a new document.
|
com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> |
createDocumentAsync(String parent,
Document document)
Creates a new document.
|
com.google.api.gax.rpc.UnaryCallable<CreateDocumentRequest,com.google.longrunning.Operation> |
createDocumentCallable()
Creates a new document.
|
com.google.api.gax.rpc.OperationCallable<CreateDocumentRequest,Document,KnowledgeOperationMetadata> |
createDocumentOperationCallable()
Creates a new document.
|
com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> |
deleteDocumentAsync(DeleteDocumentRequest request)
Deletes the specified document.
|
com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> |
deleteDocumentAsync(DocumentName name)
Deletes the specified document.
|
com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> |
deleteDocumentAsync(String name)
Deletes the specified document.
|
com.google.api.gax.rpc.UnaryCallable<DeleteDocumentRequest,com.google.longrunning.Operation> |
deleteDocumentCallable()
Deletes the specified document.
|
com.google.api.gax.rpc.OperationCallable<DeleteDocumentRequest,Empty,KnowledgeOperationMetadata> |
deleteDocumentOperationCallable()
Deletes the specified document.
|
Document |
getDocument(DocumentName name)
Retrieves the specified document.
|
Document |
getDocument(GetDocumentRequest request)
Retrieves the specified document.
|
Document |
getDocument(String name)
Retrieves the specified document.
|
com.google.api.gax.rpc.UnaryCallable<GetDocumentRequest,Document> |
getDocumentCallable()
Retrieves the specified document.
|
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.
|
DocumentsSettings |
getSettings() |
DocumentsStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
DocumentsClient.ListDocumentsPagedResponse |
listDocuments(KnowledgeBaseName parent)
Returns the list of all documents of the knowledge base.
|
DocumentsClient.ListDocumentsPagedResponse |
listDocuments(ListDocumentsRequest request)
Returns the list of all documents of the knowledge base.
|
DocumentsClient.ListDocumentsPagedResponse |
listDocuments(String parent)
Returns the list of all documents of the knowledge base.
|
com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> |
listDocumentsCallable()
Returns the list of all documents of the knowledge base.
|
com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,DocumentsClient.ListDocumentsPagedResponse> |
listDocumentsPagedCallable()
Returns the list of all documents of the knowledge base.
|
com.google.longrunning.Operation |
reloadDocument(ReloadDocumentRequest request)
Reloads the specified document from its specified source, content_uri or content.
|
com.google.api.gax.rpc.UnaryCallable<ReloadDocumentRequest,com.google.longrunning.Operation> |
reloadDocumentCallable()
Reloads the specified document from its specified source, content_uri or content.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> |
updateDocumentAsync(Document document)
Updates the specified document.
|
com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> |
updateDocumentAsync(UpdateDocumentRequest request)
Updates the specified document.
|
com.google.api.gax.rpc.UnaryCallable<UpdateDocumentRequest,com.google.longrunning.Operation> |
updateDocumentCallable()
Updates the specified document.
|
com.google.api.gax.rpc.OperationCallable<UpdateDocumentRequest,Document,KnowledgeOperationMetadata> |
updateDocumentOperationCallable()
Updates the specified document.
|
protected DocumentsClient(DocumentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected DocumentsClient(DocumentsStub stub)
public static final DocumentsClient create() throws IOException
IOException
public static final DocumentsClient create(DocumentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final DocumentsClient create(DocumentsStub stub)
public final DocumentsSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public DocumentsStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.longrunning.OperationsClient getOperationsClient()
public final DocumentsClient.ListDocumentsPagedResponse listDocuments(KnowledgeBaseName parent)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
for (Document element : documentsClient.listDocuments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The knowledge base to list all documents for. Format:
`projects/<Project ID>/knowledgeBases/<Knowledge Base ID>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final DocumentsClient.ListDocumentsPagedResponse listDocuments(String parent)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
for (Document element : documentsClient.listDocuments(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The knowledge base to list all documents for. Format:
`projects/<Project ID>/knowledgeBases/<Knowledge Base ID>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final DocumentsClient.ListDocumentsPagedResponse listDocuments(ListDocumentsRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Document element : documentsClient.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,DocumentsClient.ListDocumentsPagedResponse> listDocumentsPagedCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListDocumentsPagedResponse> future = documentsClient.listDocumentsPagedCallable().futureCall(request);
// Do something
for (Document element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDocumentsRequest,ListDocumentsResponse> listDocumentsCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListDocumentsResponse response = documentsClient.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 getDocument(DocumentName name)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
Document response = documentsClient.getDocument(name);
}
name
- Required. The name of the document to retrieve. Format `projects/<Project
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Document getDocument(String name)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
Document response = documentsClient.getDocument(name.toString());
}
name
- Required. The name of the document to retrieve. Format `projects/<Project
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Document getDocument(GetDocumentRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
GetDocumentRequest request = GetDocumentRequest.newBuilder()
.setName(name.toString())
.build();
Document response = documentsClient.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()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
GetDocumentRequest request = GetDocumentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Document> future = documentsClient.getDocumentCallable().futureCall(request);
// Do something
Document response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> createDocumentAsync(KnowledgeBaseName parent, Document document)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = Document.newBuilder().build();
Document response = documentsClient.createDocumentAsync(parent, document).get();
}
parent
- Required. The knoweldge base to create a document for. Format:
`projects/<Project ID>/knowledgeBases/<Knowledge Base ID>`.document
- Required. The document to create.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> createDocumentAsync(String parent, Document document)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = Document.newBuilder().build();
Document response = documentsClient.createDocumentAsync(parent.toString(), document).get();
}
parent
- Required. The knoweldge base to create a document for. Format:
`projects/<Project ID>/knowledgeBases/<Knowledge Base ID>`.document
- Required. The document to create.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> createDocumentAsync(CreateDocumentRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = Document.newBuilder().build();
CreateDocumentRequest request = CreateDocumentRequest.newBuilder()
.setParent(parent.toString())
.setDocument(document)
.build();
Document response = documentsClient.createDocumentAsync(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 fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<CreateDocumentRequest,Document,KnowledgeOperationMetadata> createDocumentOperationCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = Document.newBuilder().build();
CreateDocumentRequest request = CreateDocumentRequest.newBuilder()
.setParent(parent.toString())
.setDocument(document)
.build();
OperationFuture<Document, KnowledgeOperationMetadata> future = documentsClient.createDocumentOperationCallable().futureCall(request);
// Do something
Document response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateDocumentRequest,com.google.longrunning.Operation> createDocumentCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
KnowledgeBaseName parent = KnowledgeBaseName.of("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = Document.newBuilder().build();
CreateDocumentRequest request = CreateDocumentRequest.newBuilder()
.setParent(parent.toString())
.setDocument(document)
.build();
ApiFuture<Operation> future = documentsClient.createDocumentCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> deleteDocumentAsync(DocumentName name)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
documentsClient.deleteDocumentAsync(name).get();
}
name
- The name of the document to delete. Format: `projects/<Project
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> deleteDocumentAsync(String name)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
documentsClient.deleteDocumentAsync(name.toString()).get();
}
name
- The name of the document to delete. Format: `projects/<Project
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Empty,KnowledgeOperationMetadata> deleteDocumentAsync(DeleteDocumentRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder()
.setName(name.toString())
.build();
documentsClient.deleteDocumentAsync(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 fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<DeleteDocumentRequest,Empty,KnowledgeOperationMetadata> deleteDocumentOperationCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder()
.setName(name.toString())
.build();
OperationFuture<Empty, KnowledgeOperationMetadata> future = documentsClient.deleteDocumentOperationCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteDocumentRequest,com.google.longrunning.Operation> deleteDocumentCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
DocumentName name = DocumentName.of("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Operation> future = documentsClient.deleteDocumentCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> updateDocumentAsync(Document document)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
Document document = Document.newBuilder().build();
Document response = documentsClient.updateDocumentAsync(document).get();
}
document
- Required. The document to update.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Document,KnowledgeOperationMetadata> updateDocumentAsync(UpdateDocumentRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
Document document = Document.newBuilder().build();
UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder()
.setDocument(document)
.build();
Document response = documentsClient.updateDocumentAsync(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 fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<UpdateDocumentRequest,Document,KnowledgeOperationMetadata> updateDocumentOperationCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
Document document = Document.newBuilder().build();
UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder()
.setDocument(document)
.build();
OperationFuture<Document, KnowledgeOperationMetadata> future = documentsClient.updateDocumentOperationCallable().futureCall(request);
// Do something
Document response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateDocumentRequest,com.google.longrunning.Operation> updateDocumentCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
Document document = Document.newBuilder().build();
UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder()
.setDocument(document)
.build();
ApiFuture<Operation> future = documentsClient.updateDocumentCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final com.google.longrunning.Operation reloadDocument(ReloadDocumentRequest request)
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
ReloadDocumentRequest request = ReloadDocumentRequest.newBuilder().build();
Operation response = documentsClient.reloadDocument(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<ReloadDocumentRequest,com.google.longrunning.Operation> reloadDocumentCallable()
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.
Operation <response: [Document][google.cloud.dialogflow.v2beta1.Document], metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata]>
Sample code:
try (DocumentsClient documentsClient = DocumentsClient.create()) {
ReloadDocumentRequest request = ReloadDocumentRequest.newBuilder().build();
ApiFuture<Operation> future = documentsClient.reloadDocumentCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.