Skip to content

[Bug] Please update PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices to reflect the correct names #1033

@cosileone

Description

@cosileone

When using the Twilio pricing api the response returns snake_case properties.

{
  "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/US",
  "country": "United States",
  "price_unit": "USD",
  "phone_number_prices": [
    {
      "number_type": "local",
      "base_price": "1.15",
      "current_price": "1.15"
    },
    {
      "number_type": "toll free",
      "base_price": "2.15",
      "current_price": "2.15"
    }
  ],
  "iso_country": "US"
}

However when using the Twilio Node SDK (v1) endpoint as such

const response = await ctx.twilio.pricing.v1.phoneNumbers
        .countries("US")
        .fetch((err, result) => result?.toJSON())

A mixed casing response is received, properties as shown below.

{
  country: 'United States',
  isoCountry: 'US',
  phoneNumberPrices: [
    { number_type: 'local', base_price: '1.15', current_price: '1.15' },
    {
      number_type: 'toll free',
      base_price: '2.15',
      current_price: '2.15'
    }
  ],
  priceUnit: 'USD',
  url: 'https://pricing.twilio.com/v1/PhoneNumbers/Countries/US'
}

Notice how number_type is snake_case whereas phoneNumberPrices is camelCase, this is incorrect as the SDK expects camelCase property names as shown below.

export class PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
}

Please either update to correctly camelCase all property names, or update PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices to correctly reflect the snake_case response to allow for correct property access in Typescript.

e.g.
response.phoneNumberPrices[0].numberType <-- this is currently not possible with the current typings

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions