App-SpreadRevolutionaryDate

 view release on metacpan or  search on metacpan

lib/App/SpreadRevolutionaryDate/MsgMaker/Gemini.pm  view on Meta::CPAN

#
# This file is part of App-SpreadRevolutionaryDate
#
# This software is Copyright (c) 2019-2026 by Gérald Sédrati.
#
# This is free software, licensed under:
#
#   The GNU General Public License, Version 3, June 2007
#
use 5.014;
use utf8;
package App::SpreadRevolutionaryDate::MsgMaker::Gemini;
$App::SpreadRevolutionaryDate::MsgMaker::Gemini::VERSION = '0.54';
# ABSTRACT: MsgMaker class for L<App::SpreadRevolutionaryDate> to build message with Gemini prompt

use Moose;
with 'App::SpreadRevolutionaryDate::MsgMaker';

use DateTime;
use File::ShareDir ':ALL';
use LWP::UserAgent;
use JSON;

use Locale::TextDomain 'App-SpreadRevolutionaryDate';
use namespace::autoclean;

has 'api_key' => (
  is  => 'ro',
  isa => 'Str',
  required => 1,
);

has 'process' => (
  is  => 'ro',
  isa => 'Str',
  required => 1,
);

has 'prompt' => (
  is  => 'ro',
  isa => 'HashRef[Str]',
  required => 1,
);

has 'search' => (
  is  => 'ro',
  isa => 'HashRef[Bool]',
);

has 'intro' => (
  is  => 'ro',
  isa => 'HashRef[Str]',
);

has 'img_path' => (
  is  => 'ro',
  isa => 'HashRef[Str]',
);

has 'img_url' => (
  is  => 'ro',
  isa => 'HashRef[Str]',
);

has 'img_alt' => (
  is  => 'ro',
  isa => 'HashRef[Str]',
);

has '+locale' => (
  default => 'fr',
);

around BUILDARGS => sub {
  my ($orig, $class, %args) = @_;

  if ($args{process}) {
      die "Process $args{process} has no prompt\n" unless $args{prompt}->{$args{process}};
  }

  return $class->$orig(%args);
};


sub compute {



( run in 0.715 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )