Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-google-calendar-api
Advanced tools
An api to manage your google calendar
npm install --save react-google-calendar-api
import ApiCalendar from 'react-google-calendar-api';
import ApiCalendar from 'react-google-calendar-api/ApiCalendar';
Create a file apiGoogleconfig.json in the root directory with your googleApi clientId and ApiKey. https://console.developers.google.com/flows/enableapi?apiid=calendar.
{
"clientId": "<CLIENT_ID>",
"apiKey": "<API_KEY>",
"scope": "https://www.googleapis.com/auth/calendar",
"discoveryDocs": ["https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"]
}
/**
* Sign in with a Google account.
*/
public handleAuthClick(): void
/**
* Sign out user google account
*/
public handleSignoutClick(): void
import React, {ReactNode, SyntheticEvent} from 'react';
import ApiCalendar from 'react-google-calendar-api';
export default class DoubleButton extends React.Component {
constructor(props) {
super(props);
this.handleItemClick = this.handleItemClick.bind(this);
}
public handleItemClick(event: SyntheticEvent<any>, name: string): void {
if (name === 'sign-in') {
ApiCalendar.handleAuthClick();
} else if (name === 'sign-out') {
ApiCalendar.handleSignoutClick();
}
}
render(): ReactNode {
return (
<button
onClick={(e) => this.handleItemClick(e, 'sign-in')}
>
sign-in
</button>
<button
onClick={(e) => this.handleItemClick(e, 'sign-out')}
>
sign-out
</button>
);
}
}
/**
* Set the default attribute calendar
* @param {string} newCalendar ID.
*/
public setCalendar(newCalendar: string): void
You need to be registered with handleAuthClick.
/**
* Create calendar event
* @param {string} CalendarId for the event by default use 'primary'.
* @param {object} Event with start and end dateTime
* @returns {any} Promise on the event.
*/
public createEvent(event: object, calendarId: string = this.calendar): any {
/**
* Create an event from the current time for a certain period.
* @param {number} Time in minutes for the event
* @param {string} Summary(Title) of the event
* @param {string} Description of the event (optional)
* @param {string} CalendarId by default calendar set by setCalendar.
* @returns {any} Promise on the event.
*/
public createEventFromNow({time, summary, description = ''}: any, calendarId: string = this.calendar): any
import ApiCalendar from 'react-google-calendar-api';
const eventFromNow: object = {
summary: "Poc Dev From Now",
time: 480,
};
ApiCalendar.createEventFromNow(eventFromNow)
.then((result: object) => {
console.log(result);
})
.catch((error: any) => {
console.log(error);
});
/**
* List all events in the calendar
* @param {number} maxResults to see
* @param {string} calendarId to see by default use the calendar attribute
* @returns {any} Promise with the result.
*/
public listUpcomingEvents(maxResults: number, calendarId: string = this.calendar): any
import ApiCalendar from 'react-google-calendar-api';
if (ApiCalendar.sign)
ApiCalendar.listUpcomingEvents(10)
.then(({result}: any) => {
console.log(result.items);
});
/**
* Execute the callback function when a user is disconnected or connected with the sign status.
* @param callback
*/
public listenSign(callback: any): void
/**
* Execute the callback function when gapi is loaded (gapi needs to be loaded to use any other methods)
* @param callback
*/
public onLoad(callback: any): void
import React, {ReactNode} from 'react';
import ApiCalendar from 'react-google-calendar-api';
export default class StatusSign extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = {
sign: ApiCalendar.sign,
};
this.signUpdate = this.signUpdate.bind(this);
ApiCalendar.onLoad(() => {
ApiCalendar.listenSign(this.signUpdate);
});
}
public signUpdate(sign: boolean): any {
this.setState({
sign
})
}
render(): ReactNode {
return (
<div>{this.state.sign}</div>
);
}
}
FAQs
An api to manage your google calendar
The npm package react-google-calendar-api receives a total of 941 weekly downloads. As such, react-google-calendar-api popularity was classified as not popular.
We found that react-google-calendar-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.