/** Module: CalendarApp */ type CalendarApp = typeof CalendarApp; declare namespace CalendarApp { /** * Creates a new all-day event. * *
* // Creates an all-day event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
* new Date('July 20, 1969'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param date - the date of the event (only the day is used; the time is ignored)
*
* @returns the created event
*/
function createAllDayEvent(
title: string,
date: Date
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
* new Date('August 15, 1969'),
* new Date('August 18, 1969'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startDate - the date when the event starts (only the day is used; the time is ignored)
* @param endDate - the date when the event ends (only the day is used; the time is ignored)
*
* @returns the created event
*/
function createAllDayEvent(
title: string,
startDate: Date,
endDate: Date
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
* new Date('August 15, 1969'),
* new Date('August 18, 1969'),
* {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startDate - the date when the event starts (only the day is used; the time is ignored)
* @param endDate - the date when the event ends (only the day is used; the time is ignored)
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
function createAllDayEvent(
title: string,
startDate: Date,
endDate: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
* new Date('July 20, 1969'),
* {location: 'The Moon'});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param date - the date of the event (only the day is used; the time is ignored)
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
function createAllDayEvent(
title: string,
date: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event series.
*
*
* // Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
* new Date('January 2, 2013 03:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014')));
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startDate - the date of the first event in the series (only the day is used; the time is
* ignored)
* @param recurrence - the recurrence settings of the event series
*
* @returns the created event series
*/
function createAllDayEventSeries(
title: string,
startDate: Date,
recurrence: CalendarApp.EventRecurrence
): CalendarApp.CalendarEventSeries
/**
* Creates a new all-day event series.
*
*
* // Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
* new Date('January 2, 2013 03:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014')),
* {guests: 'everyone@example.com'});
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startDate - the date of the first event in the series (only the day is used; the time is
* ignored)
* @param recurrence - the recurrence settings of the event series
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event series
*/
function createAllDayEventSeries(
title: string,
startDate: Date,
recurrence: CalendarApp.EventRecurrence,
options: object
): CalendarApp.CalendarEventSeries
/**
* Creates a new calendar, owned by the user.
*
*
* // Creates a new calendar named "Travel Plans".
* var calendar = CalendarApp.createCalendar('Travel Plans');
* Logger.log('Created the calendar "%s", with the ID "%s".',
* calendar.getName(), calendar.getId());
*
*
* @param name - the name of the new calendar
*
* @returns the newly created calendar
*/
function createCalendar(
name: string
): CalendarApp.Calendar
/**
* Creates a new calendar, owned by the user.
*
*
* // Creates a new calendar named "Travel Plans" with a summary and color.
* var calendar = CalendarApp.createCalendar('Travel Plans', {
* summary: 'A calendar to plan my travel schedule.',
* color: CalendarApp.Color.BLUE
* });
* Logger.log('Created the calendar "%s", with the ID "%s".',
* calendar.getName(), calendar.getId());
*
*
* @param name - the name of the new calendar
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the newly created calendar
*/
function createCalendar(
name: string,
options: object
): CalendarApp.Calendar
/**
* Creates a new event.
*
* If no time zone is specified, the time values are interpreted in the context of the script's * time zone, which may be different than the calendar's time zone. * *
* // Creates an event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
* new Date('July 20, 1969 20:00:00 UTC'),
* new Date('July 21, 1969 21:00:00 UTC'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startTime - the date and time when the event starts
* @param endTime - the date and time when the event ends
*
* @returns the created event
*/
function createEvent(
title: string,
startTime: Date,
endTime: Date
): CalendarApp.CalendarEvent
/**
* Creates a new event.
*
* If no time zone is specified, the time values are interpreted in the context of the script's * time zone, which may be different than the calendar's time zone. * *
* // Creates an event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
* new Date('July 20, 1969 20:00:00 UTC'),
* new Date('July 20, 1969 21:00:00 UTC'),
* {location: 'The Moon'});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startTime - the date and time when the event starts
* @param endTime - the date and time when the event ends
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
function createEvent(
title: string,
startTime: Date,
endTime: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates an event from a free-form description.
*
* The description should use the same format as the UI's "Quick Add" feature. * *
* // Creates a new event and logs its ID.
* var event = CalendarApp.getDefaultCalendar()
* .createEventFromDescription('Lunch with Mary, Friday at 1PM');
* Logger.log('Event ID: ' + event.getId());
*
*
* @param description - a free-form description of the event
*
* @returns the created event
*/
function createEventFromDescription(
description: string
): CalendarApp.CalendarEvent
/**
* Creates a new event series.
*
*
* // Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
* new Date('January 1, 2013 03:00:00 PM EST'),
* new Date('January 1, 2013 04:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
* .until(new Date('January 1, 2014')));
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startTime - the date and time when the first event in the series starts
* @param endTime - the date and time when the first event in the series ends
* @param recurrence - the recurrence settings of the event series
*
* @returns the created event series
*/
function createEventSeries(
title: string,
startTime: Date,
endTime: Date,
recurrence: CalendarApp.EventRecurrence
): CalendarApp.CalendarEventSeries
/**
* Creates a new event series.
*
*
* // Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
* new Date('January 1, 2013 03:00:00 PM EST'),
* new Date('January 1, 2013 04:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
* .until(new Date('January 1, 2014')),
* {location: 'Conference Room'});
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startTime - the date and time when the first event in the series starts
* @param endTime - the date and time when the first event in the series ends
* @param recurrence - the recurrence settings of the event series
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event series
*/
function createEventSeries(
title: string,
startTime: Date,
endTime: Date,
recurrence: CalendarApp.EventRecurrence,
options: object
): CalendarApp.CalendarEventSeries
/**
* Gets all calendars that the user owns or is subscribed to.
*
*
* // Determines how many calendars the user can access.
* var calendars = CalendarApp.getAllCalendars();
* Logger.log('This user owns or is subscribed to %s calendars.',
* calendars.length);
*
*
* @returns all calendars that the user can access
*/
function getAllCalendars(): CalendarApp.Calendar[]
/**
* Gets all calendars that the user owns.
*
*
* // Determines how many calendars the user owns.
* var calendars = CalendarApp.getAllOwnedCalendars();
* Logger.log('This user owns %s calendars.', calendars.length);
*
*
* @returns all calendars that the user owns
*/
function getAllOwnedCalendars(): CalendarApp.Calendar[]
/**
* Gets the calendar with the given ID.
*
*
* // Gets the public calendar "US Holidays" by ID.
* var calendar = CalendarApp.getCalendarById(
* 'en.usa#holiday@group.v.calendar.google.com');
* Logger.log('The calendar is named "%s".', calendar.getName());
*
*
* @param id - the calendar ID
*
* @returns the calendar with the given ID, or null if the calendar does not exist, if the
* user cannot access it, or if the user is not subscribed to the calendar
*/
function getCalendarById(
id: string
): CalendarApp.Calendar
/**
* Gets all calendars with a given name that the user owns or is subscribed to. Names are not
* case-sensitive.
*
*
* // Gets the public calendar named "US Holidays".
* var calendars = CalendarApp.getCalendarsByName('US Holidays');
* Logger.log('Found %s matching calendars.', calendars.length);
*
*
* @param name - the calendar name
*
* @returns all calendars with this name that the user can access
*/
function getCalendarsByName(
name: string
): CalendarApp.Calendar[]
/**
* Gets the color of the calendar.
*
* @returns a hexadecimal color string ("#rrggbb")
*/
function getColor(): string
/**
* Gets the user's default calendar.
*
*
* // Determines the time zone of the user's default calendar.
* var calendar = CalendarApp.getDefaultCalendar();
* Logger.log('My default calendar is set to the time zone "%s".',
* calendar.getTimeZone());
*
*
* @returns the user's default calendar
*/
function getDefaultCalendar(): CalendarApp.Calendar
/**
* Gets the description of the calendar.
*
* @returns the description of this calendar
*/
function getDescription(): string
/**
* Gets the event with the given ID. If the series belongs to a calendar other than the default
* calendar, this method must be called from that CalendarApp. Calling getEventById(iCalId) only
* returns an event in the default calendar.
*
* Multiple events may have the same ID if they are part of an event series. In this case this
* method returns only the first event from that series.
*
* @param iCalId - ID of the event
*
* @returns the event with the given ID, or null if the event doesn't exist or the user
* cannot access it.
*/
function getEventById(
iCalId: string
): CalendarApp.CalendarEvent
/**
* Gets the event series with the given ID. If the ID given is for a single CalendarEvent,
* then a CalendarEventSeries is returned with a single event in the series. Note that if
* the event series belongs to a calendar other than the default calendar, this method must be
* called from that CalendarApp; calling getEventSeriesById(iCalId)
* directly only returns an event series that exists in the default calendar.
*
* @param iCalId - ID of the event series
*
* @returns the series with the given ID, or null if the series doesn't exist or the user
* cannot access it
*/
function getEventSeriesById(
iCalId: string
): CalendarApp.CalendarEventSeries
/**
* Gets all events that occur within a given time range.
*
*
This method returns events that start during the given time range, end during the time * range, or encompass the time range. If no time zone is specified, the time values are * interpreted in the context of the script's time zone, which may be different from the * calendar's time zone. * *
* // Determines how many events are happening in the next two hours.
* var now = new Date();
* var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
* var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow);
* Logger.log('Number of events: ' + events.length);
*
*
* @param startTime - the start of the time range
* @param endTime - the end of the time range, non-inclusive
*
* @returns the events that occur within the time range
*/
function getEvents(
startTime: Date,
endTime: Date
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur within a given time range and meet the specified criteria.
*
* This method returns events that start during the given time range, ends during the time * range, or encompasses the time range. If no time zone is specified, the time values are * interpreted in the context of the script's time zone, which may be different from the * calendar's time zone. * *
Be aware that filtering on author, search, or statusFilters takes
* place after applying start and max. This means that the number of events
* returned may be less than max, even though additional events meet the criteria.
*
*
* // Determines how many events are happening in the next two hours that contain the term
* // "meeting".
* var now = new Date();
* var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
* var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow,
* {search: 'meeting'});
* Logger.log('Number of events: ' + events.length);
*
*
* @param startTime - the start of the time range
* @param endTime - the end of the time range, non-inclusive
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the events that take place within the time range and match the criteria
*/
function getEvents(
startTime: Date,
endTime: Date,
options: object
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur on a given day.
*
* This method returns events if they start during the given day, end during the day, or * encompass the day. * *
Note that only the date portion of the Date object is used, and the time portion is ignored. * The date is interpreted as midnight that day to midnight the next day in the calendar's time * zone. * *
* // Determines how many events are happening today.
* var today = new Date();
* var events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
* Logger.log('Number of events: ' + events.length);
*
*
* @param date - the date to retrieve events for (only the day is used; the time is ignored)
*
* @returns the events that occur on the given date
*/
function getEventsForDay(
date: Date
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur on a given day and meet specified criteria.
*
* This method returns events if they start during the given day, end during the day, or * encompass the day. * *
Note that only the date portion of the Date object is used, and the time portion is ignored. * The date is interpreted as midnight that day to midnight the next day in the calendar's time * zone. * *
Be aware that filtering on author, search, or statusFilters takes
* place after applying start and max. This means that the number of events
* returned may be less than max, even though additional events meet the criteria.
*
*
* // Determines how many events are happening today and contain the term "meeting".
* var today = new Date();
* var events = CalendarApp.getDefaultCalendar().getEventsForDay(today, {search: 'meeting'});
* Logger.log('Number of events: ' + events.length);
*
*
* @param date - the date to retrieve events for (only the day is used; the time is ignored)
* @param options - advanced filtering options
*
* @returns the events that occur on the given date and match the criteria
*/
function getEventsForDay(
date: Date,
options: object
): CalendarApp.CalendarEvent[]
/**
* Gets the ID of the calendar. The ID for a user's default calendar is their email address.
*
* @returns the ID of the calendar
*/
function getId(): string
/**
* Gets the name of the calendar.
*
* @returns this calendar's name
*/
function getName(): string
/**
* Gets the calendar with the given ID, if the user owns it.
*
* To find a calendar ID, click the arrow next to the calendar's name in Google Calendar and * select Calendar settings. The ID is shown near the bottom of the settings * page. * *
* // Gets a (non-existent) private calendar by ID.
* var calendar = CalendarApp.getOwnedCalendarById(
* '123456789@group.calendar.google.com');
* Logger.log('The calendar is named "%s".', calendar.getName());
*
*
* @param id - the calendar id
*
* @returns the calendar with the given ID, or null if the calendar does not exist or the
* user does not own it
*/
function getOwnedCalendarById(
id: string
): CalendarApp.Calendar
/**
* Gets all calendars with a given name that the user owns. Names are not case-sensitive.
*
*
* // Gets a private calendar named "Travel Plans".
* var calendars = CalendarApp.getOwnedCalendarsByName('Travel Plans');
* Logger.log('Found %s matching calendars.', calendars.length);
*
*
* @param name - the calendar name
*
* @returns all calendars with this name that the user owns
*/
function getOwnedCalendarsByName(
name: string
): CalendarApp.Calendar[]
/**
* Gets the time zone of the calendar.
*
* @returns the time zone, specified in "long" format (e.g., "America/New_York", as listed by Joda.org)
*/
function getTimeZone(): string
/**
* Determines whether the calendar is hidden in the user interface.
*
* @returns true if the calendar is hidden in the user interface; false if not
*/
function isHidden(): Boolean
/**
* Determines whether the calendar is the default calendar for the effective user.
*
* @returns true if the calendar is the default calendar for the effective user; false if not
*/
function isMyPrimaryCalendar(): Boolean
/**
* Determines whether the calendar is owned by the effective user.
*
* @returns true if the calendar is owned by the effective user; false if not
*/
function isOwnedByMe(): Boolean
/**
* Determines whether the calendar's events are displayed in the user interface.
*
* @returns true if the calendar's events are displayed in the user interface; false if not
*/
function isSelected(): Boolean
/**
* Creates a new recurrence object, which can be used to create rules for event recurrence.
*
*
* // Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014'));
* var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
* new Date('January 2, 2013 03:00:00 PM EST'),
* recurrence);
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @returns a new recurrence object with no rules set (behaves as a weekly recurrence)
*/
function newRecurrence(): CalendarApp.EventRecurrence
/**
* Sets the color of the calendar.
*
* @param color - a hexadecimal color string ("#rrggbb") or a value from CalendarApp.Colors
*
* @returns this calendar for chaining
*/
function setColor(
color: string
): CalendarApp.Calendar
/**
* Sets the description of the calendar.
*
* @param description - the description of this calendar
*
* @returns this calendar for chaining
*/
function setDescription(
description: string
): CalendarApp.Calendar
/**
* Sets whether the calendar is visible in the user interface.
*
* @param hidden - true to hide the calendar in the user interface; false to show it
*
* @returns this calendar for chaining
*/
function setHidden(
hidden: Boolean
): CalendarApp.Calendar
/**
* Sets the name of the calendar.
*
* @param name - the new name
*
* @returns this calendar for chaining
*/
function setName(
name: string
): CalendarApp.Calendar
/**
* Sets whether the calendar's events are displayed in the user interface.
*
* @param selected - true to show the calendar's events in the user interface; false
* to hide them
*
* @returns this calendar for chaining
*/
function setSelected(
selected: Boolean
): CalendarApp.Calendar
/**
* Sets the time zone of the calendar.
*
* @param timeZone - the time zone, specified in "long" format (e.g., "America/New_York", as listed
* by Joda.org)
*
* @returns this calendar for chaining
*/
function setTimeZone(
timeZone: string
): CalendarApp.Calendar
/**
* Subscribes the user to the calendar with the given ID, if the user is allowed to subscribe.
*
*
* // Subscribe to the calendar "US Holidays".
* var calendar = CalendarApp.subscribeToCalendar(
* 'en.usa#holiday@group.v.calendar.google.com');
* Logger.log('Subscribed to the calendar "%s".', calendar.getName());
*
*
* @param id - the ID of the calendar to subscribe to
*
* @returns the newly subscribed to calendar
*/
function subscribeToCalendar(
id: string
): CalendarApp.Calendar
/**
* Subscribes the user to the calendar with the given ID, if the user is allowed to subscribe.
*
*
* // Subscribe to the calendar "US Holidays", and set it to the color blue.
* var calendar = CalendarApp.subscribeToCalendar(
* 'en.usa#holiday@group.v.calendar.google.com',
* { color: CalendarApp.Color.BLUE });
* Logger.log('Subscribed to the calendar "%s".', calendar.getName());
*
*
* @param id - the ID of the calendar to subscribe to
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the newly subscribed calendar
*/
function subscribeToCalendar(
id: string,
options: object
): CalendarApp.Calendar
class Calendar {
private constructor();
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
* new Date('July 20, 1969'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param date - the date of the event (only the day is used; the time is ignored)
*
* @returns the created event
*/
createAllDayEvent(
title: string,
date: Date
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
* new Date('August 15, 1969'),
* new Date('August 18, 1969'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startDate - the date when the event starts (only the day is used; the time is ignored)
* @param endDate - the date when the event ends (only the day is used; the time is ignored)
*
* @returns the created event
*/
createAllDayEvent(
title: string,
startDate: Date,
endDate: Date
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
* new Date('August 15, 1969'),
* new Date('August 18, 1969'),
* {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startDate - the date when the event starts (only the day is used; the time is ignored)
* @param endDate - the date when the event ends (only the day is used; the time is ignored)
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
createAllDayEvent(
title: string,
startDate: Date,
endDate: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event.
*
*
* // Creates an all-day event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
* new Date('July 20, 1969'),
* {location: 'The Moon'});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param date - the date of the event (only the day is used; the time is ignored)
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
createAllDayEvent(
title: string,
date: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates a new all-day event series.
*
*
* // Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
* new Date('January 2, 2013 03:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014')));
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startDate - the date of the first event in the series (only the day is used; the time is
* ignored)
* @param recurrence - the recurrence settings of the event series
*
* @returns the created event series
*/
createAllDayEventSeries(
title: string,
startDate: Date,
recurrence: CalendarApp.EventRecurrence
): CalendarApp.CalendarEventSeries
/**
* Creates a new all-day event series.
*
*
* // Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
* new Date('January 2, 2013 03:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014')),
* {guests: 'everyone@example.com'});
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startDate - the date of the first event in the series (only the day is used; the time is
* ignored)
* @param recurrence - the recurrence settings of the event series
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event series
*/
createAllDayEventSeries(
title: string,
startDate: Date,
recurrence: CalendarApp.EventRecurrence,
options: object
): CalendarApp.CalendarEventSeries
/**
* Creates a new event.
*
* If no time zone is specified, the time values are interpreted in the context of the script's * time zone, which may be different than the calendar's time zone. * *
* // Creates an event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
* new Date('July 20, 1969 20:00:00 UTC'),
* new Date('July 21, 1969 21:00:00 UTC'));
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startTime - the date and time when the event starts
* @param endTime - the date and time when the event ends
*
* @returns the created event
*/
createEvent(
title: string,
startTime: Date,
endTime: Date
): CalendarApp.CalendarEvent
/**
* Creates a new event.
*
* If no time zone is specified, the time values are interpreted in the context of the script's * time zone, which may be different than the calendar's time zone. * *
* // Creates an event for the moon landing and logs the ID.
* var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
* new Date('July 20, 1969 20:00:00 UTC'),
* new Date('July 20, 1969 21:00:00 UTC'),
* {location: 'The Moon'});
* Logger.log('Event ID: ' + event.getId());
*
*
* @param title - the title of the event
* @param startTime - the date and time when the event starts
* @param endTime - the date and time when the event ends
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event
*/
createEvent(
title: string,
startTime: Date,
endTime: Date,
options: object
): CalendarApp.CalendarEvent
/**
* Creates an event from a free-form description.
*
* The description should use the same format as the UI's "Quick Add" feature. * *
* // Creates a new event and logs its ID.
* var event = CalendarApp.getDefaultCalendar()
* .createEventFromDescription('Lunch with Mary, Friday at 1PM');
* Logger.log('Event ID: ' + event.getId());
*
*
* @param description - a free-form description of the event
*
* @returns the created event
*/
createEventFromDescription(
description: string
): CalendarApp.CalendarEvent
/**
* Creates a new event series.
*
*
* // Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
* new Date('January 1, 2013 03:00:00 PM EST'),
* new Date('January 1, 2013 04:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
* .until(new Date('January 1, 2014')));
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startTime - the date and time when the first event in the series starts
* @param endTime - the date and time when the first event in the series ends
* @param recurrence - the recurrence settings of the event series
*
* @returns the created event series
*/
createEventSeries(
title: string,
startTime: Date,
endTime: Date,
recurrence: CalendarApp.EventRecurrence
): CalendarApp.CalendarEventSeries
/**
* Creates a new event series.
*
*
* // Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
* new Date('January 1, 2013 03:00:00 PM EST'),
* new Date('January 1, 2013 04:00:00 PM EST'),
* CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
* .until(new Date('January 1, 2014')),
* {location: 'Conference Room'});
* Logger.log('Event Series ID: ' + eventSeries.getId());
*
*
* @param title - the title of the events in the series
* @param startTime - the date and time when the first event in the series starts
* @param endTime - the date and time when the first event in the series ends
* @param recurrence - the recurrence settings of the event series
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the created event series
*/
createEventSeries(
title: string,
startTime: Date,
endTime: Date,
recurrence: CalendarApp.EventRecurrence,
options: object
): CalendarApp.CalendarEventSeries
/**
* Deletes the calendar permanently. A user can only delete a calendar they own.
*/
deleteCalendar(): void
/**
* Gets the color of the calendar.
*
* @returns a hexadecimal color string ("#rrggbb")
*/
getColor(): string
/**
* Gets the description of the calendar.
*
* @returns the description of this calendar
*/
getDescription(): string
/**
* Gets the event with the given ID. If the series belongs to a calendar other than the default
* calendar, this method must be called from that Calendar. Calling CalendarApp.getEventById(iCalId) only
* returns an event in the default calendar.
*
* Multiple events may have the same ID if they are part of an event series. In this case this
* method returns only the first event from that series.
*
* @param iCalId - ID of the event
*
* @returns the event with the given ID, or null if the event doesn't exist or the user
* cannot access it.
*/
getEventById(
iCalId: string
): CalendarApp.CalendarEvent
/**
* Gets the event series with the given ID. If the ID given is for a single CalendarEvent,
* then a CalendarEventSeries is returned with a single event in the series. Note that if
* the event series belongs to a calendar other than the default calendar, this method must be
* called from that Calendar; calling CalendarApp.getEventSeriesById(iCalId)
* directly only returns an event series that exists in the default calendar.
*
* @param iCalId - ID of the event series
*
* @returns the series with the given ID, or null if the series doesn't exist or the user
* cannot access it
*/
getEventSeriesById(
iCalId: string
): CalendarApp.CalendarEventSeries
/**
* Gets all events that occur within a given time range.
*
*
This method returns events that start during the given time range, end during the time * range, or encompass the time range. If no time zone is specified, the time values are * interpreted in the context of the script's time zone, which may be different from the * calendar's time zone. * *
* // Determines how many events are happening in the next two hours.
* var now = new Date();
* var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
* var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow);
* Logger.log('Number of events: ' + events.length);
*
*
* @param startTime - the start of the time range
* @param endTime - the end of the time range, non-inclusive
*
* @returns the events that occur within the time range
*/
getEvents(
startTime: Date,
endTime: Date
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur within a given time range and meet the specified criteria.
*
* This method returns events that start during the given time range, ends during the time * range, or encompasses the time range. If no time zone is specified, the time values are * interpreted in the context of the script's time zone, which may be different from the * calendar's time zone. * *
Be aware that filtering on author, search, or statusFilters takes
* place after applying start and max. This means that the number of events
* returned may be less than max, even though additional events meet the criteria.
*
*
* // Determines how many events are happening in the next two hours that contain the term
* // "meeting".
* var now = new Date();
* var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
* var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow,
* {search: 'meeting'});
* Logger.log('Number of events: ' + events.length);
*
*
* @param startTime - the start of the time range
* @param endTime - the end of the time range, non-inclusive
* @param options - a JavaScript object that specifies advanced parameters, as listed below
*
* @returns the events that take place within the time range and match the criteria
*/
getEvents(
startTime: Date,
endTime: Date,
options: object
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur on a given day.
*
* This method returns events if they start during the given day, end during the day, or * encompass the day. * *
Note that only the date portion of the Date object is used, and the time portion is ignored. * The date is interpreted as midnight that day to midnight the next day in the calendar's time * zone. * *
* // Determines how many events are happening today.
* var today = new Date();
* var events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
* Logger.log('Number of events: ' + events.length);
*
*
* @param date - the date to retrieve events for (only the day is used; the time is ignored)
*
* @returns the events that occur on the given date
*/
getEventsForDay(
date: Date
): CalendarApp.CalendarEvent[]
/**
* Gets all events that occur on a given day and meet specified criteria.
*
* This method returns events if they start during the given day, end during the day, or * encompass the day. * *
Note that only the date portion of the Date object is used, and the time portion is ignored. * The date is interpreted as midnight that day to midnight the next day in the calendar's time * zone. * *
Be aware that filtering on author, search, or statusFilters takes
* place after applying start and max. This means that the number of events
* returned may be less than max, even though additional events meet the criteria.
*
*
* // Determines how many events are happening today and contain the term "meeting".
* var today = new Date();
* var events = CalendarApp.getDefaultCalendar().getEventsForDay(today, {search: 'meeting'});
* Logger.log('Number of events: ' + events.length);
*
*
* @param date - the date to retrieve events for (only the day is used; the time is ignored)
* @param options - advanced filtering options
*
* @returns the events that occur on the given date and match the criteria
*/
getEventsForDay(
date: Date,
options: object
): CalendarApp.CalendarEvent[]
/**
* Gets the ID of the calendar. The ID for a user's default calendar is their email address.
*
* @returns the ID of the calendar
*/
getId(): string
/**
* Gets the name of the calendar.
*
* @returns this calendar's name
*/
getName(): string
/**
* Gets the time zone of the calendar.
*
* @returns the time zone, specified in "long" format (e.g., "America/New_York", as listed by Joda.org)
*/
getTimeZone(): string
/**
* Determines whether the calendar is hidden in the user interface.
*
* @returns true if the calendar is hidden in the user interface; false if not
*/
isHidden(): Boolean
/**
* Determines whether the calendar is the default calendar for the effective user.
*
* @returns true if the calendar is the default calendar for the effective user; false if not
*/
isMyPrimaryCalendar(): Boolean
/**
* Determines whether the calendar is owned by the effective user.
*
* @returns true if the calendar is owned by the effective user; false if not
*/
isOwnedByMe(): Boolean
/**
* Determines whether the calendar's events are displayed in the user interface.
*
* @returns true if the calendar's events are displayed in the user interface; false if not
*/
isSelected(): Boolean
/**
* Sets the color of the calendar.
*
* @param color - a hexadecimal color string ("#rrggbb") or a value from CalendarApp.Colors
*
* @returns this calendar for chaining
*/
setColor(
color: string
): CalendarApp.Calendar
/**
* Sets the description of the calendar.
*
* @param description - the description of this calendar
*
* @returns this calendar for chaining
*/
setDescription(
description: string
): CalendarApp.Calendar
/**
* Sets whether the calendar is visible in the user interface.
*
* @param hidden - true to hide the calendar in the user interface; false to show it
*
* @returns this calendar for chaining
*/
setHidden(
hidden: Boolean
): CalendarApp.Calendar
/**
* Sets the name of the calendar.
*
* @param name - the new name
*
* @returns this calendar for chaining
*/
setName(
name: string
): CalendarApp.Calendar
/**
* Sets whether the calendar's events are displayed in the user interface.
*
* @param selected - true to show the calendar's events in the user interface; false
* to hide them
*
* @returns this calendar for chaining
*/
setSelected(
selected: Boolean
): CalendarApp.Calendar
/**
* Sets the time zone of the calendar.
*
* @param timeZone - the time zone, specified in "long" format (e.g., "America/New_York", as listed
* by Joda.org)
*
* @returns this calendar for chaining
*/
setTimeZone(
timeZone: string
): CalendarApp.Calendar
/**
* Unsubscribes the user from the calendar. A user cannot unsubscribe from a calendar they own.
*/
unsubscribeFromCalendar(): void
}
class CalendarEvent {
private constructor();
/**
* Adds a new email reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEvent for chaining
*/
addEmailReminder(
minutesBefore: number
): CalendarApp.CalendarEvent
/**
* Adds a guest to the event.
*
* @param email - the email address of the guest
*
* @returns this CalendarEvent for chaining
*/
addGuest(
email: string
): CalendarApp.CalendarEvent
/**
* Adds a new popup reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEvent for chaining
*/
addPopupReminder(
minutesBefore: number
): CalendarApp.CalendarEvent
/**
* Adds a new SMS reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEvent for chaining
*/
addSmsReminder(
minutesBefore: number
): CalendarApp.CalendarEvent
/**
* Determines whether anyone can invite themselves.
*
* @returns true if non-guests can add themselves to the event; false if not
*/
anyoneCanAddSelf(): Boolean
/**
* Deletes the event.
*/
deleteEvent(): void
/**
* Deletes a key/value tag from the event.
*
* @param key - the tag key
*
* @returns this CalendarEvent for chaining
*/
deleteTag(
key: string
): CalendarApp.CalendarEvent
/**
* Gets the date on which this all-day calendar event ends. (If this is not an all-day event, then
* this method throws an exception.) The returned Date represents midnight at the
* beginning of the day after the event ends in the script's time zone. To use the
* calendar's time zone instead, call getEndTime().
*
* @returns this all-day calendar event's end date
*/
getAllDayEndDate(): Date
/**
* Gets the date on which this all-day calendar event begins. (If this is not an all-day event,
* then this method throws an exception.) The returned Date represents midnight at the
* beginning of the day on which the event starts in the script's time zone. To use the
* calendar's time zone instead, call getStartTime().
*
* @returns this all-day calendar event's start date
*/
getAllDayStartDate(): Date
/**
* Gets all keys for tags that have been set on the event.
*
* @returns an array of string keys
*/
getAllTagKeys(): string[]
/**
* Returns the color of the calendar event.
*
* @returns the string representation of the event color, as an index (1-11) of values from CalendarApp.EventColors
*/
getColor(): string
/**
* Gets the creators of the event.
*
* @returns the email addresses of the event's creators
*/
getCreators(): string[]
/**
* Gets the date the event was created.
*
* @returns the date of creation
*/
getDateCreated(): Date
/**
* Gets the description of the event.
*
* @returns the description
*/
getDescription(): string
/**
* Gets the minute values for all email reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getEmailReminders(): number[]
/**
* Gets the date and time at which this calendar event ends. For non–all-day events, this is
* the instant in time at which the event was defined to end. For all-day events, which only store
* an end date (not a date and time), this is midnight at the beginning of the day after the event
* ends in the calendar's time zone. This allows meaningful comparison of end times for
* all types of events; however, it does not necessarily preserve the original day-of-year
* unmodified.
*
* For all-day events, getAllDayEndDate() should almost
* always be called in preference to this method.
*
* @returns this calendar event's end time
*/
getEndTime(): Date
/**
* Gets the series of recurring events that this event belongs to. A CalendarEventSeries
* object is returned even if this event doesn't belong to a series, so that you can add new
* recurrence settings.
*
* @returns the event series this event belongs to, or a new event series if it does not yet belong
* to a series
*/
getEventSeries(): CalendarApp.CalendarEventSeries
/**
* Gets a guest by email address.
*
* @param email - the address of the guest
*
* @returns the guest, or null if the email address does not correspond to a guest
*/
getGuestByEmail(
email: string
): CalendarApp.EventGuest
/**
* Gets the guests for the event, not including the event owner.
*
* @returns an array of the guests
*/
getGuestList(): CalendarApp.EventGuest[]
/**
* Gets the guests for the event, potentially including the event owners.
*
* @param includeOwner - whether to include the owners as a guest
*
* @returns an array of the guests
*/
getGuestList(
includeOwner: Boolean
): CalendarApp.EventGuest[]
/**
* Gets the unique iCalUID of the event. Note that the iCalUID and the event id used by the Calendar v3 API and Calendar advanced service are not identical and
* cannot be used interchangebly. One difference in their semantics is that in recurring events
* all occurrences of one event have different ids while they all share the same iCalUIDs.
*
* @returns the iCalUID of the event
*/
getId(): string
/**
* Gets the date the event was last updated.
*
* @returns the last updated date
*/
getLastUpdated(): Date
/**
* Gets the location of the event.
*
* @returns the event location
*/
getLocation(): string
/**
* Gets the event status (attending, etc.) of the effective user. Always returns GuestStatus.OWNER if the effective user is the owner of the event.
*
* @returns the status
*/
getMyStatus(): CalendarApp.GuestStatus
/**
* Get the ID of the calendar where this event was originally created.
*
* @returns the ID of the original calendar
*/
getOriginalCalendarId(): string
/**
* Gets the minute values for all popup reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getPopupReminders(): number[]
/**
* Gets the minute values for all SMS reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getSmsReminders(): number[]
/**
* Gets the date and time at which this calendar event begins. For non–all-day events, this
* is the instant in time at which the event was defined to start. For all-day events, which only
* store a start date (not a date and time), this is midnight at the beginning of the day on which
* the event starts in the calendar's time zone. This allows meaningful comparison of
* start times for all types of events; however, it is not necessarily preserve the original
* day-of-year unmodified.
*
*
For all-day events, getAllDayStartDate() should
* almost always be called in preference to this method.
*
* @returns this calendar event's start time
*/
getStartTime(): Date
/**
* Gets a tag value of the event.
*
* @param key - the key
*
* @returns the tag value
*/
getTag(
key: string
): string
/**
* Gets the title of the event.
*
* @returns the title
*/
getTitle(): string
/**
* Gets the visibility of the event.
*
* @returns the visibility value
*/
getVisibility(): CalendarApp.Visibility
/**
* Determines whether guests can invite other guests.
*
* @returns true if guests can invite others; false if not
*/
guestsCanInviteOthers(): Boolean
/**
* Determines whether guests can modify the event.
*
* @returns true if guests can modify the event; false if not
*/
guestsCanModify(): Boolean
/**
* Determines whether guests can see other guests.
*
* @returns true if guests can see other guests; false if not
*/
guestsCanSeeGuests(): Boolean
/**
* Determines whether this is an all-day event.
*
* @returns true if the event is all-day; false if not
*/
isAllDayEvent(): Boolean
/**
* Determines whether the event is owned by the effective user.
*
* @returns true if the event is owned by the effective user; false if not
*/
isOwnedByMe(): Boolean
/**
* Determines whether the event is part of an event series.
*
* @returns true if the event is part of an event series; false if not
*/
isRecurringEvent(): Boolean
/**
* Removes all reminders from the event.
*
* @returns this CalendarEvent for chaining
*/
removeAllReminders(): CalendarApp.CalendarEvent
/**
* Removes a guest from the event.
*
* @param email - the email address of the guest
*
* @returns this CalendarEvent for chaining
*/
removeGuest(
email: string
): CalendarApp.CalendarEvent
/**
* Resets the reminders using the calendar's default settings.
*
* @returns this CalendarEvent for chaining
*/
resetRemindersToDefault(): CalendarApp.CalendarEvent
/**
* Sets the date of the event. Applying this method changes a regular event into an all-day event.
*
* @param date - the date for the event (the time is ignored)
*
* @returns this CalendarEvent for chaining
*/
setAllDayDate(
date: Date
): CalendarApp.CalendarEvent
/**
* Sets the dates of the event. Applying this method changes a regular event into an all-day
* event.
*
* @param startDate - the date when the event starts (the time is ignored)
* @param endDate - the date when the event ends (the time is ignored)
*
* @returns this CalendarEvent for chaining
*/
setAllDayDates(
startDate: Date,
endDate: Date
): CalendarApp.CalendarEvent
/**
* Sets whether non-guests can add themselves to the event.
*
* @param anyoneCanAddSelf - whether anyone can invite themselves
*
* @returns this CalendarEvent for chaining
*/
setAnyoneCanAddSelf(
anyoneCanAddSelf: Boolean
): CalendarApp.CalendarEvent
/**
* Sets the color of the calendar event.
*
* @param color - an integer color index as a string, or a value from CalendarApp.EventColors
*
* @returns this calendar event, for chaining
*/
setColor(
color: string
): CalendarApp.CalendarEvent
/**
* Sets the description of the event.
*
* @param description - the new description
*
* @returns this CalendarEvent for chaining
*/
setDescription(
description: string
): CalendarApp.CalendarEvent
/**
* Sets whether guests can invite other guests.
*
* @param guestsCanInviteOthers - whether guests can invite others
*
* @returns this CalendarEvent for chaining
*/
setGuestsCanInviteOthers(
guestsCanInviteOthers: Boolean
): CalendarApp.CalendarEvent
/**
* Sets whether guests can modify the event.
*
* @param guestsCanModify - whether guests can modify the event
*
* @returns this CalendarEvent for chaining
*/
setGuestsCanModify(
guestsCanModify: Boolean
): CalendarApp.CalendarEvent
/**
* Sets whether guests can see other guests.
*
* @param guestsCanSeeGuests - whether guests can see others
*
* @returns this CalendarEvent for chaining
*/
setGuestsCanSeeGuests(
guestsCanSeeGuests: Boolean
): CalendarApp.CalendarEvent
/**
* Sets the location of the event.
*
* @param location - the new location
*
* @returns this CalendarEvent for chaining
*/
setLocation(
location: string
): CalendarApp.CalendarEvent
/**
* Sets the event status (attending, etc.) of the effective user.
*
* @param status - the new status
*
* @returns this CalendarEvent for chaining
*/
setMyStatus(
status: CalendarApp.GuestStatus
): CalendarApp.CalendarEvent
/**
* Sets a key/value tag on the event, for storing custom metadata.
*
* @param key - the tag key
* @param value - the tag value
*
* @returns this CalendarEvent for chaining
*/
setTag(
key: string,
value: string
): CalendarApp.CalendarEvent
/**
* Sets the dates and times for the start and end of the event. Applying this method changes an
* all-day event into a regular event.
*
* @param startTime - the new start of the event
* @param endTime - the new end of the event
*
* @returns this CalendarEvent for chaining
*/
setTime(
startTime: Date,
endTime: Date
): CalendarApp.CalendarEvent
/**
* Sets the title of the event.
*
* @param title - the new title
*
* @returns this CalendarEvent for chaining
*/
setTitle(
title: string
): CalendarApp.CalendarEvent
/**
* Sets the visibility of the event.
*
* @param visibility
*
* @returns this CalendarEvent for chaining
*/
setVisibility(
visibility: CalendarApp.Visibility
): CalendarApp.CalendarEvent
}
class CalendarEventSeries {
private constructor();
/**
* Adds a new email reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEventSeries for chaining
*/
addEmailReminder(
minutesBefore: number
): CalendarApp.CalendarEventSeries
/**
* Adds a guest to the event.
*
* @param email - the email address of the guest
*
* @returns this CalendarEventSeries for chaining
*/
addGuest(
email: string
): CalendarApp.CalendarEventSeries
/**
* Adds a new popup reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEventSeries for chaining
*/
addPopupReminder(
minutesBefore: number
): CalendarApp.CalendarEventSeries
/**
* Adds a new SMS reminder to the event. The reminder must be at least 5 minutes, and at most 4
* weeks (40320 minutes), before the event.
*
* @param minutesBefore - the number of minutes before the event
*
* @returns this CalendarEventSeries for chaining
*/
addSmsReminder(
minutesBefore: number
): CalendarApp.CalendarEventSeries
/**
* Determines whether anyone can invite themselves.
*
* @returns true if non-guests can add themselves to the event; false if not
*/
anyoneCanAddSelf(): Boolean
/**
* Deletes the event series.
*/
deleteEventSeries(): void
/**
* Deletes a key/value tag from the event.
*
* @param key - the tag key
*
* @returns this CalendarEventSeries for chaining
*/
deleteTag(
key: string
): CalendarApp.CalendarEventSeries
/**
* Gets all keys for tags that have been set on the event.
*
* @returns an array of string keys
*/
getAllTagKeys(): string[]
/**
* Returns the color of the calendar event.
*
* @returns the string representation of the event color, as an index (1-11) of values from CalendarApp.EventColors
*/
getColor(): string
/**
* Gets the creators of the event.
*
* @returns the email addresses of the event's creators
*/
getCreators(): string[]
/**
* Gets the date the event was created.
*
* @returns the date of creation
*/
getDateCreated(): Date
/**
* Gets the description of the event.
*
* @returns the description
*/
getDescription(): string
/**
* Gets the minute values for all email reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getEmailReminders(): number[]
/**
* Gets a guest by email address.
*
* @param email - the address of the guest
*
* @returns the guest, or null if the email address does not correspond to a guest
*/
getGuestByEmail(
email: string
): CalendarApp.EventGuest
/**
* Gets the guests for the event, not including the event owner.
*
* @returns an array of the guests
*/
getGuestList(): CalendarApp.EventGuest[]
/**
* Gets the guests for the event, potentially including the event owners.
*
* @param includeOwner - whether to include the owners as a guest
*
* @returns an array of the guests
*/
getGuestList(
includeOwner: Boolean
): CalendarApp.EventGuest[]
/**
* Gets the unique iCalUID of the event. Note that the iCalUID and the event id used by the Calendar v3 API and Calendar advanced service are not identical and
* cannot be used interchangebly. One difference in their semantics is that in recurring events
* all occurrences of one event have different ids while they all share the same iCalUIDs.
*
* @returns the iCalUID of the event
*/
getId(): string
/**
* Gets the date the event was last updated.
*
* @returns the last updated date
*/
getLastUpdated(): Date
/**
* Gets the location of the event.
*
* @returns the event location
*/
getLocation(): string
/**
* Gets the event status (attending, etc.) of the effective user. Always returns GuestStatus.OWNER if the effective user is the owner of the event.
*
* @returns the status
*/
getMyStatus(): CalendarApp.GuestStatus
/**
* Get the ID of the calendar where this event was originally created.
*
* @returns the ID of the original calendar
*/
getOriginalCalendarId(): string
/**
* Gets the minute values for all popup reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getPopupReminders(): number[]
/**
* Gets the minute values for all SMS reminders for the event.
*
* @returns an array in which each value corresponds to the number of minutes before the event that
* a reminder triggers
*/
getSmsReminders(): number[]
/**
* Gets a tag value of the event.
*
* @param key - the key
*
* @returns the tag value
*/
getTag(
key: string
): string
/**
* Gets the title of the event.
*
* @returns the title
*/
getTitle(): string
/**
* Gets the visibility of the event.
*
* @returns the visibility value
*/
getVisibility(): CalendarApp.Visibility
/**
* Determines whether guests can invite other guests.
*
* @returns true if guests can invite others; false if not
*/
guestsCanInviteOthers(): Boolean
/**
* Determines whether guests can modify the event.
*
* @returns true if guests can modify the event; false if not
*/
guestsCanModify(): Boolean
/**
* Determines whether guests can see other guests.
*
* @returns true if guests can see other guests; false if not
*/
guestsCanSeeGuests(): Boolean
/**
* Determines whether the event is owned by the effective user.
*
* @returns true if the event is owned by the effective user; false if not
*/
isOwnedByMe(): Boolean
/**
* Removes all reminders from the event.
*
* @returns this CalendarEventSeries for chaining
*/
removeAllReminders(): CalendarApp.CalendarEventSeries
/**
* Removes a guest from the event.
*
* @param email - the email address of the guest
*
* @returns this CalendarEventSeries for chaining
*/
removeGuest(
email: string
): CalendarApp.CalendarEventSeries
/**
* Resets the reminders using the calendar's default settings.
*
* @returns this CalendarEventSeries for chaining
*/
resetRemindersToDefault(): CalendarApp.CalendarEventSeries
/**
* Sets whether non-guests can add themselves to the event.
*
* @param anyoneCanAddSelf - whether anyone can invite themselves
*
* @returns this CalendarEventSeries for chaining
*/
setAnyoneCanAddSelf(
anyoneCanAddSelf: Boolean
): CalendarApp.CalendarEventSeries
/**
* Sets the color of the calendar event.
*
* @param color - an integer color index as a string, or a value from CalendarApp.EventColors
*
* @returns this calendar event, for chaining
*/
setColor(
color: string
): CalendarApp.CalendarEventSeries
/**
* Sets the description of the event.
*
* @param description - the new description
*
* @returns this CalendarEventSeries for chaining
*/
setDescription(
description: string
): CalendarApp.CalendarEventSeries
/**
* Sets whether guests can invite other guests.
*
* @param guestsCanInviteOthers - whether guests can invite others
*
* @returns this CalendarEventSeries for chaining
*/
setGuestsCanInviteOthers(
guestsCanInviteOthers: Boolean
): CalendarApp.CalendarEventSeries
/**
* Sets whether guests can modify the event.
*
* @param guestsCanModify - whether guests can modify the event
*
* @returns this CalendarEventSeries for chaining
*/
setGuestsCanModify(
guestsCanModify: Boolean
): CalendarApp.CalendarEventSeries
/**
* Sets whether guests can see other guests.
*
* @param guestsCanSeeGuests - whether guests can see others
*
* @returns this CalendarEventSeries for chaining
*/
setGuestsCanSeeGuests(
guestsCanSeeGuests: Boolean
): CalendarApp.CalendarEventSeries
/**
* Sets the location of the event.
*
* @param location - the new location
*
* @returns this CalendarEventSeries for chaining
*/
setLocation(
location: string
): CalendarApp.CalendarEventSeries
/**
* Sets the event status (attending, etc.) of the effective user.
*
* @param status - the new status
*
* @returns this CalendarEventSeries for chaining
*/
setMyStatus(
status: CalendarApp.GuestStatus
): CalendarApp.CalendarEventSeries
/**
* Sets the recurrence rules for an all-day event series. Applying this method changes a regular
* event series into an all-day event series.
*
*
* // Sets the events in a series to take place every Wednesday in 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
* var startDate = new Date('January 2, 2013 03:00:00 PM EST');
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
* .until(new Date('January 1, 2014'));
* eventSeries.setRecurrence(recurrence, startDate);
*
*
* @param recurrence - the recurrence rules to use
* @param startDate - the date of the first event in the series (only the day is used; the time is
* ignored)
*
* @returns this CalendarEventSeries for chaining
*/
setRecurrence(
recurrence: CalendarApp.EventRecurrence,
startDate: Date
): CalendarApp.CalendarEventSeries
/**
* Sets the recurrence rules for this event series. Applying this method changes an all-day event
* series into a regular event series.
*
*
* // Sets the events in a series to take place from 3pm to 4pm every Tuesday and Thursday in
* // 2013.
* var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
* var startTime = new Date('January 1, 2013 03:00:00 PM EST');
* var endTime = new Date('January 1, 2013 04:00:00 PM EST');
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
* .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
* .until(new Date('January 1, 2014'));
* eventSeries.setRecurrence(recurrence, startTime, endTime);
*
*
* @param recurrence - the recurrence rules to use
* @param startTime - the date and time when the first event in the series starts
* @param endTime - the date and time when the first event in the series ends
*
* @returns this CalendarEventSeries for chaining
*/
setRecurrence(
recurrence: CalendarApp.EventRecurrence,
startTime: Date,
endTime: Date
): CalendarApp.CalendarEventSeries
/**
* Sets a key/value tag on the event, for storing custom metadata.
*
* @param key - the tag key
* @param value - the tag value
*
* @returns this CalendarEventSeries for chaining
*/
setTag(
key: string,
value: string
): CalendarApp.CalendarEventSeries
/**
* Sets the title of the event.
*
* @param title - the new title
*
* @returns this CalendarEventSeries for chaining
*/
setTitle(
title: string
): CalendarApp.CalendarEventSeries
/**
* Sets the visibility of the event.
*
* @param visibility
*
* @returns this CalendarEventSeries for chaining
*/
setVisibility(
visibility: CalendarApp.Visibility
): CalendarApp.CalendarEventSeries
}
enum Color {
/**
* #2952A3).
*/
BLUE = "BLUE",
/**
* #8D6F47).
*/
BROWN = "BROWN",
/**
* #4E5D6C).
*/
CHARCOAL = "CHARCOAL",
/**
* #865A5A).
*/
CHESTNUT = "CHESTNUT",
/**
* #5A6986).
*/
GRAY = "GRAY",
/**
* #0D7813).
*/
GREEN = "GREEN",
/**
* #5229A3).
*/
INDIGO = "INDIGO",
/**
* #528800).
*/
LIME = "LIME",
/**
* #88880E).
*/
MUSTARD = "MUSTARD",
/**
* #6E6E41).
*/
OLIVE = "OLIVE",
/**
* #BE6D00).
*/
ORANGE = "ORANGE",
/**
* #B1365F).
*/
PINK = "PINK",
/**
* #705770).
*/
PLUM = "PLUM",
/**
* #7A367A).
*/
PURPLE = "PURPLE",
/**
* #A32929).
*/
RED = "RED",
/**
* #B1440E).
*/
RED_ORANGE = "RED_ORANGE",
/**
* #29527A).
*/
SEA_BLUE = "SEA_BLUE",
/**
* #4A716C).
*/
SLATE = "SLATE",
/**
* #28754E).
*/
TEAL = "TEAL",
/**
* #1B887A).
*/
TURQOISE = "TURQOISE",
/**
* #AB8B00).
*/
YELLOW = "YELLOW",
}
enum EventColor {
/**
* "9").
*/
BLUE = "BLUE",
/**
* "7").
*/
CYAN = "CYAN",
/**
* "8").
*/
GRAY = "GRAY",
/**
* "10").
*/
GREEN = "GREEN",
/**
* "3").
*/
MAUVE = "MAUVE",
/**
* "6").
*/
ORANGE = "ORANGE",
/**
* "1").
*/
PALE_BLUE = "PALE_BLUE",
/**
* "2").
*/
PALE_GREEN = "PALE_GREEN",
/**
* "4").
*/
PALE_RED = "PALE_RED",
/**
* "11").
*/
RED = "RED",
/**
* "5").
*/
YELLOW = "YELLOW",
}
class EventGuest {
private constructor();
/**
* Gets the number of additional people that this guest has said are attending.
*
* @returns the number of additional people this guest has said are attending
*/
getAdditionalGuests(): number
/**
* Gets the email address of the guest.
*
* @returns the guest's email address
*/
getEmail(): string
/**
* Gets the status of the guest for the event.
*
* @returns the status of this guest
*/
getGuestStatus(): CalendarApp.GuestStatus
/**
* Gets the name of the guest. If the name of the guest is not available, this method returns the
* guest's email address.
*
* @returns the guest's name, or the guest's email address if the name is not available
*/
getName(): string
/**
* Gets the status of the guest for the event.
*
* @returns the status of this guest
*/
getStatus(): string
}
class EventRecurrence {
private constructor();
/**
* Adds a rule that excludes occurrences on a daily basis.
*
*
* // Creates a rule that recurs every week after the first 30 days.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().addDailyExclusion().times(30);
*
*
* @returns the new RecurrenceRule
*/
addDailyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a daily basis.
*
*
* // Creates a rule that recurs every day for ten days.
* var recurrence = CalendarApp.newRecurrence().addDailyRule().times(10);
*
*
* @returns the new RecurrenceRule
*/
addDailyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a specific date.
*
* @param date
*
* @returns this EventRecurrence for chaining
*/
addDate(
date: Date
): CalendarApp.EventRecurrence
/**
* Adds a rule that excludes an occurrence for a specific date.
*
* @param date
*
* @returns this EventRecurrence for chaining
*/
addDateExclusion(
date: Date
): CalendarApp.EventRecurrence
/**
* Adds a rule that excludes occurrences on a monthly basis.
*
* By default the exclusion is applied on the same day of the month as the first event in the
* series, but this can be altered by calling RecurrenceRule.onlyOnMonthDay(day) or RecurrenceRule.onlyOnMonthDays(days).
*
* @returns the new RecurrenceRule
*/
addMonthlyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a monthly basis.
*
*
By default the event recurs on the same day of the month as the first event in the series,
* but this can be altered by calling RecurrenceRule.onlyOnMonthDay(day) or RecurrenceRule.onlyOnMonthDays(days).
*
*
* // Creates a rule that recurs every month for three months.
* var recurrence = CalendarApp.newRecurrence().addMonthlyRule().times(4);
*
*
* @returns the new RecurrenceRule
*/
addMonthlyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that excludes occurrences on a weekly basis.
*
* By default the exclusion is applied on the same day of the week as the first event in the
* series, but this can be altered by calling RecurrenceRule.onlyOnWeekday(day) or RecurrenceRule.onlyOnWeekdays(days).
*
*
* // Creates a rule that recurs every day except the first four Wednesdays.
* var recurrence = CalendarApp.newRecurrence().addDailyRule()
* .addWeeklyExclusion().onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY).times(4);
*
*
* @returns the new RecurrenceRule
*/
addWeeklyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a weekly basis.
*
* By default the event recurs on the same day of the week as the first event in the series,
* but this can be altered by calling RecurrenceRule.onlyOnWeekday(day) or RecurrenceRule.onlyOnWeekdays(days).
*
*
* // Creates a rule that recurs every week for ten weeks.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().times(10);
*
*
* @returns the new RecurrenceRule
*/
addWeeklyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that excludes occurrences on a yearly basis.
*
* By default the exclusion is applied on the same day of the year as the first event in the
* series, but this can be altered by calling RecurrenceRule.onlyOnYearDay(day) or RecurrenceRule.onlyOnYearDays(days).
*
* @returns the new RecurrenceRule
*/
addYearlyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a yearly basis.
*
*
By default the event recurs on the same day of the year as the first event in the series,
* but this can be altered by calling RecurrenceRule.onlyOnYearDay(day) or RecurrenceRule.onlyOnYearDays(days).
*
* @returns the new RecurrenceRule
*/
addYearlyRule(): CalendarApp.RecurrenceRule
/**
* Sets the time zone for this recurrence. This affects the date and time that events recur on,
* and whether the event shifts with daylight savings time. Defaults to the calendar's time zone.
*
* @param timeZone - the time zone, specified in "long" format (e.g., 'America/New_York', as listed
* by Joda.org)
*
* @returns this EventRecurrence for chaining
*/
setTimeZone(
timeZone: string
): CalendarApp.EventRecurrence
}
enum GuestStatus {
/**
* The guest has been invited, but has not indicated whether he or she is attending.
*/
INVITED = "INVITED",
/**
* The guest has indicated he or she might attend.
*/
MAYBE = "MAYBE",
/**
* The guest has indicated he or she is not attending.
*/
NO = "NO",
/**
* The guest is the owner of the event.
*/
OWNER = "OWNER",
/**
* The guest has indicated he or she is attending.
*/
YES = "YES",
}
class RecurrenceRule {
private constructor();
/**
* Adds a rule that excludes occurrences on a daily basis.
*
*
* // Creates a rule that recurs every week after the first 30 days.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().addDailyExclusion().times(30);
*
*
* @returns the new RecurrenceRule
*/
addDailyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a daily basis.
*
*
* // Creates a rule that recurs every day for ten days.
* var recurrence = CalendarApp.newRecurrence().addDailyRule().times(10);
*
*
* @returns the new RecurrenceRule
*/
addDailyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a specific date.
*
* @param date
*
* @returns this EventRecurrence for chaining
*/
addDate(
date: Date
): CalendarApp.EventRecurrence
/**
* Adds a rule that excludes an occurrence for a specific date.
*
* @param date
*
* @returns this EventRecurrence for chaining
*/
addDateExclusion(
date: Date
): CalendarApp.EventRecurrence
/**
* Adds a rule that excludes occurrences on a monthly basis.
*
* By default the exclusion is applied on the same day of the month as the first event in the
* series, but this can be altered by calling onlyOnMonthDay(day) or onlyOnMonthDays(days).
*
* @returns the new RecurrenceRule
*/
addMonthlyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a monthly basis.
*
*
By default the event recurs on the same day of the month as the first event in the series,
* but this can be altered by calling onlyOnMonthDay(day) or onlyOnMonthDays(days).
*
*
* // Creates a rule that recurs every month for three months.
* var recurrence = CalendarApp.newRecurrence().addMonthlyRule().times(4);
*
*
* @returns the new RecurrenceRule
*/
addMonthlyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that excludes occurrences on a weekly basis.
*
* By default the exclusion is applied on the same day of the week as the first event in the
* series, but this can be altered by calling onlyOnWeekday(day) or onlyOnWeekdays(days).
*
*
* // Creates a rule that recurs every day except the first four Wednesdays.
* var recurrence = CalendarApp.newRecurrence().addDailyRule()
* .addWeeklyExclusion().onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY).times(4);
*
*
* @returns the new RecurrenceRule
*/
addWeeklyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a weekly basis.
*
* By default the event recurs on the same day of the week as the first event in the series,
* but this can be altered by calling onlyOnWeekday(day) or onlyOnWeekdays(days).
*
*
* // Creates a rule that recurs every week for ten weeks.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().times(10);
*
*
* @returns the new RecurrenceRule
*/
addWeeklyRule(): CalendarApp.RecurrenceRule
/**
* Adds a rule that excludes occurrences on a yearly basis.
*
* By default the exclusion is applied on the same day of the year as the first event in the
* series, but this can be altered by calling onlyOnYearDay(day) or onlyOnYearDays(days).
*
* @returns the new RecurrenceRule
*/
addYearlyExclusion(): CalendarApp.RecurrenceRule
/**
* Adds a rule that causes the event to recur on a yearly basis.
*
*
By default the event recurs on the same day of the year as the first event in the series,
* but this can be altered by calling onlyOnYearDay(day) or onlyOnYearDays(days).
*
* @returns the new RecurrenceRule
*/
addYearlyRule(): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply at this interval of the rule's time unit.
*
*
* // Creates a rule that recurs every fourth week.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().interval(4);
*
*
* @param interval - the interval in the rule's time unit
*
* @returns this RecurrenceRule for chaining
*/
interval(
interval: number
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to a specific month.
*
*
* // Creates a rule that recurs every week in February.
* var recurrence = CalendarApp.newRecurrence()
* .addWeeklyRule().onlyInMonth(CalendarApp.Month.FEBRUARY);
*
*
* @param month - the month
*
* @returns this RecurrenceRule for chaining
*/
onlyInMonth(
month: Month
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to specific months.
*
*
* // Creates a rule that recurs every week in February and March.
* var recurrence = CalendarApp.newRecurrence()
* .addWeeklyRule().onlyInMonths([CalendarApp.Month.FEBRUARY, CalendarApp.Month.MARCH]);
*
*
* @param months - the months
*
* @returns this RecurrenceRule for chaining
*/
onlyInMonths(
months: Month[]
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to a specific day of the month.
*
*
* // Creates a rule that recurs every month on the fifth day of the month.
* var recurrence = CalendarApp.newRecurrence().addMonthlyRule().onlyOnMonthDay(5);
*
*
* @param day - the day of the month
*
* @returns this RecurrenceRule for chaining
*/
onlyOnMonthDay(
day: number
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to specific days of the month.
*
*
* // Creates a rule that recurs every month on the first and fifteenth day of the month.
* var recurrence = CalendarApp.newRecurrence().addMonthlyRule().onlyOnMonthDays([1, 15]);
*
*
* @param days - the days of the month
*
* @returns this RecurrenceRule for chaining
*/
onlyOnMonthDays(
days: number[]
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to a specific week of the year.
*
*
* // Creates a rule that recurs on the fifth week of every year.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().onlyOnWeek(5);
*
*
* @param week - the week
*
* @returns this RecurrenceRule for chaining
*/
onlyOnWeek(
week: number
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to a specific day of the week.
*
*
* // Creates a rule that recurs every week on Wednesdays.
* var recurrence = CalendarApp.newRecurrence()
* .addWeeklyRule().onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY);
*
*
* @param day - the day of the week
*
* @returns this RecurrenceRule for chaining
*/
onlyOnWeekday(
day: Weekday
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to specific days of the week.
*
*
* // Creates a rule that recurs every week on Tuesdays and Thursdays.
* var recurrence = CalendarApp.newRecurrence()
* .addWeeklyRule().onlyOnWeekdays(
* [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY]);
*
*
* @param days - the days of the week
*
* @returns this RecurrenceRule for chaining
*/
onlyOnWeekdays(
days: Weekday[]
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to specific weeks of the year.
*
*
* // Creates a rule that recurs on the fifth and tenth weeks of every year.
* var recurrence = CalendarApp.newRecurrence().addWeeklyRule().onlyOnWeeks([5, 10]);
*
*
* @param weeks - the weeks
*
* @returns this RecurrenceRule for chaining
*/
onlyOnWeeks(
weeks: number[]
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to a specific day of the year.
*
*
* // Creates a rule that recurs every year on February 15 (the 46th day).
* var recurrence = CalendarApp.newRecurrence().addYearlyRule().onlyOnYearDay(46);
*
*
* @param day - the day of the year
*
* @returns this RecurrenceRule for chaining
*/
onlyOnYearDay(
day: number
): CalendarApp.RecurrenceRule
/**
* Configures the rule to only apply to specific days of the year.
*
*
* // Creates a rule that recurs every year on January 20 and February 15.
* var recurrence = CalendarApp.newRecurrence().addYearlyRule().onlyOnYearDay([20, 46]);
*
*
* @param days - the days of the year
*
* @returns this RecurrenceRule for chaining
*/
onlyOnYearDays(
days: number[]
): CalendarApp.RecurrenceRule
/**
* Sets the time zone for this recurrence. This affects the date and time that events recur on,
* and whether the event shifts with daylight savings time. Defaults to the calendar's time zone.
*
* @param timeZone - the time zone, specified in "long" format (e.g., 'America/New_York', as listed
* by Joda.org)
*
* @returns this EventRecurrence for chaining
*/
setTimeZone(
timeZone: string
): CalendarApp.EventRecurrence
/**
* Configures the rule to end after a given number of occurrences.
*
*
* // Creates a rule that recurs every day for ten days.
* var recurrence = CalendarApp.newRecurrence().addDailyRule().times(10);
*
*
* @param times - the number of times to recur
*
* @returns this RecurrenceRule for chaining
*/
times(
times: number
): CalendarApp.RecurrenceRule
/**
* Configures the rule to end on a given date (inclusive).
*
*
* // Creates a rule that recurs every day through the end of 2013.
* var recurrence = CalendarApp.newRecurrence()
* .addDailyRule().until(new Date('December 31, 2013'));
*
*
* @param endDate
*
* @returns this RecurrenceRule for chaining
*/
until(
endDate: Date
): CalendarApp.RecurrenceRule
/**
* Configures which day a week starts on, for the purposes of applying the rule.
*
*
* // Creates a weekly rule where weeks start on Monday.
* var recurrence = CalendarApp.newRecurrence()
* .addWeeklyRule().weekStartsOn(CalendarApp.Weekday.MONDAY);
*
*
* @param day - the day on which the week starts
*
* @returns this RecurrenceRule for chaining
*/
weekStartsOn(
day: Weekday
): CalendarApp.RecurrenceRule
}
enum Visibility {
/**
* The event is private. This value is provided for compatibility reasons.
*/
CONFIDENTIAL = "CONFIDENTIAL",
/**
* Uses the default visibility for events on the calendar.
*/
DEFAULT = "DEFAULT",
/**
* The event is private and only event attendees may view event details.
*/
PRIVATE = "PRIVATE",
/**
* The event is public and event details are visible to all readers of the calendar.
*/
PUBLIC = "PUBLIC",
}
}