在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):wanasit/google-calendar开源软件地址(OpenSource Url):https://github.com/wanasit/google-calendar开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Google-CalendarGoogle Calendar library for Node.js npm install google-calendar For 0.0.x usersThis module (1.x.x) has been redesigned completely, so it is incompatible with the old version. The 0.0.x version is moved to branch name v0. UsageAccessToken & AuthenticationThis library requires Google API's Access Token with calendars scope. var gcal = require('google-calendar');
var google_calendar = new gcal.GoogleCalendar(accessToken); To get var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var passport = require('passport');
var gcal = require('google-calendar');
passport.use(new GoogleStrategy({
clientID: config.consumer_key,
clientSecret: config.consumer_secret,
callbackURL: "http://localhost:8082/auth/callback",
scope: ['openid', 'email', 'https://www.googleapis.com/auth/calendar']
},
function(accessToken, refreshToken, profile, done) {
//google_calendar = new gcal.GoogleCalendar(accessToken);
return done(null, profile);
}
)); API UsageThis library follows Google Calendar API v3 Reference. GoogleCalendar.Resource.Method( required_param1, required_param2, optional, callback ) For example var google_calendar = new gcal.GoogleCalendar(accessToken);
google_calendar.calendarList.list(function(err, calendarList) {
...
google_calendar.events.list(calendarId, function(err, calendarList) {
...
});
}); Running TestsThis library uses mocha test framework.
All test files are included in folder To run the test, you need to install the dev-dependencies.
You also need to fill Note: The process for getting those credentials is still complicated; I'll improve this later.
The testcase involves calling Google Calendar and takes a long time to complete. Thus, running mocha with a high timeout parameter (more than 6 seconds) is recommended.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论