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

g-contacts

v1.0.9

Published

Node.js wrapper for the Google Contacts API.

Downloads

7

Readme

Description

Node.js wrapper for the Google Contacts API.

Requirements

Installation

npm install g-contacts

Examples

  • Set user's credentials. If you provide a refresh_token and expiry_date (milliseconds since the Unix Epoch) and the access_token has expired, the access_token will be automatically refreshed and the request is replayed.
var GoogleContacts = require("g-contacts");

var googleContacts = new GoogleContacts(CLIENT_ID, CLIENT_SECRET);
var credentials    = {
  access_token : "ya29.GlyZBE5XzlI43OMOWbZueT",
  expiry_date  : 1501494739000,               // Set it true to force a refresh always.
  refresh_token: "1/wmz9DHCBg0CNtmKZVH_Wg",
  token_type   : "Bearer"
};

googleContacts.setUserCredentials(credentials);
  • Fetch all the contact's info such as 'name', 'email id', 'contact id' and 'contact type'.
googleContacts.getContacts(function (error, data) {
    console.log("Error " + error);
    console.log("Data " + JSON.stringify(data));
});
  • Fetch the contact's info such as 'name', 'email id', 'contact id' and 'contact type' for a given contact id.
var options = {
  contact_id: '123er45456',
  headers   :{                          // Optional
        'GData-Version': '3.0',
        'User-Agent'   : 'SomeAgent'
    },
};
googleContacts.getContacts(options, function (error, data) {
    console.log("Error " + error);
    console.log("Data " + JSON.stringify(data));
});
  • Fetch the contact's info using query parameters.

    For more info about query_params

var options = {
  query_params: {    
    q: "[email protected]"
  },
  headers     :{                          // Optional
        'GData-Version': '3.0',
        'User-Agent'   : 'SomeAgent'
    },
};
googleContacts.getContacts(options, function (error, data) {
    console.log("Error " + error);
    console.log("Data " + JSON.stringify(data));
});
  • Add a new contact into user's google contacts.
var options = {
    name        : 'Ram',                    // Default is ''
    display_name: 'Ram Singh',              // Default is ''
    email       : '[email protected]',          
    is_primary  : true,                     // Default is true
    contact_type: 'other',                  // Default is other.
    headers     :{                          // Optional
        'GData-Version': '3.0',
        'User-Agent'   : 'SomeAgent'
    },
    extended_property: [                    // Optional
        {name: 'custom_key_2', value: 'custom_value_2'},
        {name: 'custom_key_2', value: 'custom_value_2'}
    ]
};
googleContacts.addContact(options, function (error) {
    console.log("Error " + error);
});
  • Delete a contact or a list of contacts from user's google contacts list.
var options = {
    contact_ids: '1232131bv4324',          // Or a array of contact ids e.g. ['1332rweff4', '21312edsadsa',...]
    headers    :{                          // Optional
        'GData-Version': '3.0',
        'User-Agent'   : 'SomeAgent'
    }
};
googleContacts.deleteContacts(options, function (error) {
    console.log("Error " + error);
});

TODO

  • Updation of a contact.