Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Filter attendees in Google Calendar Api

I use google calendar api to import events into Google Sheet. I'm trying to omit event.creator from representation if he isn't a participant (for example assistant created an event) and can't find the solution.

I'm new to programming, so I just suppose I need to add a filter or write a new function.

Here is the snippet:

    function transformCalendarEvents(rawCalendarEvents) {
  /**
   *
   * @param {Calendar_v3.Calendar.V3.Schema.Event} event
   * @return {EventAttendee[]}
   */
  function getEventAttendees(event){
    /**
     *
     * @param {Object} event
     * @return {EventAttendee}
     */    
    function createEventAttendee(srcAttendee) {
      return {
        name: srcAttendee.displayName,
        email: srcAttendee.email,
        responseStatus: srcAttendee.responseStatus,
        organizer: srcAttendee.organizer || false,
        optional: srcAttendee.optional || false,
      }
    }

    let attendees = event.attendees || []

    if (event.creator && !attendees.map(a => a.email).includes(event.creator.email)) {
      attendees.push({
        ...event.creator,
        organizer: true,
        optional: false,
        responseStatus: event.creator.responseStatus || 'declined',
      })
    }

    if (event.organizer && !attendees.map(a => a.email).includes(event.organizer.email)) {
      attendees.push({
        ...event.organizer,
        organizer: true,
        optional: false,
        responseStatus: event.creator.responseStatus || 'declined',
      })
    }

    attendees = attendees.filter(
      atd => atd.email.indexOf('@resource.calendar.google.com') == -1
    ).sort(
      (a1, a2) => +!!a2.organizer - +!!a1.organizer
    )

    return attendees.map(createEventAttendee) 
  }

Any help would be appreciated

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!