Allow empty arguments call to methods
blake-regalia opened this issue · 2 comments
Some Slack API methods can be used without the need to pass any arguments. This should be reflected in the javascript API with
const slack = require('slack');
let token = process.env.SLACKBOT_TOKEN;
let bot = new slack({token});
bot.channels.list().then(channels => console.info);
but this throws:
TypeError: Cannot read property 'token' of undefined
... at this line
I can definitely get behind this but we'd need to consider the final param is always a callback and we'd want this to work in both the class-y oo style and the traditional errback style. (And we'd also want to note this is a breaking change to the API and we should also consider how to document that the new behavior properly. )
After thinking on this a bunch I think having slightly different documented behaviors would be more work than just making everything work the same (even if its a bit weird for the methods that have no params). Open to further discussion but closing this particular issue.