-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add integrations action endpoints (closes #34)
- Loading branch information
Showing
2 changed files
with
182 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
lib/WebService/Mattermost/V4/API/Resource/IntegrationActions.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package WebService::Mattermost::V4::API::Resource::IntegrationActions; | ||
|
||
# ABSTRACT: Wrapped API methods for the integration actions API endpoints. | ||
|
||
use Moo; | ||
|
||
extends 'WebService::Mattermost::V4::API::Resource'; | ||
|
||
################################################################################ | ||
|
||
sub open { | ||
my $self = shift; | ||
my $args = shift; | ||
|
||
return $self->_post({ | ||
endpoint => 'dialogs/open', | ||
parameters => $args, | ||
required => [ qw(trigger_id url dialog) ], | ||
view => 'Status', | ||
}); | ||
} | ||
|
||
sub submit { | ||
my $self = shift; | ||
my $args = shift; | ||
|
||
return $self->_post({ | ||
endpoint => 'dialogs/submit', | ||
parameters => $args, | ||
required => [ qw(url channel_id team_id submission) ], | ||
}); | ||
} | ||
|
||
################################################################################ | ||
|
||
1; | ||
__END__ | ||
=head1 DESCRIPTION | ||
Wrapped API methods for the integration actions endpoints. | ||
=head2 USAGE | ||
use WebService::Mattermost; | ||
my $mm = WebService::Mattermost->new({ | ||
authenticate => 1, | ||
username => 'email@address.com', | ||
password => 'passwordhere', | ||
base_url => 'https://my.mattermost.server.com/api/v4/', | ||
}); | ||
my $resource = $mm->api->integration_actions; | ||
=head2 METHODS | ||
=over 4 | ||
=item C<open()> | ||
L<Open a dialog|https://api.mattermost.com/#tag/integration_actions/operation/OpenInteractiveDialog> | ||
my $response = $resource->open({ | ||
# Required parameters: | ||
trigger_id => 'TRIGGER-ID-HERE', | ||
url => '...', | ||
dialog => { | ||
# See Mattermost API documentation (above) for payload | ||
}, | ||
}); | ||
=item C<create()> | ||
L<Submit a dialog|https://api.mattermost.com/#tag/integration_actions/operation/SubmitInteractiveDialog> | ||
my $response = $resource->create({ | ||
# Required parameters: | ||
url => '...', | ||
channel_id => 'CHANNEL-ID-HERE', | ||
team_id => 'TEAM-ID-HERE', | ||
submission => { | ||
# See Mattermost API documentation (above) for payload | ||
}, | ||
# Optional parameters | ||
callback_id => 'CALLBACK-ID-HERE', | ||
state => '...', | ||
cancelled => 1, # Boolean, 1 or 0 | ||
}); | ||
=back |