Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

fix(voice): Fixed syntax for setting action on some NCCOs #841

Closed dragonmantank closed 1 year ago

dragonmantank commented 1 year ago

Description

Some of the NCCO actions had their action property set to undefined because the typehint was set to the value, not the property. This corrects that.

Motivation and Context

This generated invalid NCCOs for these types

Testing Details

Example Output or Screenshots (if appropriate)

Code:

builder.addAction(new Talk("Hello"));
builder.addAction(
  new Stream("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
);

console.log(builder.build());

Output:

[
  Talk {
    action: 'talk',
    text: 'Hello',
    bargeIn: undefined,
    loop: undefined,
    level: undefined,
    language: undefined,
    style: undefined,
    premium: undefined
  },
  Stream {
    action: undefined, <--- Invalid action
    streamUrl: [ 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3' ],
    level: undefined,
    bargeIn: undefined,
    loop: undefined
  }
]

Types of changes

Checklist

manchuck commented 1 year ago

With #838 this is addressed with an Enum.