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

Promise interface for API #30

Open
leebenson opened this issue Nov 6, 2017 · 4 comments
Open

Promise interface for API #30

leebenson opened this issue Nov 6, 2017 · 4 comments

Comments

@leebenson
Copy link

recurly.api doesn't fit the Promise interface pattern of other calls - callback is currently required. Would be great to get this working per the other functions.

@umayr
Copy link
Owner

umayr commented Nov 9, 2017

I had started to migrate the whole library to promises and drop support for callback but I couldn't get to finish that. I'll try to continue working on that.

@gus4no
Copy link

gus4no commented Feb 27, 2018

@leebenson I may be late for this, but if you want some sort of promise to work you can do a workaround like this.

await new Promise(resolve => { recurly.account.create(params, response => { resolve(response)}}

@englayth
Copy link

@umayr great work you have here, was wondering if you have finished promisifying the project or not ?
As Im using "recurly-js/promise" and when I see accounts.list has CallBack as first argument ...

@thgreasi
Copy link
Collaborator

@englayth try passing in a noop fn as the first argument and then the options object normally.
The results will be a promise in all cases, but we should definitely change the argument order in a major release.

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

5 participants