« blib/lib/auto/share/dist/Beekeeper/chat/lib/MyApp/Bot.pm
↑ Summary
blib/lib/auto/share/dist/Beekeeper/flood/lib/MyApp/Service/Flood.pm »
| 1 | package MyApp::Service::Auth; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Beekeeper::Client; | ||
| 7 | |||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | bless {}, $class; | ||
| 12 | } | ||
| 13 | |||
| 14 | sub client { | ||
| 15 | my $proto = shift; | ||
| 16 | |||
| 17 | Beekeeper::Client->instance; | ||
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | # This is the API of service MyApp::Service::Auth | ||
| 22 | |||
| 23 | sub login { | ||
| 24 | my ($self, %args) = @_; | ||
| 25 | |||
| 26 | $self->client->call_remote( | ||
| 27 | method => 'myapp.auth.login', | ||
| 28 | params => { | ||
| 29 | username => $args{'username'}, | ||
| 30 | password => $args{'password'}, | ||
| 31 | }, | ||
| 32 | ); | ||
| 33 | } | ||
| 34 | |||
| 35 | sub logout { | ||
| 36 | my ($self) = @_; | ||
| 37 | |||
| 38 | $self->client->call_remote( | ||
| 39 | method => 'myapp.auth.logout', | ||
| 40 | ); | ||
| 41 | } | ||
| 42 | |||
| 43 | sub kick { | ||
| 44 | my ($self, %args) = @_; | ||
| 45 | |||
| 46 | $self->client->call_remote( | ||
| 47 | method => 'myapp.auth.kick', | ||
| 48 | params => { | ||
| 49 | username => $args{'username'}, | ||
| 50 | }, | ||
| 51 | ); | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; |