Telegram/Audio.pm

filter: Statementstmt 50.0% 8 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 27.2% 3 / 11 Podpod 100% 8 / 8 totaltotal 54.2% 19 / 35 SCAR 1.2
CC
1
Cov
50%
download
2.0
duration
2.0
file_id
2.0
CRAP 1.1
« Telegram/WebhookInfo.pm ↑ Summary Telegram/InlineQueryResultCachedAudio.pm »
1 # -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Net/API/Telegram/Audio.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/05/20
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::Audio;
15 BEGIN
16 {
17 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use parent qw( Net::API::Telegram::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ our( $VERSION ) = '0.1';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 };
21  
22 0 ▶sub download { return( shift->_download( @_ ) ); }
Subroutine download: not called CC=1 SCAR=6.9
Pod documented
23  
24 0 ▶sub duration { return( shift->_set_get_number( 'duration', @_ ) ); }
Subroutine duration: not called CC=1 SCAR=6.9
Pod documented
25  
26 0 ▶sub file_id { return( shift->_set_get_scalar( 'file_id', @_ ) ); }
Subroutine file_id: not called CC=1 SCAR=6.9
Pod documented
27  
28 0 ▶sub file_size { return( shift->_set_get_number( 'file_size', @_ ) ); }
Subroutine file_size: not called CC=1 SCAR=6.9
Pod documented
29  
30 0 ▶sub mime_type { return( shift->_set_get_scalar( 'mime_type', @_ ) ); }
Subroutine mime_type: not called CC=1 SCAR=6.9
Pod documented
31  
32 0 ▶sub performer { return( shift->_set_get_scalar( 'performer', @_ ) ); }
Subroutine performer: not called CC=1 SCAR=6.9
Pod documented
33  
34 0 ▶sub thumb { return( shift->_set_get_object( 'thumb', 'Net::API::Telegram::PhotoSize', @_ ) ); }
Subroutine thumb: not called CC=1 SCAR=6.9
Pod documented
35  
36 0 ▶sub title { return( shift->_set_get_scalar( 'title', @_ ) ); }
Subroutine title: not called CC=1 SCAR=6.9
Pod documented
37  
38 1 1;
39  
40 __END__
41  
42 =encoding utf-8
43  
44 =head1 NAME
45  
46 Net::API::Telegram::Audio - An audio file to be treated as music by the Telegram clients
47  
48 =head1 SYNOPSIS
49  
50 my $msg = Net::API::Telegram::Audio->new( %data ) ||
51 die( Net::API::Telegram::Audio->error, "\n" );
52  
53 =head1 DESCRIPTION
54  
55 L<Net::API::Telegram::Audio> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#audio>
56  
57 This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
58  
59 =head1 METHODS
60  
61 =over 4
62  
63 =item B<new>( {INIT HASH REF}, %PARAMETERS )
64  
65 B<new>() will create a new object for the package, pass any argument it might receive
66 to the special standard routine B<init> that I<must> exist.
67 Then it returns what returns B<init>().
68  
69 The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
70  
71 =over 8
72  
73 =item * I<verbose>
74  
75 =item * I<debug>
76  
77 =back
78  
79 =item B<download>( file_id, [ file extension ] )
80  
81 Given a file id like 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.
82  
83 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:
84  
85 =over 8
86  
87 =item I<filepath>
88  
89 The full path to the temporary file
90  
91 =item I<mime>
92  
93 The mime type returned by the server.
94  
95 =item I<response>
96  
97 The L<HTTP::Response>
98  
99 =item I<size>
100  
101 The size in bytes of the file fetched
102  
103 =back
104 =item B<download>( )
105  
106  
107  
108 =item B<duration>( Integer )
109  
110 Duration of the audio in seconds as defined by sender
111  
112 =item B<file_id>( String )
113  
114 Identifier for this file
115  
116 =item B<file_size>( Integer )
117  
118 Optional. File size
119  
120 =item B<mime_type>( String )
121  
122 Optional. MIME type of the file as defined by sender
123  
124 =item B<performer>( String )
125  
126 Optional. Performer of the audio as defined by sender or by audio tags
127  
128 =item B<thumb>( L<Net::API::Telegram::PhotoSize> )
129  
130 Optional. Thumbnail of the album cover to which the music file belongs
131  
132 =item B<title>( String )
133  
134 Optional. Title of the audio as defined by sender or by audio tags
135  
136 =back
137  
138 =head1 COPYRIGHT
139  
140 Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
141  
142 =head1 AUTHOR
143  
144 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
145  
146 =head1 SEE ALSO
147  
148 L<Net::API::Telegram>
149  
150 =head1 COPYRIGHT & LICENSE
151  
152 Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
153  
154 You can use, copy, modify and redistribute this package and associated
155 files under the same terms as Perl itself.
156  
157 =cut
158  
« Telegram/WebhookInfo.pm ↑ Summary Telegram/InlineQueryResultCachedAudio.pm »