Socket
Socket
Sign inDemoInstall

node-gmail-api

Package Overview
Dependencies
56
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.3 to 0.3.0

LICENSE

21

index.js

@@ -15,6 +15,7 @@ var request = require('request')

var retrieveCount = function (key, q, endpoint, next) {
var retrieveCount = function (key, q, endpoint, opts, next) {
request({
url: api + '/gmail/v1/users/me/' + endpoint,
json: true,
timeout: opts.timeout,
qs: {

@@ -46,2 +47,3 @@ q: q,

json: true,
timeout: opts.timeout,
qs: {

@@ -81,2 +83,3 @@ q: q

multipart: messages,
timeout: opts.timeout,
headers: {

@@ -115,4 +118,8 @@ 'Authorization': 'Bearer ' + key,

*/
Gmail.prototype.estimatedMessages = function (q, next) {
return retrieveCount(this.key, q, 'messages', next)
Gmail.prototype.estimatedMessages = function (q, opts, next) {
if (!next) {
next = opts
opts = {}
}
return retrieveCount(this.key, q, 'messages', opts, next)
}

@@ -134,4 +141,8 @@

*/
Gmail.prototype.estimatedThreads = function (q, next) {
return retrieveCount(this.key, q, 'threads', next)
Gmail.prototype.estimatedThreads = function (q, opts, next) {
if (!next) {
next = opts
opts = {}
}
return retrieveCount(this.key, q, 'threads', opts, next)
}

@@ -138,0 +149,0 @@

{
"name": "node-gmail-api",
"version": "0.2.3",
"version": "0.3.0",
"description": "Interacts with the gmail api, fetching emails",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,2 +10,7 @@ node-gmail-api

To use this module, you'll need an oauth access token key. See more details here: https://developers.google.com/gmail/api/overview#auth_and_the_gmail_api
We use [node-passport](https://github.com/jaredhanson/passport-google) to get an access key for a user, then use this module
to make requests on behave of the authenticated user.
Example

@@ -16,3 +21,5 @@ =======

// Fetch latest 10 emails and show the snippet
var gmail = new Gmail(key)
var Gmail = require('node-gmail-api')
, gmail = new Gmail(key)
, s = gmail.messages('label:inbox', {max: 10})

@@ -24,1 +31,5 @@

```
License
=======
ISC

@@ -12,3 +12,3 @@ var test = require('tape')

var gmail = new Gmail('key')
gmail.estimatedMessages('label:inbox', function (err, count) {
gmail.estimatedMessages('label:inbox', {timeout: 3000}, function (err, count) {
t.equal(count, 2)

@@ -15,0 +15,0 @@ t.end()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc