Edit a worktree's README

POST https://runix.chat/api/v1/armada/workspaces/{workspace_uuid}/readme

The README's editor: a client's changes to the document people edit together, and where its cursor is, in Yjs's binary formats, each in base64. The document's text is named markdown.

A client that opens the README, or comes back to it, also sends its state vector, and gets what it lacks, the document's state vector (from which it computes what the server lacks, to send next), and the other viewers' cursors.

Every request makes the client a viewer of the README for 45 seconds: its user gets a readme event for each change and each cursor that moves while any of its event queues lists readme in its event_types. The document is written to README.md in the worktree soon after the last change; a change made to the file meanwhile is merged into the document.

A client sends its changes in batches, at most ten a second; these requests count against their own rate limit, not against the one for the rest of the API.

Changes: New in Zulip 13.0 (feature level ZF-8c5c9c).

Usage examples

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for users and bots.

curl -sSX POST https://runix.chat/api/v1/armada/workspaces/8e6d3b9e-4c36-4f2a-9a55-3f4b0c6f1d2e/readme \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode client=2747362911 \
    --data-urlencode update=AQHu9N7EAgCEAQ5tYXJrZG93bgVjbGljawA= \
    --data-urlencode awareness=AQHu9N7EAgEDeyJ1c2VyIjp7ImlkIjoxMX19 \
    --data-urlencode state_vector=AA==

Parameters

workspace_uuid string required in path

Example: "8e6d3b9e-4c36-4f2a-9a55-3f4b0c6f1d2e"

The UUID of the worktree: a topic's workspace_uuid.


client string required

Example: "2747362911"

The client's Yjs client ID, in decimal.


update string optional

Example: "AQHu9N7EAgCEAQ5tYXJrZG93bgVjbGljawA="

A Yjs update with the client's changes, in base64.


awareness string optional

Example: "AQHu9N7EAgEDeyJ1c2VyIjp7ImlkIjoxMX19"

A Yjs awareness update with where the client's cursor is, in base64.


state_vector string optional

Example: "AA=="

The client's Yjs state vector, in base64, when it opens the README or comes back to it.


Response

Return values

  • armada_readme: object

    What the server answers the client.

    • seq: integer

      The place in the document's history of the client's update, or, with a state vector, of the latest change. Present when either was given.

    • path: string

      The README's path in the worktree. Present with a state vector.

    • exists: boolean

      Whether the worktree has the file. Present with a state vector.

    • update: string

      A Yjs update with what the client lacks, in base64. Present with a state vector.

    • state_vector: string

      The document's Yjs state vector, in base64. Present with a state vector.

    • awareness: (string)[]

      The other viewers' last awareness updates, in base64. Present with a state vector.

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "armada_readme": {
        "awareness": [],
        "exists": true,
        "path": "README.md",
        "seq": 12,
        "state_vector": "AQHu9N7EAgY=",
        "update": "AAA="
    },
    "msg": "",
    "result": "success"
}