Google Cloud Dialogflow v2 API - Class DocumentsClient (4.12.0)

public abstract class DocumentsClient

Reference documentation and code samples for the Google Cloud Dialogflow v2 API class DocumentsClient.

Documents client wrapper, for convenient use.

Inheritance

object > DocumentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.V2

Assembly

Google.Cloud.Dialogflow.V2.dll

Remarks

Service for managing knowledge [Documents][google.cloud.dialogflow.v2.Document].

Properties

CreateDocumentOperationsClient

public virtual OperationsClient CreateDocumentOperationsClient { get; }

The long-running operations client for CreateDocument.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Documents service, which is a host of "dialogflow.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Documents scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

DeleteDocumentOperationsClient

public virtual OperationsClient DeleteDocumentOperationsClient { get; }

The long-running operations client for DeleteDocument.

Property Value
TypeDescription
OperationsClient

ExportDocumentOperationsClient

public virtual OperationsClient ExportDocumentOperationsClient { get; }

The long-running operations client for ExportDocument.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual Documents.DocumentsClient GrpcClient { get; }

The underlying gRPC Documents client

Property Value
TypeDescription
DocumentsDocumentsClient

ImportDocumentsOperationsClient

public virtual OperationsClient ImportDocumentsOperationsClient { get; }

The long-running operations client for ImportDocuments.

Property Value
TypeDescription
OperationsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

ReloadDocumentOperationsClient

public virtual OperationsClient ReloadDocumentOperationsClient { get; }

The long-running operations client for ReloadDocument.

Property Value
TypeDescription
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

UpdateDocumentOperationsClient

public virtual OperationsClient UpdateDocumentOperationsClient { get; }

The long-running operations client for UpdateDocument.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static DocumentsClient Create()

Synchronously creates a DocumentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentsClientBuilder.

Returns
TypeDescription
DocumentsClient

The created DocumentsClient.

CreateAsync(CancellationToken)

public static Task<DocumentsClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a DocumentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DocumentsClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskDocumentsClient

The task representing the created DocumentsClient.

