Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cosileone opened this issue Sep 18, 2024 · 0 comments

Comments

@cosileone
Copy link

cosileone commented Sep 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant