Closed amcchord closed 2 years ago
here you go:
let myCustomVariable = await (await fetch("https://github.com")).text()
What? I think you are missing it. This would be added to the companion UI needs to be updated and would be great if I could specify a companion custom variable for the result of this call to be stored in.
yeah it needs to be part of the companion system the way the other valuables end up there. It's less about being in the browser and more about being part the system so you use the variables when working with other modules.
Companion already supports variables and custom variables. You can create them in the UI and assign them a value there. The goal of this would be for a variable created in the companion UI to have its value updated by the result of companion making an HTTP GET request.
I added the requested feature in my pull request (https://github.com/bitfocus/companion-module-generic-http/pull/25).
I can help make the story clearer
I guess the best way to think about this would be that you can add custom variables are part of the HTTP module and they would be assigned based on the response from a get request. If you are looking for examples of custom variables check out the Spotify Module.
@amcchord I used internal variables to save HTTP response -which you can use as $(internal:custom_VARNAME)- but I think you want to parse data you receive so you can assign more variables from one request. It is important to know what type of data you want to use as it is different to parse (JSON, raw HTML etc. or even if you want seperate options for both). So can you give further info on data you want to get.
(@abebeos I am not related with the team.)
@amcchord This is an example result after last push, I sticked to main repository and extended it so this PR not effect main function of the repository. You can assign internal variables and use them on other modules as intended.
I've assigned the issues/prs related to this to myself, as I intend to properly read through this and figure out the correct approach over the weekend
@abebeos as I read it, the solution is near. Please do not pollute this channel on external matters. I would advise not to go through other payment options until its absolutely clear Bountysource is failing. Then Bountysource should pay back to @amcchord first before he will transfer it again against something else. But again, this has noting to do with Companion, so please keep it out here.
Add the ability for a GET request to save the response from the remote server to a custom variable.
These variables can be used with other modules in the companion ecosystem.
One example might sending a GET request to get the name of file to play next from a custom web app. Then store this name in a variable and use it with the HyperDeck module to play that file.