This page contains a list of classes, methods, and enumerated types available in the
Google Picker API. All of these elements belong to the namespace google.picker.*
There are 2 types of classes and enumerated types: those which are used to build and configure
the Google Picker, and those which are returned by the Google Picker once the user has
selected an item.
Configuration Classes and Types
The following classes and enumerated types are used to build and configure the Google Picker.
DocsUploadView
Use DocsUploadView
to upload documents to Google Drive.
DocsUploadView() | Constructor. |
DocsUploadView.setIncludeFolders(boolean) | Allows the user to select a folder in Google Drive to upload to. |
DocsUploadView.setParent(string) | Sets the upload destination to the specified folder. This overrides setIncludeFolders to false. |
DocsView
DocsView
is a subclass of View
that can be used for Google Drive views.
DocsView(ViewId | undefined) | Constructor. The ViewId must be one of the Google Drive views. Default is ViewId.DOCS . |
DocsView.setEnableDrives(boolean) | Shows shared drives and the files they contain. Before enabling, refer to Google Drive API documentation for enabling shared drives. |
DocsView.setIncludeFolders(boolean) | Show folders in the view items. Do not combine with setOwnedByMe . When setIncludeFolders(true) is set, setOwnedByMe is ignored. |
DocsView.setSelectFolderEnabled(boolean) | Allows the user to select a folder in Google Drive. |
DocsView.setMode(DocsViewMode) | Selects which mode the view uses to display the documents. |
DocsView.setOwnedByMe(boolean | undefined) | Filters the documents based on whether they are owned by the user, or shared with the user. Do not combine this setting with setIncludeFolders . When setIncludeFolders(true) is set, setOwnedByMe is ignored. |
DocsView.setParent(string) | Sets the initial parent folder to display. |
DocsView.setStarred(boolean) | Filters the documents based on whether they are starred by the user. |
DocsViewMode
DocsViewMode
is an enumerated type for displaying data within a DocsView. Use these values in calls to DocsView.setMode
.
DocsViewMode.GRID | Display documents in a thumbnail grid. |
DocsViewMode.LIST | Display documents in a detailed list. |
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
.
Feature.MINE_ONLY | Show only documents owned by the user when showing items from Google Drive. |
Feature.MULTISELECT_ENABLED | Allow user to choose more than one item. |
Feature.NAV_HIDDEN | Hide the navigation pane. If the navigation pane is hidden, users can only select from the first view chosen. |
Feature.SIMPLE_UPLOAD_ENABLED | For photo uploads, controls whether per-photo selection (as opposed to per-album) selection is enabled. |
Feature.SUPPORT_DRIVES |
Deprecated: Shared drive items are now included by default. Whether shared drive items are included in results. |
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
object.
Picker.isVisible() | Get a boolean indicating the current Picker visibility. |
Picker.setCallback(function(object)) | Specify the callback method called whenever the user has selected an item (or canceled.) |
Picker.setRelayUrl(string) | Specify a relay URL to circumvent cross-domain issues. |
Picker.setVisible(boolean) | Control the visibility of the Picker object. |
Picker.dispose() | Disposes the Picker object. |
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. See the Google Picker code sample for typical use.
PickerBuilder() | Constructor. |
PickerBuilder.addView( | Add a View to the navigation pane. |
PickerBuilder.addViewGroup(ViewGroup) | Add a ViewGroup to the top-level navigation pane. |
PickerBuilder.build() | Construct the Picker object. The Picker object is returned. |
PickerBuilder.disableFeature(Feature) | Disable a picker feature. |
PickerBuilder.enableFeature(Feature) | Enable a picker feature. |
PickerBuilder.getRelayUrl() | Get the relay URL, used for gadgets.rpc. |
PickerBuilder.getTitle() | Get the dialog title. |
PickerBuilder.hideTitleBar() | Disable the title bar from being shown. To re-enable, call setTitle with a non-empty title or undefined. |
PickerBuilder.isFeatureEnabled(Feature) | Check if a picker Feature is enabled. |
PickerBuilder.setAppId(string) | Sets the Google Drive App ID needed to allow application to access the user's files via the Google Drive API. |
PickerBuilder.setCallback(method) | Set the callback method. This method is called when the user selects items or cancels. The callback method receives a single callback object. The structure of the callback object is described in the JSON Guide. |
PickerBuilder.setDeveloperKey(string) | Sets the Browser API key obtained from Google API Console. See the Developer's Guide for details on how to obtain the Browser API key. |
PickerBuilder.setDocument(document) | Set the document. |
PickerBuilder.setLocale(string) | ISO 639 language code. If the language is not supported, en-US is used. This method provides an alternative to setting the locale at google.load() time. See the Developer's Guide for a list of supported locales. |
PickerBuilder.setMaxItems(number) | Sets the maximum number of items a user can select. |
PickerBuilder.setOAuthToken(string) | Sets an OAuth token to use for authenticating the current user. Depending on the scope of the token, only certain views display data. Valid scopes are Google Docs, Drive, Photos, YouTube. |
PickerBuilder.setOrigin(string) | Sets the origin of the Google Picker dialog. The origin should be set to the window.location.protocol + '//' + window.location.host of the top-most page, if your application is running in an iframe. |
PickerBuilder.setRelayUrl(string) | Set the relay URL, used for gadgets.rpc. |
PickerBuilder.setSelectableMimeTypes(string) | Set the list of selectable MIME types. Use commas to separate MIME types if more than one is required. |
PickerBuilder.setSize() | Set the preferred dialog size. The dialog is auto-centered. It has a minimum size of (566,350) and a maximum size of (1051,650). |
PickerBuilder.setTitle(string) | Set the dialog title. |
PickerBuilder.toUri() | Returns the URI generated by this builder. |
ResourceId
ResourceId
is a static class used to generate resource IDs suitable for the Google Documents List API.
ResourceId.generate(Document) | Map a document object to a resource ID. |
View
View
is the abstract base class for the various View classes, such as DocsView
.
View(ViewId) | Constructor. |
View.getId() | Returns the ViewId for this view. |
View.setMimeTypes(string) | Sets the MIME types included in the view. Use commas to separate MIME types if more than one is required. If you don't set MIME types, files of all MIME types are displayed in the view. |
View.setQuery(string) | For views involving searches, prepopulate the search query with these terms. |
ViewGroup
ViewGroup
is a visual grouping of views. The root item of the ViewGroup itself must be a View
.
ViewGroup(View | ViewId) | A ViewGroup is a visual grouping of views in the navigation pane. The root item of the ViewGroup itself must be View . |
ViewGroup.addLabel(string) | Add a label to this ViewGroup . |
ViewGroup.addView(ViewId | View) | Add a view to the ViewGroup . The View can be represented by a view -derived object, or simply by ViewId. |
ViewGroup.addViewGroup(ViewGroup) | Nest a ViewGroup within the current ViewGroup . |
ViewId
ViewId
is an enumerated type, used for constructing View
and ViewGroup
objects.
ViewId.DOCS | All Google Drive document types. |
ViewId.DOCS_IMAGES | Google Drive photos. |
ViewId.DOCS_IMAGES_AND_VIDEOS | Google Drive photos and videos. |
ViewId.DOCS_VIDEOS | Google Drive videos. |
ViewId.DOCUMENTS | Google Drive Documents. |
ViewId.DRAWINGS | Google Drive Drawings. |
ViewId.FOLDERS | Google Drive Folders. |
ViewId.FORMS | Google Drive Forms. |
ViewId.PDFS | PDF files stored in Google Drive. |
ViewId.PRESENTATIONS | Google Drive Presentations. |
ViewId.SPREADSHEETS | Google Drive Spreadsheets. |
Callback Types
The following enumerated types are found in callback data returned by the Google Picker API.
Action
Action
is an enumerated type representing the action taken by the user to dismiss the dialog. This value is in the Response.ACTION
field in the callback data.
Action.CANCEL | User canceled the Google Picker dialog. |
Action.PICKED | User has chosen at least one item. |
Document
Document
is an enumerated type used to convey information about a specific selected item. Only fields which are relevant to the selected item are returned. This value is in the Response.DOCUMENTS
field in the callback data.
Document.DESCRIPTION | A user-contributed description of the selected item. |
Document.DURATION | The duration of a selected video. |
Document.EMBEDDABLE_URL | A URL for this item suitable for embedding in a web page. |
Document.ICON_URL | A URL to an icon for this item. |
Document.ID | The ID for the selected item. |
Document.IS_NEW | Returns true if the selected item was just uploaded. |
Document.LAST_EDITED_UTC | The timestamp describing when this item was last edited. |
Document.MIME_TYPE | The MIME type of this item. |
Document.NAME | The name of this item. |
Document.NUM_CHILDREN | The number of children contained in this item. For example, the number of files in the selected folder. |
Document.PARENT_ID | The parent ID of this item. For example, the folder containing this file. |
Document.SERVICE_ID | A ServiceId describing the service this item was selected from. |
Document.THUMBNAILS | An array of Thumbnail s which describe the attributes of a photo or video. Thumbnails aren't returned if the selected items belong to Google Drive. |
Document.TYPE | The Type of the selected item. |
Document.URL | A URL to this item. |
Response
Response
is an enumerated type used to convey information about the user's selected items.
Response.ACTION | An Action type representing the action taken by the user to dismiss the dialog. |
Response.DOCUMENTS | An array of Document s selected by the user. |
Response.PARENTS | The IDs of the parent folders for the selected items. (For example, IDs of the parent folders whose files were selected.) |
Response.VIEW | The View the user selected these items from. |
service-id
ServiceId
is an enumerated type used to describe the service the item was selected from. This value is in the Document.SERVICE_ID
field of the selected Document
.
ServiceId.DOCS | Google Drive. |
thumbnail
Thumbnail
is an enumerated type used to convey information about a selected photo or video. This value can be found in the Document.THUMBNAILS
field of a selected Document
.
Thumbnail.HEIGHT | The height of the photo or video in pixels. |
Thumbnail.WIDTH | The width of the photo or video in pixels. |
Thumbnail.URL | A URL to the selected photo or video. |
type
Type
is an enumerated type used to categorize the selected item. This value can be found in the Document.TYPE
field of a selected Document
.
Type.DOCUMENT | The item is a document. |
Type.PHOTO | The item is a photo. |
Type.VIDEO | The item is a video. |