I am currently trying to bring some order to our Google App Script files and develop a HTMLService app that finds and parses GAS files in Google Drive and produces API documentation based on jsdoc style comments.
I have the WebApp functional and can pull all the data I need and parse the comments but by default it exports the current GAS file contents, regardless of if it's published or not.
What I would like to do is pull the contents of the latest Saved Version rather than the current dev content, is there a way I can specify a version to export?
I am using a URLFetch() to get the content, as per below:
var params = {
headers:{
'Accept':'application/vnd.google-apps.script+json',
'Authorization':'Bearer '+ ScriptApp.getOAuthToken()
},
method:'get'
};
var fileDrive = Drive.Files.get(fileId);
var link = JSON.parse(fileDrive)['exportLinks']['application/vnd.google-apps.script+json'];
var fetched = UrlFetchApp.fetch(link, params);
return { meta: fileDrive, source: JSON.parse(fetched.getContentText()) };
Any help would be appreciated, thank you!