<commit_before>"use strict";

var fs = require('fs');
var google = require('googleapis');
var ical = require('ical');

var config = require('./config');
var authorize = require('./authorize');

function sendEvents(user, calendar) {
	if (!(user in config.CALENDAR_ID)) {
		console.log('User: ' + user + ' does not have a CALENDAR_ID');
		return;
	}
	// Load client secrets from a local file.
	fs.readFile(config.CLIENT_SECRET, function(err, content) {
		if (err) {
			console.log('Error loading client secret file: ' + err);
			return;
		}
		// Authorize a client with the loaded credentials, then call the
		// Google Calendar API.
		authorize.authorize(JSON.parse(content), function(auth) {
			HandleAllEvents(user, calendar, auth);
		});
	});
}

function registerToken() {
	// Load client secrets from a local file.
	fs.readFile(config.CLIENT_SECRET, function(err, content) {
		if (err) {
			console.log('Error loading client secret file: ' + err);
			return;
		}
		// Authorize a client with the loaded credentials, then call the
		// Google Calendar API.
		authorize.authorize(JSON.parse(content), function(auth) {});
	});
}

function createSchedule() {
	let icalCreator = require('../ical/icalCreator');
	icalCreator.createSchedule(sendEvents);
}

function eventTimeout(user, event, auth, func) {
	return function() {
		func(user, event, auth);
	}
}

function addEvent(user, event, auth) {
	let json = event.toJSON();
	let calendar = google.calendar('v3');
	calendar.events.insert({
		auth: auth,
		calendarId: config.CALENDAR_ID[user],<commit_msg> - fixed bug (wrong include)<commit_after>"use strict";

var fs = require('fs');
var google = require('googleapis');
var ical = require('ical');

var config = require('./config');
var authorize = require('./authorize');

function sendEvents(user, calendar) {
	if (!(user in config.CALENDAR_ID)) {
		console.log('User: ' + user + ' does not have a CALENDAR_ID');
		return;
	}
	// Load client secrets from a local file.
	fs.readFile(config.CLIENT_SECRET, function(err, content) {
		if (err) {
			console.log('Error loading client secret file: ' + err);
			return;
		}
		// Authorize a client with the loaded credentials, then call the
		// Google Calendar API.
		authorize.authorize(JSON.parse(content), function(auth) {
			HandleAllEvents(user, calendar, auth);
		});
	});
}

function registerToken() {
	// Load client secrets from a local file.
	fs.readFile(config.CLIENT_SECRET, function(err, content) {
		if (err) {
			console.log('Error loading client secret file: ' + err);
			return;
		}
		// Authorize a client with the loaded credentials, then call the
		// Google Calendar API.
		authorize.authorize(JSON.parse(content), function(auth) {});
	});
}

function createSchedule() {
	let icalCreator = require('../ical/ical_creator');
	icalCreator.createSchedule(sendEvents);
}

function eventTimeout(user, event, auth, func) {
	return function() {
		func(user, event, auth);
	}
}

function addEvent(user, event, auth) {
	let json = event.toJSON();
	let calendar = google.calendar('v3');
	calendar.events.insert({
		auth: auth,
		calendarId: config.CALENDAR_ID[user],
{'fraction_non_alphanumeric': 0.14573991031390135, 'fraction_numerical': 0.0006406149903907751, 'mean_word_length': 4.284263959390863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7472258', 'n_tokens_mistral': 1051, 'n_tokens_neox': 990, 'n_words': 275}