richorama/IronBlock

Help with WebAPI to Blockly

ignatandrei opened this issue · 15 comments

Hello ,
I have created another component with Blockly:

It takes WebAPI ( + swagger + OData ) specification and transforms to Blockly blocks with Javascript. For an example, see https://netcoreblockly.herokuapp.com/blockly.html .

I think that your project can be usefull to execute also on the backend , not just to the frontend.

For this, I need some help about how to implement

TypeArgumentBase - this is the value
ActionInfo - this is the function ( WebAPI , ODATA, and so on)

( To understand ,you could start from

  var strDef = GenerateDefinitionString(type);
            var strJS = GenerateJSstring(type);


it will be helpfull if it will have a GenerateC# or similar

Waiting for your answer

Hi, I took a look at your link, but I got an error :¬(

Let me know how I can help you, as it sounds like you've got an interesting idea.

@richorama : Did you have the time to look ?

Latest call ;-)

Thanks for the reminder :¬)

Your project looks cool. I'm very happy to help you, but I don't really know how. You have two lines of code in your comment, but I'm not sure how IronBlock fits into this.

Very easy.
Please see
https://netcoreblockly.herokuapp.com/

Press " execute "
It executes WeatherForecast 4 times from javascript, calling the backend

The project is https://github.com/ignatandrei/NETCoreBlockly . The VS2019 sln is src/NetCore2Blockly/NetCore2Blockly.sln . The project is Test/TestBlocklyHtml

Could you explain , please , how can I execute this on the backend with your IronBlock ( or make a PR with this ) ?

( Even if you do not call WeatherForecast , it will help if you show on my project how to execute the some blocks on the backend with your IronBlock )

( You will be between contributors , at least ;-) )

Thanks for your time,
Andrei

great, I'll see what I can do :¬)

I remembered that I have a demo that does something quite similar to what you're possibly thinking (it even uses the current weather as an example!)

Have a look at this repo: https://github.com/richorama/IronDemo

It allows you to design a blockly program that runs in .netcore, calling out to a 3rd party API.

Screenshot from 2020-07-09 12-09-31

Great. I will take a look today! Thanks for the tip!

I see now . Pretty easy - if I generate call for each blocks. Thank you. I will keep you posted!

Just another question about the static
CustomPrintBlock.Text.Clear();
...
return this.Content(string.Join('\n',CustomPrintBlock.Text));

It is not thread safe. ( What if 2 users running almost simultaneously the Execute ?)

Could you make thread safe ?

yes, it's a nasty hack. I'll have a think about making it thread safe ;¬)

Done with this PR: richorama/IronDemo#1

Thanks! Now, all I should do is to integrate with my project!