Class: Zernio::CallsApi
- Inherits:
-
Object
- Object
- Zernio::CallsApi
- Defined in:
- lib/zernio-sdk/api/calls_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_call(id, opts = {}) ⇒ GetCall200Response
Get a call (any channel) Channel-agnostic call detail: works for both WhatsApp and regular phone (PSTN) calls, so any row from
GET /v1/callscan be opened without branching onchannel. -
#get_call_recording(id, opts = {}) ⇒ GetWhatsAppCallRecording200Response
Get a call recording Channel-agnostic recording fetch: resolves a fresh, playable MP3 URL for any call regardless of channel (provider-signed URLs expire ~10 minutes after signing, so this re-signs on demand).
-
#get_call_recording_with_http_info(id, opts = {}) ⇒ Array<(GetWhatsAppCallRecording200Response, Integer, Hash)>
Get a call recording Channel-agnostic recording fetch: resolves a fresh, playable MP3 URL for any call regardless of channel (provider-signed URLs expire ~10 minutes after signing, so this re-signs on demand).
-
#get_call_with_http_info(id, opts = {}) ⇒ Array<(GetCall200Response, Integer, Hash)>
Get a call (any channel) Channel-agnostic call detail: works for both WhatsApp and regular phone (PSTN) calls, so any row from `GET /v1/calls` can be opened without branching on `channel`.
-
#initialize(api_client = ApiClient.default) ⇒ CallsApi
constructor
A new instance of CallsApi.
-
#list_calls(opts = {}) ⇒ ListCalls200Response
List all calls (unified history) Unified call history across ALL of your numbers: both channels (WhatsApp Business Calling + regular phone/PSTN), inbound and outbound, newest first.
-
#list_calls_with_http_info(opts = {}) ⇒ Array<(ListCalls200Response, Integer, Hash)>
List all calls (unified history) Unified call history across ALL of your numbers: both channels (WhatsApp Business Calling + regular phone/PSTN), inbound and outbound, newest first.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_call(id, opts = {}) ⇒ GetCall200Response
Get a call (any channel)
Channel-agnostic call detail: works for both WhatsApp and regular phone (PSTN) calls, so any row from GET /v1/calls can be opened without branching on channel. Returns the full call including transcript segments, with contactId/contactName set when the counterparty matches a CRM contact.
27 28 29 30 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 27 def get_call(id, opts = {}) data, _status_code, _headers = get_call_with_http_info(id, opts) data end |
#get_call_recording(id, opts = {}) ⇒ GetWhatsAppCallRecording200Response
Get a call recording
Channel-agnostic recording fetch: resolves a fresh, playable MP3 URL for any call regardless of channel (provider-signed URLs expire ~10 minutes after signing, so this re-signs on demand). Default responds 302 Found redirecting to the fresh URL; pass as=json to receive { url } instead.
91 92 93 94 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 91 def get_call_recording(id, opts = {}) data, _status_code, _headers = get_call_recording_with_http_info(id, opts) data end |
#get_call_recording_with_http_info(id, opts = {}) ⇒ Array<(GetWhatsAppCallRecording200Response, Integer, Hash)>
Get a call recording Channel-agnostic recording fetch: resolves a fresh, playable MP3 URL for any call regardless of channel (provider-signed URLs expire ~10 minutes after signing, so this re-signs on demand). Default responds `302 Found` redirecting to the fresh URL; pass `as=json` to receive `{ url }` instead.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 102 def get_call_recording_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CallsApi.get_call_recording ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CallsApi.get_call_recording" end allowable_values = ["json"] if @api_client.config.client_side_validation && opts[:'as'] && !allowable_values.include?(opts[:'as']) fail ArgumentError, "invalid value for \"as\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/calls/{id}/recording'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'as'] = opts[:'as'] if !opts[:'as'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetWhatsAppCallRecording200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"CallsApi.get_call_recording", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: CallsApi#get_call_recording\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_call_with_http_info(id, opts = {}) ⇒ Array<(GetCall200Response, Integer, Hash)>
Get a call (any channel) Channel-agnostic call detail: works for both WhatsApp and regular phone (PSTN) calls, so any row from `GET /v1/calls` can be opened without branching on `channel`. Returns the full call including transcript segments, with `contactId`/`contactName` set when the counterparty matches a CRM contact.
37 38 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 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 37 def get_call_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CallsApi.get_call ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling CallsApi.get_call" end # resource path local_var_path = '/v1/calls/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetCall200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"CallsApi.get_call", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: CallsApi#get_call\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_calls(opts = {}) ⇒ ListCalls200Response
List all calls (unified history)
Unified call history across ALL of your numbers: both channels (WhatsApp Business Calling + regular phone/PSTN), inbound and outbound, newest first. Unlike GET /v1/voice/calls (PSTN-only) and GET /v1/whatsapp/calls (one account at a time), this endpoint needs no accountId and never requires fanning out one request per number. Any row can be opened channel-agnostically via GET /v1/calls/{id} and GET /v1/calls/{id}/recording; no branching on channel needed. When the counterparty number matches a CRM contact, contactId and contactName are set. Cursor pagination: pass the returned nextCursor as before to fetch the next page. nextCursor is null on the last page.
166 167 168 169 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 166 def list_calls(opts = {}) data, _status_code, _headers = list_calls_with_http_info(opts) data end |
#list_calls_with_http_info(opts = {}) ⇒ Array<(ListCalls200Response, Integer, Hash)>
List all calls (unified history) Unified call history across ALL of your numbers: both channels (WhatsApp Business Calling + regular phone/PSTN), inbound and outbound, newest first. Unlike `GET /v1/voice/calls` (PSTN-only) and `GET /v1/whatsapp/calls` (one account at a time), this endpoint needs no `accountId` and never requires fanning out one request per number. Any row can be opened channel-agnostically via `GET /v1/calls/id` and `GET /v1/calls/id/recording`; no branching on `channel` needed. When the counterparty number matches a CRM contact, `contactId` and `contactName` are set. Cursor pagination: pass the returned `nextCursor` as `before` to fetch the next page. `nextCursor` is null on the last page.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/zernio-sdk/api/calls_api.rb', line 182 def list_calls_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CallsApi.list_calls ...' end allowable_values = ["whatsapp", "pstn"] if @api_client.config.client_side_validation && opts[:'channel'] && !allowable_values.include?(opts[:'channel']) fail ArgumentError, "invalid value for \"channel\", must be one of #{allowable_values}" end allowable_values = ["ringing", "answered", "ended", "failed"] if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status']) fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}" end allowable_values = ["inbound", "outbound"] if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction']) fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CallsApi.list_calls, must be smaller than or equal to 200.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CallsApi.list_calls, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/calls' # query parameters query_params = opts[:query_params] || {} query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil? query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil? query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListCalls200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"CallsApi.list_calls", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: CallsApi#list_calls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |