google-calendar = function (access_token) { return new GoogleCalendar(access_token); }
n/a
function GoogleCalendar(access_token){ this.request = function(type, path, params, options, body, callback) { var url = 'https://www.googleapis.com/calendar/v3'+path+'?access_token='+access_token; params = params || {} options = options || {} options.json = true; type = type.toUpperCase(); if(body && typeof body !== 'string') body = JSON.stringify(body); for(var k in params){ url += '&'+encodeURIComponent(k)+'='+ encodeURIComponent(params[k]); } needle.request(type, url, body, options, responseHandler); function responseHandler(error, response, body) { if(error) return callback(error, body); if(body.error) return callback(body.error, null); return callback(null, body); } }; this.acl = new Acl(this.request); this.calendarList = new CalendarList(this.request); this.calendars = new Calendars(this.request); this.events = new Events(this.request); this.freebusy = new Freebusy(this.request); this.settings = new Settings(this.request); }
...
#### AccessToken & Authentication
This library requires Google API's [Access Token](https://developers.google.com/accounts/docs/OAuth2) with calendars [scope
](https://developers.google.com/google-apps/calendar/auth).
```javascript
var gcal = require('google-calendar');
var google_calendar = new gcal.GoogleCalendar(accessToken);
```
To get `accessToken`, use another authentication framework such as [passport](https://github.com/jaredhanson/passport) (recommended
, but not required) for OAuth 2.0 authentication. You can take look at the example code in [example](https://github.com/berryboy
/google-calendar/tree/master/example) folder.
```javascript
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var passport = require('passport');
...
function GoogleCalendar(access_token){ this.request = function(type, path, params, options, body, callback) { var url = 'https://www.googleapis.com/calendar/v3'+path+'?access_token='+access_token; params = params || {} options = options || {} options.json = true; type = type.toUpperCase(); if(body && typeof body !== 'string') body = JSON.stringify(body); for(var k in params){ url += '&'+encodeURIComponent(k)+'='+ encodeURIComponent(params[k]); } needle.request(type, url, body, options, responseHandler); function responseHandler(error, response, body) { if(error) return callback(error, body); if(body.error) return callback(body.error, null); return callback(null, body); } }; this.acl = new Acl(this.request); this.calendarList = new CalendarList(this.request); this.calendars = new Calendars(this.request); this.events = new Events(this.request); this.freebusy = new Freebusy(this.request); this.settings = new Settings(this.request); }
...
#### AccessToken & Authentication
This library requires Google API's [Access Token](https://developers.google.com/accounts/docs/OAuth2) with calendars [scope
](https://developers.google.com/google-apps/calendar/auth).
```javascript
var gcal = require('google-calendar');
var google_calendar = new gcal.GoogleCalendar(accessToken);
```
To get `accessToken`, use another authentication framework such as [passport](https://github.com/jaredhanson/passport) (recommended
, but not required) for OAuth 2.0 authentication. You can take look at the example code in [example](https://github.com/berryboy
/google-calendar/tree/master/example) folder.
```javascript
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var passport = require('passport');
...