vonage-go-sdk icon indicating copy to clipboard operation
vonage-go-sdk copied to clipboard

The NumberInsightClient.Standard call returns an unmarshal error when the roaming field is 'unknown'

Open panyushov opened this issue 3 years ago • 0 comments

Whenever I call the standard number insight on an Italian number

auth := vonage.CreateAuthFromKeySecret("*****", "*******")
niClient := vonage.NewNumberInsightClient(auth)

result, _, err := niClient.Standard("39**********", vonage.NiOpts{})
if err != nil {
    ...
}

I'm getting a json: cannot unmarshal string into Go struct field NiResponseJsonStandard.roaming of type numberinsight.NiRoaming error since the roaming field in the return JSON is of type string with value unknown that cannot be unmarshalled into the NiRoaming struct.

{
    "status": 0,
    "status_message": "Success",
    "request_id": "4edb629f-114b-401b-8871-29710867ca5d",
    "country_code": "IT",
    "country_code_iso3": "ITA",
    "country_name": "Italy",
    "country_prefix": "39",
    ...
    "ported": "ported",
    "roaming": "unknown"
}

Here's decode that causes the issue.

panyushov avatar Mar 08 '22 08:03 panyushov