Class: Retell::SDK::Unofficial::API::Call
- Inherits:
-
Object
- Object
- Retell::SDK::Unofficial::API::Call
- Defined in:
- lib/retell/sdk/unofficial/api/call.rb
Instance Method Summary collapse
- #create_phone_call(from_number:, to_number:, override_agent_id: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #create_web_call(agent_id:, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
-
#initialize(client) ⇒ Call
constructor
A new instance of Call.
- #list(filter_criteria: nil, limit: nil, pagination_key: nil, sort_order: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #register(agent_id:, direction: nil, from_number: nil, to_number: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #retrieve(call_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Call
Returns a new instance of Call.
6 7 8 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_phone_call(from_number:, to_number:, override_agent_id: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 39 def create_phone_call( from_number:, to_number:, override_agent_id: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) override_agent_id = override_agent_id.is_a?(Retell::SDK::Unofficial::Agent) ? override_agent_id.agent_id : override_agent_id validate_phone_number(from_number, 'from_number') validate_phone_number(to_number, 'to_number') validate_non_empty_string(override_agent_id, 'override_agent_id') if override_agent_id payload = { from_number: from_number, to_number: to_number, override_agent_id: override_agent_id, metadata: , retell_llm_dynamic_variables: retell_llm_dynamic_variables }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.post('/v2/create-phone-call', payload, **) end |
#create_web_call(agent_id:, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 10 def create_web_call( agent_id:, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_id = agent_id.is_a?(Retell::SDK::Unofficial::Agent) ? agent_id.agent_id : agent_id validate_non_empty_string(agent_id, 'agent_id') payload = { agent_id: agent_id, metadata: , retell_llm_dynamic_variables: retell_llm_dynamic_variables }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.post('/v2/create-web-call', payload, **) end |
#list(filter_criteria: nil, limit: nil, pagination_key: nil, sort_order: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 134 def list( filter_criteria: nil, limit: nil, pagination_key: nil, sort_order: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) validate_positive_integer(limit, 'limit') if limit validate_sort_order(sort_order) if sort_order validate_filter_criteria(filter_criteria) if filter_criteria payload = { filter_criteria: filter_criteria, limit: limit, pagination_key: pagination_key, sort_order: sort_order }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.post('/v2/list-calls', payload, **) end |
#register(agent_id:, direction: nil, from_number: nil, to_number: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 74 def register( agent_id:, direction: nil, from_number: nil, to_number: nil, metadata: nil, retell_llm_dynamic_variables: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_id = agent_id.is_a?(Retell::SDK::Unofficial::Agent) ? agent_id.agent_id : agent_id validate_non_empty_string(agent_id, 'agent_id') validate_direction(direction) if direction validate_phone_number(from_number, 'from_number') if from_number validate_phone_number(to_number, 'to_number') if to_number payload = { agent_id: agent_id, direction: direction, from_number: from_number, to_number: to_number, metadata: , retell_llm_dynamic_variables: retell_llm_dynamic_variables }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.post('/v2/register-phone-call', payload, **) end |
#retrieve(call_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/retell/sdk/unofficial/api/call.rb', line 113 def retrieve( call_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) call_id = (call_or_id.is_a?(Retell::SDK::Unofficial::PhoneCall) || call_or_id.is_a?(Retell::SDK::Unofficial::WebCall)) ? call_or_id.call_id : call_or_id validate_non_empty_string(call_id, 'call_id') = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.get("/v2/get-call/#{call_id}", **) end |