Skip to content
OhNotreDame edited this page May 22, 2017 · 2 revisions

Files & Behaviour

Due to Google Chrome constraints, pages and code are separated.
All the components created to interact with gmail api is stored in the mail folder.

  • inbox.js and inbox.html prepare and render the page, based on different queries (Inbox, Updates, Promotions, ...)
  • mail.js contains all the functions used in inbox.js

Gmail API

API Version

Gmail API v1 Reference

Loading API

gapi.client.load('gmail', 'v1', renderInbox);

Calling API Method (Get Threads Messages)

function getThreadMessage(threadId, callback) {
     var request = gapi.client.gmail.users.threads.get({
               'userId': USER,
               'id': threadId
     });
     request.execute(function (resp) {
          callback(resp);
     });
}

API Methods covered by the code

Users.Messages

Methods Implemented Used Function
users.messages.list Yes mail.js listMessages()
users.messages.get Yes mail.js getMessage()
users.messages.modify Yes mail.js markMessageAsRead()
users.messages.delete Yes mail.js deleteMessagePermanently()
users.messages.trash Yes mail.js sendMessageToTrash()
users.messages.untrash Yes mail.js sendMessageBackToInbox()

Users.Threads

Methods Implemented Used Function
users.threads.list Yes mail.js listThreads()
users.threads.get Yes mail.js getThread()
users.threads.modify Yes mail.js markThreadAsRead()
users.threads.delete Yes mail.js deleteThreadPermanently()
users.threads.trash Yes mail.js sendThreadToTrash()
users.threads.untrash Yes mail.js sendThreadBackToInbox()

UI

CSS

Screenshots