Since Cards have the printJson() method, it seems like it would be
possible to build a web app that, instead of returning a card, instead
does something like:
client:
google.script.run.doSomething()
apps script:
function doSomething() {
const card = CardService.cardBuilder()...build();
return JSON.parse(card.printJson());
}
or whatever.
Obviously, the client would have loaded some framework that would know
what to do with the data to build widgets in the browser.
I suppose the same framework could be used to test output from
https://developers.google.com/workspace/add-ons/guides/alternate-runtimes
without needing to go through setting up an actual Add-on (well,
presuming the printJson() output is pretty close to what the actual
rpc is,
https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1).
Of course, such a UI would be pretty boring, since Cards tend to
expect a window of only a few hundred pixels wide.
But, it would be nice to have a project that works nearly the same way
whether it is being used as an Add-on or a Web App.
So, I'm just wondering if something like this already exists and I
haven't found it yet, or just a silly idea?
Or, if not exactly the Card API, some sort of adapter that could take
that same card.printJson() output and return the equivalent for some
other data-driven UI.
Thanks,
mrc