Discovery Engine v1 API - Class DocumentServiceClient (1.1.0)

public abstract class DocumentServiceClient

Reference documentation and code samples for the Discovery Engine v1 API class DocumentServiceClient.

DocumentService client wrapper, for convenient use.

Inheritance

object > DocumentServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1

Assembly

Google.Cloud.DiscoveryEngine.V1.dll

Remarks

Service for ingesting [Document][google.cloud.discoveryengine.v1.Document] information of the customer's website.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default DocumentService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default DocumentService scopes are:

GrpcClient

public virtual DocumentService.DocumentServiceClient GrpcClient { get; }

The underlying gRPC DocumentService client

Property Value
Type Description
DocumentServiceDocumentServiceClient

ImportDocumentsOperationsClient

public virtual OperationsClient ImportDocumentsOperationsClient { get; }

The long-running operations client for ImportDocuments.

Property Value
Type Description
OperationsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

PurgeDocumentsOperationsClient

public virtual OperationsClient PurgeDocumentsOperationsClient { get; }

The long-running operations client for PurgeDocuments.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static DocumentServiceClient Create()

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

Returns
Type Description
DocumentServiceClient

The created DocumentServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskDocumentServiceClient

The task representing the created DocumentServiceClient.

CreateDocument(BranchName, Document, string, CallSettings)

public virtual Document CreateDocument(BranchName parent, Document document, string documentId, CallSettings callSettings = null)

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent BranchName

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
BranchName parent = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
Document document = new Document();
string documentId = "";
// Make the request
Document response = documentServiceClient.CreateDocument(parent, document, documentId);

CreateDocument(CreateDocumentRequest, CallSettings)

public virtual Document CreateDocument(CreateDocumentRequest request, CallSettings callSettings = null)

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request CreateDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Document = new Document(),
    DocumentId = "",
};
// Make the request
Document response = documentServiceClient.CreateDocument(request);

CreateDocument(string, Document, string, CallSettings)

public virtual Document CreateDocument(string parent, Document document, string documentId, CallSettings callSettings = null)

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent string

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]";
Document document = new Document();
string documentId = "";
// Make the request
Document response = documentServiceClient.CreateDocument(parent, document, documentId);

CreateDocumentAsync(BranchName, Document, string, CallSettings)

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

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent BranchName

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
BranchName parent = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
Document document = new Document();
string documentId = "";
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(parent, document, documentId);

CreateDocumentAsync(BranchName, Document, string, CancellationToken)

public virtual Task<Document> CreateDocumentAsync(BranchName parent, Document document, string documentId, CancellationToken cancellationToken)

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent BranchName

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
BranchName parent = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
Document document = new Document();
string documentId = "";
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(parent, document, documentId);

CreateDocumentAsync(CreateDocumentRequest, CallSettings)

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

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request CreateDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Document = new Document(),
    DocumentId = "",
};
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(request);

CreateDocumentAsync(CreateDocumentRequest, CancellationToken)

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

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request CreateDocumentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
CreateDocumentRequest request = new CreateDocumentRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Document = new Document(),
    DocumentId = "",
};
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(request);

CreateDocumentAsync(string, Document, string, CallSettings)

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

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent string

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]";
Document document = new Document();
string documentId = "";
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(parent, document, documentId);

CreateDocumentAsync(string, Document, string, CancellationToken)

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

Creates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
parent string

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

document Document

Required. The [Document][google.cloud.discoveryengine.v1.Document] to create.

documentId string

Required. The ID to use for the [Document][google.cloud.discoveryengine.v1.Document], which becomes the final component of the [Document.name][google.cloud.discoveryengine.v1.Document.name].

If the caller does not have permission to create the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

This field must be unique among all [Document][google.cloud.discoveryengine.v1.Document]s with the same [parent][google.cloud.discoveryengine.v1.CreateDocumentRequest.parent]. Otherwise, an ALREADY_EXISTS error is returned.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]";
Document document = new Document();
string documentId = "";
// Make the request
Document response = await documentServiceClient.CreateDocumentAsync(parent, document, documentId);

DeleteDocument(DeleteDocumentRequest, CallSettings)

