package JSON::API::v1::Roles::Links;
our $VERSION = '0.002';
use Moose::Role;
use namespace::autoclean;
# ABSTRACT: An role that implements the default links object
has links => (
is => '
ro',
isa => 'JSON::API::v1::Links',
predicate => 'has_links',
);
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::Roles::Links - An role that implements the default links
use utf8;
package JSON::API::v1::Resource;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
# ABSTRACT: A JSON API Resource object
has id => (
is => 'ro',
is => 'ro',
isa => 'Defined',
predicate => 'has_relationships',
);
sub TO_JSON {
my $self = shift;
if ($self->has_id && $self->has_type) {
return {
qw(
JSON::API::v1::Roles::TO_JSON
JSON::API::v1::Roles::MetaObject
);
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::Resource - A JSON API Res
kage JSON::API::v1;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
use List::Util qw(uniq);
our @CARP_NOT = qw(Class::MOP::Method::Wrapped);
# ABSTRACT: A JSON API
object according to jsonapi.org v1 specification
has data => (
is => 'ro',
isa => 'ArrayRef[JSON::API::v1::Resource]',
traits => ['Array'],
lazy => 1,
default
'ArrayRef[JSON::API::v1::Error]',
traits => ['Array'],
lazy => 1,
default => sub { [] },
handles => { add_error => 'push', has_errors => 'count' },
);
has jsonapi => (
:Filter::json;
use Pcore -class, -res;
use Pcore::Util::Src qw[:FILTER_STATUS];
with qw[Pcore::Util::Src::Filter];
sub decompress ($self) {
eval {
my $data = P->data->from_json( $self->
lf->{data} = P->data->to_json( $data, readable => 1 );
};
return $@ ? $SRC_FATAL : $SRC_OK;
}
sub compress ($self) {
eval {
my $data = P->data->from_json( $self->{data} );
$self->{data} = P->data->to_json( $data, readable => 0 );
};
return $@ ? $SRC_FATAL : $SRC_OK;
}
1;
## -----SOURCE FILTER LOG BEGIN-----
##
## PerlCritic profile "pcore-script" policy vio
use utf8;
package JSON::API::v1::JSONAPI;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
# ABSTRACT: A JSON API jsonapi object
sub TO_JSON {
my $self = shift;
JSON::API::v1::Roles::TO_JSON
JSON::API::v1::Roles::MetaObject
);
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::JSONAPI - A JSON API jsonapi
head1 VERSION
version 0.002
=head1 SYNOPSIS
use JSON::API::v1::JSONAPI;
my $object = JSON::API::v1::JSONAPI->new(
meta => JSON::API::v1::MetaObject->new(),
);
=head1 DESCRIPTIO
package JSON::API::v1::Roles::TO_JSON;
our $VERSION = '0.002';
use Moose::Role;
use namespace::autoclean;
# ABSTRACT: An interface for Objects to adhere to
requires qw(
TO_JSON
);
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::Roles::TO_JSON - An interface for Objects to adhere to
=head1 VERSION
version 0.002
=head1 SYNOPSIS
=head1 DESCRIPTION
This role implements an
which consumers must adhere to. It defines
several methods that L<JSON::API::v1> namespaced objects must implement
to support the JSON API v1 specifications.
=head1 AUTHOR
Wesley Schwengle
=head1 L
use utf8;
package JSON::API::v1::Error;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
# ABSTRACT: A JSON API object according to jsonapi.org v1 specification
has id => (
is
=> (
is => 'ro',
isa => 'Defined',
predicate => 'has_source',
);
sub TO_JSON {
my $self = shift;
my %rv;
foreach (qw(id status code title detail source links)) {
(
JSON::API::v1::Roles::TO_JSON
JSON::API::v1::Roles::MetaObject
JSON::API::v1::Roles::Links
);
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API
e utf8;
package JSON::API::v1::Attribute;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
use List::Util qw(any);
our @CARP_NOT;
# ABSTRACT: A JSON API Attribute ob
ject according to jsonapi v1 specification
has attributes => (
is => 'ro',
isa => 'HashRef',
traits => ['Hash'],
lazy => 1,
default => sub { {} },
handles => {
clear_attribute => 'delete',
get_attribute_names => 'keys',
},
);
sub TO_JSON {
my $self = shift;
my %rv;
foreach ($self->get_attribute_names) {
$rv{$_} =
package JSON::API::v1::Roles::MetaObject;
our $VERSION = '0.002';
use Moose::Role;
use namespace::autoclean;
# ABSTRACT: An role that implements the default meta object
has meta_object => (
is
'has_meta_object',
init_arg => 'meta',
);
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::Roles::MetaObject - An role that implements the default meta object
=head1 VERSION
ve
utf8;
package JSON::API::v1::Relationship;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
use List::Util qw(any);
our @CARP_NOT;
# ABSTRACT: A JSON API Relationsh
ip object according to jsonapi v1 specification
has data => (
is => 'ro',
isa => 'Defined',
predicate => 'has_data',
);
sub TO_JSON {
my $self = shift;
if (!$self->
(
JSON::API::v1::Roles::TO_JSON
JSON::API::v1::Roles::Links
JSON::API::v1::Roles::MetaObject
);
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API
use utf8;
package JSON::API::v1::Links;
our $VERSION = '0.002';
use Moose;
use namespace::autoclean;
use Carp qw(croak);
use MooseX::Types::URI qw(Uri);
# ABSTRACT: A JSON API Links object
has uri
1,
);
has related => (
is => 'ro',
isa => 'JSON::API::v1::Links',
predicate => 'has_related',
);
sub TO_JSON {
my $self = shift;
if (!$self->has_uri && !$self->has_
qw(
JSON::API::v1::Roles::TO_JSON
JSON::API::v1::Roles::MetaObject
);
__PACKAGE__->meta->make_immutable;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::API::v1::Links - A JSON API Link
package JSON::Karabiner::Manipulator::Conditions::Input_source_if ;
$JSON::Karabiner::Manipulator::Conditions::Input_source_if::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Carp;
use par
;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Conditions::Input_source_if - definition for Frontmost_application_if condition
=head1 SYNOPSIS
use JSON::Karabiner;
=head1 DESCRIPTIO
package JSON::Karabiner::Manipulator::Conditions::Event_changed_unless ;
$JSON::Karabiner::Manipulator::Conditions::Event_changed_unless::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Car
p;
use parent 'JSON::Karabiner::Manipulator::Conditions::Event_changed_if';
# ABSTRACT: definition for event_changed_unless condition
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Co
ons::Event_changed_unless - definition for event_changed_unless condition
=head1 SYNOPSIS
use JSON::Karabiner;
=head1 DESCRIPTION
=head3 method1()
=head3 method2()
=head1 VERSION
version 0.01
JSON::Karabiner::Manipulator::Conditions::Frontmost_application_unless ;
$JSON::Karabiner::Manipulator::Conditions::Frontmost_application_unless::VERSION = '0.018';
use strict;
use warnings;
use JSON
use parent 'JSON::Karabiner::Manipulator::Conditions::Frontmost_application_if';
# ABSTRACT: definition for Frontmost_application_unless condition
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::
pplication_unless - definition for Frontmost_application_unless condition
=head1 SYNOPSIS
use JSON::Karabiner;
=head1 DESCRIPTION
=head3 method1()
=head3 method2()
=head1 VERSION
version 0.01
package JSON::Karabiner::Manipulator::Conditions::Variable_unless ;
$JSON::Karabiner::Manipulator::Conditions::Variable_unless::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Carp;
use par
dition
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Conditions::Variable_unless - action variable_unless condition
=head1 SYNOPSIS
use JSON::Karabiner;
=head1 DESCRIPTION
=head
age JSON::Karabiner::Manipulator::Conditions::Variable_if ;
$JSON::Karabiner::Manipulator::Conditions::Variable_if::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Carp;
use parent 'JSON::K
t;
croak ('No description passed.') unless $desc;
$s->{data}{description} = $desc;
}
sub TO_JSON {
my $obj = shift;
my $name = $obj->{def_name};
my $value = $obj->{data};
my %super_hash
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Conditions::Variable_if - definition for Frontmost_application_if condition
=head1 SYNOPSIS
use JSON::Karabiner;
=head1 DESCRIPTION
ackage JSON::Karabiner::Manipulator::Actions::To_if_alone ;
$JSON::Karabiner::Manipulator::Actions::To_if_alone::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Carp;
use parent 'JSON::Kara
action class
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Actions::To_if_alone - to_if_alone action class
=head1 SYNOPSIS
use JSON::Karabiner;
my $to_if_alone_action = $manip
PTION
See L<JSON::Karabiner::Manipulator::Actions::To> for documentation of this
class' methods.
See L<the official Karabiner documentation|https://karabiner-elements.pqrs.org/docs/json/complex-modi
rom::JSON;
use v5.16.3;
use Moo::Role;
use MooX::Types::MooseLike::Base qw(:all);
use Carp;
use Path::Class;
use Data::AnyXfer::JSON qw/ decode_json /;
=head1 NAME
Data::AnyXfer::From::JSON - tr
ansfer from json sources
=head1 SYNOPSIS
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
extends 'Data::AnyXfer';
with 'Data::AnyXfer::From::JSON';
...
# Path::Class::Fil
e
has '+json' => ( default => sub { file('example.json'); } );
# Json string
has '+json' => ( default => sub { return '{"documents": [{"author": "Douglas Adams"}]'});
# Direct hash s
package JSON::Karabiner::Manipulator::Actions::To ;
$JSON::Karabiner::Manipulator::Actions::To::VERSION = '0.018';
use strict;
use warnings;
use JSON;
use Carp;
use parent 'JSON::Karabiner::Manipulato
key_code;
$hash{lazy} = JSON::true if $letter_code && $letter_code eq 'L';
$hash{halt} = JSON::true if $letter_code && $letter_code eq 'H';
$hash{repeat} = JSON::true if $letter_code && $l
$lkc->{modifiers} = $existing;
}
# ABSTRACT: To action object
1;
__END__
=pod
=head1 NAME
JSON::Karabiner::Manipulator::Actions::To - To action object
=head1 SYNOPSIS
add_action 'to';
#
package Data::AnyXfer::JSON;
use v5.10.1;
use utf8;
use strict;
use warnings;
use base 'Cpanel::JSON::XS';
use Encode ();
use Path::Class ();
use Exporter qw/ import /;
our $VERSION = '0.07';
o
_json
encode_json_pretty
decode_json
decode_json_file
decode_json_handle
/;
our @EXPORT_OK = @EXPORT;
=head1 NAME
=encoding utf8
Data::AnyXfer::JSON - functions for encoding/decoding JSON
er::JSON qw/ decode_json /;
my $json = encode_json( { price => '£185pcm' } );
my $hash = decode_json( $json );
=head1 DESCRIPTION
This module provides simple wrappers around L<Cpanel::JSON::X