Skip to content

An API to create a document room if it does not exist? #328

@krassowski

Description

@krassowski

Problem

Currently it is possible for other extensions to get the document (or it's copy - by default) if there is a collaborative session for it. However, it is not currently possible to create the document room when it does not exist. This would be useful to allow server-side execution for notebooks which are not currently open (e.g. user clicks from context menu in the file browser on the notebook and chooses to execute it).

Proposed Solution

Add a new public API for creating the notebook. This could be as simple as a new argument to the existing get_document, a boolean create which would default to false.

Additional context

async def get_document(
self: YDocExtension,
*,
path: str | None = None,
content_type: str | None = None,
file_format: Literal["json", "text"] | None = None,
room_id: str | None = None,
copy: bool = True,
) -> YBaseDoc | None:
"""Get a view of the shared model for the matching document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions