The following is a list of classes, methods, and enumerated types available in the Google Picker API. They all belong to the namespace google.picker.*
There are two 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 picked 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. Note: Feature.SUPPORT_DRIVES needs to be enabled when enabling this. |
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 will use 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 | Whether shared drive items should be included in results. Before enabling this make sure to refer Google Drive API documentation for enabling shared drives and make any necessary Drive Rest API changes. |
ImageSearchView
ImageSearchView
is a subclass of View
. Finer aspects of image searchs can be controlled using this class.
ImageSearchView() | Constructor. |
ImageSearchView.setLicense(ImageSearchView.License) | Set the License filter for images. This allows clients to filter items returned based on Creative Commons attributes. For more details, read Usage Rights. |
ImageSearchView.License.NONE | No Creative Commons attributes required. All images. |
ImageSearchView.License.COMMERCIAL_REUSE | Excludes cc_noncommercial. |
ImageSearchView.License.COMMERCIAL_REUSE_WITH_MODIFICATION | Excludes cc_noncommercial and cc_nonderived. Default choice. |
ImageSearchView.License.REUSE | No exclusions for images with Creative Common attributes. |
ImageSearchView.License.REUSE_WITH_MODIFICATION | Excludes cc_nonderived. |
ImageSearchView.setSite(string) | Add a site filter for image source. E.g. flickr.com. Only the last site set by setSite is honored (i.e. it is not cumulative.) |
ImageSearchView.setSize(ImageSearchView.Size) | Set the minimum size of image. |
ImageSearchView.Size.SIZE_QSVGA | Images at least 400x300 in either aspect ratio. |
ImageSearchView.Size.SIZE_VGA | Images at least 640x480. |
ImageSearchView.Size.SIZE_SVGA | Images at least 800x600. |
ImageSearchView.Size.SIZE_XGA | Images at least 1024x768. |
ImageSearchView.Size.SIZE_WXGA | Images at least 1280x800. |
ImageSearchView.Size.SIZE_WXGA2 | Images at least 1440x900. |
ImageSearchView.Size.SIZE_2MP | Images at least 2 megapixels. |
ImageSearchView.Size.SIZE_4MP | Images at least 4 megapixels. |
ImageSearchView.Size.SIZE_6MP | Images at least 6 megapixels. |
ImageSearchView.Size.SIZE_8MP | Images at least 8 megapixels. |
ImageSearchView.Size.SIZE_10MP | Images at least 10 megapixels. |
ImageSearchView.Size.SIZE_12MP | Images at least 12 megapixels. |
ImageSearchView.Size.SIZE_15MP | Images at least 15 megapixels. |
ImageSearchView.Size.SIZE_20MP | Images at least 20 megapixels. |
ImageSearchView.Size.SIZE_40MP | Images at least 40 megapixels. |
ImageSearchView.Size.SIZE_70MP | Images at least 70 megapixels. |
ImageSearchView.Size.SIZE_140MP | Images at least 140 megapixels. |
MapsView
MapsView
is a subclass of View
. Control the initial view for map selection using this class.
MapsView() | Constructor. |
MapsView.setCenter(number, number) | Center the initial map view at a given coordinate. The arguments are latitude and longitude values, respectively. |
MapsView.setZoom(number) | Set the initial zoom level. Valid range is 0 to 21; a higher value indicates a greater zoom. |
PhotoAlbumsView
PhotoAlbumsView
is a subclass of View
that can be used to select albums from Google Photos albums.
PhotoAlbumsView() | Constructor. |
PhotosView
PhotosView
is a subclass of View
. Finer aspects of photos selection can be controlled using this class.
PhotosView() | Constructor. |
PhotosView.setParent(string) | Sets the initial parent album to display. |
PhotosView.setType(PhotosView.Type) | Filter photos shown in the view by PhotosView.Type. |
PhotosView.Type.UPLOADED | Select from the user's most recently uploaded photos, from any album, with the most recently uploaded photos shown first. |
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 picked 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 are of type PickerBuilder
, allowing you to chain one call after another. See the Hello World example for typical use.
PickerBuilder() | Constructor. |
PickerBuilder.addView(View | ViewId) | 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 called when the user picks and item (or 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 pick. |
PickerBuilder.setOAuthToken(string) | Sets an OAuth token to use for authenticating the current user. Depending on the scope of the token, only certain views will display data. Valid scopes are Google Docs, Drive, Photos, YouTube. |
PickerBuilder.setOrigin(string) | Sets the origin of 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 MIME types which will be selectable. Use commas to separate MIME types if more than one is required. |
PickerBuilder.setSize() | Set the preferred dialog size. The dialog will be 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. |
VideoSearchView
VideoSearchView
is a subclass of View
. Use this class to select URLs of videos.
VideoSearchView() | Constructor. |
VideoSearchView.setSite(string) | Constrain the video search results to a particular domain. |
VideoSearchView.YOUTUBE | A string constant suitable for the VideoSearchView.setSite() method. |
View
View
is the abstract base class for the various View classes, such as ImageSearchView.
View(ViewId) | Constructor. |
View.getId() | Returns the ViewId for this view. |
View.setMimeTypes(string) | For views listing documents, set the MIME types which will be included in the view. Use commas to separate MIME types if more than one is required. |
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.IMAGE_SEARCH | Google Image Search. |
ViewId.PDFS | PDF files stored in Google Drive. |
ViewId.PHOTO_ALBUMS | Google Photos albums. |
ViewId.PHOTO_UPLOAD | Upload to Google Photos. |
ViewId.PHOTOS | Photos from Google photos. |
ViewId.PRESENTATIONS | Google Drive Presentations. |
ViewId.RECENTLY_PICKED | A collection of most recently selected items. |
ViewId.SPREADSHEETS | Google Drive Spreadsheets. |
ViewId.VIDEO_SEARCH | Google Video Search. |
ViewId.WEBCAM | Webcam photos. |
ViewId.YOUTUBE | Your YouTube videos. |
WebCamView
WebCamView
derives from View
and is used to record videos or take photos using a web camera.
WebCamView(WebCamViewType | undefined) | Constructor. |
WebCamViewType
WebCamViewType
is an enumerated type, used for constructing WebCamViews
.
WebCamViewType.STANDARD | Take a photo using a web camera. |
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 will in the Response.ACTION field in the callback data.
Action.CANCEL | User canceled the picker dialog. |
Action.PICKED | User has chosen at least one item. |
Audience
Audience
is an enumerated type representing the audience of a photo album. This value will be in the Document.AUDIENCE field of the Document object when a Google Photos album is picked.
Audience.OWNER_ONLY | Contents are accessible only to the owner. |
Audience.LIMITED | Contents are accessible to users other than the owner. |
Audience.PUBLIC | Contents are accessible to everyone. |
Document
Document
is an enumerated type used to convey information about a specific picked item. Only fields which are relevant to the selected item are returned. This value will be in the Response.DOCUMENTS field in the callback data.
Document.ADDRESS_LINES | The address of the picked location. |
Document.AUDIENCE | An Audience type used to convey the audience of a Google Photos album. |
Document.DESCRIPTION | A user-contributed description of the picked item. |
Document.DURATION | The duration of a picked 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 picked item. |
Document.IS_NEW | Returns true if the picked item was just uploaded. |
Document.LAST_EDITED_UTC | The timestamp describing when this item was last edited. |
Document.LATITUDE | The latitude of the picked location. |
Document.LONGITUDE | The longitude of the picked location. |
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 photos in a selected album. |
Document.PARENT_ID | The parent id of this item. For example, the album which contains this photo. |
Document.PHONE_NUMBERS | The phone number of the picked location. |
Document.SERVICE_ID | A ServiceId describing the service this item was picked from. |
Document.THUMBNAILS | An array of Thumbnails which describe the attributes of a photo or video. Thumbnails will not be returned if the picked items belong to Google Drive. |
Document.TYPE | The Type of the picked item. |
Document.URL | A URL to this item. |
Response
Response
is an enumerated type used to convey information about the user's picked items.
Response.ACTION | An Action type representing the action taken by the user to dismiss the dialog. |
Response.DOCUMENTS | An array of Documents picked by the user. |
Response.PARENTS | The parent ids of the items that were picked. (For example, the album of a picked photo.) |
Response.VIEW | The View the user selected these items from. |
ServiceId
ServiceId
is an enumerated type used to describe the service the item was picked from. This value will be in the Document.SERVICE_ID field of the picked Document.
ServiceId.DOCS | Google Drive. |
ServiceId.MAPS | Google Maps. |
ServiceId.PHOTOS | Google Photos. |
ServiceId.SEARCH_API | Google Web Search. |
ServiceId.URL | A user-supplied URL. |
ServiceId.YOUTUBE | YouTube. |
Thumbnail
Thumbnail
is an enumerated type used to convey information about a picker photo or video. This value can be found in the Document.THUMBNAILS field of a picked 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 catorgize the picked item. This value can be found in the Document.TYPE field of a picked Document.
Type.ALBUM | The item is a Google Photos album. |
Type.DOCUMENT | The item is a document. |
Type.LOCATION | The item is a location. |
Type.PHOTO | The item is a photo. |
Type.URL | The item is a URL. |
Type.VIDEO | The item is a video. |