Socket
Socket
Sign inDemoInstall

node-gmail-api

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-gmail-api - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

32

index.js

@@ -15,11 +15,4 @@ var request = require('request')

/*
* Fetches email that matches the query. Returns a stream of messages with a max of 100 messages
* since the batch api sets a limit of 100.
*
* e.g. to search an inbox: gmail.messages('label:inbox')
*/
Gmail.prototype.messages = function (q, opts) {
var key = this.key
, result = new Parser({objectMode: true})
var retrieve = function (key, q, endpoint, opts) {
var result = new Parser({objectMode: true})
, combined = ss()

@@ -29,3 +22,3 @@ , opts = opts || {}

request({
url: api + '/gmail/v1/users/me/messages',
url: api + '/gmail/v1/users/me/' + endpoint,
json: true,

@@ -47,6 +40,6 @@ qs: {

var messages = body.messages.map(function (m) {
var messages = body[endpoint].map(function (m) {
return {
'Content-Type': 'application/http',
body: 'GET ' + api + '/gmail/v1/users/me/messages/' + m.id + '\n'
body: 'GET ' + api + '/gmail/v1/users/me/' + endpoint + '/' + m.id + '\n'
}

@@ -73,2 +66,3 @@ })

r.on('response', function (res) {
res.pipe(process.stdout)
var type = res.headers['content-type']

@@ -92,2 +86,16 @@ , form = new multiparty.Form

/*
* Fetches email that matches the query. Returns a stream of messages with a max of 100 messages
* since the batch api sets a limit of 100.
*
* e.g. to search an inbox: gmail.messages('label:inbox')
*/
Gmail.prototype.messages = function (q, opts) {
return retrieve(this.key, q, 'messages', opts)
}
Gmail.prototype.threads = function (q, opts) {
return retrieve(this.key, q, 'threads', opts)
}
module.exports = Gmail
{
"name": "node-gmail-api",
"version": "0.1.1",
"version": "0.2.0",
"description": "Interacts with the gmail api, fetching emails",

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc