- Picker API Quickstart
+ Google Picker API Quickstart
-
Picker API API Quickstart
+
Google Picker API Quickstart
-
+
@@ -39,11 +39,11 @@
// included, separated by spaces.
const SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly';
- // TODO(developer): Set to client ID and API key from the Developer Console
+ // TODO(developer): Replace with your client ID and API key from https://console.cloud.google.com/.
const CLIENT_ID = '';
const API_KEY = '';
- // TODO(developer): Replace with your own project number from console.developers.google.com.
+ // TODO(developer): Replace with your project number from https://console.cloud.google.com/.
const APP_ID = '';
let tokenClient;
@@ -51,7 +51,6 @@
let pickerInited = false;
let gisInited = false;
-
document.getElementById('authorize_button').style.visibility = 'hidden';
document.getElementById('signout_button').style.visibility = 'hidden';
@@ -132,7 +131,7 @@
}
/**
- * Create and render a Picker object for searching images.
+ * Create and render a Google Picker object for searching images.
*/
function createPicker() {
const view = new google.picker.View(google.picker.ViewId.DOCS);
@@ -152,11 +151,11 @@
/**
* Displays the file details of the user's selection.
- * @param {object} data - Containers the user selection from the picker
+ * @param {object} data - Contains the user selection from the Google Picker.
*/
async function pickerCallback(data) {
if (data.action === google.picker.Action.PICKED) {
- let text = `Picker response: \n${JSON.stringify(data, null, 2)}\n`;
+ let text = `Google Picker response: \n${JSON.stringify(data, null, 2)}\n`;
const document = data[google.picker.Response.DOCUMENTS][0];
const fileId = document[google.picker.Document.ID];
console.log(fileId);