class WebService::Intercom::User types WebService::Intercom::Types {
has
'type'
=> (
is
=>
'ro'
);
has
'id'
=> (
is
=>
'ro'
);
has
'created_at'
=> (
is
=>
'rw'
,
isa
=> Int);
has
'signed_up_at'
=> (
is
=>
'rw'
,
isa
=> Int);
has
'updated_at'
=> (
is
=>
'rw'
,
isa
=> Int);
has
'user_id'
=> (
is
=>
'rw'
,
isa
=> Str);
has
'email'
=> (
is
=>
'rw'
,
isa
=> Str);
has
'name'
=> (
is
=>
'rw'
,
isa
=> Str);
has
'custom_attributes'
=> (
is
=>
'rw'
,
isa
=> CustomAttributesType);
has
'last_request_at'
=> (
is
=>
'rw'
,
isa
=> Int);
has
'session_count'
=> (
is
=>
'ro'
,
isa
=> Int);
has
'avatar'
=> (
is
=>
'ro'
,
isa
=> AvatarType);
has
'unsubscribed_from_emails'
=> (
is
=>
'rw'
,
isa
=> Bool);
has
'location_data'
=> (
is
=>
'ro'
,
isa
=> LocationDataType);
has
'user_agent_data'
=> (
is
=>
'ro'
,
isa
=> Str);
has
'last_seen_ip'
=> (
is
=>
'ro'
,
isa
=> IPAddressType);
has
'companies'
=> (
is
=>
'ro'
,
isa
=> CompaniesListType);
has
'social_profiles'
=> (
is
=>
'ro'
,
isa
=> SocialProfileListType);
has
'segments'
=> (
is
=>
'ro'
,
isa
=> SegmentsListType);
has
'tags'
=> (
is
=>
'ro'
,
isa
=> TagsListType);
has
'intercom'
=> (
is
=>
'ro'
,
isa
=> InstanceOf[
"WebService::Intercom"
],
required
=> 1);
method save() {
$self
->intercom->user_create_or_update(
$self
);
}
method
delete
() {
$self
->intercom->user_delete(
$self
);
}
multi method tag(Str :
$name
) {
$self
->intercom->tag_items(
name
=>
$name
,
users
=> [{
id
=>
$self
->id,
email
=>
$self
->email,
user_id
=>
$self
->user_id,
}]);
}
multi method tag(WebService::Intercom::Tag
$tag
) {
$self
->intercom->tag_items(
name
=>
$tag
->name,
users
=> [{
id
=>
$self
->id,
email
=>
$self
->email,
user_id
=>
$self
->user_id,
}]);
}
method untag(Str :
$name
) {
$self
->intercom->tag_items(
name
=>
$name
,
users
=> [{
id
=>
$self
->id,
email
=>
$self
->email,
user_id
=>
$self
->user_id,
untag
=> 1
}]);
}
method add_note(Str :
$admin_id
?,
Str :
$body
?) {
$self
->intercom->note_create(
id
=>
$self
->id,
email
=>
$self
->email,
user_id
=>
$self
->user_id,
admin_id
=>
$admin_id
,
body
=>
$body
);
}
method add_event(EventNameType :
$event_name
,
Maybe[Int] :
$created_at
?,
EventMetadataType :
$metadata
? where {
scalar
(
keys
%$_
) <= 5 }) {
$self
->intercom->event_create(
user_id
=>
$self
->user_id,
email
=>
$self
->email,
event_name
=>
$event_name
,
created_at
=>
$created_at
,
metadata
=>
$metadata
);
}
};
1;