{"id":22451460,"url":"https://github.com/kubessandra/react-google-calendar-api","last_synced_at":"2025-04-04T07:08:28.475Z","repository":{"id":37576822,"uuid":"130474899","full_name":"Kubessandra/react-google-calendar-api","owner":"Kubessandra","description":"An api to manage your google calendar","archived":false,"fork":false,"pushed_at":"2023-08-10T09:28:09.000Z","size":2282,"stargazers_count":217,"open_issues_count":20,"forks_count":88,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T07:08:24.636Z","etag":null,"topics":["google-api","google-calendar-api","manage","reactjs","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kubessandra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Kubessandra"]}},"created_at":"2018-04-21T13:12:00.000Z","updated_at":"2025-02-20T00:16:29.000Z","dependencies_parsed_at":"2024-06-18T14:00:10.688Z","dependency_job_id":"fcb0d75e-d304-4245-a3c6-b93c194c9d43","html_url":"https://github.com/Kubessandra/react-google-calendar-api","commit_stats":{"total_commits":127,"total_committers":13,"mean_commits":9.76923076923077,"dds":0.5511811023622047,"last_synced_commit":"87810fd17ff8b12359fe7ae9e14ae5a305151549"},"previous_names":["insomniiak/react-google-calendar-api"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kubessandra%2Freact-google-calendar-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kubessandra%2Freact-google-calendar-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kubessandra%2Freact-google-calendar-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kubessandra%2Freact-google-calendar-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kubessandra","download_url":"https://codeload.github.com/Kubessandra/react-google-calendar-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135144,"owners_count":20889421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-api","google-calendar-api","manage","reactjs","typescript"],"created_at":"2024-12-06T06:08:01.751Z","updated_at":"2025-04-04T07:08:28.446Z","avatar_url":"https://github.com/Kubessandra.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Kubessandra"],"categories":[],"sub_categories":[],"readme":"# react-google-calendar-api\n\n![Build Status](https://travis-ci.com/Insomniiak/react-google-calendar-api.svg?branch=master)\n![npm (custom registry)](https://img.shields.io/npm/l/express.svg?registry_uri=https%3A%2F%2Fregistry.npmjs.com)\n![npm (downloads)](https://img.shields.io/npm/dy/react-google-calendar-api.svg?style=popout)\n[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/react-google-calendar-api/community?utm_source=share-link\u0026utm_medium=link\u0026utm_campaign=share-link)\n\nAn api to manage your google calendar\n\n## Install\n\nNpm\n\n```\nnpm install --save react-google-calendar-api\n```\n\nyarn\n\n```\nyarn add react-google-calendar-api\n```\n\n## Use (Javascript / Typescript)\n\nYou will need to enable the \"Google Calendar API\"(https://console.developers.google.com/flows/enableapi?apiid=calendar.)\nYou will need a clientId and ApiKey from Google(https://developers.google.com/workspace/guides/create-credentials)\n\n```javascript\nimport ApiCalendar from \"react-google-calendar-api\";\n\nconst config = {\n  clientId: \"\u003cCLIENT_ID\u003e\",\n  apiKey: \"\u003cAPI_KEY\u003e\",\n  scope: \"https://www.googleapis.com/auth/calendar\",\n  discoveryDocs: [\n    \"https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest\",\n  ],\n};\n\nconst apiCalendar = new ApiCalendar(config);\n```\n\n## Setup\n\n### handleAuthClick:\n\n```javascript\n    /**\n     * Sign in with a Google account.\n     * @returns {any} A Promise that is fulfilled with the GoogleUser instance when the user successfully authenticates and grants the requested scopes, or rejected with an object containing an error property if an error happened\n     */\n    public handleAuthClick(): void\n```\n\n### handleSignOutClick:\n\n```javascript\n    /**\n     * Sign out user google account\n     */\n    public handleSignoutClick(): void\n```\n\n#### Example\n\n```javascript\n  import React, {ReactNode, SyntheticEvent} from 'react';\n  import ApiCalendar from 'react-google-calendar-api';\n\n  const config = {\n    \"clientId\": \"\u003cCLIENT_ID\u003e\",\n    \"apiKey\": \"\u003cAPI_KEY\u003e\",\n    \"scope\": \"https://www.googleapis.com/auth/calendar\",\n    \"discoveryDocs\": [\n      \"https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest\"\n    ]\n  }\n\n  const apiCalendar = new ApiCalendar(config)\n\n  export default class DoubleButton extends React.Component {\n      constructor(props) {\n        super(props);\n        this.handleItemClick = this.handleItemClick.bind(this);\n      }\n\n      public handleItemClick(event: SyntheticEvent\u003cany\u003e, name: string): void {\n        if (name === 'sign-in') {\n          apiCalendar.handleAuthClick()\n        } else if (name === 'sign-out') {\n          apiCalendar.handleSignoutClick();\n        }\n      }\n\n      render(): ReactNode {\n        return (\n              \u003cbutton\n                  onClick={(e) =\u003e this.handleItemClick(e, 'sign-in')}\n              \u003e\n                sign-in\n              \u003c/button\u003e\n              \u003cbutton\n                  onClick={(e) =\u003e this.handleItemClick(e, 'sign-out')}\n              \u003e\n                sign-out\n              \u003c/button\u003e\n          );\n      }\n  }\n```\n\n### setCalendar:\n\n```javascript\n    /**\n     * Set the default attribute calendar\n     * @param {string} newCalendar ID.\n     */\n    public setCalendar(newCalendar: string): void\n```\n\n## Manage Event\n\nYou need to be registered with handleAuthClick.\n\n### Create Event:\n\n```javascript\n    /**\n    * Create calendar event\n    * @param {string} CalendarId for the event by default use 'primary'.\n    * @param {object} Event with start and end dateTime\n    * @param {string} sendUpdates Acceptable values are: \"all\", \"externalOnly\", \"none\"\n    * @returns {any} Promise on the event.\n    */\n   public createEvent(event: object, calendarId: string = this.calendar, sendUpdates: string = 'none',): any\n```\n\n### Create Event From Now:\n\n```javascript\n     /**\n     * Create an event from the current time for a certain period.\n     * @param {number} Time in minutes for the event\n     * @param {string} Summary(Title) of the event\n     * @param {string} Description of the event (optional)\n     * @param {string} CalendarId by default calendar set by setCalendar.\n     * @param {string} timeZone The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. \"Europe/Zurich\".)\n     * @returns {any} Promise on the event.\n     */\n    public createEventFromNow({time, summary, description = ''}: any, calendarId: string = this.calendar, timeZone: string = \"Europe/Paris\"): any\n```\n\n### Create Event With Video Conference:\n\n```javascript\n     /**\n     * Create Calendar event with video conference\n     * @param {object} event with start and end dateTime\n     * @param {string} calendarId for the event.\n     * @param {string} sendUpdates Acceptable values are: \"all\", \"externalOnly\", \"none\"\n     * @returns {any}\n     */\n  public createEventWithVideoConference(\n    event: any,\n    calendarId: string = this.calendar,\n    sendUpdates: \"all\" | \"externalOnly\" | \"none\" = \"none\"\n  ): any\n```\n\n#### Example\n\n```javascript\nimport ApiCalendar from \"react-google-calendar-api\";\n\nconst config = {\n  clientId: \"\u003cCLIENT_ID\u003e\",\n  apiKey: \"\u003cAPI_KEY\u003e\",\n  scope: \"https://www.googleapis.com/auth/calendar\",\n  discoveryDocs: [\n    \"https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest\",\n  ],\n};\n\nconst apiCalendar = new ApiCalendar(config);\n\nconst eventFromNow: object = {\n  summary: \"Poc Dev From Now\",\n  time: 480,\n};\n\napiCalendar\n  .createEventFromNow(eventFromNow)\n  .then((result: object) =\u003e {\n    console.log(result);\n  })\n  .catch((error: any) =\u003e {\n    console.log(error);\n  });\n\nconst eventWithVideoConference: object = {\n  summary: \"Event With Google Meet Conference\",\n  start: {\n    dateTime: new Date().toISOString(),\n    timeZone: \"Europe/Paris\",\n  },\n  end: {\n    dateTime: new Date(new Date().getTime() + 3600000).toISOString(),\n    timeZone: \"Europe/Paris\",\n  },\n};\n\napiCalendar\n  .createEventWithVideoConference(eventWithVideoConference)\n  .then((result: object) =\u003e {\n    console.log(result);\n  })\n  .catch((error: any) =\u003e {\n    console.log(error);\n  });\n```\n\n### List All Upcoming Events:\n\n```javascript\n    /**\n     * List all events in the calendar\n     * @param {number} maxResults to see\n     * @param {string} calendarId to see by default use the calendar attribute\n     * @returns {any} Promise with the result.\n     */\n    public listUpcomingEvents(maxResults: number, calendarId: string = this.calendar): any\n```\n\n#### Example\n\n```javascript\n  // The user need to signIn with Handle AuthClick before\n  apiCalendar.listUpcomingEvents(10).then(({ result }: any) =\u003e {\n    console.log(result.items);\n```\n\n### List All Events:\n\n```javascript\n    /**\n     * List all events in the calendar queried by custom query options\n     * See all available options here https://developers.google.com/calendar/v3/reference/events/list\n     * @param {object} queryOptions to see\n     * @param {string} calendarId to see by default use the calendar attribute\n     * @returns {any}\n     */\n    public listEvents(queryOptions, calendarId = this.calendar): any\n```\n\n#### Example\n\n```javascript\n  // The user need to signIn with Handle AuthClick before\n  apiCalendar.listEvents({\n      timeMin: new Date()..toISOString(),\n      timeMax: new Date().addDays(10).toISOString(),\n      showDeleted: true,\n      maxResults: 10,\n      orderBy: 'updated'\n  }).then(({ result }: any) =\u003e {\n    console.log(result.items);\n  });\n```\n\n### Update Event\n\n```javascript\n   /**\n    * Update Calendar event\n    * @param {string} calendarId for the event.\n    * @param {string} eventId of the event.\n    * @param {object} event with details to update, e.g. summary\n    * @param {string} sendUpdates Acceptable values are: \"all\", \"externalOnly\", \"none\"\n    * @returns {any} Promise object with result\n    */\n   public updateEvent(event: object, eventId: string, calendarId: string = this.calendar, sendUpdates: string = 'none'): any\n```\n\n#### Example\n\n```javascript\nconst event = {\n  summary: \"New Event Title\",\n};\n\napiCalendar.updateEvent(event, \"2eo85lmjkkd2i63uo3lhi8a2cq\").then(console.log);\n```\n\n### Delete Event\n\n```javascript\n   /**\n   * Delete an event in the calendar.\n   * @param {string} eventId of the event to delete.\n   * @param {string} calendarId where the event is.\n   * @returns {any} Promise resolved when the event is deleted.\n   */\n   public deleteEvent(eventId: string, calendarId: string = this.calendar): any\n```\n\n#### Example\n\n```javascript\napiCalendar.deleteEvent(\"2eo85lmjkkd2i63uo3lhi8a2cq\").then(console.log);\n```\n\n### Get Event\n\n```javascript\n   /**\n   * Get Calendar event\n   * @param {string} calendarId for the event.\n   * @param {string} eventId specifies individual event\n   * @returns {any}\n   */\n   public getEvent(eventId: string, calendarId: string = this.calendar): any\n```\n\n#### Example\n\n```javascript\napiCalendar.getEvent(\"2eo85lmjkkd2i63uo3lhi8a2cq\").then(console.log);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubessandra%2Freact-google-calendar-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubessandra%2Freact-google-calendar-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubessandra%2Freact-google-calendar-api/lists"}