CreateDocument(CreateDocumentRequest, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> CreateDocument(CreateDocumentRequest request, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestCreateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    Document = new Document(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.CreateDocument(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceCreateDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocument(KnowledgeBaseName, Document, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> CreateDocument(KnowledgeBaseName parent, Document document, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentKnowledgeBaseName

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
KnowledgeBaseName parent = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.CreateDocument(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceCreateDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocument(string, Document, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> CreateDocument(string parent, Document document, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentstring

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.CreateDocument(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceCreateDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(CreateDocumentRequest, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(CreateDocumentRequest request, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestCreateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    Document = new Document(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(CreateDocumentRequest, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(CreateDocumentRequest request, CancellationToken cancellationToken)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestCreateDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    Document = new Document(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(KnowledgeBaseName, Document, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(KnowledgeBaseName parent, Document document, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentKnowledgeBaseName

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
KnowledgeBaseName parent = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(KnowledgeBaseName, Document, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(KnowledgeBaseName parent, Document document, CancellationToken cancellationToken)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentKnowledgeBaseName

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
KnowledgeBaseName parent = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(string, Document, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(string parent, Document document, CallSettings callSettings = null)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentstring

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

CreateDocumentAsync(string, Document, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> CreateDocumentAsync(string parent, Document document, CancellationToken cancellationToken)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
parentstring

Required. The knowledge base to create a document for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

documentDocument

Required. The document to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
Document document = new Document();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.CreateDocumentAsync(parent, document);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceCreateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

DeleteDocument(DeleteDocumentRequest, CallSettings)

public virtual Operation<Empty, KnowledgeOperationMetadata> DeleteDocument(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
requestDeleteDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = documentsClient.DeleteDocument(request);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceDeleteDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocument(DocumentName, CallSettings)

public virtual Operation<Empty, KnowledgeOperationMetadata> DeleteDocument(DocumentName name, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
nameDocumentName

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = documentsClient.DeleteDocument(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceDeleteDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocument(string, CallSettings)

public virtual Operation<Empty, KnowledgeOperationMetadata> DeleteDocument(string name, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
namestring

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = documentsClient.DeleteDocument(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceDeleteDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(DeleteDocumentRequest, CallSettings)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
requestDeleteDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(DeleteDocumentRequest, CancellationToken)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(DeleteDocumentRequest request, CancellationToken cancellationToken)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
requestDeleteDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(DocumentName, CallSettings)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(DocumentName name, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
nameDocumentName

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(DocumentName, CancellationToken)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(DocumentName name, CancellationToken cancellationToken)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
nameDocumentName

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(string, CallSettings)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(string name, CallSettings callSettings = null)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
namestring

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

DeleteDocumentAsync(string, CancellationToken)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> DeleteDocumentAsync(string name, CancellationToken cancellationToken)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: An Empty message
Parameters
NameDescription
namestring

Required. The name of the document to delete. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Operation<Empty, KnowledgeOperationMetadata> response = await documentsClient.DeleteDocumentAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceDeleteDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Empty retrievedResult = retrievedResponse.Result;
}

ExportDocument(ExportDocumentRequest, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> ExportDocument(ExportDocumentRequest request, CallSettings callSettings = null)

Exports a smart messaging candidate document into the specified destination.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestExportDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
ExportDocumentRequest request = new ExportDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    GcsDestination = new GcsDestination(),
    ExportFullContent = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.ExportDocument(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceExportDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ExportDocumentAsync(ExportDocumentRequest, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ExportDocumentAsync(ExportDocumentRequest request, CallSettings callSettings = null)

Exports a smart messaging candidate document into the specified destination.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestExportDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ExportDocumentRequest request = new ExportDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    GcsDestination = new GcsDestination(),
    ExportFullContent = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ExportDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceExportDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ExportDocumentAsync(ExportDocumentRequest, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ExportDocumentAsync(ExportDocumentRequest request, CancellationToken cancellationToken)

Exports a smart messaging candidate document into the specified destination.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestExportDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ExportDocumentRequest request = new ExportDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    GcsDestination = new GcsDestination(),
    ExportFullContent = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ExportDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceExportDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

GetDocument(DocumentName, CallSettings)

public virtual Document GetDocument(DocumentName name, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Document response = documentsClient.GetDocument(name);

GetDocument(GetDocumentRequest, CallSettings)

public virtual Document GetDocument(GetDocumentRequest request, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
requestGetDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Document response = documentsClient.GetDocument(request);

GetDocument(string, CallSettings)

public virtual Document GetDocument(string name, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
namestring

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Document response = documentsClient.GetDocument(name);

GetDocumentAsync(DocumentName, CallSettings)

public virtual Task<Document> GetDocumentAsync(DocumentName name, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Document response = await documentsClient.GetDocumentAsync(name);

GetDocumentAsync(DocumentName, CancellationToken)

public virtual Task<Document> GetDocumentAsync(DocumentName name, CancellationToken cancellationToken)

Retrieves the specified document.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
// Make the request
Document response = await documentsClient.GetDocumentAsync(name);

GetDocumentAsync(GetDocumentRequest, CallSettings)

public virtual Task<Document> GetDocumentAsync(GetDocumentRequest request, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
requestGetDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Document response = await documentsClient.GetDocumentAsync(request);

GetDocumentAsync(GetDocumentRequest, CancellationToken)

public virtual Task<Document> GetDocumentAsync(GetDocumentRequest request, CancellationToken cancellationToken)

Retrieves the specified document.

Parameters
NameDescription
requestGetDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
};
// Make the request
Document response = await documentsClient.GetDocumentAsync(request);

GetDocumentAsync(string, CallSettings)

public virtual Task<Document> GetDocumentAsync(string name, CallSettings callSettings = null)

Retrieves the specified document.

Parameters
NameDescription
namestring

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Document response = await documentsClient.GetDocumentAsync(name);

GetDocumentAsync(string, CancellationToken)

public virtual Task<Document> GetDocumentAsync(string name, CancellationToken cancellationToken)

Retrieves the specified document.

Parameters
NameDescription
namestring

Required. The name of the document to retrieve. Format projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
// Make the request
Document response = await documentsClient.GetDocumentAsync(name);

ImportDocuments(ImportDocumentsRequest, CallSettings)

public virtual Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> ImportDocuments(ImportDocumentsRequest request, CallSettings callSettings = null)

Creates documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
Parameters
NameDescription
requestImportDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationImportDocumentsResponseKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    GcsSource = new GcsSources(),
    DocumentTemplate = new ImportDocumentTemplate(),
    ImportGcsCustomMetadata = false,
};
// Make the request
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> response = documentsClient.ImportDocuments(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ImportDocumentsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceImportDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportDocumentsResponse retrievedResult = retrievedResponse.Result;
}

ImportDocumentsAsync(ImportDocumentsRequest, CallSettings)

public virtual Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>> ImportDocumentsAsync(ImportDocumentsRequest request, CallSettings callSettings = null)

Creates documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
Parameters
NameDescription
requestImportDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationImportDocumentsResponseKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    GcsSource = new GcsSources(),
    DocumentTemplate = new ImportDocumentTemplate(),
    ImportGcsCustomMetadata = false,
};
// Make the request
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> response = await documentsClient.ImportDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportDocumentsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceImportDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportDocumentsResponse retrievedResult = retrievedResponse.Result;
}

ImportDocumentsAsync(ImportDocumentsRequest, CancellationToken)

public virtual Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>> ImportDocumentsAsync(ImportDocumentsRequest request, CancellationToken cancellationToken)

Creates documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
Parameters
NameDescription
requestImportDocumentsRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationImportDocumentsResponseKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    GcsSource = new GcsSources(),
    DocumentTemplate = new ImportDocumentTemplate(),
    ImportGcsCustomMetadata = false,
};
// Make the request
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> response = await documentsClient.ImportDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ImportDocumentsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceImportDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ImportDocumentsResponse retrievedResult = retrievedResponse.Result;
}

ListDocuments(KnowledgeBaseName, string, int?, CallSettings)

public virtual PagedEnumerable<ListDocumentsResponse, Document> ListDocuments(KnowledgeBaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
parentKnowledgeBaseName

Required. The knowledge base to list all documents for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
KnowledgeBaseName parent = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocuments(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Document item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListDocumentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListDocuments(ListDocumentsRequest, CallSettings)

public virtual PagedEnumerable<ListDocumentsResponse, Document> ListDocuments(ListDocumentsRequest request, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
requestListDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
ListDocumentsRequest request = new ListDocumentsRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocuments(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Document item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListDocumentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListDocuments(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListDocumentsResponse, Document> ListDocuments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
parentstring

Required. The knowledge base to list all documents for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocuments(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Document item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListDocumentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListDocumentsAsync(KnowledgeBaseName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListDocumentsResponse, Document> ListDocumentsAsync(KnowledgeBaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
parentKnowledgeBaseName

Required. The knowledge base to list all documents for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
KnowledgeBaseName parent = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocumentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Document item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListDocumentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListDocumentsAsync(ListDocumentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListDocumentsResponse, Document> ListDocumentsAsync(ListDocumentsRequest request, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
requestListDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ListDocumentsRequest request = new ListDocumentsRequest
{
    ParentAsKnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocumentsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Document item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListDocumentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListDocumentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListDocumentsResponse, Document> ListDocumentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
parentstring

Required. The knowledge base to list all documents for. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentsClient.ListDocumentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Document item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListDocumentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Document item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Document> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Document item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

PollOnceCreateDocument(string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> PollOnceCreateDocument(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The result of polling the operation.

PollOnceCreateDocumentAsync(string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> PollOnceCreateDocumentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A task representing the result of polling the operation.

PollOnceDeleteDocument(string, CallSettings)

public virtual Operation<Empty, KnowledgeOperationMetadata> PollOnceDeleteDocument(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of DeleteDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyKnowledgeOperationMetadata

The result of polling the operation.

PollOnceDeleteDocumentAsync(string, CallSettings)

public virtual Task<Operation<Empty, KnowledgeOperationMetadata>> PollOnceDeleteDocumentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of DeleteDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyKnowledgeOperationMetadata

A task representing the result of polling the operation.

PollOnceExportDocument(string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> PollOnceExportDocument(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The result of polling the operation.

PollOnceExportDocumentAsync(string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> PollOnceExportDocumentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A task representing the result of polling the operation.

PollOnceImportDocuments(string, CallSettings)

public virtual Operation<ImportDocumentsResponse, KnowledgeOperationMetadata> PollOnceImportDocuments(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ImportDocuments.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationImportDocumentsResponseKnowledgeOperationMetadata

The result of polling the operation.

PollOnceImportDocumentsAsync(string, CallSettings)

public virtual Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>> PollOnceImportDocumentsAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ImportDocuments.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationImportDocumentsResponseKnowledgeOperationMetadata

A task representing the result of polling the operation.

PollOnceReloadDocument(string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> PollOnceReloadDocument(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ReloadDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The result of polling the operation.

PollOnceReloadDocumentAsync(string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> PollOnceReloadDocumentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ReloadDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A task representing the result of polling the operation.

PollOnceUpdateDocument(string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> PollOnceUpdateDocument(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of UpdateDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The result of polling the operation.

PollOnceUpdateDocumentAsync(string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> PollOnceUpdateDocumentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of UpdateDocument.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A task representing the result of polling the operation.

ReloadDocument(DocumentName, string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> ReloadDocument(DocumentName name, string contentUri, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.ReloadDocument(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceReloadDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocument(ReloadDocumentRequest, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> ReloadDocument(ReloadDocumentRequest request, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
requestReloadDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
ReloadDocumentRequest request = new ReloadDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    ContentUri = "",
    ImportGcsCustomMetadata = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.ReloadDocument(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceReloadDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocument(string, string, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> ReloadDocument(string name, string contentUri, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
namestring

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.ReloadDocument(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceReloadDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(DocumentName, string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(DocumentName name, string contentUri, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(DocumentName, string, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(DocumentName name, string contentUri, CancellationToken cancellationToken)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
nameDocumentName

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]");
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(ReloadDocumentRequest, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(ReloadDocumentRequest request, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
requestReloadDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ReloadDocumentRequest request = new ReloadDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    ContentUri = "",
    ImportGcsCustomMetadata = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(ReloadDocumentRequest, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(ReloadDocumentRequest request, CancellationToken cancellationToken)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
requestReloadDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
ReloadDocumentRequest request = new ReloadDocumentRequest
{
    DocumentName = DocumentName.FromProjectKnowledgeBaseDocument("[PROJECT]", "[KNOWLEDGE_BASE]", "[DOCUMENT]"),
    ContentUri = "",
    ImportGcsCustomMetadata = false,
    SmartMessagingPartialUpdate = false,
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(string, string, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(string name, string contentUri, CallSettings callSettings = null)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
namestring

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ReloadDocumentAsync(string, string, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> ReloadDocumentAsync(string name, string contentUri, CancellationToken cancellationToken)

Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
namestring

Required. The name of the document to reload. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

contentUristring

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.

For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]/documents/[DOCUMENT]";
string contentUri = "";
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.ReloadDocumentAsync(name, contentUri);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceReloadDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateDocument(Document, FieldMask, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> UpdateDocument(Document document, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
documentDocument

Required. The document to update.

updateMaskFieldMask

Optional. Not specified means update all. Currently, only display_name can be updated, an InvalidArgument will be returned for attempting to update other fields.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.UpdateDocument(document, updateMask);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceUpdateDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

UpdateDocument(UpdateDocumentRequest, CallSettings)

public virtual Operation<Document, KnowledgeOperationMetadata> UpdateDocument(UpdateDocumentRequest request, CallSettings callSettings = null)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestUpdateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationDocumentKnowledgeOperationMetadata

The RPC response.

Example
// Create client
DocumentsClient documentsClient = DocumentsClient.Create();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = documentsClient.UpdateDocument(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = documentsClient.PollOnceUpdateDocument(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

UpdateDocumentAsync(Document, FieldMask, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> UpdateDocumentAsync(Document document, FieldMask updateMask, CallSettings callSettings = null)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
documentDocument

Required. The document to update.

updateMaskFieldMask

Optional. Not specified means update all. Currently, only display_name can be updated, an InvalidArgument will be returned for attempting to update other fields.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.UpdateDocumentAsync(document, updateMask);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceUpdateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

UpdateDocumentAsync(Document, FieldMask, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> UpdateDocumentAsync(Document document, FieldMask updateMask, CancellationToken cancellationToken)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
documentDocument

Required. The document to update.

updateMaskFieldMask

Optional. Not specified means update all. Currently, only display_name can be updated, an InvalidArgument will be returned for attempting to update other fields.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.UpdateDocumentAsync(document, updateMask);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceUpdateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

UpdateDocumentAsync(UpdateDocumentRequest, CallSettings)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> UpdateDocumentAsync(UpdateDocumentRequest request, CallSettings callSettings = null)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestUpdateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.UpdateDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceUpdateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}

UpdateDocumentAsync(UpdateDocumentRequest, CancellationToken)

public virtual Task<Operation<Document, KnowledgeOperationMetadata>> UpdateDocumentAsync(UpdateDocumentRequest request, CancellationToken cancellationToken)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

  • metadata: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
  • response: [Document][google.cloud.dialogflow.v2.Document]
Parameters
NameDescription
requestUpdateDocumentRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationDocumentKnowledgeOperationMetadata

A Task containing the RPC response.

Example
// Create client
DocumentsClient documentsClient = await DocumentsClient.CreateAsync();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Document, KnowledgeOperationMetadata> response = await documentsClient.UpdateDocumentAsync(request);

// Poll until the returned long-running operation is complete
Operation<Document, KnowledgeOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Document result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Document, KnowledgeOperationMetadata> retrievedResponse = await documentsClient.PollOnceUpdateDocumentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Document retrievedResult = retrievedResponse.Result;
}