我正在使用 Changes:list API 来列出更改。
https://developers.google.com/drive/api/v3/reference/changes/list
但结果包括我驱动器中的所有文件夹。我想过滤特定文件夹的结果。在文档中,我没有看到像“Files:List”那样的“changes:list”参数“q”。
有没有办法通过 API 参数过滤结果?或者我是否需要使用我已经知道的“文件夹 ID”在我的代码中执行此操作?
这是我正在使用的代码:
var request = gapi.client.drive.changes.list({
//The collection works by providing the current state of each item, if and only if the item has changed since a given point in time.
//point in history to retrive changes, we can saved this to know if there are changes
pageToken: '820167',
//test parameters that are not working
//q: "'12pDb31bRw7p3pfJoF_N6VncDqISSY1W4' in parents",
//q: 'trashed=false and "'+ folderId +'" in parents',
fields: '*',
pageSize: 5,
orderby:'title',
maxResults: 50
});
request.execute(function (resp) {
console.log(resp);
});
我可能会建议改用Drive Activity API,它可以让您查询文件夹中的更改。您需要指定参数ancestorName=items/${folderId}
。Drive Activity 还会让您更深入地了解所发生的实际活动。
驱动器更改资源非常少。它旨在快速查看整个驱动器/共享驱动器的变化。它增加的价值是能够为推送通知设置监视——这些可用于触发进一步的操作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句