NAME

Twilio::Rest::Chat::V1::Service::Role - The Role resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $role = $client->chat->v1->services($service_sid)->roles->create($friendly_name, $type, $permission);
for my $role ($client->chat->v1->services($service_sid)->roles->read({}, 20)) {
  ...
}
my $role = $client->chat->v1->services($service_sid)->roles($sid)->fetch;
$client->chat->v1->services($service_sid)->roles($sid)->update($permission);
$client->chat->v1->services($service_sid)->roles($sid)->delete;

DESCRIPTION

Roles determining user or member permissions

This file holds RoleList, RolePage, RoleContext and RoleInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

RoleList

Returned by $client->chat->v1->services($service_sid)->roles. See also Twilio::ListResource.

create

my $role = $client->chat->v1->services($service_sid)->roles->create($friendly_name, $type, $permission);

Returns a RoleInstance.

The required values are:

$friendly_name

A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

$type

One of channel or deployment.

$permission

A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's type and are described in the documentation. An array reference.

read

my @records = $client->chat->v1->services($service_sid)->roles->read(\%options, $limit, $page_size);

Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->chat->v1->services($service_sid)->roles->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->chat->v1->services($service_sid)->roles->page(\%options, $page_size, $page_token, $page_number);

Fetches one page, and returns a Twilio::Page.

get_page

my $page = $client->chat->v1->services($service_sid)->roles->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->chat->v1->services($service_sid)->roles->get_context($sid);

Returns a RoleContext, and makes no request.

RolePage

A Twilio::Page of RoleInstance objects.

records_key

build_instance

Used by Twilio::Page.

RoleContext

Returned by $client->chat->v1->services($service_sid)->roles($sid). It makes no request until one of these methods is called.

fetch

my $role = $client->chat->v1->services($service_sid)->roles($sid)->fetch;

Returns a RoleInstance.

update

my $role = $client->chat->v1->services($service_sid)->roles($sid)->update($permission);

Returns a RoleInstance.

The required values are:

$permission

A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's type and are described in the documentation. An array reference.

delete

$client->chat->v1->services($service_sid)->roles($sid)->delete;

Returns true.

RoleInstance

See also Twilio::InstanceResource.

It has fetch, update and delete, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Role resource.

date_created

The date and time in GMT when the resource was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

friendly_name

The string that you assigned to describe the resource.

permissions

An array of the permissions the role has been granted, formatted as a JSON string.

service_sid

The SID of the Service the resource is associated with.

sid

The unique string that we created to identify the Role resource.

type

One of channel or deployment.

url

The absolute URL of the Role resource.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.