« blib/lib/SignalWire/Skills/Builtin/PlayBackgroundFile.pm
↑ Summary
blib/lib/SignalWire/REST/Namespaces/Fabric.pm »
| 1 | package SignalWire::REST::Namespaces::PhoneNumbers; | ||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 6 | extends 'SignalWire::REST::Namespaces::CrudResource'; | |||||||||
| 6 | |||||||||||
| 7 | 6 | ▶ | use SignalWire::REST::PhoneCallHandler; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 21 | ▶ | has '+_update_method' => ( default => sub { 'PUT' } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | sub search { | ||||||||
|
Subroutine
search: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 12 | 1 | my ($self, %params) = @_; | |||||||||
| 13 | 1 | ▶ | my $p = %params ? \%params : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 1 | return $self->_http->get($self->_path('search'), params => $p); | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | # --- Typed binding helpers ------------------------------------------------- | ||||||||||
| 18 | # | ||||||||||
| 19 | # Each helper is a one-line wrapper over `update` with the right | ||||||||||
| 20 | # `call_handler` value and companion field already set. Extra key/value | ||||||||||
| 21 | # pairs are passed through for cases the helper doesn't name explicitly | ||||||||||
| 22 | # (e.g. you can pass `name => "..."` on any of them). | ||||||||||
| 23 | |||||||||||
| 24 | 4 | ▶ | sub set_swml_webhook { | ||||||||
|
Subroutine
set_swml_webhook: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 25 | 4 | my ($self, $resource_id, %args) = @_; | |||||||||
| 26 | my $url = delete $args{url} | ||||||||||
| 27 | 4 | ▶ | or die "set_swml_webhook: 'url' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 3 | return $self->update( | |||||||||
| 29 | $resource_id, | ||||||||||
| 30 | call_handler => SignalWire::REST::PhoneCallHandler::RELAY_SCRIPT, | ||||||||||
| 31 | call_relay_script_url => $url, | ||||||||||
| 32 | %args, | ||||||||||
| 33 | ); | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | ▶ | sub set_cxml_webhook { | ||||||||
|
Subroutine
set_cxml_webhook: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 37 | 2 | my ($self, $resource_id, %args) = @_; | |||||||||
| 38 | my $url = delete $args{url} | ||||||||||
| 39 | 2 | ▶ | or die "set_cxml_webhook: 'url' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 2 | my $fallback_url = delete $args{fallback_url}; | |||||||||
| 41 | 2 | my $status_callback_url = delete $args{status_callback_url}; | |||||||||
| 42 | |||||||||||
| 43 | 2 | my %body = ( | |||||||||
| 44 | call_handler => SignalWire::REST::PhoneCallHandler::LAML_WEBHOOKS, | ||||||||||
| 45 | call_request_url => $url, | ||||||||||
| 46 | ); | ||||||||||
| 47 | 2 | ▶ | $body{call_fallback_url} = $fallback_url if defined $fallback_url; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 2 | ▶ | $body{call_status_callback_url} = $status_callback_url if defined $status_callback_url; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 2 | return $self->update($resource_id, %body, %args); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | ▶ | sub set_cxml_application { | ||||||||
|
Subroutine
set_cxml_application: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 54 | 1 | my ($self, $resource_id, %args) = @_; | |||||||||
| 55 | my $application_id = delete $args{application_id} | ||||||||||
| 56 | 1 | ▶ | or die "set_cxml_application: 'application_id' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 1 | return $self->update( | |||||||||
| 58 | $resource_id, | ||||||||||
| 59 | call_handler => SignalWire::REST::PhoneCallHandler::LAML_APPLICATION, | ||||||||||
| 60 | call_laml_application_id => $application_id, | ||||||||||
| 61 | %args, | ||||||||||
| 62 | ); | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | ▶ | sub set_ai_agent { | ||||||||
|
Subroutine
set_ai_agent: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 66 | 1 | my ($self, $resource_id, %args) = @_; | |||||||||
| 67 | my $agent_id = delete $args{agent_id} | ||||||||||
| 68 | 1 | ▶ | or die "set_ai_agent: 'agent_id' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | 1 | return $self->update( | |||||||||
| 70 | $resource_id, | ||||||||||
| 71 | call_handler => SignalWire::REST::PhoneCallHandler::AI_AGENT, | ||||||||||
| 72 | call_ai_agent_id => $agent_id, | ||||||||||
| 73 | %args, | ||||||||||
| 74 | ); | ||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 2 | ▶ | sub set_call_flow { | ||||||||
|
Subroutine
set_call_flow: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 78 | 2 | my ($self, $resource_id, %args) = @_; | |||||||||
| 79 | my $flow_id = delete $args{flow_id} | ||||||||||
| 80 | 2 | ▶ | or die "set_call_flow: 'flow_id' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 81 | 2 | my $version = delete $args{version}; | |||||||||
| 82 | |||||||||||
| 83 | 2 | my %body = ( | |||||||||
| 84 | call_handler => SignalWire::REST::PhoneCallHandler::CALL_FLOW, | ||||||||||
| 85 | call_flow_id => $flow_id, | ||||||||||
| 86 | ); | ||||||||||
| 87 | 2 | ▶ | $body{call_flow_version} = $version if defined $version; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | |||||||||||
| 89 | 2 | return $self->update($resource_id, %body, %args); | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | 1 | ▶ | sub set_relay_application { | ||||||||
|
Subroutine
set_relay_application: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 93 | 1 | my ($self, $resource_id, %args) = @_; | |||||||||
| 94 | my $name = delete $args{name} | ||||||||||
| 95 | 1 | ▶ | or die "set_relay_application: 'name' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | 1 | return $self->update( | |||||||||
| 97 | $resource_id, | ||||||||||
| 98 | call_handler => SignalWire::REST::PhoneCallHandler::RELAY_APPLICATION, | ||||||||||
| 99 | call_relay_application => $name, | ||||||||||
| 100 | %args, | ||||||||||
| 101 | ); | ||||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | 2 | ▶ | sub set_relay_topic { | ||||||||
|
Subroutine
set_relay_topic: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 105 | 2 | my ($self, $resource_id, %args) = @_; | |||||||||
| 106 | my $topic = delete $args{topic} | ||||||||||
| 107 | 2 | ▶ | or die "set_relay_topic: 'topic' is required"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 108 | 2 | my $status_callback_url = delete $args{status_callback_url}; | |||||||||
| 109 | |||||||||||
| 110 | 2 | my %body = ( | |||||||||
| 111 | call_handler => SignalWire::REST::PhoneCallHandler::RELAY_TOPIC, | ||||||||||
| 112 | call_relay_topic => $topic, | ||||||||||
| 113 | ); | ||||||||||
| 114 | 2 | ▶ | $body{call_relay_topic_status_callback_url} = $status_callback_url | ||||||||
|
Branch: 1 branch
| |||||||||||
| 115 | if defined $status_callback_url; | ||||||||||
| 116 | |||||||||||
| 117 | 2 | return $self->update($resource_id, %body, %args); | |||||||||
| 118 | } | ||||||||||
| 119 | |||||||||||
| 120 | 6 | 1; | |||||||||
| 121 | |||||||||||
| 122 | __END__ | ||||||||||