dialogflow / dialogflow-fulfillment-nodejs

Dialogflow agent fulfillment library supporting v1&v2, 8 platforms, and text, card, image, suggestion, custom responses
Apache License 2.0
597 stars 282 forks source link

Exports PLATFORMS as Platforms #344

Open techiejd opened 1 year ago

techiejd commented 1 year ago

This is necessary to access Platforms in a .ts file.

For example: new Payload(Platforms.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true})

The platforms are not exposed any where publicly. From the js examples I've seen online, most people access the platforms by WebhookClient.Platform. This doesn't work with ts because WebhookClient.Platform is not an explicit method or a field.

The @types/dialogflow-fulfillment exports the platforms.

Without exposing it, we get a run time error because the dialogflow-fulfillment.d.ts is not compiled and the .js does not expose the platforms. So, the solution is to also export it from the .js .

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.