flickr / flickr-sdk

Almost certainly the best Flickr API client in the world for node and the browser
https://www.flickr.com/services/api
MIT License
131 stars 29 forks source link

Suggestion to improve Flickr.Upload #151

Open ianengelbrecht opened 2 years ago

ianengelbrecht commented 2 years ago

Hi guys,

I think the sdk could be improved as follows:

If we already have:

var flickr = new Flickr(Flickr.OAuth.createPlugin(
  process.env.FLICKR_CONSUMER_KEY,
  process.env.FLICKR_CONSUMER_SECRET,
  process.env.FLICKR_OAUTH_TOKEN,
  process.env.FLICKR_OAUTH_TOKEN_SECRET
));

... then why not just await flickr.upload(file, [args]) rather than having to call a constructor again?

It feels like this would be more intuitive. I've got a module where I create flickr and then I import it wherever I need it. But currently for upload, I have to create the auth function again, call a constructor, and await the resulting promise.

Great library though, I got up and running with the API very quickly.

Cheers,

Ian