File Coverage

blib/lib/Net/API/Telegram/InlineQueryResultCachedPhoto.pm
Criterion Covered Total %
statement 7 17 41.1
branch n/a
condition n/a
subroutine 3 13 23.0
pod 10 10 100.0
total 20 40 50.0


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Net/API/Telegram/InlineQueryResultCachedPhoto.pm
4             ## Version 0.1
5             ## Copyright(c) 2019 Jacques Deguest
6             ## Author: Jacques Deguest <jack@deguest.jp>
7             ## Created 2019/05/29
8             ## Modified 2020/03/28
9             ## All rights reserved.
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package Net::API::Telegram::InlineQueryResultCachedPhoto;
15             BEGIN
16             {
17 1     1   1055 use strict;
  1         2  
  1         46  
18 1     1   9 use parent qw( Net::API::Telegram::Generic );
  1         2  
  1         6  
19 1     1   345 our( $VERSION ) = '0.1';
20             };
21              
22 0     0 1   sub caption { return( shift->_set_get_scalar( 'caption', @_ ) ); }
23              
24 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
25              
26 0     0 1   sub download { return( shift->_download( @_ ) ); }
27              
28 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
29              
30 0     0 1   sub input_message_content { return( shift->_set_get_object( 'input_message_content', 'Net::API::Telegram::InputMessageContent', @_ ) ); }
31              
32 0     0 1   sub parse_mode { return( shift->_set_get_scalar( 'parse_mode', @_ ) ); }
33              
34 0     0 1   sub photo_file_id { return( shift->_set_get_scalar( 'photo_file_id', @_ ) ); }
35              
36 0     0 1   sub reply_markup { return( shift->_set_get_object( 'reply_markup', 'Net::API::Telegram::InlineKeyboardMarkup', @_ ) ); }
37              
38 0     0 1   sub title { return( shift->_set_get_scalar( 'title', @_ ) ); }
39              
40 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
41              
42             1;
43              
44             __END__
45              
46             =encoding utf-8
47              
48             =head1 NAME
49              
50             Net::API::Telegram::InlineQueryResultCachedPhoto - A link to a photo stored on the Telegram servers
51              
52             =head1 SYNOPSIS
53              
54             my $msg = Net::API::Telegram::InlineQueryResultCachedPhoto->new( %data ) ||
55             die( Net::API::Telegram::InlineQueryResultCachedPhoto->error, "\n" );
56              
57             =head1 DESCRIPTION
58              
59             L<Net::API::Telegram::InlineQueryResultCachedPhoto> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#inlinequeryresultcachedphoto>
60              
61             This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
62              
63             =head1 METHODS
64              
65             =over 4
66              
67             =item B<new>( {INIT HASH REF}, %PARAMETERS )
68              
69             B<new>() will create a new object for the package, pass any argument it might receive
70             to the special standard routine B<init> that I<must> exist.
71             Then it returns what returns B<init>().
72              
73             The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
74              
75             =over 8
76              
77             =item * I<verbose>
78              
79             =item * I<debug>
80              
81             =back
82              
83             =item B<caption>( String )
84              
85             Optional. Caption of the photo to be sent, 0-1024 characters
86              
87             =item B<description>( String )
88              
89             Optional. Short description of the result
90              
91             =item B<download>( file_id, [ file extension ] )
92              
93             Given a file id like photo_file_id, this will call the B<getFile>() method from the parent L<Net::API::Telegram> package and receive a L<Net::API::Telegram::File> object in return, which contains a file path valid for only one hour according to Telegram api here L<https://core.telegram.org/bots/api#getfile>. With this file path, this B<download> method will issue a http get request and retrieve the file and save it locally in a temproary file generated by L<File::Temp>. If an extension is provided, it will be appended to the temproary file name such as C<myfile.jpg> otherwise the extension will be gussed from the mime type returned by the Telegram http server, if any.
94              
95             This method returns undef() on error and sets a L<Net::API::Telegram::Error> or, on success, returns a hash reference with the following properties:
96              
97             =over 8
98              
99             =item I<filepath>
100              
101             The full path to the temporary file
102              
103             =item I<mime>
104              
105             The mime type returned by the server.
106              
107             =item I<response>
108              
109             The L<HTTP::Response>
110              
111             =item I<size>
112              
113             The size in bytes of the file fetched
114              
115             =back
116             =item B<download>( )
117              
118              
119              
120             =item B<id>( String )
121              
122             Unique identifier for this result, 1-64 bytes
123              
124             =item B<input_message_content>( L<Net::API::Telegram::InputMessageContent> )
125              
126             Optional. Content of the message to be sent instead of the photo
127              
128             =item B<parse_mode>( String )
129              
130             Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
131              
132             =item B<photo_file_id>( String )
133              
134             A valid file identifier of the photo
135              
136             =item B<reply_markup>( L<Net::API::Telegram::InlineKeyboardMarkup> )
137              
138             Optional. Inline keyboard attached to the message
139              
140             =item B<title>( String )
141              
142             Optional. Title for the result
143              
144             =item B<type>( String )
145              
146             Type of the result, must be photo
147              
148             =back
149              
150             =head1 COPYRIGHT
151              
152             Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
153              
154             =head1 AUTHOR
155              
156             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
157              
158             =head1 SEE ALSO
159              
160             L<Net::API::Telegram>
161              
162             =head1 COPYRIGHT & LICENSE
163              
164             Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
165              
166             You can use, copy, modify and redistribute this package and associated
167             files under the same terms as Perl itself.
168              
169             =cut
170