Bring back platform specific response getters?


#1

As I am working through new unit testing for Jovo V2, I find myself longing for the getters that J1 used to have. For Example:

Alexa: getDirectives(), hasStandardCard() , hasSimpleCard(),
hasAskForCountryAndPostalCodeCard()

Google: hasImageCard(), hasBasicCard()

For now I can dig into the response and get the info, but I would still like to see these make a comeback. Anyone else feel the same? Any plans to already do this perhaps?


#2

It’s on the list.

PRs appreciated :wink:


#3

Ok guys, I am working on these and wondering how to handle adding info to documentation. Should I add a new “Platform Specific Methods” section here: https://www.jovo.tech/docs/requests-responses/response ?

Or add a section about it to https://www.jovo.tech/docs/unit-testing ?


#4

That’s great! :raised_hands:
I think a “Platform Specific Methods” section on the response page makes sense!


#5

Great, thanks so much!!


#6

Thanks a lot for this great Pull Request, @natrixx :pray:


#7

You’re welcome!

I think next up I will add some for google:

getCard()
hasBasicCard()
hasImageCard()
hasSuggestionChips()
getSuggestionChips()
hasDisplayText()
getDisplayText()

Any other suggestions to add to the list are welcome! :smile:


#8

What about hasMediaResponse() and getMediaResponse() ?

Not really needed now, but maybe useful in the future.

hasTable()
hasList()
hasCarousel()
and all the other askFor methods

Thanks again, Nate!


#9

No problemo! These are all good ones too, I will get them on the list!


#10

@AlexSwe - As I start getting setup to work on these, I started to wonder something. The fix I made for hasState was corrected in DialogflowResponse.ts.

But while digging around, I found that getSpeech for example seems to route/end up at GoogleActionResponse.ts.

So basically, where would you prefer these new methods go, and why? :slight_smile:


#11

Oh yes, haha, that’s the difficulty of the Dialogflow/Google Action relationship.

Google Assistant doesn’t do session handling, so anything related to session data, state etc. would go into Dialogflow, which handles it for Google Assistant. Anything Google Action specific (inside the custom google payload (see here in the Google docs) would go into GoogleActionResponse.ts.

Hope this helps!


#12

Perfect, thanks abunch!! :+1: