Giter VIP home page Giter VIP logo

client-nodejs's People

Contributors

andreassaltsberg avatar andrewkarell avatar andris9 avatar bashmach avatar boedy avatar chemitaxis avatar clim-godaddy avatar denisbutcher avatar dependabot[bot] avatar dmitriyeff avatar eerootsus avatar ignorancepulls avatar jonathanstokes avatar kashmircake avatar kristok avatar kungla avatar leopiel avatar martintajur avatar mpukk avatar mykhailo-riabokon avatar pimpelsang avatar reivilo85k avatar rutsest avatar s-pogoda avatar siimkirjanen avatar siirimangus avatar spaceoven avatar tot-ra avatar youssef-saber-3 avatar ziimk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

client-nodejs's Issues

person_id 0 when set

When retrieving the person_id with getAll it is an object with multiple values.
but when i try to set it while creating a new Deal. it becomes 0 even though i passed in an object as a value ?

Strict mode - Extra information

Hey there,

I just debugged the code like half a hour because the response from Deals doesn't had the "extended" version of (for example) user_id
When I did the same request in the browser, the response included the extended version of the id's.
After some debugging I noticed that in the library strict_mode=1 is applied to the URI.
This causes to not include the extended objects for the id fields.

Though I understand it, it isn't very clear in the README. And I also couldn't find anything on strict_mode in the API documentation on developers.pipedrive.com

I'd like to see the README updated with some additional information about strict mode.
In the README it's just applied, without any comment on it.

Jesse

Usage with async/await

Hi guys, I see you still use callback for async call.

I'd like to know if we can use async/await instead of CB, is there a lib we can use for that?

npm install pipedrive fails

I am trying your samples but get hold on the install.

I get the following message:
npm WARN install Refusing to install pipedrive as a dependency of itself

string length limit on deal field

It seems like there is a problem on string size limit on deal field, some of my long string are cut when I see them in pipedrive.

Bulk add

is it possible to have a bulk add of objects?

deal.addProduct does not honor required fields

if deal.addProduct does not contain the required fields it will return a success callback but without attaching the deal

