/** * Lists all labels in the user's mailbox * @see https://developers.google.com/gmail/api/reference/rest/v1/users.labels/list */functionlistLabels(){try{// Gmail.Users.Labels.list() API returns the list of all Labels in user's mailboxconstresponse=Gmail.Users.Labels.list("me");if(!response||response.labels.length===0){// TODO (developer) - No labels are returned from the responseconsole.log("No labels found.");return;}// Print the Labels that are available.console.log("Labels:");for(constlabelofresponse.labels){console.log("- %s",label.name);}}catch(err){// TODO (developer) - Handle exception on Labels.list() APIconsole.log("Labels.list() API failed with error %s",err.toString());}}