Revisions

Revisions are objects that describe changes to snippets.

Schema

A revision looks like this:

{
    "title": "Destroy earth",
    "description": "This code destroys earth planet",
    "code": "earth.destroy()",
    "language": {
        "id": 6,
        "name": "JavaScript"
    },
    "category": {
        "id": 3,
        "name": "Free lines"
    },
    "author": "trains",
    "explanation": "Because why not",
    "createdAt": "2018-06-21T08:21:49.000Z"
}

Everything should be self-explanatory. It's important to note, however, that there is no ID associted with any revision, and instead the index of the revision is used for that.

For example when getting revisions for a certain snippet, if 3 revisions, are returned, then the IDs for the revisions are 1, 2, and 3.

Getting revisions

The end-point is GET /snippets/{id}/revisions, it never throws errors, and the response is an array of revisions.

There is always at least 1 revision, so this will never return [] (unless we have a broken back-end)

Getting specific revision

The end-point is GET /snippets/{id}/revisions/{id}, and it responds with a revision object

There should be far more end-points documented here but given that authentication is yet to be documented, they are omitted for now.