Kubessandra / react-google-calendar-api

An api to manage your google calendar
MIT License
215 stars 88 forks source link

Resolve RGCA #56 "[CustomList] Mehtod to list events using input custom options" #58

Closed clariceabreu closed 3 years ago

clariceabreu commented 3 years ago

WHY

Currently, the only method to list events in the package is listUpcomingEvents() but it only receives maxResults parameter. This makes listing events using custom options impossible.

WHAT

This PR creates a new method that receives all the query options from params.

    /**
     * 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

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);
  });
clariceabreu commented 3 years ago

@Kubessandra @bateradt Can you approve this one, please? Now I'm pointing to master.

clariceabreu commented 3 years ago

@Kubessandra I think I don't have permission to merge. Can you do it for me, please? Besides that, how can I/we create a new release tag, so I can use the function in my application?

Kubessandra commented 3 years ago

I will merge this, build and update the package today

Kubessandra commented 3 years ago

The new version is 1.3.1, thank you for the contribution !

clariceabreu commented 3 years ago

Thank you for the approval and release!