react-google-calendar-api
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -28,2 +28,3 @@ 'use strict'; | ||
this.listUpcomingEvents = this.listUpcomingEvents.bind(this); | ||
this.listEvents = this.listEvents.bind(this); | ||
this.createEventFromNow = this.createEventFromNow.bind(this); | ||
@@ -184,2 +185,25 @@ this.listenSign = this.listenSign.bind(this); | ||
/** | ||
* List all events in the calendar queried by custom query options | ||
* See all available options here https://developers.google.com/calendar/v3/reference/events/list | ||
* @param {object} queryOptions to see | ||
* @param {string} calendarId to see by default use the calendar attribute | ||
* @returns {any} | ||
*/ | ||
}, { | ||
key: 'listEvents', | ||
value: function listEvents(queryOptions) { | ||
var calendarId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.calendar; | ||
if (this.gapi) { | ||
return this.gapi.client.calendar.events.list({ | ||
'calendarId': calendarId, | ||
...queryOptions | ||
}); | ||
} else { | ||
console.log('Error: this.gapi not loaded'); | ||
return false; | ||
} | ||
} | ||
/** | ||
* Create an event from the current time for a certain period | ||
@@ -186,0 +210,0 @@ * @param {number} time in minutes for the event |
@@ -16,3 +16,3 @@ # Contributing | ||
**2** - Each Pull Request should have its own issue created and referenced in every commit. All branches | ||
should start from `development` branch. Naming convention for the issue is `[(THEME)] (TITLE)` and Branch Naming | ||
should start from `master` branch. Naming convention for the issue is `[(THEME)] (TITLE)` and Branch Naming | ||
should be `(TYPE)/(PROJECT_ID)-(ISSUE_NUMBER)-(TITLE)`. As an example, if you want to add | ||
@@ -19,0 +19,0 @@ something related with Redux, Issue name can be `[Redux] Add Reducer`, and Branch should be |
{ | ||
"name": "react-google-calendar-api", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "An api to manage your google calendar", | ||
@@ -5,0 +5,0 @@ "main": "./build/ApiCalendar.js", |
@@ -182,2 +182,28 @@ # react-google-calendar-api | ||
### List All Events: | ||
```javascript | ||
/** | ||
* List all events in the calendar queried by custom query options | ||
* See all available options here https://developers.google.com/calendar/v3/reference/events/list | ||
* @param {object} queryOptions to see | ||
* @param {string} calendarId to see by default use the calendar attribute | ||
* @returns {any} | ||
*/ | ||
public listEvents(queryOptions, calendarId = this.calendar): any | ||
``` | ||
#### Example | ||
```javascript | ||
import ApiCalendar from 'react-google-calendar-api'; | ||
if (ApiCalendar.sign) | ||
ApiCalendar.listEvents({ | ||
timeMin: new Date()..toISOString(), | ||
timeMax: new Date().addDays(10).toISOString(), | ||
showDeleted: true, | ||
maxResults: 10, | ||
orderBy: 'updated' | ||
}).then(({ result }: any) => { | ||
console.log(result.items); | ||
}); | ||
``` | ||
### Update Event | ||
@@ -184,0 +210,0 @@ |
@@ -15,2 +15,3 @@ const Config = require('../../../apiGoogleconfig.json'); | ||
this.listUpcomingEvents = this.listUpcomingEvents.bind(this); | ||
this.listEvents = this.listEvents.bind(this); | ||
this.createEventFromNow = this.createEventFromNow.bind(this); | ||
@@ -148,2 +149,18 @@ this.listenSign = this.listenSign.bind(this); | ||
/** | ||
* List all events in the calendar queried by custom query options | ||
* See all available options here https://developers.google.com/calendar/v3/reference/events/list | ||
* @param {object} queryOptions to see | ||
* @param {string} calendarId to see by default use the calendar attribute | ||
* @returns {any} | ||
*/ | ||
listEvents(queryOptions, calendarId = this.calendar) { | ||
if (this.gapi) { | ||
return this.gapi.client.calendar.events.list(Object.assign({ calendarId }, queryOptions)); | ||
} | ||
else { | ||
console.log('Error: this.gapi not loaded'); | ||
return false; | ||
} | ||
} | ||
/** | ||
* Create an event from the current time for a certain period | ||
@@ -150,0 +167,0 @@ * @param {number} time in minutes for the event |
@@ -17,2 +17,3 @@ const Config = require('../../../apiGoogleconfig.json'); | ||
this.listUpcomingEvents = this.listUpcomingEvents.bind(this); | ||
this.listEvents = this.listEvents.bind(this); | ||
this.createEventFromNow = this.createEventFromNow.bind(this); | ||
@@ -159,2 +160,21 @@ this.listenSign = this.listenSign.bind(this); | ||
/** | ||
* List all events in the calendar queried by custom query options | ||
* See all available options here https://developers.google.com/calendar/v3/reference/events/list | ||
* @param {object} queryOptions to see | ||
* @param {string} calendarId to see by default use the calendar attribute | ||
* @returns {any} | ||
*/ | ||
public listEvents(queryOptions: object,calendarId: string = this.calendar): any { | ||
if (this.gapi) { | ||
return this.gapi.client.calendar.events.list({ | ||
calendarId, | ||
...queryOptions | ||
}); | ||
} else { | ||
console.log('Error: this.gapi not loaded'); | ||
return false; | ||
} | ||
} | ||
/** | ||
* Create an event from the current time for a certain period | ||
@@ -161,0 +181,0 @@ * @param {number} time in minutes for the event |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46804
936
360