#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;

use WebService::Browshot;

my $browshot = WebService::Browshot->new(
	key	=> 'my_api_key',
	debug	=> 0, # no more debug information
);


my $screenshot = $browshot->screenshot_create(url => 'http://mobilio.net/', instance_id => 12); 
sleep 60;

# Delete the screenshto URL
$browshot->screenshot_delete(id => $screenshot->{id}, data => 'url');

my $info = $browshot->screenshot_info(id => $screenshot->{id});
if (! exists ($info->{url}) || $info->{url} eq '') {
	print "URL has been deleted for screenshot #", $screenshot->{id}, "\n";
}

# Delete the image
$browshot->screenshot_delete(id => $screenshot->{id}, data => 'image');
my $image = $browshot->screenshot_thumbnail(id => $screenshot->{id});
if (length($image) == 0) {
	print "Screenshot for #", $screenshot->{id}, " has been deleted\n";
}

# Delete everything
$browshot->screenshot_delete(id => $screenshot->{id}, data => 'all');