public virtual void DeleteDocument(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request DeleteDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
documentServiceClient.DeleteDocument(request);

DeleteDocument(DocumentName, CallSettings)

public virtual void DeleteDocument(DocumentName name, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
documentServiceClient.DeleteDocument(name);

DeleteDocument(string, CallSettings)

public virtual void DeleteDocument(string name, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
documentServiceClient.DeleteDocument(name);

DeleteDocumentAsync(DeleteDocumentRequest, CallSettings)

public virtual Task DeleteDocumentAsync(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request DeleteDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
await documentServiceClient.DeleteDocumentAsync(request);

DeleteDocumentAsync(DeleteDocumentRequest, CancellationToken)

public virtual Task DeleteDocumentAsync(DeleteDocumentRequest request, CancellationToken cancellationToken)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request DeleteDocumentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteDocumentRequest request = new DeleteDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
await documentServiceClient.DeleteDocumentAsync(request);

DeleteDocumentAsync(DocumentName, CallSettings)

public virtual Task DeleteDocumentAsync(DocumentName name, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
await documentServiceClient.DeleteDocumentAsync(name);

DeleteDocumentAsync(DocumentName, CancellationToken)

public virtual Task DeleteDocumentAsync(DocumentName name, CancellationToken cancellationToken)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
await documentServiceClient.DeleteDocumentAsync(name);

DeleteDocumentAsync(string, CallSettings)

public virtual Task DeleteDocumentAsync(string name, CallSettings callSettings = null)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
await documentServiceClient.DeleteDocumentAsync(name);

DeleteDocumentAsync(string, CancellationToken)

public virtual Task DeleteDocumentAsync(string name, CancellationToken cancellationToken)

Deletes a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to delete the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to delete does not exist, a NOT_FOUND error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
await documentServiceClient.DeleteDocumentAsync(name);

GetDocument(DocumentName, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
Document response = documentServiceClient.GetDocument(name);

GetDocument(GetDocumentRequest, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request GetDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
Document response = documentServiceClient.GetDocument(request);

GetDocument(string, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
Document response = documentServiceClient.GetDocument(name);

GetDocumentAsync(DocumentName, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(name);

GetDocumentAsync(DocumentName, CancellationToken)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name DocumentName

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
DocumentName name = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(name);

GetDocumentAsync(GetDocumentRequest, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request GetDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(request);

GetDocumentAsync(GetDocumentRequest, CancellationToken)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request GetDocumentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
GetDocumentRequest request = new GetDocumentRequest
{
    DocumentName = DocumentName.FromProjectLocationDataStoreBranchDocument("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]"),
};
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(request);

GetDocumentAsync(string, CallSettings)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(name);

GetDocumentAsync(string, CancellationToken)

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

Gets a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
name string

Required. Full resource name of [Document][google.cloud.discoveryengine.v1.Document], such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

If the caller does not have permission to access the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the requested [Document][google.cloud.discoveryengine.v1.Document] does not exist, a NOT_FOUND error is returned.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]/documents/[DOCUMENT]";
// Make the request
Document response = await documentServiceClient.GetDocumentAsync(name);

ImportDocuments(ImportDocumentsRequest, CallSettings)

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

Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s. Request processing may be synchronous. Non-existing items are created.

Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.

Parameters
Name Description
request ImportDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationImportDocumentsResponseImportDocumentsMetadata

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    InlineSource = new ImportDocumentsRequest.Types.InlineSource(),
    ErrorConfig = new ImportErrorConfig(),
    ReconciliationMode = ImportDocumentsRequest.Types.ReconciliationMode.Unspecified,
    UpdateMask = new FieldMask(),
    AutoGenerateIds = false,
    IdField = "",
};
// Make the request
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> response = documentServiceClient.ImportDocuments(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> 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, ImportDocumentsMetadata> retrievedResponse = documentServiceClient.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, ImportDocumentsMetadata>> ImportDocumentsAsync(ImportDocumentsRequest request, CallSettings callSettings = null)

Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s. Request processing may be synchronous. Non-existing items are created.

Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.

Parameters
Name Description
request ImportDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationImportDocumentsResponseImportDocumentsMetadata

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    InlineSource = new ImportDocumentsRequest.Types.InlineSource(),
    ErrorConfig = new ImportErrorConfig(),
    ReconciliationMode = ImportDocumentsRequest.Types.ReconciliationMode.Unspecified,
    UpdateMask = new FieldMask(),
    AutoGenerateIds = false,
    IdField = "",
};
// Make the request
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> response = await documentServiceClient.ImportDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> 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, ImportDocumentsMetadata> retrievedResponse = await documentServiceClient.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, ImportDocumentsMetadata>> ImportDocumentsAsync(ImportDocumentsRequest request, CancellationToken cancellationToken)

Bulk import of multiple [Document][google.cloud.discoveryengine.v1.Document]s. Request processing may be synchronous. Non-existing items are created.

Note: It is possible for a subset of the [Document][google.cloud.discoveryengine.v1.Document]s to be successfully updated.

Parameters
Name Description
request ImportDocumentsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationImportDocumentsResponseImportDocumentsMetadata

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
ImportDocumentsRequest request = new ImportDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    InlineSource = new ImportDocumentsRequest.Types.InlineSource(),
    ErrorConfig = new ImportErrorConfig(),
    ReconciliationMode = ImportDocumentsRequest.Types.ReconciliationMode.Unspecified,
    UpdateMask = new FieldMask(),
    AutoGenerateIds = false,
    IdField = "",
};
// Make the request
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> response = await documentServiceClient.ImportDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ImportDocumentsResponse, ImportDocumentsMetadata> 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, ImportDocumentsMetadata> retrievedResponse = await documentServiceClient.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(BranchName, string, int?, CallSettings)

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

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
parent BranchName

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
BranchName parent = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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)

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
request ListDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
ListDocumentsRequest request = new ListDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
};
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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)

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
parent string

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListDocumentsResponseDocument

A pageable sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]";
// Make the request
PagedEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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(BranchName, string, int?, CallSettings)

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

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
parent BranchName

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
BranchName parent = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]");
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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)

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
request ListDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
ListDocumentsRequest request = new ListDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
};
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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)

