1.1.1 • Published 4 years ago

google-calender-package v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

NPM package calendar

Installation

  • clone this package
  • npm pack
  • npm link
  • pwd //take the link to root project
  • in your root project run npm i path to package

Usage

import {CalendarFacade} from 'calendar'

const newObj=new CalendarFacade();

oauth Configuration

 const credentials = {
    "installed": {
                 "client_id": "",
        "project_id": "",
         "auth_uri": "https://accounts.google.com/o/oauth2/auth"
         "token_uri": "https://oauth2.googleapis.com/token",
         "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
         "client_secret": "Jwcvq_Ta5VEjnCpZ3Z-XNewO",
         "redirect_uris": [
            "urn:ietf:wg:oauth:2.0:oob",
             "http://localhost"
         ]
     }
 } -->

 const token = {
     "access_token": "",//accestoken 
     "refresh_token": "",//refreshtoken
     "scope": "https://www.googleapis.com/auth/calendar",
     "token_type": "Bearer",
     "expiry_date": 1570383252847
 }
}

// const oauthobj = newObj.oauthConfig(credentials, token);

CREATE CALENDAR EVENT

const data = {
     summary: 'event 1 test 1',
     location: '800 Howard St., San Francisco, CA 94103',
     description: 'This is a chance for test calendar.',
    start: {
         dateTime: '2019-10-14T12:00:00-07:00',
         timeZone: 'Time zone in India (GMT+5:30) ',
     },
     end: {
         dateTime: '2019-10-14T12:00:00-07:00',
         timeZone: 'Time zone in India (GMT+5:30) ',
     },
     eventId: 'event458',
     attendees: [
         { email: 'sp@outlook.com' },
         { email: 'sbrin@example.com' },
     ],
     reminders: {
         overrides: [
             { method: 'email', minutes: 24 * 60 },
             { method: 'popup', minutes: 10 }
         ],

         useDefault: false,
     }
 }


 newObj.createEvent(oauthobj, data, eventdetails, ((err, res) => {

     if (err) {
         console.log(err);
     }
     else {
         console.log(res);
     }
 }));