Asana / node-asana

Official node.js and browser JS client for the Asana API v1
MIT License
264 stars 74 forks source link

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

Open davidyang opened 7 years ago

davidyang commented 7 years ago

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?

slobak commented 7 years ago

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. :)

mblais commented 3 years ago

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