
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
node-gcalendar-api
Advanced tools
#Google Calendar API connector for Nodejs
This node module provides a set of methods to interact against Google Calendar's API v3 services. The module was created as part of KidoZen project, as a connector for its Enterprise API feature.
##Installation Use npm to install the module:
> npm install node-gcalendar-api
To create your application you must get familiar with Google Cloud Console and setup a new project
##API Due to the asynchronous nature of Nodejs, this module uses callbacks in requests. All callbacks have 2 arguments: err and data.
function callback (err, data) {
// err contains an Error class instance, if any
// data contains the resulting data
}
##Constructor
The module exports a class and its constructor requires a configuration object with following properties
account
: Required string. This is the Email Addresskey
: Required string. This is a private KeyuseDelegation
: Optional boolean. This flag specifies if the user making the call will be impersonated.To get this values you must create a Service Account for Authentication. Once you created the service account for your application you must use the new created Email Address
value for the account
property. To obtain the value for the key
property you must:
openssl pkcs12 -in key.p12 -out key.pem -nocerts -nodes
-----BEGIN RSA PRIVATE KEY-----
...
...
-----END RSA PRIVATE KEY-----
##Methods
All public methods has the same signature. The signature has two arguments: options
and callback
.
options
: must be an object instance containig the properties specified in the Paramenters
section of the Google Api Referencecallback
: must be a function.For example, to clear a Calendar:
var settings = {
account : "abc@developer.gserviceaccount.com",
key : "-----BEGIN RSA PRIVATE KEY-----..."
};
var gcal = new GoogleCalendar(settings);
var options = { calendarId:'primary' };
gcal.ClearCalendar(options, function(err, result) {
...
});
});
##OAuth2 authentication
You can provide a valid OAuth2 token to call the methods as follow:
var options = {
access_token : "Your OAuthAccessToken",
calendarId:'primary'
};
gdrive.ClearCalendar(options, function(err, result) {
...
});
##Methods
##Calendar Functions
######ClearCalendar(options, callback) Implements this API
######DeleteSecondaryCalendar(options, callback) Implements this API
######GetCalendar(options, callback) Implements this API
######InsertCalendars(options, callback) Implements this API
In options
supply a Calendars resource
######UpdateCalendar(options, callback)
Implements this API. In options
also supply a resource
property with a Calendars resource
######PatchCalendar(options, callback)
Implements this API. In options
also supply a resource
property with a Calendars resource
##Events Functions
######DeleteEvent(options, callback) Implements this API
######GetEvent(options, callback) Implements this API
######InsertEvent(options, callback)
Implements this API. In options
also supply a resource
property with a Events resource
######QuickAddEvent(options, callback) Implements this API
######GetAllEvents(options, callback) Implements this API
######GetEventInstances(options, callback) Implements this API
######UpdateEvent(options, callback)
Implements this API. In options
supply a 'resource' property with a Events resource
######PatchEvent(options, callback)
Implements this API. In options
supply a 'resource' property with a Events resource
##FreeBusy Functions
######QueryFreebusy
Implements this API. In options
supply data with the structure specified in the documentation
##ACL Functions
######ListAcl Implements this API
######GetAcl Implements this API
######InsertAcl
Implements this API. In options
supply a rule
property with a ACL resource
######UpdateAcl
Implements this API. In options
supply a rule
property with a ACL resource
######PatchAcl
Implements this API. In options
supply a rule
property with a ACL resource
######DeleteAcl Implements this API
##Settings Functions
######ListSettings Implements this API
######GetSetting Implements this API
##Colors Functions
######GetColors Implements this API
In order to execute the tests, first set up an environment variable 'GOOGLE_ACCOUNT' with the your account, something like this: "abcdefghij@developer.gserviceaccount.com". You also have copy your .pem file to the 'test' folder and name it key.pem. Then run the tests using mocha or npm test.
Notice: these tests are going to be hitting your google calendar directly, so I recommend setting a tests project.
FAQs
Google calendar connector for KidoZen
The npm package node-gcalendar-api receives a total of 0 weekly downloads. As such, node-gcalendar-api popularity was classified as not popular.
We found that node-gcalendar-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.