node-asana icon indicating copy to clipboard operation
node-asana copied to clipboard

Preferred way to get node-asana to work in Google Apps Script?

Open davidyang opened this issue 8 years ago • 2 comments

Hey team - big fan of Asana and have made some cool integrations with Google Apps Script (with a small client I wrote myself). Was considering making the node-asana library work instead and would appreciate any thoughts on best way to do it.

My thought is to either allow configuring another dispatcher that uses Google's UrlFetchApp or to build something like google-request that can be subbed in using browserify.

Any thoughts on best way to do this or if this has been done already?

davidyang avatar Dec 01 '16 15:12 davidyang

Hi David - thanks for your participation! That would be sweet to be able to import our JS client library into Google Apps Script.

Cc'ing @praecipula for his thoughts too

The Dispatcher does more than just make requests, it wraps a bunch of functionality. So overriding / extending it would probably create complexity or duplicated functionality which is less desirable.

I think the thing that we want to factor out is the "request" aspect of the dispatcher. It turns out this is already delegated to the request library; if we provide some facility for the Dispatcher to have a new request function injected (e.g. via options) then it becomes adaptable to new platforms. You could then just write an adapter that implements the request function in terms of the facilities that Google Apps Script offers. It's possible we could autodetect when we are being used from GAS so developers don't need to do anything special to use it, but that might be too magic / advanced. :)

slobak avatar Dec 06 '16 05:12 slobak

Great idea, but GAS does not really support async or Promises.

mblais avatar Jan 24 '21 22:01 mblais