NAME
Twilio::Rest::Memory::V1::TraitGroup - The TraitGroup resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $trait_group = $client->memory->v1->trait_groups($store_id)->create(\%body);
for my $trait_group ($client->memory->v1->trait_groups($store_id)->read({}, 20)) {
...
}
my $trait_group = $client->memory->v1->trait_groups($store_id, $trait_group_name)->fetch;
$client->memory->v1->trait_groups($store_id, $trait_group_name)->patch(\%body, \%options);
$client->memory->v1->trait_groups($store_id, $trait_group_name)->delete;
DESCRIPTION
This file holds TraitGroupList, TraitGroupPage, TraitGroupContext, TraitGroupInstance, CreateTraitGroup202ResponseInstance, FetchTraitGroup200ResponseInstance, PatchTraitGroup202ResponseInstance and DeleteTraitGroup202ResponseInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
TraitGroupList
Returned by $client->memory->v1->trait_groups($store_id). See also Twilio::ListResource.
create
my $trait_group = $client->memory->v1->trait_groups($store_id)->create(\%body);
Creates a Trait Group with declarative trait schemas for this Memory Store. Returns a CreateTraitGroup202ResponseInstance.
%body is sent as JSON. It can be left out. When given, it takes the names Twilio's API documentation uses.
Its fields are:
description-
description of the Trait Group
displayName-
Required. Unique name of the Trait Group
traits-
Map of traits belonging to this Trait Group, keyed by trait name.
read
my @records = $client->memory->v1->trait_groups($store_id)->read(\%options, $limit, $page_size);
Returns a list of Trait Groups for this Memory Store, with optional traits information. Returns the records as a list, fetching as many pages as it needs.
The options are:
include_traits-
Whether to include trait definitions in the response
order_by-
Either 'ASC' or 'DESC' to sort results ascending or descending respectively. One of
ASCorDESC.
stream
my $stream = $client->memory->v1->trait_groups($store_id)->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->memory->v1->trait_groups($store_id)->page(\%options, $page_size, $page_token);
Fetches one page, and returns a Twilio::TokenPaginationPage. This API pages by token, so there is no page number.
get_page
my $page = $client->memory->v1->trait_groups($store_id)->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->memory->v1->trait_groups($store_id)->get_context($trait_group_name);
Returns a TraitGroupContext, and makes no request.
TraitGroupPage
A Twilio::Page of TraitGroupInstance objects.
records_key
build_instance
Used by Twilio::Page.
TraitGroupContext
Returned by $client->memory->v1->trait_groups($store_id, $trait_group_name). It makes no request until one of these methods is called.
fetch
my $trait_group = $client->memory->v1->trait_groups($store_id, $trait_group_name)->fetch(\%options);
Retrieve a specific Trait Group by its unique name for this Memory Store, with optional traits information. Returns a FetchTraitGroup200ResponseInstance.
The options are:
include_traits-
Whether to include trait definitions in the response
order_by-
Either 'ASC' or 'DESC' to sort results ascending or descending respectively. One of
ASCorDESC. page_size-
The maximum number of items to return per page, maximum of 100.
page_token-
The token for the page of results to retrieve.
patch
my $trait_group = $client->memory->v1->trait_groups($store_id, $trait_group_name)->patch(\%body, \%options);
Partially updates a Trait Group. Only the fields provided in the request body will be updated. For traits: existing traits with matching keys will be updated, new keys will be added. To remove a trait, set its dataType to an empty string ("") - this serves as an explicit deletion marker. Returns a PatchTraitGroup202ResponseInstance.
%body is sent as JSON. It takes the names Twilio's API documentation uses.
Its fields are:
description-
Updated description of the Trait Group
traits-
Map of traits to add, update, or remove in this Trait Group, where the key is the trait name. - To update/add a trait: provide the complete TraitDefinition object - To remove a trait: set dataType to an empty string ("")
The options are:
if_match-
Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches the one provided, preventing accidental overwrites.
delete
$client->memory->v1->trait_groups($store_id, $trait_group_name)->delete;
Deletes the Trait Group and all associated Traits from the Memory Store. Returns a DeleteTraitGroup202ResponseInstance.
TraitGroupInstance
See also Twilio::InstanceResource.
It has fetch, patch and delete, which work as they do on the context.
Its fields are:
- description
-
description of the Trait Group
- display_name
-
Provides a unique and addressable name to be assigned to this Trait Group
- traits
-
Map of traits that are part of this Trait Group, where the key is the trait name and the value is the trait's definition.
- version
-
The current version number of the Trait Group. Incremented on each successful update.
CreateTraitGroup202ResponseInstance
Returned by create, for an answer that is not a TraitGroup. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check operation status.
FetchTraitGroup200ResponseInstance
Returned by fetch, for an answer that is not a TraitGroup. See also Twilio::InstanceResource.
Its fields are:
- meta
-
No description in the specification.
- trait_group
-
No description in the specification.
PatchTraitGroup202ResponseInstance
Returned by patch, for an answer that is not a TraitGroup. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check operation status.
DeleteTraitGroup202ResponseInstance
Returned by delete, for an answer that is not a TraitGroup. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- status_url
-
URI to check operation status.
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.