team-telnyx / telnyx-php

PHP SDK for the Telnyx API
MIT License
33 stars 26 forks source link

Add params to Retrieve call #92

Open aetikon opened 1 week ago

aetikon commented 1 week ago

I'm attempting to retrieve the caller-name and carrier types from a NumberLookup but those properties are always returned as null.

I'm using the following code:

\Telnyx\NumberLookup::Retrieve($number, ["type" => ["caller-name", "carrier"]]);

but it appears that ?type=carrier&type=caller-name isn't appended to the request URL.

Is there a fix for this or do I need to just use cURL?

weroh commented 1 week ago

I can't remember if the library will implode arrays. The lib might be ignoring that param.

Before you switch to cURL, try just using a string instead of an array.

\Telnyx\NumberLookup::Retrieve($number, ["type" => "caller-name,carrier"]);
weroh commented 1 week ago

Sorry I just realized this endpoint needs two type parameters. This is how I have it setup in my test code from several years back:

\Telnyx\NumberLookup::Retrieve($number, ["type" => "caller-name", "type" => "carrier"]);
aetikon commented 1 week ago

You're suggesting using a duplicate array key?

In any case, that code doesn't work in v2.9.0 nor 3.0.0.

The caller_name property is still null even when only using the following:

\Telnyx\NumberLookup::Retrieve($number, ["type" => "caller-name"]);