Coder Social home page Coder Social logo

Support for v1 about node-alexa-smapi HOT 17 CLOSED

tejashah88 avatar tejashah88 commented on August 21, 2024
Support for v1

from node-alexa-smapi.

Comments (17)

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern Good question! I just looked at the migration guide and it appears that most of the changes are just additions of new parameters to existing endpoints. We would still need to support v0 until Amazon deprecates it at a much later date. Since this library is technically not at version 1, we can afford to make some breaking changes, especially since I didn't expect Amazon to release a new version of their API so soon.

As for how to go about implementing the new endpoints, I was thinking of altering how the client library was instantiated, to account for the new changes and possibly future ones. Currently, it takes 2 parameters: the auth token and an optional base url. I'd propose to use an object with an authToken, version (which can take v0 or v1), and a continentCode (which can take NA, EU, or FR).

var smapiClientV1 = require('node-alexa-smapi')({
  authToken: 'auth token', // required
  version: 'v1' // optional; defaults to v1
  continentCode: 'NA'  // optional; defaults to NA
});

What do you think?

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 works for me. I can create a pull request to see if it lines up with your thinking.

Around tokens: it took me a few hours of fooling around and testing different ways to make this work until I finally figured out how to refresh the Login with Amazon token based on refresh_token, client_id, and client_secret. So, right now, I do not even use the initial token parameter, just initialize the library and use the procedure above to invoke refreshToken() before any SMAPI call. I suspect it might make it easier for other non OAUTH2 initiated to use the lib. Thoughts?

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern By all means, go for it!

You might be right, although I don't have as much experience with OAUTH2. One option that we could add is a refreshToken() to the library, in case the token expires.

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 just submitted the pull request.

README probably needs to be updated but I did not want to go for it before you had a chance to look over the code. Just let me know ;-)

The test cases show how to use the smapi.tokens.refresh() and I also added instructions in the test file on how to get the necessary refresh() parameters (refresh_token, client_id, client_secret), which might come handy when updating README.

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern Thank you for the pull request. I just reviewed it and it looks good so far, just needs some minor changes as listed in the my review.

As for documentation, it might be better to put it in a different file, because we don't want a huge README file. Additionally, the testing instructions can also be put into a separate file. Last thing is that we should add a changelog to this library, just in case anyone has used it beforehand.

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 test instructions were moved to its own README under test folder.

Will update README to reflect the new token behavior you can then strike it out if you believe it got too long.

Will add changelog.

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern Great work! The only thing is that since we have breaking changes, we should release a new version as 1.0.0, especially since we've changed how the client is initialized. (i.e. Following semantic versioning)

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 perfect, I just updated new version as 1.0.0

Please let me know if you need anything else on this and enjoy the long weekend ;-)

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

Aside from some final feedback in the PR, it looks great so far! I wanted to ask you if you wanted to be an active maintainer for this library, which means that you'll have publish access for npm?

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

Also, enjoy the long weekend as well!

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 sure, please let me know if there are any specific guidelines you would like me to follow as a maintainer.

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern Good point! Honestly, it's more of following GitHub common sense like not committing directly to master (unless it's document changes) or follow semantic versioning when releasing a new version. I'll make a document for future contributors to follow when working with this library.

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern If you have an npm account, can you tell me what's your username so that I can give you publishing access?

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

I've opened PR #5 for the contributing document, as some of the links depend on #4 to be merged and if there needs to be small changes to the template.

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

@tejashah88 my npm username is the same as github: marcelobern

from node-alexa-smapi.

tejashah88 avatar tejashah88 commented on August 21, 2024

@marcelobern Thank you! I've sent an invite for the GitHub repo and I've given write access for NPM.

from node-alexa-smapi.

marcelobern avatar marcelobern commented on August 21, 2024

Just merged PR #4 so I believe this one is closed now

from node-alexa-smapi.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.