Program for sync mystat schedule to google calendar
First you need to download the program to your computer:
$ git clone https://github.com/fan1ech00/mystat-google-calendar.git
To work with google calendar you need to create a google cloud project.
Before using Google Calendar API, you need to enable its in a Google Cloud project. Enable the API.
To authenticate as an end user and access user data in your app, you need to create OAuth 2.0 Client ID. A client ID is used to identify a single app to Google's OAuth servers.
- In the Google Cloud console, go to Menu > APIs & Services > Credentials. Go to Credentials
- Click Create Credentials > OAuth client ID.
- In the OAuth consent screen select External User Type
- In the Test Users Click Add user and enter the email with which you will log in
- Click Application type > Desktop app.
- In the Name field, type a name for the credential. This name is only shown in the Google Cloud console.
- Click Create. The OAuth client created screen appears, showing your new Client ID and Client secret.
- Click OK. The newly created credential appears under OAuth 2.0 Client IDs.
- Save the downloaded JSON file as
google-credentials.json
, and move the file to your working directory in theconfig/
folder.
- Sync event name, time, audience number and teacher's fullname
- Specifying a date range for sync
- Choosing a name for the calendar
- Ability to choose a name prefix for events
- Fast sync a lot of events, thanks to the use of the Google Batch Requests
const mystatCredentials = {
login: 'your_login',
password: 'your_pass',
};
const syncOptions = {
dateStart: DateTime.local(2023, 1, 1),
dateEnd: DateTime.local(2023, 12, 31),
calendarName: 'Mystat',
eventPrefix: 'Prefix | '
};
try {
const mystat = new Mystat();
await mystat.authorize(mystatCredentials);
const googleCalendar = new GoogleCalendar();
await googleCalendar.authorize();
await App.sync(mystat, googleCalendar, syncOptions);
} catch(err) {
console.log(err);
}