Edits history of script submission #22374 for ' Create Quick Event (gcal)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    type Gcal = {
      token: string;
    };
    export async function main(
      gcal_auth: Gcal,
      calendarId: string,
      eventText: string,
    ) {
      const sendUpdates = "all";
    
      const QUICK_EVENT_URL = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events/quickAdd/?text=${eventText}&sendUpdates=${sendUpdates}`;
    
      const token = gcal_auth["token"];
    
      const response = await fetch(QUICK_EVENT_URL, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + token,
          "Content-Type": "application/json",
        },
      });
    
      const result = await response.json();
    
      return result;
    }
    

    Submitted by hugo989 6 days ago