blib/lib/WebService/Mattermost/V4/API/Resource/OAuth.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 3 | 9 | 33.3 |
branch | n/a | ||
condition | n/a | ||
subroutine | 1 | 3 | 33.3 |
pod | 2 | 2 | 100.0 |
total | 6 | 14 | 42.8 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WebService::Mattermost::V4::API::Resource::OAuth; 2: 3: # ABSTRACT: Wrapped API methods for the OAuth API endpoints. 4: 5: use Moo; 6: 7: extends 'WebService::Mattermost::V4::API::Resource'; 8: with 'WebService::Mattermost::V4::API::Resource::Role::View::Application'; 9: 10: ################################################################################ 11: 12: sub register_app { 13: my $self = shift; 14: my $args = shift; 15: 16: return $self->_single_view_post({ 17: endpoint => 'apps', 18: parameters => $args, 19: required => [ qw(name description callback_urls homepage) ], 20: }); 21: } 22: 23: sub get_apps { 24: my $self = shift; 25: my $args = shift; 26: 27: return $self->_get({ 28: endpoint => 'apps', 29: parameters => $args, 30: }); 31: } 32: 33: ################################################################################ 34: 35: 1; 36: 37: __END__ 38: 39: =pod 40: 41: =encoding UTF-8 42: 43: =head1 NAME 44: 45: WebService::Mattermost::V4::API::Resource::OAuth - Wrapped API methods for the OAuth API endpoints. 46: 47: =head1 VERSION 48: 49: version 0.28 50: 51: =head1 DESCRIPTION 52: 53: =head2 USAGE 54: 55: use WebService::Mattermost; 56: 57: my $mm = WebService::Mattermost->new({ 58: authenticate => 1, 59: username => 'me@somewhere.com', 60: password => 'hunter2', 61: base_url => 'https://my.mattermost.server.com/api/v4/', 62: }); 63: 64: my $resource = $mm->api->oauth; 65: 66: =head2 METHODS 67: 68: =over 4 69: 70: =item C<register_app()> 71: 72: L<Register OAuth app|https://api.mattermost.com/#tag/OAuth%2Fpaths%2F~1oauth~1apps%2Fpost> 73: 74: my $response = $resource->register_app({ 75: # Required parameters: 76: name => '...', 77: description => '...', 78: callback_urls => [ '...' ], 79: homepage => '...', 80: 81: # Optional parameters: 82: icon_url => '...', 83: is_trusted => \0, # or \1 for true 84: }); 85: 86: =item C<get_apps()> 87: 88: L<Get OAuth apps|https://api.mattermost.com/#tag/OAuth%2Fpaths%2F~1oauth~1apps%2Fget> 89: 90: my $response = $resource->get_apps({ 91: # Optional parameters: 92: page => 0, 93: per_page => 60, 94: }); 95: 96: =back 97: 98: =head1 AUTHOR 99: 100: Mike Jones <mike@netsplit.org.uk> 101: 102: =head1 COPYRIGHT AND LICENSE 103: 104: This software is Copyright (c) 2020 by Mike Jones. 105: 106: This is free software, licensed under: 107: 108: The MIT (X11) License 109: 110: =cut 111: |