| 1 | package Net::Google::CalendarV3::Types; | ||
| 2 | $Net::Google::CalendarV3::Types::VERSION = '0.16'; | ||
| 3 | use Type::Library | ||
| 4 | -base, | ||
| 5 | -declare => qw( DefaultReminder NotificationSettings ListOfNotificationSettings | ||
| 6 | CalendarListEntry Person Attendee Date CalendarId | ||
| 7 | Event | ||
| 8 | DateTime | ||
| 9 | CBool | ||
| 10 | ); | ||
| 11 | use Type::Utils -all; | ||
| 12 | use Types::Standard -types; | ||
| 13 | |||
| 14 | class_type DefaultReminder, { class => 'Net::Google::CalendarV3::DefaultReminder' }; | ||
| 15 | class_type NotificationSettings, { class => 'Net::Google::CalendarV3::NotificationSettings' }; | ||
| 16 | class_type CalendarListEntry, { class => 'Net::Google::CalendarV3::Calendar' }; | ||
| 17 | class_type Person, { class => 'Net::Google::CalendarV3::Person' }; | ||
| 18 | class_type Attendee, { class => 'Net::Google::CalendarV3::Attendee' }; | ||
| 19 | class_type Date, { class => 'Net::Google::CalendarV3::Date' }; | ||
| 20 | class_type Event, { class => 'Net::Google::CalendarV3::Event' }; | ||
| 21 | class_type DateTime, { class => 'DateTime' }; | ||
| 22 | |||
| 23 | declare ListOfNotificationSettings, | ||
| 24 | as ArrayRef[NotificationSettings]; | ||
| 25 | |||
| 26 | declare CBool, as Bool, where { !!$_ || !$_ }; | ||
| 27 | |||
| 28 | declare CalendarId, as Str, where { 1 }; | ||
| 29 | |||
| 30 | coerce CBool, | ||
| 31 | from Any, via { !!$_ }; | ||
| 32 | coerce CalendarId, | ||
| 33 | from CalendarListEntry, via { $_->id }; | ||
| 34 | coerce CalendarId, | ||
| 35 | from Str, via { $_ }; | ||
| 36 | coerce DefaultReminder, | ||
| 37 | from HashRef, via { 'Net::Google::CalendarV3::DefaultReminder'->new($_) }; | ||
| 38 | coerce NotificationSettings, | ||
| 39 | from HashRef, via { 'Net::Google::CalendarV3::NotificationSettings'->new($_) }; | ||
| 40 | coerce CalendarListEntry, | ||
| 41 | from HashRef, via { 'Net::Google::CalendarV3::Calendar'->new($_) }; | ||
| 42 | coerce Person, | ||
| 43 | from HashRef, via { 'Net::Google::CalendarV3::Person'->new($_) }; | ||
| 44 | coerce Attendee, | ||
| 45 | from HashRef, via { 'Net::Google::CalendarV3::Attendee'->new($_) }; | ||
| 46 | coerce Date, | ||
| 47 | from HashRef, via { 'Net::Google::CalendarV3::Date'->new($_) }; | ||
| 48 | coerce Event, | ||
| 49 | from HashRef, via { 'Net::Google::CalendarV3::Event'->new($_) }; | ||
| 50 | |||
| 51 | coerce ListOfNotificationSettings, | ||
| 52 | from HashRef, via { [ map { to_NotificationSettings($_) } @{ $_->{notifications} } ] }; | ||
| 53 | |||
| 54 | 1; | ||
| 55 |