NAME

WebService::Mattermost::V4::API::Object::Role::APIMethods - Allows a result object to call the API.

VERSION

version 0.29

DESCRIPTION

Mark methods as available for use from a result object.

USAGE

package SomeResultObj;

use Moo;

extends 'WebService::Mattermost::V4::API::Object';
with    'WebService::Mattermost::V4::API::Object::Role::APIMethods';

sub BUILD {
    my $self = shift;

    # e.g. user
    $self->api_resource_name('lower case name of the API resource');

    $self->set_available_api_methods([ qw(
        method_name
        another_method_name
        yet_another_method_name
    ) ]);
}

1;

METHODS

call()

Call an API method which is available to this class.

$object->call('method_name', {
    some => 'arguments',
});
set_available_api_methods()
$self->set_available_api_methods([ qw(foo bar baz) ]);
method_is_valid()

Checks whether the given method is set as permitted.

my $valid = $self->method_is_valid('foo'); # 1 or 0

AUTHOR

Mike Jones <mike@netsplit.org.uk>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Mike Jones.

This is free software, licensed under:

The MIT (X11) License