Google Drive API 是否提供了一种在 Google Drive 服务器基础上执行我的代码的方法?
假设我想基于grep
让客户搜索他们的文件来编写 Google Dirve。我希望能够写出这样的东西:(非常简化以使其简短)
/* define the function for grep */
var grep = function(params, callback) {
// 1) find all text files using `gapi.client.drive.files.list`
// 2) open each file with `gapi.client.drive.files.get`
// 3) scan for the serach string occurance
callback(search_result);
}
/* register the code on the server with imaginary API */
gapi.client.drive.server.register('myapp.grep', grep);
/* execute from Browser */
gapi.client.drive.server.myapp.grep({searchString: 'Abrakadabra', mimeType: 'application/javascript'},
function(resutls) {
console.log(results)
}
);
有大量的应用程序类型可以利用这种方法。简单的数据库管理器是另一个例子。