Gets a list of [Document][google.cloud.discoveryengine.v1.Document]s.

Parameters
Name Description
parent string

Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

If the caller does not have permission to list [Document][google.cloud.discoveryengine.v1.Document]s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListDocumentsResponseDocument

A pageable asynchronous sequence of Document resources.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]/branches/[BRANCH]";
// Make the request
PagedAsyncEnumerable<ListDocumentsResponse, Document> response = documentServiceClient.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;

PollOnceImportDocuments(string, CallSettings)

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

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationImportDocumentsResponseImportDocumentsMetadata

The result of polling the operation.

PollOnceImportDocumentsAsync(string, CallSettings)

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

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationImportDocumentsResponseImportDocumentsMetadata

A task representing the result of polling the operation.

PollOncePurgeDocuments(string, CallSettings)

public virtual Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> PollOncePurgeDocuments(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationPurgeDocumentsResponsePurgeDocumentsMetadata

The result of polling the operation.

PollOncePurgeDocumentsAsync(string, CallSettings)

public virtual Task<Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata>> PollOncePurgeDocumentsAsync(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationPurgeDocumentsResponsePurgeDocumentsMetadata

A task representing the result of polling the operation.

PurgeDocuments(PurgeDocumentsRequest, CallSettings)

public virtual Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> PurgeDocuments(PurgeDocumentsRequest request, CallSettings callSettings = null)

Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a branch.

This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].

To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.

Parameters
Name Description
request PurgeDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationPurgeDocumentsResponsePurgeDocumentsMetadata

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
PurgeDocumentsRequest request = new PurgeDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Filter = "",
    Force = false,
};
// Make the request
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> response = documentServiceClient.PurgeDocuments(request);

// Poll until the returned long-running operation is complete
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
PurgeDocumentsResponse 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<PurgeDocumentsResponse, PurgeDocumentsMetadata> retrievedResponse = documentServiceClient.PollOncePurgeDocuments(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeDocumentsResponse retrievedResult = retrievedResponse.Result;
}

PurgeDocumentsAsync(PurgeDocumentsRequest, CallSettings)

public virtual Task<Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata>> PurgeDocumentsAsync(PurgeDocumentsRequest request, CallSettings callSettings = null)

Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a branch.

This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].

To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.

Parameters
Name Description
request PurgeDocumentsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationPurgeDocumentsResponsePurgeDocumentsMetadata

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
PurgeDocumentsRequest request = new PurgeDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Filter = "",
    Force = false,
};
// Make the request
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> response = await documentServiceClient.PurgeDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
PurgeDocumentsResponse 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<PurgeDocumentsResponse, PurgeDocumentsMetadata> retrievedResponse = await documentServiceClient.PollOncePurgeDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeDocumentsResponse retrievedResult = retrievedResponse.Result;
}

