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

Node-style callbacks? #16

Closed
pcothenet opened this issue Aug 25, 2015 · 10 comments
Closed

Node-style callbacks? #16

pcothenet opened this issue Aug 25, 2015 · 10 comments

Comments

@pcothenet
Copy link
Contributor

Hi team,

I've been looking at switching to the official client from this unoffical one.

The two main problems:

  • MUST HAVE: The callback are not standard node-style callbacks (e.g. function(err, result)). One advantage of the unoffical intercom.io was to reject the promise (or return an err in the callback) when the response body would contain an error. In my opinion, this is one of the main advantages of using a node wrapper vs. the standard API.
  • SHOULD HAVE: Support for promises (in addition to callbacks) would be really great (especially since this seems to be a feature of ES6)

Sticking to the other library in the meantime!

@bobjflong
Copy link
Contributor

Hi @pcothenet

Thanks for getting in touch. We're still very much developing this lib, and we're hopeful we can get it to something everyone really loves using.

Re. your first point, would you mind checking out this diff? #18

@pcothenet
Copy link
Contributor Author

That looks way better yes! (I don't think the doc is up-to-date though).

No worries, I'm actually super happy that you guys are building an official library. Happy to help!

@pcothenet pcothenet changed the title Node-style callback and promises? Node-style callbacks? Aug 28, 2015
@bobjflong
Copy link
Contributor

@pcothenet docs updated with a note about calllbacks https://www.npmjs.com/package/intercom-client

@tejasmanohar
Copy link
Contributor

👍 for what @pcothenet said. If you're going to expose callback-style functions, it should really follow node-style callbacks. The great part of this is users of the API can even integrate things like Bluebird's promisify() with their code to wrap your library if the convention is followed :D

@bobjflong
Copy link
Contributor

@tejasmanohar when you say "node-style" are you referring to promises too? I may split out promises into another issue and close this to reduce confusion if so.

@tejasmanohar
Copy link
Contributor

@bobjflong Nope, not at all. function(err, result) = node-style callbacks. My comment on Bluebird was related to Bluebird's promisify method which only works for node-style callbacks. Anyhow, node-style is the way to go due to convention :) - I have a few points of feedback on this repo and will send PRs soon.

@bobjflong
Copy link
Contributor

@tejasmanohar but the callbacks currently support the form function(err, result) - see #18

@tejasmanohar
Copy link
Contributor

Ah ok perfect, sorry, I was looking at the wrong thing. Thanks for clarifying, @bobjflong! I would recommend opening another issue for promises as well then as this is a bit misleading in title.

@bobjflong
Copy link
Contributor

Done here: #45 I will likely add this today

@tejasmanohar
Copy link
Contributor

Thanks, @bobjflong! Till then, users should be able to promisify this using a module like Bluebird or an independent one on NPM to get the same end result :)

hypeofpipe added a commit that referenced this issue Jan 18, 2022
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

No branches or pull requests

3 participants