Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow err params in callbacks and support objects in Client #18

Merged
merged 1 commit into from
Aug 27, 2015

Conversation

bobjflong
Copy link
Contributor

If the callback has 2-arity, we assume the first param is err and use it when the API returns an error.list. This allows for idiomatic callback handling like:

client.users.list(function(err, d) { ... });

Additionally this pr adds support for objects in client construction:

var client = new Client({ appId: 'foo', appApiKey: 'bar' });

fixes #15

@bobjflong bobjflong mentioned this pull request Aug 27, 2015
@bobjflong bobjflong changed the title Allow err params in callbacks Allow err params in callbacks and support objects in Client Aug 27, 2015
@josler
Copy link

josler commented Aug 27, 2015

🚢

bobjflong added a commit that referenced this pull request Aug 27, 2015
Allow err params in callbacks and support objects in Client
@bobjflong bobjflong merged commit b052303 into master Aug 27, 2015
@bobjflong bobjflong deleted the BL/callback branch August 27, 2015 13:48
@billinghamj
Copy link
Contributor

@bobjflong Are there plans to deprecate the original behavior? Arity detection is generally considered bad practice and is likely to cause unexpected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instantiate new client with a credentials object?
3 participants