ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
use URI::QueryParam;
use MIME::Base64 qw(encode_base64);
use Math::Random::Secure qw(irand);
use JSON::MaybeUTF8 qw(:v1);
use curry;
use Net::Async::Spotify::Scope qw(:all);
use Net::Async::Spotify:
$self->client_id, $self->client_secret), ''),
},
);
$result = decode_json_utf8($result->decoded_content);
} catch ($e) {
use Data::Dumper;
$log->errorf
Log::Any qw($log);
use Net::Async::Spotify;
use Net::Async::Spotify::Util qw(hash_to_string);
use JSON::MaybeUTF8 qw(:v1);
use Net::Async::HTTP::Server;
use Future::Utils qw(fmap_concat);
use Unicode:
;
$response->add_content(encode_json_utf8({response => 'Got it! From spotify-cli.pl ;)'}));
$response->content_type("application/json");
$response->content_length(l
# need to implement to_hash there in order to be able to do this
#$to_write = encode_json_utf8($content);
if ( ref $content eq 'HASH' ) {
if ( exists $content->{conten
:Spotify::Object;
my $sp_json_decoded_res = {danceability => 0.735,,...}; # Audio Features response.
my $obj = Net::Async::Spotify::Object->new(
$sp_json_decoded_res,
{
r distribution provides a "csv2json" script, your F<META.json> would
contain:
"x_provides_scripts": {
"csv2json": {
"version": "0.1",
"file": "bin/csv2json"
}
}
References:
=over
is option to rewrite main classes.
=item B<-j>, B<--only-json>
If exists it will only print out Spotify enpoints and object structure as JSON.
Good to be piped to `jq` in order to view Spotify API s
:DOM;
use Template;
use Module::Runtime qw(require_module);
use Path::Tiny;
use Data::Dumper;
use JSON::MaybeUTF8 qw(:v1);
GetOptions(
'd|docs-uri=s' => \(my $docs_uri = 'https://developer.
=> \my $init_class,
'l|log-level=s' => \(my $log_level = 'info'),
'j|only-json' => \my $only_json,
'h|help' => \my $help,
);
require Log::Any::Adapter;
Log::Any::Adap
,
# cache => ...,
# chi => ...
# });
#
# - Add Acceptance for XRD and JRD and JSON as a header
# UserAgent name
my $UA_NAME = __PACKAGE__ . ' v' . $VERSION;
# UserAgent maxi
ugin, $mojo) = @_;
# Add types
for ($mojo->types) {
$_->type(jrd => 'application/jrd+json');
$_->type(xrd => 'application/xrd+xml');
};
my $reply_xrd = sub {
my ($c, $xr
$c->respond_to(
# JSON request
json => sub { $c->render(
status => $status,
data => $head_data // $xrd->to_json,
format => 'json'
)},
# JRD
t::Async::Spotify::API::Generated::Search);
use Log::Any qw($log);
use Syntax::Keyword::Try;
use JSON::MaybeUTF8 qw(:v1);
use Net::Async::Spotify::Object;
=encoding utf8
=head1 NAME
Net::Async::Sp
tify_html/;
use Mojo::ByteStream 'b';
use Mojo::Util qw/xml_escape quote/;
use Mojo::JSON qw/encode_json decode_json/;
use File::Spec;
use File::Basename;
has [qw/base_class base_timeout/];
state $p
s
foreach (@$notify_array) {
$notify{$_->[0]} = 1;
$log .= '.' . $_->[0] . '(' . encode_json($_->[-1]);
if (scalar @{$_} == 3) {
my %param = %{$_->[1]};
# Remove potential l
d
$param{timeout} = 0;
# Encode parameters if left
$log .= ', ' . encode_json(\%param) if keys %param;
# Define callback
$log .= ', function(){var r=new XMLHt
al engines
plugin Notifications => {
Humane => {
base_class => 'libnotify'
},
JSON => 1
};
# Add notification messages in controllers
$c->notify(warn => 'Something went wron
s 'humane';
# ... or in any other responses
my $json = { text => 'That\'s my response' };
$c->render(json => $c->notifications(json => $json));
=head1 DESCRIPTION
L<Mojolicious::Plugin::Noti
tions 'humane' => [qw/warn error success/];
%= notifications 'html';
$c->render(json => $c->notifications(json => {
text => 'My message'
}));
Serve notifications to your user based on an e
r 'import';
use Mojo::ByteStream 'b';
use Mojo::Util qw/xml_escape quote/;
use Mojo::JSON qw/decode_json encode_json/;
use Scalar::Util qw/blessed/;
use File::Spec;
use File::Basename;
our @EXPORT_OK
= @_;
# Add JRD link
$hostmeta->link(lrdd => {
type => 'application/jrd+json',
template => $c->endpoint(
webfinger => {
'?' => undef
}
use Syntax::Keyword::Try;
use Scalar::Util qw(weaken isweak);
use URI;
use URI::QueryParam;
use JSON::MaybeUTF8 qw(:v1);
use Net::Async::Spotify::Object;
=head1 NAME
Net::Async::Spotify::API::Bas
est->{param}{json_body_parameter}
or $request->{method} eq 'POST'
) {
$request_content = {
content => {},
content_type => 'application/json',
};
arameters
for my $bp (keys $request->{param}{json_body_parameter}->%*) {
if ( exists $args{$bp} ) {
if ( $request->{param}{json_body_parameter}{$bp}{type} =~ /^array/ ) {
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back
ify::Object::Base/generate>, L<to_hash|Net::Async::Spotify::Object::Base/to_hash>, L<to_human|Net::Async::Spotify::Object::Base/to_human>, L<to_json|Net::Async::Spotify::Object::Base/to_json>
=back