#!/usr/bin/perl

use Moo::Google;

my $gapi = Moo::Google->new(debug => 1); # my $gapi = Moo::Google->new(access_token => '');
# my $user = 'galemathias@gmail.com'; # full gmail
my $user = 'serviceaccountforkalendertest@kalendertest-235300.iam.gserviceaccount.com'; # full gmail

$gapi->auth_storage->setup({type => 'jsonfile', path => './NY_kalendertest-235300-62ceba857bb7.json' }); # by default
# $gapi->auth_storage->setup({ type => 'dbi', path => 'DBI object' });
# $gapi->auth_storage->setup({ type => 'mongodb', path => 'details' });

$gapi->user($user);
$gapi->do_autorefresh(1);

my $r1 = $gapi->Calendar->Events->list({ calendarId => 'primary' })->json;
warn scalar @{$r1->{items}};
