diff --git a/types/gapi.calendar/gapi.calendar-tests.ts b/types/gapi.calendar/gapi.calendar-tests.ts index bd42483df5..f2d5058ad2 100644 --- a/types/gapi.calendar/gapi.calendar-tests.ts +++ b/types/gapi.calendar/gapi.calendar-tests.ts @@ -149,4 +149,24 @@ request.execute(function(event) { appendPre('Event created: ' + event.htmlLink); }); + + + + function deleteEvent(calendarEventId: any) { + var request = gapi.client.calendar.events.delete({ + calendarId: 'primary', + eventId: calendarEventId, + sendNotifications: true + }); + + request.then( + (response) => { + appendPre('Successfully deleted event ' + calendarEventId); + }, + (error) => { + appendPre('Unable to delete event from your calendar' + calendarEventId); + } + ); + } + } diff --git a/types/gapi.calendar/index.d.ts b/types/gapi.calendar/index.d.ts index b13106b9e3..62016a4c33 100644 --- a/types/gapi.calendar/index.d.ts +++ b/types/gapi.calendar/index.d.ts @@ -271,6 +271,9 @@ declare namespace gapi.client.calendar { static insert(parameters: EventsInsertParameters): HttpRequest; static update(parameters: EventsUpdateParameters): HttpRequest; static get(parameters: EventsGetParameters): HttpRequest; + + // delete the existing event from calendar + static delete(parameters: EventsDeleteParameters): HttpRequest; } interface EventsGetParameters { @@ -306,6 +309,15 @@ declare namespace gapi.client.calendar { resource: EventInput; } + // calendarId: 'primary' or the calendar from which the event to be deleted + // eventId: the event that need to be deleted from calendar (Event.id from the list/insert response) + interface EventsDeleteParameters { + calendarId: string; + eventId: string; + + sendNotifications?: boolean; + } + interface EventInput { // Required Properties attachments?: {