如何使用API​​ v3在Typescript中设置Google驱动器文件权限?

时间:2019-03-09 10:34:55

标签: typescript google-drive-api

可在此处找到Google Drive API的文档:v2-> permissions-> inserthttps://developers.google.com/drive/api/v2/reference/permissions/insert

页面底部有一个javascript示例,其中将body变量分配给传递给resource函数的对象的insert属性。

我想使用v3版本,因为我正在写打字稿,而v3版本有一个@types包; https://www.npmjs.com/package/@types/gapi.client.drive, 类型定义:https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi.client.drive/index.d.ts

在第3版中,insert已重命名为create,并在此处记录。 https://developers.google.com/drive/api/v3/reference/permissions/create

但是,此文档页面没有javascript示例,并且在类型包中,要传递给create函数的对象没有resource属性。

从打字稿中使用v3时,应该如何迁移v2代码示例的这一部分?

  var body = {
    'value': value,
    'type': type,
    'role': role
  };

0 个答案:

没有答案