【发布时间】:2013-06-22 01:57:10
【问题描述】:
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)
}
);
有大量的应用程序类型可以利用这种方法。 简单的数据库管理器是另一个例子。
【问题讨论】:
标签: google-apps-script google-drive-api