App-Mxpress-PDF

 view release on metacpan or  search on metacpan

lib/App/Mxpress/PDF.pm  view on Meta::CPAN

package App::Mxpress::PDF;
use Dancer2;
use App::Mxpress::PDF::API;
our $VERSION = '0.22';

prefix undef;

get '/' => sub {
    template 'index' => { 'title' => 'App::Mxpress::PDF' };
};

true;

=head1 NAME
 
App::Mxpress::PDF - A utility application for generating PDFs
 
=head1 VERSION
 
Version 0.22
 
=cut

=head1 SYNOPSIS

	plackup `which app-mxpress-pdf.psgi'

=cut

=head1 routes

=head2 '/'

Returns the html - single page application.

=head2 /api/login

Authenticate to the api, the default username and password is username and password. This can be updated
inside of the conf.yml file.
	
	header('Token', $csrf_token);
	post('/api/login', {
		username => Types::Standard::Optional->of(Str),
		password => Types::Standard::Optional->of(Str)
	});

=head2 /api/logout

Logout of the session.

	header('Token', $csrf_token);
	post('/api/logout')

=head2 /api/session

Check whether the current session is valid.

	get('/api/session')

=head2 /api/generate/pod

Generate a pdf from pod.

	header('Token', $csrf_token);
	post('/api/generate/pod', {
		styles => Str,
		type => Enum[qw/module distribution raw/],
		name => StrMatch[ qr{([a-zA-Z0-9\-\:]+)} ],
		module => Types::Standard::Optional->of(StrMatch[ qr{([a-zA-Z0-9\-\:]*)} ]),
		distribution => Types::Standard::Optional->of(StrMatch[ qr{([a-zA-Z0-9\-\:]*)} ],),
		raw => Types::Standard::Optional->of(Str)
	});

=head2 /api/generate/pdf

Generate a pdf from a template

	header('Token', $csrf_token);
	post('/api/generate/pdf', {
		params => HashRef,
		name => StrMatch[ qr{([a-zA-Z0-9\-\:]+)} ],
		styles => Types::Standard::Optional->of(Str),
		size => Types::Standard::Optional->of(Enum[qw/A1 A2 A3 A4 A5 A6/]),
		template => Types::Standard::Optional->of(Str)
	});

=head2 /api/templates

	get('/api/templates')

=head2 /api/create/template

	header('Token', $csrf_token);
	post('/api/create/template', {
		name => StrMatch[ qr{([a-zA-Z0-9\-\:]+)} ],
		styles => Str,
		size => Enum[qw/A1 A2 A3 A4 A5 A6/],
		template => Str



( run in 1.457 second using v1.01-cache-2.11-cpan-39bf76dae61 )