Google Picker API 的资源摘要
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Picker API 使用带有 PickerBuilder
和 Picker
的构建器模式。
const picker = new google.picker.PickerBuilder()
.setOAuthtoken('TOKEN_FOR_USER')
.setAppId('1234567890') // Cloud Project number
.addView(google.picker.ViewId.DOCS)
.setCallback((data) => {
console.log(data);
})
.build();
picker.setVisible(true);
类
名称 |
说明 |
DocsUploadView |
使用 DocsUploadView 将文件上传到 Google 云端硬盘。 |
DocsView |
使用 DocsView 从 Google 云端硬盘中选择文件。 |
Picker |
Picker 是表示用户的界面操作的顶级对象。这些对象不是直接创建的,而是使用 PickerBuilder 类创建的。 |
PickerBuilder |
PickerBuilder 用于创建 Picker 对象。除非另有说明,否则以下方法的返回类型均为 PickerBuilder ,这让您可以将一个调用链接到另一个调用。 |
ResourceId |
ResourceId 是一个实用程序类,用于为文档生成资源 ID。 |
View |
适用于所有视图的抽象类。 |
ViewGroup |
ViewGroup 是导航窗格中视图的可视化分组。 |
枚举
名称 |
说明 |
Action |
ResponseObject 的操作类型。 |
Audience |
Audience 是一种枚举类型,用于描述 DocumentObject 的受众群体。 |
DocsViewMode |
DocsViewMode 是在 DocumentView 中显示数据的枚举类型。在调用 DocsView.setMode 时使用这些值。 |
Document |
Document 是一种枚举类型,用于描述 DocumentObject 的字段。 |
Feature |
Feature 是一种枚举类型,用于为各种视图开启/关闭功能。在对 PickerBuilder.enableFeature 和 PickerBuilder.disableFeature 的调用中使用这些值。 |
Response |
Response 是一种枚举类型,用于描述 ResponseObject 的字段。 |
ServiceId |
ServiceId 是一个枚举类型,用于描述所选项来自的服务。 |
Thumbnail |
Thumbnail 是一种枚举类型,用于描述 ThumbnailObject 的字段。 |
Type |
所选项的类型。 |
ViewId |
ViewId 是选择器中可用各种视图的枚举类型。在对 DocsView 和 PickerBuilder 的调用中使用这些值。 |
ViewToken |
ViewToken 是一种枚举类型,用于描述 ResponseObject.viewToken 的元素。 |
接口
类型别名
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["# Resource summary for Google Picker API\n\nThe Google Picker API uses a builder pattern with\n[`PickerBuilder`](./picker.pickerbuilder) and [`Picker`](./picker.picker). \n\n const picker = new google.picker.PickerBuilder()\n .setOAuthtoken('TOKEN_FOR_USER')\n .setAppId('1234567890') // Cloud Project number\n .addView(google.picker.ViewId.DOCS)\n .setCallback((data) =\u003e {\n console.log(data);\n })\n .build();\n\n picker.setVisible(true);\n\nClasses\n-------\n\n| Name | Description |\n|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`DocsUploadView`](./picker.docsuploadview) | Use `DocsUploadView` to upload files to Google Drive. |\n| [`DocsView`](./picker.docsview) | Use `DocsView` to select files from Google Drive. |\n| [`Picker`](./picker.picker) | `Picker` is the top level object representing the UI action with the user. These objects are not created directly, but instead use the `PickerBuilder` class. |\n| [`PickerBuilder`](./picker.pickerbuilder) | `PickerBuilder` is used to create `Picker` objects. Except where noted otherwise, the return type of methods below is of type `PickerBuilder`, allowing you to chain one call after another. |\n| [`ResourceId`](./picker.resourceid) | `ResourceId` is a utility class for generating resource IDs for documents. |\n| [`View`](./picker.view) | An abstract class for all views. |\n| [`ViewGroup`](./picker.viewgroup) | A `ViewGroup` is a visual grouping of views in the navigation pane. |\n\nEnums\n-----\n\n| Name | Description |\n|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`Action`](./picker.action) | The action type for the `ResponseObject`. |\n| [`Audience`](./picker.audience) | `Audience` is an enumerated type used to describe the audience of the `DocumentObject`. |\n| [`DocsViewMode`](./picker.docsviewmode) | `DocsViewMode` is an enumerated type for displaying data within a DocsView. Use these values in calls to `DocsView.setMode`. |\n| [`Document`](./picker.document) | `Document` is an enumerated type used to describe the fields of a `DocumentObject`. |\n| [`Feature`](./picker.feature) | `Feature` is an enumerated type, for turning on/off features for various views. Use these values in calls to `PickerBuilder.enableFeature` and `PickerBuilder.disableFeature`. |\n| [`Response`](./picker.response) | `Response` is an enumerated type used to describe the fields of a `ResponseObject`. |\n| [`ServiceId`](./picker.serviceid) | `ServiceId` is an enumerated type used to describe the service the item was selected from. |\n| [`Thumbnail`](./picker.thumbnail) | `Thumbnail` is an enumerated type describing the fields of a `ThumbnailObject`. |\n| [`Type`](./picker.type) | The type of the selected item. |\n| [`ViewId`](./picker.viewid) | `ViewId` is an enumerated type for the various views available in the Picker. Use these values in calls to `DocsView` and `PickerBuilder`. |\n| [`ViewToken`](./picker.viewtoken) | `ViewToken` is an enumerated type used to describe the elements of a `ResponseObject.viewToken`. |\n\nInterfaces\n----------\n\n| Name | Description |\n|-----------------------------------------------|----------------------------------------------------------------------------------|\n| [`DocumentObject`](./picker.documentobject) | `DocumentObject` is an interface describing the attributes of a selected item. |\n| [`ResponseObject`](./picker.responseobject) | The response object passed to the callback method. |\n| [`ThumbnailObject`](./picker.thumbnailobject) | `ThumbnailObject` is an interface describing the attributes of a photo or video. |\n\nType aliases\n------------\n\n| Name | Description |\n|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [`Locales`](./picker.locales) | The supported ISO 639 language codes for `PickerBuilder.setLocale`. |\n| [`ParentDocumentObject`](./picker.parentdocumentobject) | `ParentDocumentObject` is an interface describing the attributes of a parent folder for a selected item. |"]]