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

Can you make it support promise??? #38

Closed
SiwakornSitti opened this issue Jan 10, 2017 · 5 comments
Closed

Can you make it support promise??? #38

SiwakornSitti opened this issue Jan 10, 2017 · 5 comments

Comments

@SiwakornSitti
Copy link

No description provided.

@chemdrew
Copy link

http://bluebirdjs.com/docs/api/promise.promisifyall.html

Promise.promisifyAll(pipedrive.Activities);
Promise.promisifyAll(pipedrive.ActivityTypes);
Promise.promisifyAll(pipedrive.Authorizations);
Promise.promisifyAll(pipedrive.Currencies);
Promise.promisifyAll(pipedrive.Deals);
Promise.promisifyAll(pipedrive.DealFields);
Promise.promisifyAll(pipedrive.Files);
Promise.promisifyAll(pipedrive.Filters);
Promise.promisifyAll(pipedrive.Notes);
Promise.promisifyAll(pipedrive.Organizations);
Promise.promisifyAll(pipedrive.OrganizationFields);
Promise.promisifyAll(pipedrive.Persons);
Promise.promisifyAll(pipedrive.PersonFields);
Promise.promisifyAll(pipedrive.Pipelines);
Promise.promisifyAll(pipedrive.Products);
Promise.promisifyAll(pipedrive.ProductFields);
Promise.promisifyAll(pipedrive.SearchResults);
Promise.promisifyAll(pipedrive.Stages);
Promise.promisifyAll(pipedrive.Users);

lol

@meetbryce
Copy link

I found this Stackoverflow helpful

Here's how I implemented their suggestion:

return new Promise((resolve, reject) => { // Shims old school NodeJS callback approach as ES6 Promise
  pipedrive.Deals.getAll({ filter_id }, (err, data) => {
    if (err !== null) return reject(err);
      resolve(data);
    });
}).catch((err) => console.log('ERROR ==>', err));

@lprhodes
Copy link

lprhodes commented Apr 4, 2017

const promiseFuncs = [ 'Deals', 'Notes', 'Organizations', 'Persons' ]

promiseFuncs.forEach((funcName) => {
  pipedrive[funcName] = Promise.promisifyAll(pipedrive[funcName])
})

@IgorHalfeld
Copy link

Check out this #84

@tot-ra
Copy link
Contributor

tot-ra commented Nov 1, 2019

Duplicate of #81

@tot-ra tot-ra marked this as a duplicate of #81 Nov 1, 2019
@tot-ra tot-ra closed this as completed Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants