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

Added Alexa Contact, Device, ISP and List APIs #149

Merged
merged 5 commits into from Sep 4, 2018
Merged

Added Alexa Contact, Device, ISP and List APIs #149

merged 5 commits into from Sep 4, 2018

Conversation

omenocal
Copy link
Contributor

@omenocal omenocal commented Sep 3, 2018

Features added:

  • Customer Contact API
  • Device Address API
  • Device Settings API
  • In-Skill Purchases API
  • Lists API

@coveralls
Copy link

coveralls commented Sep 4, 2018

Coverage Status

Coverage increased (+0.3%) to 87.993% when pulling f2b8553 on omenocal:v3 into f708415 on mediarain:v3.


.. code-block:: javascript

skill.onIntent('BuyIntent', async (voxaEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know ISP is an Alexa feature, but shouldn't this be app instead of skill?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for all other skill statements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it makes sense. I was just following the same structure of the docs. If you look at other docs' examples, it uses skill as well. Also, in the headspace action and skill, the guys are still using skill for their intents/states:
https://github.com/mediarain/headspace-skill/blob/V3-staging/app/states/alexa.states.js

@armonge thoughts on this change ?? If we go with @lvelasquezm suggestion, I'd have to change all the docs (and probably the tests?)

I also think is a matter of the developer's preference. I really like skill since I'm coming from the voxa2 version and I'm used to that. But open to any guidance on this topic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should call them app, in Voxa3 most of the code is part of the VoxaApp, the skill is just the actual wrapper. Also, if you see the docs calling stuff skill instead of app go ahead and change that, wherever it makes sens

docs/index.rst Outdated
@@ -133,6 +133,11 @@ Links
statemachine-skill
request-flow
i18n
customerContact
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a way to signal the user from the menu that this is alexa only

@@ -61,6 +61,7 @@
"@types/chai": "^4.0.10",
"@types/chai-as-promised": "^7.1.0",
"@types/mocha": "^2.2.45",
"@types/nock": "^9.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe you also need to add nock, not only @types/nock

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I didn't have any issues in my tests nor lint, nor in Travis, do you still think is worth it to include it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, most likely nock was included as a dependency from another package, however the @types/nock package does not include it as a dependency. Add nock in here to have a specific version and not depend on side effects from other packages

src/VoxaEvent.ts Outdated
@@ -24,6 +24,8 @@ export abstract class IVoxaEvent {
public requestToIntent: ITypeMap = {};
public requestToRequest: ITypeMap = {};
public platform!: string;
public alexa: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this seems like keys that should only be present in the AlexaEvent and DialogFlowEvent subclasses

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, they're not any we know which keys are present, go ahead and define a type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll remove the google one because I'm not using it. I'll just move out the alexa key

@@ -50,6 +57,14 @@ export class AlexaEvent extends IVoxaEvent {
}

this.platform = "alexa";

this.alexa = {
customerContact: new CustomerContact(event),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of event better pass the rawEvent

export class ApiBase {
public errorCodeSafeToIgnore: number = 0; // the code error to ignore on checkError function
public tag: string = ""; // the class reference for error logging
public voxaEvent: any; // the event as sent by the service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using a voxaEvent perhaps it's better to use the rawEvent which has a type of RequestEnvelope if i'm not mistaken. In any case, let's try and not use any when possible

this.voxaEvent = _.cloneDeep(event);
}

protected getResult(path = "", method = "GET", body = {}): any {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type of each api response can be found in the ask-sdk-model package, for example

services.deviceAddress.Address
services.deviceAddress.ShortAddress

Let's use those, seems like a great oportunitty for generics

public voxaEvent: any; // the event as sent by the service

constructor(event: RequestEnvelope) {
this.voxaEvent = _.cloneDeep(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check this, you're passing a voxaEvent as any in the calling AlexaEvent class, however this class takes a RequestEnvelope in the constructor

@armonge
Copy link
Contributor

armonge commented Sep 4, 2018

Also, seems like we should update https://github.com/mediarain/voxa/blob/v3/docs/voxa-event.rst

@omenocal
Copy link
Contributor Author

omenocal commented Sep 4, 2018

screen shot 2018-09-04 at 11 57 54 am

@armonge done, just added bullets to group Alexa APIs in a single item

@armonge armonge merged commit 9db4d69 into VoxaAI:v3 Sep 4, 2018
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

Successfully merging this pull request may close these issues.

None yet

4 participants