In brief:
JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they’re creating. This is then processed, by various tools, to produce documentation in accessible formats like HTML and Rich Text Format. The JSDoc specification is released under CC BY-SA 3.0, while its companion documentation generator and parser library is free software under the Apache License 2.0., see JSDoc
JSDoc style documentations (annotations or comments at top lines of function definitions) can be used with Google Apps Script.
This annotation let you restrict authorization on the current document:
1 | /** @OnlyCurrentDoc */ |
An opposing annotation is this:
1 | @NotOnlyCurrentDoc |
You can test the authorization:
1 2 3 4 5 6 | function testAuth() { // Log the authorization status (REQUIRED or NOT_REQUIRED). var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL); Logger.log(authInfo.getAuthorizationStatus()); } |
… answer:
1 | 9:33:57 PM Info NOT_REQUIRED |
and you can get the get the AuthorizationInfo:
1 2 3 4 5 6 | function testAuthURL() { // Log the URL used to grant access to the script. var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL); Logger.log(authInfo.getAuthorizationUrl()); } |