npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

os-gmail-handler

v1.1.2

Published

This module contains simplified gmail api commands.

Downloads

21

Readme

Introduction

This module contains simplified Gmail API commands (search/read/send emails).

Installation

Install via npm:

npm i os-gmail-handler

Allow Gmail API

To allow this repo to run, you have to supply your gmail JSON credentials to the handler.

To do so, follow these steps to open the Gmail API:

  1. Go to the Google Cloud Console and open a new project. Search for "Gmail API", enable it
  2. In the Google Cloud Console, Click on the drawer at the top left and click API & Services -> Credentials
  3. At the top "Create credentials" -> "OAuth client ID" -> "Desktop app"
  4. Save the credentials JSON on a secured location on your computer

Usage

  • Require the api handler:
const gmailApi = require("os-gmail-handler")

Then initiate the handler and run it:

function start() {
    gmailApi.init("path/to/your/credentials.json", "path/to/store/your/token.json", onPostLoad)
}

// this callback will run after the API initialization
async function onPostLoad(auth) {

    // use the msgSearcher instance to find new messages from your girlfriends.
    // (change the query to search whatever you like. Be advised that it doesn't work exactly like the search in the Gmail web app. Read more about it here:
    // https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list)
    let msgs = await gmailApi.msgSearcher.searchMessages(auth, "subject:Hey honey", gmailApi.msgSearcher.LABEL_UNREAD)

    // run on all of those messages
    for (let i = 0; i < msgs.length; i++) {
        
        // read them one by one
        let msgRead = await gmailApi.msgReader.readMessage(auth, msgs[i].id)
        
        // get the name of the girlfriend
        let from = gmailApi.msgTools.getFrom(msgRead)
        
        // send a new message to the girlfriend
        await gmailApi.msgSender.sendMessage(auth, from.email, "Whatcha doin tonight?", "haha funny and corny content")
    }
}

And more...

Links -> see more tools

  • os-tools-npm -> This module contains fundamental functions to implement in an npm project
  • os-file-handler-npm -> This module contains fundamental files manipulation functions to implement in an npm project
  • os-file-stream-handler-npm -> This module contains read/write and more advanced operations on files
  • os-xml-handler-npm -> This module will build, read and manipulate an xml file. Other handy stuff is also available, like search for specific nodes

GitHub - osfunappsapps

Licence

ISC