Class DocumentServiceClient (2.20.0-rc)

This service lets you manage document.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

DocumentServiceClient(DocumentServiceClient const &)

Copy and move support

Parameter
NameDescription
DocumentServiceClient const &

DocumentServiceClient(DocumentServiceClient &&)

Copy and move support

Parameter
NameDescription
DocumentServiceClient &&

DocumentServiceClient(std::shared_ptr< DocumentServiceConnection >, Options)

Parameters
NameDescription
connection std::shared_ptr< DocumentServiceConnection >
opts Options

Operators

operator=(DocumentServiceClient const &)

Copy and move support

Parameter
NameDescription
DocumentServiceClient const &
Returns
TypeDescription
DocumentServiceClient &

operator=(DocumentServiceClient &&)

Copy and move support

Parameter
NameDescription
DocumentServiceClient &&
Returns
TypeDescription
DocumentServiceClient &

Functions

CreateDocument(std::string const &, google::cloud::contentwarehouse::v1::Document const &, Options)

Creates a document.

Parameters
NameDescription
parent std::string const &

Required. The parent name. Format: projects/{project_number}/locations/{location}.

document google::cloud::contentwarehouse::v1::Document const &

Required. The document to create.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::CreateDocumentResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.CreateDocumentResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDocument(google::cloud::contentwarehouse::v1::CreateDocumentRequest const &, Options)

Creates a document.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::CreateDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.CreateDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::CreateDocumentResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.CreateDocumentResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDocument(std::string const &, Options)

Gets a document.

Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
name std::string const &

Required. The name of the document to retrieve. Format: projects/{project_number}/locations/{location}/documents/{document_id} or projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::Document >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDocument(google::cloud::contentwarehouse::v1::GetDocumentRequest const &, Options)

Gets a document.

Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::GetDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.GetDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::Document >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDocument(std::string const &, google::cloud::contentwarehouse::v1::Document const &, Options)

Updates a document.

Returns INVALID_ARGUMENT if the name of the document is non-empty and does not equal the existing name.

Parameters
NameDescription
name std::string const &

Required. The name of the document to update. Format: projects/{project_number}/locations/{location}/documents/{document_id} or projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.

document google::cloud::contentwarehouse::v1::Document const &

Required. The document to update.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::UpdateDocumentResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.UpdateDocumentResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateDocument(google::cloud::contentwarehouse::v1::UpdateDocumentRequest const &, Options)

Updates a document.

Returns INVALID_ARGUMENT if the name of the document is non-empty and does not equal the existing name.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::UpdateDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.UpdateDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::UpdateDocumentResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.UpdateDocumentResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteDocument(std::string const &, Options)

Deletes a document.

Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
name std::string const &

Required. The name of the document to delete. Format: projects/{project_number}/locations/{location}/documents/{document_id} or projects/{project_number}/locations/{location}/documents/referenceId/{reference_id}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteDocument(google::cloud::contentwarehouse::v1::DeleteDocumentRequest const &, Options)

Deletes a document.

Returns NOT_FOUND if the document does not exist.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::DeleteDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.DeleteDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
Status

a Status object. If the request failed, the status contains the details of the failure.

SearchDocuments(std::string const &, Options)

Searches for documents using provided SearchDocumentsRequest.

This call only returns documents that the caller has permission to search against.

Parameters
NameDescription
parent std::string const &

Required. The parent, which owns this collection of documents. Format: projects/{project_number}/locations/{location}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StreamRange< google::cloud::contentwarehouse::v1::SearchDocumentsResponse::MatchingDocument >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

SearchDocuments(google::cloud::contentwarehouse::v1::SearchDocumentsRequest, Options)

Searches for documents using provided SearchDocumentsRequest.

This call only returns documents that the caller has permission to search against.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::SearchDocumentsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.SearchDocumentsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StreamRange< google::cloud::contentwarehouse::v1::SearchDocumentsResponse::MatchingDocument >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

LockDocument(std::string const &, Options)

Lock the document so the document cannot be updated by other users.

Parameters
NameDescription
name std::string const &

Required. The name of the document to lock. Format: projects/{project_number}/locations/{location}/documents/{document}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::Document >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

LockDocument(google::cloud::contentwarehouse::v1::LockDocumentRequest const &, Options)

Lock the document so the document cannot be updated by other users.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::LockDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.LockDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::Document >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

FetchAcl(std::string const &, Options)

Gets the access control policy for a resource.

Returns NOT_FOUND error if the resource does not exist. Returns an empty policy if the resource exists but does not have a policy set.

Parameters
NameDescription
resource std::string const &

Required. REQUIRED: The resource for which the policy is being requested. Format for document: projects/{project_number}/locations/{location}/documents/{document_id}. Format for collection: projects/{project_number}/locations/{location}/collections/{collection_id}. Format for project: projects/{project_number}.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::FetchAclResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.FetchAclResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

FetchAcl(google::cloud::contentwarehouse::v1::FetchAclRequest const &, Options)

Gets the access control policy for a resource.

Returns NOT_FOUND error if the resource does not exist. Returns an empty policy if the resource exists but does not have a policy set.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::FetchAclRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.FetchAclRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::FetchAclResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.FetchAclResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SetAcl(std::string const &, google::iam::v1::Policy const &, Options)

Sets the access control policy for a resource.

Replaces any existing policy.

Parameters
NameDescription
resource std::string const &

Required. REQUIRED: The resource for which the policy is being requested. Format for document: projects/{project_number}/locations/{location}/documents/{document_id}. Format for collection: projects/{project_number}/locations/{location}/collections/{collection_id}. Format for project: projects/{project_number}.

policy google::iam::v1::Policy const &

Required. REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. This refers to an Identity and Access (IAM) policy, which specifies access controls for the Document.
You can set ACL with condition for projects only.
Supported operators are: =, !=, <, <=, >, and >= where the left of the operator is DocumentSchemaId or property name and the right of the operator is a number or a quoted string. You must escape backslash () and quote (") characters.
Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for example, "((A AND B AND C) OR D) AND E"), a maximum of 10 comparisons are allowed in the expression. The expression must be < 6000 bytes in length.
Sample condition: `"DocumentSchemaId = "some schema id" OR SchemaId.floatPropertyName

= 10"`

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::SetAclResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.SetAclResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

SetAcl(google::cloud::contentwarehouse::v1::SetAclRequest const &, Options)

Sets the access control policy for a resource.

Replaces any existing policy.

Parameters
NameDescription
request google::cloud::contentwarehouse::v1::SetAclRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.contentwarehouse.v1.SetAclRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::contentwarehouse::v1::SetAclResponse >

the result of the RPC. The response message type (google.cloud.contentwarehouse.v1.SetAclResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.