package JSON::Feed;
our $VERSION = '1.001';
use Moo;
use namespace::clean;
use JSON qw<to_json from_json>;
use JSON::Feed::Types qw<JSONFeed JSONFeedItem>;
has feed => (
is => 'ro',
defa
eturn +{
version => "https://jsonfeed.org/version/1",
title => 'Untitle',
items => [],
};
},
isa => JSONFeed,
);
around BUILDARGS => sub {
y ( $orig, $class, %args ) = @_;
return +{
feed => +{
version => "https://jsonfeed.org/version/1",
items => [],
%args
}
};
};
sub get {
package JSON::Feed::Types {
use Type::Library -base;
use Type::Utils -all;
use Types::Standard qw<Str Int Bool Dict Optional ArrayRef HashRef>;
use Types::Common::Numeric qw< PositiveO
rZeroInt >;
my $AuthorWithoutExt = declare JSONFeedAuthorWithoutExt => as Dict[
name => Optional[Str],
url => Optional[Str],
avatar => Optional[Str],
], where {
exists($_->{name}) || exists($_->{url}) || exists($_->{avatar})
};
my $Author = declare JSONFeedAuthor => as HashRef, where {
my $val = $_;
my %o = map { $_ => $val->{$_} } g