Google Cloud Dialogflow v2 API - Class DocumentsClient (4.2.0)

Stay organized with collections Save and categorize content based on your preferences.
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
IReadOnlyList<String>
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
Documents.DocumentsClient

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(CancellationToken))

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
Task<DocumentsClient>

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
Operation<Document, KnowledgeOperationMetadata>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Document, KnowledgeOperationMetadata>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

documentDocument

Required. The document to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Operation<Empty, KnowledgeOperationMetadata>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Empty, KnowledgeOperationMetadata>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Empty, KnowledgeOperationMetadata>

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
Task<Operation<Empty, KnowledgeOperationMetadata>>

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
Task<Operation<Empty, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Empty, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Empty, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Empty, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Empty, KnowledgeOperationMetadata>>

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
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Document>

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
Task<Document>

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
Task<Document>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;Document ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Document>

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
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>

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
Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>>

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
Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>>

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, Nullable<Int32>, 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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<ListDocumentsResponse, Document>

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
PagedEnumerable<ListDocumentsResponse, Document>

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, Nullable<Int32>, 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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<ListDocumentsResponse, Document>

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, Nullable<Int32>, 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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<ListDocumentsResponse, Document>

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
PagedAsyncEnumerable<ListDocumentsResponse, Document>

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, Nullable<Int32>, 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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<ListDocumentsResponse, Document>

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
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Operation<Empty, KnowledgeOperationMetadata>

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
Task<Operation<Empty, KnowledgeOperationMetadata>>

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
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>

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
Task<Operation<ImportDocumentsResponse, KnowledgeOperationMetadata>>

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
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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
Operation<Document, KnowledgeOperationMetadata>

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
Task<Operation<Document, KnowledgeOperationMetadata>>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;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://&lt;bucket-name>/&lt;object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Document, KnowledgeOperationMetadata>

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
Operation<Document, KnowledgeOperationMetadata>

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/&lt;Project ID>/locations/&lt;Location ID>/knowledgeBases/&lt;Knowledge Base ID>/documents/&lt;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://&lt;bucket-name>/&lt;object-name>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Document, KnowledgeOperationMetadata>

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
name