I am attempting to read the raw contents of a specific file in my repository using the GraphQL API. This is detailed in the REST api here:
https://docs.gitlab.com/ee/api/repository_files.html#get-raw-file-from-repository
and here I believe:
https://docs.gitlab.com/ee/api/repositories.html#raw-blob-content
Yet I can’t quite figure out how to do this with graphql. This is as far as I’ve gotten.
{
project(fullPath: "BenSa/first-project") {
repository {
tree(ref: "master", recursive: true){
blobs{
nodes {
name
type
flatPath
sha
}
}
}
}
}
}
The result of this query is
{
"data": {
"project": {
"repository": {
"tree": {
"blobs": {
"nodes": [
{
"name": "data.json",
"type": "blob",
"flatPath": "",
"sha": "aa6f396f7a0e2c3163bc05c857539db89ade1a37"
},
{
"name": "index.html",
"type": "blob",
"flatPath": "",
"sha": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
}
]
}
}
}
}
}
}
Yet I want to access the raw contents of “data.json”. I have searched through the GraphQL schema for the word “raw” and only found references to snippets. The Blob type has a webUrl but not a rawUrl. I suppose I could change “blob” to “raw” in the webUrl but seems a little hackish. Any ideas?
Thanks