From e2fefb8304a0efec5a0bd56337f7d487cd3964b7 Mon Sep 17 00:00:00 2001 From: jupyter Date: Fri, 29 Jul 2022 19:20:26 +0200 Subject: [PATCH] Adds a delete_event method to API::Google::GCal object --- lib/API/Google/GCal.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/API/Google/GCal.pm b/lib/API/Google/GCal.pm index 95a550d..049cbea 100755 --- a/lib/API/Google/GCal.pm +++ b/lib/API/Google/GCal.pm @@ -34,6 +34,7 @@ use parent 'API::Google'; $event_data->{start}{timeZone} = $event_data->{end}{timeZone} = $timeZone; # not obligatory $gapi->add_event($user, $calendar_id, $event_data); + $gapi->delete_event($user, $calendar_id, $event_id); my $freebusy_data = { user => $user, @@ -101,6 +102,24 @@ sub get_calendar_id_by_name { } +=head2 add_event + + $gapi->add_event($user, $calendar_id, $event_data) + +# https://developers.google.com/google-apps/calendar/v3/reference/events/delete + +=cut + +sub delete_event { + my ($self, $user, $calendar_id, $event_id) = @_; + $self->api_query({ + method => 'delete', + route => $self->{api_base}.'/calendars/'.$calendar_id.'/events/'.$event_id, + user => $user + }); +} + + =head2 add_event $gapi->add_event($user, $calendar_id, $event_data)