Skip to content

create_comment async

create_comment(
    document_id: ResourceIdType,
    version_id: DocumentVersionIdType,
    text: CommentTextType,
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[AuthenticationHeaderType] = None,
    parent_id: Optional[CommentIdType] = None,
    thread_id: Optional[CommentIdType] = None,
    visibility: Optional[CommentVisibilityType] = None,
    notify_collaborators: Optional[BooleanType] = None,
) -> CreateCommentResponse

Adds a new comment to the specified document version.

Parameters:

  • authentication_token (Optional[AuthenticationHeaderType], default: None ) –

    Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

  • document_id (ResourceIdType) –

    The ID of the document.

  • version_id (DocumentVersionIdType) –

    The ID of the document version.

  • parent_id (Optional[CommentIdType], default: None ) –

    The ID of the parent comment.

  • thread_id (Optional[CommentIdType], default: None ) –

    The ID of the root comment in the thread.

  • text (CommentTextType) –

    The text of the comment.

  • visibility (Optional[CommentVisibilityType], default: None ) –

    The visibility of the comment. Options are either PRIVATE, where the comment is visible only to the comment author and document owner and co-owners, or PUBLIC, where the comment is visible to document owners, co-owners, and contributors.

  • notify_collaborators (Optional[BooleanType], default: None ) –

    Set this parameter to TRUE to send an email out to the document collaborators after the comment is created.

Raises:

Source code in docs_src/capo_workdocs/_services/async_work_docs.py
async def create_comment(
    self,
    document_id: "capo_workdocs.types.resource_id_type.ResourceIdType",
    version_id: "capo_workdocs.types.document_version_id_type.DocumentVersionIdType",
    text: "capo_workdocs.types.comment_text_type.CommentTextType",
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[
        "capo_workdocs.types.authentication_header_type.AuthenticationHeaderType"
    ] = None,
    parent_id: Optional["capo_workdocs.types.comment_id_type.CommentIdType"] = None,
    thread_id: Optional["capo_workdocs.types.comment_id_type.CommentIdType"] = None,
    visibility: Optional[
        "capo_workdocs.types.comment_visibility_type.CommentVisibilityType"
    ] = None,
    notify_collaborators: Optional[
        "capo_workdocs.types.boolean_type.BooleanType"
    ] = None,
) -> "capo_workdocs.types.create_comment_response.CreateCommentResponse":
    """<p>Adds a new comment to the specified document version.</p>

    Args:
        authentication_token: <p>Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.</p>
        document_id: <p>The ID of the document.</p>
        version_id: <p>The ID of the document version.</p>
        parent_id: <p>The ID of the parent comment.</p>
        thread_id: <p>The ID of the root comment in the thread.</p>
        text: <p>The text of the comment.</p>
        visibility: <p>The visibility of the comment. Options are either PRIVATE, where the comment is visible only to the comment author and document owner and co-owners, or PUBLIC, where the comment is visible to document owners, co-owners, and contributors.</p>
        notify_collaborators: <p>Set this parameter to TRUE to send an email out to the document collaborators after the comment is created.</p>

    Raises:
        capo_workdocs.errors.document_locked_for_comments_exception.DocumentLockedForCommentsException: <p>This exception is thrown when the document is locked for comments and user tries to create or delete a comment on that document.</p>
        capo_workdocs.errors.entity_not_exists_exception.EntityNotExistsException: <p>The resource does not exist.</p>
        capo_workdocs.errors.failed_dependency_exception.FailedDependencyException: <p>The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.</p>
        capo_workdocs.errors.invalid_comment_operation_exception.InvalidCommentOperationException: <p>The requested operation is not allowed on the specified comment object.</p>
        capo_workdocs.errors.prohibited_state_exception.ProhibitedStateException: <p>The specified document version is not in the INITIALIZED state.</p>
        capo_workdocs.errors.service_unavailable_exception.ServiceUnavailableException: <p>One or more of the dependencies is unavailable.</p>
        capo_workdocs.errors.unauthorized_operation_exception.UnauthorizedOperationException: <p>The operation is not permitted.</p>
        capo_workdocs.errors.unauthorized_resource_access_exception.UnauthorizedResourceAccessException: <p>The caller does not have access to perform the action on the resource.</p>
        capo_workdocs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workdocs.types.create_comment_request.CreateCommentRequest]",
    ) -> AsyncOperationResponse[
        "capo_workdocs.types.create_comment_response.CreateCommentResponse"
    ]:
        import capo_workdocs._operations.aws_gorilla_boy_service.create_comment

        (
            output,
            http_response,
        ) = await capo_workdocs._operations.aws_gorilla_boy_service.create_comment.async_create_comment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workdocs.types.create_comment_request.CreateCommentRequest",
    ) -> dict[str, Any]:
        import capo_workdocs.types.create_comment_request

        return capo_workdocs.types.create_comment_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_workdocs.types.create_comment_response.CreateCommentResponse",
    ) -> dict[str, Any]:
        import capo_workdocs.types.create_comment_response

        return capo_workdocs.types.create_comment_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateComment",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_workdocs.types.create_comment_request.CreateCommentRequest = {
        "document_id": document_id,
        "version_id": version_id,
        "text": text,
    }
    if authentication_token is not None:
        input_["authentication_token"] = authentication_token
    if parent_id is not None:
        input_["parent_id"] = parent_id
    if thread_id is not None:
        input_["thread_id"] = thread_id
    if visibility is not None:
        input_["visibility"] = visibility
    if notify_collaborators is not None:
        input_["notify_collaborators"] = notify_collaborators

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output