Description
Node.js wrapper for the Google Contacts API.
Requirements
- Node.js -- v0.10.32 or newer
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 = ; var 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;
- Fetch all the contact's info such as 'name', 'email id', 'contact id' and 'contact type'.
googleContacts;
- 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;
-
Fetch the contact's info using query parameters.
For more info about query_params
var options = query_params: q: "ram@gmail.com" headers : // Optional 'GData-Version': '3.0' 'User-Agent' : 'SomeAgent' ;googleContacts;
- Add a new contact into user's google contacts.
var options = name : 'Ram' // Default is '' display_name: 'Ram Singh' // Default is '' email : 'ram@gmail.com' 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;
- 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;
TODO
- Updation of a contact.