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

Add ability to use request body response in scene #1148

Merged
merged 4 commits into from
Apr 19, 2021

Conversation

Pierre-Gilles
Copy link
Contributor

@Pierre-Gilles Pierre-Gilles commented Apr 17, 2021

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • Did you add fake requests data for the demo mode (front/src/config/demo.json) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

The user is now able to use the try a request in scene, and use the API response in other boxes of the scene

Example with Bitcoin price:

Kapture.2021-04-17.at.11.31.19.mp4

@codecov
Copy link

codecov bot commented Apr 17, 2021

Codecov Report

Merging #1148 (8a65887) into master (05c2111) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1148   +/-   ##
=======================================
  Coverage   96.26%   96.27%           
=======================================
  Files         638      639    +1     
  Lines        8090     8097    +7     
=======================================
+ Hits         7788     7795    +7     
  Misses        302      302           
Impacted Files Coverage Δ
server/lib/index.js 94.44% <ø> (ø)
server/models/scene.js 93.75% <ø> (ø)
server/api/controllers/http.controller.js 100.00% <100.00%> (ø)
server/api/routes.js 97.95% <100.00%> (+0.08%) ⬆️
server/lib/http/http.request.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05c2111...8a65887. Read the comment docs.

@Pierre-Gilles
Copy link
Contributor Author

Two questions:

  • What do we need to do if internet is down?
  • What do we need to do if API response changed compared to the first time?

@atrovato
Copy link
Contributor

Nice demo, 2 questions, really ?

What do we need to do if internet is down?

Be able to catch default 4xx / 5xx errors, and maybe replace values by a magic i18n word -- error --?

What do we need to do if API response changed compared to the first time?

If you use get-value, add a default magic value -- data not found --?

@Pierre-Gilles
Copy link
Contributor Author

Pierre-Gilles commented Apr 19, 2021

Be able to catch default 4xx / 5xx errors, and maybe replace values by a magic i18n word -- error --?
If you use get-value, add a default magic value -- data not found --?

I don't think we want that, sending a message with a variable is just an example, but variables can be used in the "continue only if" block and compared with numbers, so it makes no sense no replace variables with default values.

I think we might want to do nothing for now, and see with usage if we want to add an option in the action box like "stop the scene if the request fails"

Edit: See my message here about why it's not the default option: https://community.gladysassistant.com/t/utiliser-une-reponse-api-externe-dans-une-scene/6199/8?u=pierre-gilles

@Pierre-Gilles Pierre-Gilles merged commit 1d58b39 into master Apr 19, 2021
@Pierre-Gilles Pierre-Gilles deleted the try-http-request-scene branch April 19, 2021 02:45
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.

2 participants