Adding one more API request to help with generating changelogs:
2.9 Listing all versions for a given Document
query {
share(id: "$SHARE_ID") {
versionHistory(include: [VERSION]) {
entries {
... on Version {
kind # starred revision will have "PUBLISHED" here
description # will be non-null for a starred revision
updatedAt
}
}
}
}
}
According to the the schema
versionHistory()
also supports optionalbefore
andafter
arguments (e.g. to skip older versions when generating a changelog) but I couldn’t get them to work.
curl command
curl 'https://graphql.sketch.cloud/api' \
-H "authorization: bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"query": "query{share(id:\\"$SHARE_ID\\"){versionHistory(include:[VERSION]){entries{... on Version{kind description order updatedAt}}}}}"
}'
Example output
{
"data": {
"share": {
"versionHistory": {
"entries": [
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:47:47Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:43:00Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:40:48Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:02:39Z"
},
{
"description": "Another milestone for this design",
"kind": "PUBLISHED",
"updatedAt": "2023-06-14T10:35:21Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:02:01Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T13:01:32Z"
},
{
"description": "The second update with ✨",
"kind": "PUBLISHED",
"updatedAt": "2023-06-14T10:34:53Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T12:53:10Z"
},
{
"description": null,
"kind": "DRAFT",
"updatedAt": "2023-05-12T12:42:29Z"
},
{
"description": "The first revision ever",
"kind": "PUBLISHED",
"updatedAt": "2023-06-14T10:33:45Z"
}
]
}
}
}
}