PurgeDocumentsAsync(PurgeDocumentsRequest, CancellationToken)

public virtual Task<Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata>> PurgeDocumentsAsync(PurgeDocumentsRequest request, CancellationToken cancellationToken)

Permanently deletes all selected [Document][google.cloud.discoveryengine.v1.Document]s in a branch.

This process is asynchronous. Depending on the number of [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, this operation can take hours to complete. Before the delete operation completes, some [Document][google.cloud.discoveryengine.v1.Document]s might still be returned by [DocumentService.GetDocument][google.cloud.discoveryengine.v1.DocumentService.GetDocument] or [DocumentService.ListDocuments][google.cloud.discoveryengine.v1.DocumentService.ListDocuments].

To get a list of the [Document][google.cloud.discoveryengine.v1.Document]s to be deleted, set [PurgeDocumentsRequest.force][google.cloud.discoveryengine.v1.PurgeDocumentsRequest.force] to false.

Parameters
Name Description
request PurgeDocumentsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationPurgeDocumentsResponsePurgeDocumentsMetadata

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
PurgeDocumentsRequest request = new PurgeDocumentsRequest
{
    ParentAsBranchName = BranchName.FromProjectLocationDataStoreBranch("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]"),
    Filter = "",
    Force = false,
};
// Make the request
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> response = await documentServiceClient.PurgeDocumentsAsync(request);

// Poll until the returned long-running operation is complete
Operation<PurgeDocumentsResponse, PurgeDocumentsMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
PurgeDocumentsResponse 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<PurgeDocumentsResponse, PurgeDocumentsMetadata> retrievedResponse = await documentServiceClient.PollOncePurgeDocumentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    PurgeDocumentsResponse 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
Type Description
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 Document UpdateDocument(Document document, FieldMask updateMask, CallSettings callSettings = null)

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
document Document

Required. The document to update/create.

If the caller does not have permission to update the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to update does not exist and [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] is not set, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided imported 'document' to update. If not set, by default updates all fields.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Document response = documentServiceClient.UpdateDocument(document, updateMask);

UpdateDocument(UpdateDocumentRequest, CallSettings)

public virtual Document UpdateDocument(UpdateDocumentRequest request, CallSettings callSettings = null)

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request UpdateDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Document

The RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = DocumentServiceClient.Create();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    AllowMissing = false,
    UpdateMask = new FieldMask(),
};
// Make the request
Document response = documentServiceClient.UpdateDocument(request);

UpdateDocumentAsync(Document, FieldMask, CallSettings)

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

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
document Document

Required. The document to update/create.

If the caller does not have permission to update the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to update does not exist and [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] is not set, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided imported 'document' to update. If not set, by default updates all fields.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Document response = await documentServiceClient.UpdateDocumentAsync(document, updateMask);

UpdateDocumentAsync(Document, FieldMask, CancellationToken)

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

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
document Document

Required. The document to update/create.

If the caller does not have permission to update the [Document][google.cloud.discoveryengine.v1.Document], regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the [Document][google.cloud.discoveryengine.v1.Document] to update does not exist and [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] is not set, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided imported 'document' to update. If not set, by default updates all fields.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
FieldMask updateMask = new FieldMask();
// Make the request
Document response = await documentServiceClient.UpdateDocumentAsync(document, updateMask);

UpdateDocumentAsync(UpdateDocumentRequest, CallSettings)

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

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request UpdateDocumentRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    AllowMissing = false,
    UpdateMask = new FieldMask(),
};
// Make the request
Document response = await documentServiceClient.UpdateDocumentAsync(request);

UpdateDocumentAsync(UpdateDocumentRequest, CancellationToken)

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

Updates a [Document][google.cloud.discoveryengine.v1.Document].

Parameters
Name Description
request UpdateDocumentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDocument

A Task containing the RPC response.

Example
// Create client
DocumentServiceClient documentServiceClient = await DocumentServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateDocumentRequest request = new UpdateDocumentRequest
{
    Document = new Document(),
    AllowMissing = false,
    UpdateMask = new FieldMask(),
};
// Make the request
Document response = await documentServiceClient.UpdateDocumentAsync(request);