File Coverage

blib/lib/Net/API/Telegram/InlineKeyboardButton.pm
Criterion Covered Total %
statement 7 16 43.7
branch n/a
condition n/a
subroutine 3 12 25.0
pod 8 8 100.0
total 18 36 50.0


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Net/API/Telegram/InlineKeyboardButton.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::InlineKeyboardButton;
15             BEGIN
16             {
17 1     1   1309 use strict;
  1         1  
  1         30  
18 1     1   5 use parent qw( Net::API::Telegram::Generic );
  1         2  
  1         4  
19 1     1   248 our( $VERSION ) = '0.1';
20             };
21              
22 0     0 1   sub callback_data { return( shift->_set_get_scalar( 'callback_data', @_ ) ); }
23              
24 0     0 1   sub callback_game { return( shift->_set_get_object( 'callback_game', 'Net::API::Telegram::CallbackGame', @_ ) ); }
25              
26 0     0 1   sub login_url { return( shift->_set_get_object( 'login_url', 'Net::API::Telegram::LoginUrl', @_ ) ); }
27              
28 0     0 1   sub pay { return( shift->_set_get_scalar( 'pay', @_ ) ); }
29              
30 0     0 1   sub switch_inline_query { return( shift->_set_get_scalar( 'switch_inline_query', @_ ) ); }
31              
32 0     0 1   sub switch_inline_query_current_chat { return( shift->_set_get_scalar( 'switch_inline_query_current_chat', @_ ) ); }
33              
34 0     0 1   sub text { return( shift->_set_get_scalar( 'text', @_ ) ); }
35              
36 0     0 1   sub url { return( shift->_set_get_scalar( 'url', @_ ) ); }
37              
38 0     0     sub _is_boolean { return( grep( /^$_[1]$/, qw( pay ) ) ); }
39              
40             1;
41              
42             __END__
43              
44             =encoding utf-8
45              
46             =head1 NAME
47              
48             Net::API::Telegram::InlineKeyboardButton - One button of an inline keyboard
49              
50             =head1 SYNOPSIS
51              
52             my $msg = Net::API::Telegram::InlineKeyboardButton->new( %data ) ||
53             die( Net::API::Telegram::InlineKeyboardButton->error, "\n" );
54              
55             =head1 DESCRIPTION
56              
57             L<Net::API::Telegram::InlineKeyboardButton> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#inlinekeyboardbutton>
58              
59             This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
60              
61             =head1 METHODS
62              
63             =over 4
64              
65             =item B<new>( {INIT HASH REF}, %PARAMETERS )
66              
67             B<new>() will create a new object for the package, pass any argument it might receive
68             to the special standard routine B<init> that I<must> exist.
69             Then it returns what returns B<init>().
70              
71             The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
72              
73             =over 8
74              
75             =item * I<verbose>
76              
77             =item * I<debug>
78              
79             =back
80              
81             =item B<callback_data>( String )
82              
83             Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
84              
85             =item B<callback_game>( L<Net::API::Telegram::CallbackGame> )
86              
87             Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row.
88              
89             =item B<login_url>( L<Net::API::Telegram::LoginUrl> )
90              
91             Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
92              
93             =item B<pay>( Boolean )
94              
95             Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row.
96              
97             =item B<switch_inline_query>( String )
98              
99             Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.
100              
101             =item B<switch_inline_query_current_chat>( String )
102              
103             Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options.
104              
105             =item B<text>( String )
106              
107             Label text on the button
108              
109             =item B<url>( String )
110              
111             Optional. HTTP or tg:// url to be opened when button is pressed
112              
113             =back
114              
115             =head1 COPYRIGHT
116              
117             Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
118              
119             =head1 AUTHOR
120              
121             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
122              
123             =head1 SEE ALSO
124              
125             L<Net::API::Telegram>
126              
127             =head1 COPYRIGHT & LICENSE
128              
129             Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
130              
131             You can use, copy, modify and redistribute this package and associated
132             files under the same terms as Perl itself.
133              
134             =cut
135