Vonage / vonage-go-sdk

A lightweight library to help Go users everywhere integrate with the Vonage APIs. Issues and PRs all really welcome!!
https://vonage.github.io/vonage-go-sdk/
Apache License 2.0
51 stars 32 forks source link

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

Open panyushov opened 2 years ago

panyushov commented 2 years ago

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.