Create a new DocumentManager.
Private
baseThe base URL of the remote document manager API.
Private
Optional
tokenA string that grants the bearer access to the document management API.
Creates a new document on the y-sweet server given an optional docId. If a document with given ID already exists, this is a no-op.
Optional
docId: stringThe ID of the document to be created. If not provided, a random ID will be generated.
A DocCreationResult object containing the ID of the created document.
Private
doInternal helper for making an authorized fetch request to the API.
Internal helper for making an authorized fetch request to the API.
Get a client token for the given document.
If you are using authorization, this is expected to be called from your server after a user has authenticated. The returned token should then be passed to the client.
The ID of the document to get a token for.
A ClientToken object containing the URL and token needed to connect to the document.
A convenience wrapper around DocumentManager.createDoc and DocumentManager.getClientToken for getting a client token for a document. If a docId is provided, ensures that a document exists with that ID or that one is created. If no docId is provided, a new document is created with a random ID.
Optional
docId: stringThe ID of the document to get or create. If not provided, a new document with a random ID will be created.
A ClientToken object containing the URL and token needed to connect to the document.
Represents an interface to a y-sweet document management endpoint.