deal.addProduct({` product_id: 23, quantity: 1, item_price: 0 }, (addErr, addData) => {
addErr = null
addData = [ CollectionItem {
    id: false,
    save: [Function],
    remove: [Function],
    get: [Function],
    merge: [Function],
    duplicate: [Function],
    toObject: [Function],
    set: [Function],
    getDeals: [Function] } ]

where item_price has to be defined and greater than 0 apparently. At least make this return in the error callback if id is false?

Client.getAll is broken

Client.getAll method is broken. The wrong parameters variable is being passed in the recursive fetch function.

PR incoming :)

Error in Open API specification

This really is not a Node.js client issue, but I couldn't find a place to drop this. It seems like the Open API specification has an error, specifically:

[main] WARN  o.o.c.config.CodegenConfigurator - There were issues with the specification, but validation has been explicitly disabled.
Errors: 
	-attribute components.schemas.WebhookBadRequest.items is missing

Perhaps this could be a "documentation" issue, or it could be escalated to the API spec team? Anyway, hope it helps.

The specification in question is here. The documentation links this url here - section Open API 3.

Bad request with {object}.save ?

when i set a new value to a deal object and the execute the save function on it i get the following response : [Error: Pipedrive API error:Bad request]

Any idea as to why this may be happening ?
code i am using below :

deal.set(deal.value, updateValue)
deal.save(function handleSaveCallBack(err,data){
console.log('updatedValue : ', err, data)
})

{Object}.save not working

Here's what I'm trying to do:

const Pipedrive = require('pipedrive');
const pipedrive = new Pipedrive.Client('mykey', { strictMode: true });
pipedrive.Deals.get(123, function(err, deal){
  console.log("Got deal :)", deal);
  deal.set("title", "LOOOL");
  deal.save(function(err, out) {
    if (err) return console.log(err);
    console.log("saved :)", out);
  });
});

And that throws the following error:

> TypeError: Cannot read property 'id' of null
    at doWrap (/path/to/project/node_modules/pipedrive/lib/wrapCollectionItems.js:12:21)
    at /path/to/project/node_modules/pipedrive/lib/wrapCollectionItems.js:37:5
    at Function.forEach (/path/to/project/node_modules/pipedrive/node_modules/lodash/dist/lodash.js:3298:15)
    at wrapCollectionItems (/path/to/project/node_modules/pipedrive/lib/wrapCollectionItems.js:36:6)
    at /path/to/project/node_modules/pipedrive/lib/CollectionItem.js:26:27
    at RestHandlers.genericResponse (/path/to/project/node_modules/pipedrive/lib/restHandlers.js:79:3)
    at Request.<anonymous> (/path/to/project/node_modules/pipedrive/lib/restHandlers.js:171:9)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/path/to/project/node_modules/pipedrive/lib/rest.js:131:16)

I have tested really extensively and everything else I'm trying to do works perfectly well...

Install Error

This is really a contextify issue:
brianmcd/contextify#187

But, since pipedrive won't install, I thought it'd be worth posting here as well.

Any workarounds for this?

$ npm install --save pipedrive

> [email protected] install /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
In file included from ../src/bufferutil.cc:16:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                        ^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                        ^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
    , node::smalloc::FreeCallback callback
      ~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
           ^~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to
      'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
In file included from ../src/bufferutil.cc:16:
../node_modules/nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
  V8_INLINE Local(Local<S> that)
            ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
  V8_INLINE Local(S* that)
            ^
In file included from ../src/bufferutil.cc:16:
../node_modules/nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
           ~~~~~~~~~~~~~~^
In file included from ../src/bufferutil.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/bufferutil.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/bufferutil.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/bufferutil.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
    return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
9 errors generated.
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/ws/node_modules/bufferutil
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

> [email protected] install /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
In file included from ../src/validation.cc:15:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                        ^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                        ^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
    , node::smalloc::FreeCallback callback
      ~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
           ^~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to
      'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
In file included from ../src/validation.cc:15:
../node_modules/nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
  V8_INLINE Local(Local<S> that)
            ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
  V8_INLINE Local(S* that)
            ^
In file included from ../src/validation.cc:15:
../node_modules/nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
           ~~~~~~~~~~~~~~^
In file included from ../src/validation.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/validation.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/validation.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/validation.cc:7:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
    return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
9 errors generated.
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN optional dep failed, continuing [email protected]

> [email protected] install /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
In file included from ../src/contextify.cc:3:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                        ^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                        ^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
    , node::smalloc::FreeCallback callback
      ~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
           ^~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to
      'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
/Users/the-user/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
In file included from ../src/contextify.cc:3:
../node_modules/nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from
      'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
      ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
  V8_INLINE Local(Local<S> that)
            ^
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
  V8_INLINE Local(S* that)
            ^
In file included from ../src/contextify.cc:3:
../node_modules/nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
           ~~~~~~~~~~~~~~^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
    return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Value *volatile' from incompatible type 'v8::Context *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:267:10: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Context>' requested here
  return NanNew(val);
         ^
../src/contextify.cc:159:16: note: in instantiation of function template specialization '_NanEnsureLocal<v8::Local<v8::Context> >' requested here
        return NanEscapeScope(NanNew<Context>(
               ^
../node_modules/nan/nan.h:398:43: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                                          ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Context *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../src/contextify.cc:159:16: note: in instantiation of function template specialization 'v8::Local<v8::Context>::Local<v8::Value>' requested here
        return NanEscapeScope(NanNew<Context>(
               ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:7367:3: error: assigning to 'v8::Integer *volatile' from incompatible type 'v8::Value *'
  TYPE_CHECK(T, S);
  ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../src/contextify.cc:211:13: note: in instantiation of function template specialization 'v8::ReturnValue<v8::Integer>::Set<v8::Value>' requested here
            NanReturnValue(NanNew<Integer>(None));
            ^
../node_modules/nan/nan.h:401:61: note: expanded from macro 'NanReturnValue'
# define NanReturnValue(value) return args.GetReturnValue().Set(_NanEnsureLocal(value))
                                                            ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:7367:3: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
  TYPE_CHECK(T, S);
  ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../src/contextify.cc:225:13: note: in instantiation of function template specialization 'v8::ReturnValue<v8::Boolean>::Set<v8::Value>' requested here
            NanReturnValue(NanNew<Boolean>(false));
            ^
../node_modules/nan/nan.h:401:61: note: expanded from macro 'NanReturnValue'
# define NanReturnValue(value) return args.GetReturnValue().Set(_NanEnsureLocal(value))
                                                            ^
In file included from ../src/contextify.cc:1:
In file included from /Users/the-user/.node-gyp/4.1.2/include/node/node.h:42:
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:7367:3: error: assigning to 'v8::Array *volatile' from incompatible type 'v8::Value *'
  TYPE_CHECK(T, S);
  ^~~~~~~~~~~~~~~~
/Users/the-user/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../src/contextify.cc:236:13: note: in instantiation of function template specialization 'v8::ReturnValue<v8::Array>::Set<v8::Value>' requested here
            NanReturnValue(blank);
            ^
../node_modules/nan/nan.h:401:61: note: expanded from macro 'NanReturnValue'
# define NanReturnValue(value) return args.GetReturnValue().Set(_NanEnsureLocal(value))
                                                            ^
14 errors generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/the-user/ws/the-project/node_modules/pipedrive/node_modules/sockjs-client-node/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN optional dep failed, continuing [email protected]
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "pipedrive"
npm ERR! node v4.1.2
npm ERR! npm  v2.14.4
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/the-user/ws/the-project/npm-debug.log

`pipedrive.Deals.add` request times out with no response or error

I have an express API that handles routing form submission data to Pipedrive via a series of 3 API calls:

  1. Create Org with company name.
  2. Create Person with name/email.
  3. Create Deal with both org and person associated.

Due to a reason that I can't identify, my pipedrive.Deals.add function began getting hung up and timing out yesterday. My deal does get created in Pipedrive, but no response or error is returned. I am also using Sentry to catch errors and see nothing in there. Here are the functions I use:

function createOrg(company) {
  return new Promise(resolve => pipedrive.Organizations.add({ name: company, owner_id: config.pipedrive.ownerId }, (err, decoded) => {
    if (err) {
      Sentry.captureException(new Error(err));
      return resolve({});
    }
    return resolve(decoded)}));
}

Completes successfully and returns the expected orgobject.

function createPerson(name, email, org_id) {
  return new Promise(resolve => pipedrive.Persons.add({ name, email, owner_id: config.pipedrive.ownerId, org_id }, (err, decoded) => {
    if (err) {
      Sentry.captureException(new Error(err));
      return resolve({});
    }
    return resolve(decoded)}));
}

Completes successfully and returns the expected persons object.

function createDeal(title, person_id, org_id, stage_id) {
  return new Promise(resolve => pipedrive.Deals.add({ title, user_id: config.pipedrive.ownerId, person_id, org_id, stage_id }), (err, decoded) => {
    if (err) {
      console.log(err);
      Sentry.captureException(new Error(err));
      return resolve({});
    }
    return resolve(decoded)});
}

Seems to complete (ie. deal is created in Pipedrive), but returns no response, doesn't log out any errors, and the API request hangs indefinitely. Could someone help point me to what's going wrong here? I suspect there is either a bug with this node package or that something is going on with the Pipedrive API's deals endpoint, but I could be handling something incorrectly in my code as well.

Note that this request did work as expected previously and I am almost certain nothing changed in my API code.

Return the RateLimiting headers in metadata

AFAIK, the response from this SDK does not return the rate limiting info, right?

Would be great to add it in the response (along with pagination):

  [
    [
        'results'
    ], 
        {
        pagination: {
            start: 0,
            limit: 500,
            more_items_in_collection: true,
            next_start: 500
        },
        rate_limit: {
            limit: x,
            remaining: xx,
            reset: xxx,
        }
    }
  ]

When Persons.add and Deals.add, error is blank

When Persons.Add and Deals.add fails, the error object is blank.

Code example (typescript):

pipedrive.Persons.add(person, async (error: any, person: any) => {
        if (error) {
            logInRollbar('PERSON NOT CREATED', error);
           //...

In my rollbar account i recive:

Screenshot from 2019-03-30 14-52-13

Updating first_name fails

Hello,
First of all - thanks for the great API, so far it's working great, except for a glitch I just found when testing it around.
I am running the following code from my node app -

pipedrive.Persons.update(3908, {name: 'Loops333',first_name:'loop', last_name:'mull', email: '[email protected]'}, function(err){if (err) throw err;});

The odd thing is that the email and name fields are updated, but the first_name and last_name fields remain the same.
If needed, I can attach more parts of the code and screenshots of the process.

Thanks,
Yaron.

deal.getProduct only returns first 100 entries

Hi,

I am using pipedrive.getAll to access organizations / products / persons > 100. However, the getXXX functions for related items (e.g. deals.getProducts) do not support pagination. Could you add a deal.getAll('Products') as well? I have a few deals I am trying to import with a large number of itemized sub items.

Thanks

pipedrive.on not a function

Hi, I'm testing the beta event listeners and was just trying to duplicate the example in the readme:

var Pipedrive = require('pipedrive');
var pipedrive = new Pipedrive.Client('PUT_YOUR_API_TOKEN_HERE', { strictMode: true });
 
pipedrive.on('deal.added', function(event, data) {
    console.log('A deal was added! ' + data.current.title + ' (' + data.current.value + ' ' + data.current.currency + ')');
});

The system responds with 'pipedrive.on is not a function'. All of my other pipedrive functions work as advertised - I'm doing searches, retrievals and updates without any problems.
I can see the 'on' function in the source code so I'm not sure what's going on.
Thanks for any info / suggestions.
Phil Heinz

Timezone of date fields

The API / SDK returns date fields in this format:

{
    update_time: '2016-10-13 15:20:06',
    add_time: '2016-09-30 16:54:18'
}

what time zone are those fields in? UTC? My account timezone?

Note: ISO strings would probably be a good idea for the API V2 :)

Accessing Deal Flow (Updates)

Sorry if I've missed something obvious but I'm not sure how to access the Deal Flow (Update) data using the API. The REST API doc list the following call;

List updates about a deal
get /deals/{id}/flow

Thanks for your help.

ps.

Typos in the Readme.md

  • npm install pipedrive is not necessary since the dependencies already contain this package. Only npm install is sufficient

  • npm run tests should be changed to npm run test

  • The npm run test gives error on the Windows platform because of the path
    (/) issues. The proposed solution is:
    "scripts": { "test:unx": "./node_modules/mocha/bin/mocha ./test/unit", "test:win": "node node_modules\\mocha\\bin\\mocha .\\test\\unit" },

Automatic rate limiting

This would be so cool! It'd be super easy to stay under pipedrive limits. And also not that hard, I think.

Maybe there's an option where you can set the rate limit for all API requests.

Unable to authenticate with Pipedrive.authenticate

When I try to authenticate using your function Pipedrive.authenticate, it throws this error. It seems that the function listItemsHandler is not accessible by the exported function authenticate because it is only defined inside the exported function Client.

Thanks for your help!

`/My_Project/node_modules/pipedrive/lib/Pipedrive.js:139
return listItemsHandler('authorizations', auth, function(error, data, additionalData) {
^

ReferenceError: listItemsHandler is not defined
at Object.exports.authenticate (/My_Project/node_modules/pipedrive/lib/Pipedrive.js:139:10)`

getAll('Organizations') Not working on NodeJS v6.10.2

NodeJS: v6.10.2
OS: macOS Sierra 10.12.3 (16D32)
Pipedrive: "pipedrive": "^3.0.2"

This is the error I am getting when using this module to get All organization:

=== JS stack trace =========================================

Security context: 0x14c3659cfb39
1: /* anonymous /(aka / anonymous /) [/Users/RSharma/leadgen/mean_stack/leadgen/node_modules/pipedrive/lib/Pipedrive.js:93] [pc=0x20e6127640b9] (this=0x14c365904381 ,err=0x14c365904201 ,models=0x3d9bb9e05691 <JS Array[100]>)
2: arguments adaptor frame: 5->2
3: /
anonymous /(aka / anonymous */) [/Users/RSharma/leadgen/mean_stack/leadgen/node_modules/pipedrive/l...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
2: node::FatalException(v8::Isolate*, v8::Localv8::Value, v8::Localv8::Message) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
4: v8::internal::Factory::NewUninitializedFixedArray(int) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
5: v8::internal::Factory::NewJSArrayStorage(v8::internal::Handlev8::internal::JSArray, int, int, v8::internal::ArrayStorageAllocationMode) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
6: v8::internal::Factory::NewJSArray(v8::internal::ElementsKind, int, int, v8::internal::ArrayStorageAllocationMode, v8::internal::PretenureFlag) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
7: v8::internal::ElementsAccessor::Concat(v8::internal::Isolate*, v8::internal::Arguments*, unsigned int) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
8: v8::internal::(anonymous namespace)::Fast_ArrayConcat(v8::internal::Isolate*, v8::internal::Arguments*) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
9: v8::internal::Builtin_Impl_ArrayConcat(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)0>, v8::internal::Isolate*) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
10: v8::internal::Builtin_ArrayConcat(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/RSharma/.nvm/versions/node/v6.10.2/bin/node]
11: 0x20e611c092a7

And this is my code:
`
const Pipedrive = require('pipedrive');

const pipedriveCl = new Pipedrive.Client(pipedriveConstants.pipedriveAPIToken, { strictMode: true });

pipedriveCl.getAll('Organizations', function (err, collection) {
res.json({
success: true,
data: collection
})
})
`

Event listeners broken

It appears that the Ad hoc event listeners have stopped working. I'm pretty sure that the problem isn't on my end because even the examples file live-updates.js won't fire the pipedrive.on('connect' event or the pipedrive.on('deal.added' event. No event listeners at all are working, but things like pipedrive.Deals.getAll() still work fine. Does pipedrive still support this client?

Changing product price / removing a product currency

Hi,

I am trying to update prices for products through the API. In the specific case I am struggling with, I am trying to change a product default price of 0 EUR to 299 USD. As this is a currency change, the API will actually add a scond price in USD. That is ok for me, but I could not find a way in the API to remove the EUR price. I can only do that through the UI.
I also tried with the API tester with and update the prices parameters to [{"currency":"USD", "price":299}] and nothing changed.

What is the correct way in the API to remove a currency / price?

Thanks

Is merge organizations working?

Hi there,

I am coding a script to merge organizations pairs extracted from a CSV string. Apparently, the calls to merge are silently failing. The do not merge the organizations nor reach the callback function. Any tip would be appreciated. Bellow is my code for furtther clarification (the API token is deleted for obvious reasons):

'use strict';

console.log('Loading function');

var Pipedrive = require('pipedrive');
var pipedrive = new Pipedrive.Client('XXXXXXXXXXXXXXXX', { strictMode: true });
// Merge 14843 with 11912 and 14844 with 11912 in the next call
var list = [14843, 11912, 14844, 11912];
var index = 0;
var currentWichId = list[index];
var currentWithId = list[index+1];
var gCallback;

exports.handler = (event, context, callback) => {
if (list.length%2 !== 0) return callback(Error('The length of the list must be even'));
console.log('Merging ' + currentWichId + ' with ' + currentWithId);
pipedrive.Organizations.merge({ "whichId": currentWichId, "withId": currentWithId }, mergeOrganizations);
console.log('---1---');
gCallback = callback;
};

var mergeOrganizations = function (err, organizations, additionalData) {
console.log('---2---');
if (err) throw err;
index += 2;
if (index < list.length) {
var currentWichId = list[index];
var currentWithId = list[index + 1];
console.log('Merging ' + currentWichId + ' with ' + currentWithId);
pipedrive.Organizations.merge({ "whichId": currentWichId, "withId": currentWithId }, mergeOrganizations);
}
else
{
console.log('Merging is done');
gCallback(null, list);
}
};

Functional approach and Promise support

I work at @NOALVO and here we use a functional approach.
I saw the issue #38 and I think curry approach with promise would be nice!

const Pipedrive = require('pipedrive');
const pipedrive = new Pipedrive.Client('API_KEY_GOES_HERE', { strictMode: true });

/**
 * @param {String} name Entity name e.g. Deal
 * @param {Object} payload Payload data
 * @returns {Promise}
 */
export const createEntity = name => payload => new Promise((resolve, reject) => {
  pipedrive[name].add(payload, (error, id) => error ? reject(error) : resolve(id));
});

/**
 * @param {String} name Entity name e.g. Deal
 * @returns {Promise}
 */
export const listEntity = name => new Promise((resolve, reject) => {
  pipedrive[name].getAll({}, (error, entities) => error ? reject(error) : resolve(entities));
});

/**
 * @param {String} name Entity name e.g. Deal
 * @param {String} id Entity id
 * @returns {Promise}
 */
export const getEntity = name => id => new Promise((resolve, reject) => {
  pipedrive[name].get(id, (error, entity) => error ? reject(error) : resolve(entity));
});


export const createDeal = createEntity('Deals');
export const listDeal = listEntity('Deals');
// createDeal({ name: 'Example' ... });
// listDeal();

of course, this is only a wrapper, but would be awesome be native implementation ๐Ÿ’ƒ
I created a issue before send PR, only for see whats you think

_this badass implementation is from @FelipeMonobe ๐Ÿš€ _

Organizations.getAll only retrieving 100 organizations

        router.get('/', function(req, res) 
          {
                var orgName = [];
                var orgID = [];


               pipedrive.Organizations.getAll({}, function(err, organization) 
                    {
                    if (err) throw err;
                   for (var i = 0; i < organization.length; i++) 
                   {
                     orgName.push(organization[i].name);

                    }


                   res.json(orgName);
                     });
             });

This only ever returns 100. My company has a lot of organizations. How can I get it to return more?

Support the field selector

This is a feature request to support the field selector as described in the Pipedrive API v1 reference.

Field selector
You can pass in a field selector to indicate which fields you would like to fetch per each object when asking for a collection/list of objects. For example, you may only want to fetch deal's ID, title, value and currency when asking the deals list. This can be done by using the following syntax: GET https://companydomain.pipedrive.com/v1/deals:(id,title,value,currency)?api_token=YOUR_API_TOKEN.

Is there any way to use the field selector with the existing client? I tried the pipedrive.getAll('Collection:(id)') method, but this did not work.

Is the subdomain required?

In this documentation and PHP example they use the companies subdomain when making requests.

However, this nodejs library does not require it when instantiating the client.

Is the company subdomain required when using the REST API?

I am building a client for Elixir, and just wondering if I should require a company_domain configuration option.

Thanks!

File Add Not Working

Hello,

I am having trouble getting the 'Files Add' to work on the Pipedrive API.

My server is setup with Express using the connect bodyParser like so.

app.use(express.bodyParser({ keepExtensions: true, uploadDir: 'uploads' }));

I submit a POST request to /submit with form data containing a file called 'myFile', and the user email in the query string. The request is sent as 'multipart/form-data encoding', and received successfully.

Pipedrive's client-nodejs is setup like this.

app.post('/submit', function(request, response) {
  var url_parts = url.parse(request.url, true);
  var email = url_parts.query.email;

  pipedrive.SearchResults.field({
    term: email,
    exact_match: '0',
    field_type: 'personField',
    field_key: 'email',
    return_item_ids: '1'
  }, function(err, data) {
    pipedrive.Files.add({
      file: request.files.myFile,         // Something wrong here
      person_id: data[0].id
    }, function(err, data) {
      response.send(data);
    });
  });

});

Everything works until I get to the Files.add section, then I receive this error:

Error: Pipedrive API error:No files were provided with the request.

Any ideas what might be the issue?

Thank you for your help!

Danny

OAuth 2.0 support

Hello.

Does this support oauth tokens instead of api token?
Pipedrive only allows marketing support for projects that use the oauth token.

If this exists can it be added into the docs??

Error handling is totally broken

When calling pd.OrganizationFields.add with some invalid arguments one would expect an error to be returned as the first argument of the callback.
This is not the case, I don't believe this is the case for any API method. Instead err is null and the rest of the arguments are empty objects.
It is incredibly frustrating as an API user to have silently failing API calls. Please see the attached image. As you can see, it's gotten to the default else case and will not emit an error.

image

ENOENT: no such file or directory, open '//../package.json'

Not sure if this is a problem for others, but I came accross this when bundling the client using serverless-webpack.

Basically the client expects a package.json in its root directory from which it fetches the version.

inflector.version = JSON.parse(
require( 'fs' ).readFileSync( __dirname + '/../package.json', 'utf8' )
).version;

The script is making some assumptions about it's runtime environment that may not be guaranteed.

Any chance of removing this?

File upload breaks with binary files

When I use the JavaScript client to upload a binary file to a deal, the file gets corrupted. I see that issue #5 (which is closed) explains a fix was to use the file_path property. However, this only works for plain text files for me. When I use a binary file, I get the behavior that @alexandremaeda mentioned in #5.

Ultimately, I had to bypass using the JavaScript client completely and go straight to the API. I looked at how the Pipedrive web app did file uploads and saw that it used the form-data library. The gist below shows my solution using form-data. Because this solution deviates from the typical pattern in the JavaScript client for sending requests to the API, I did not create a pull request.

https://gist.github.com/scottsbaldwin/230465d8d90c9e05b37535dbc723c7ac

Could something like this be adapted to work in the API?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.