Coder Social home page Coder Social logo

evernote-sdk-js's People

Contributors

akhaku avatar browsnet avatar brpaz avatar deiga avatar heziqiang avatar install avatar janogonzalez avatar jayhjkwon avatar joeydong avatar julen avatar mariecl avatar matveifisenko avatar mustafa avatar nishanths avatar poscar avatar rekotan avatar terales avatar thspinto avatar tomzhang32 avatar zonabi 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

evernote-sdk-js's Issues

Error in NodeBinaryHttpTransport.flush: Binary protocol does not support synchronous calls

I've just installed the Evernote SDK, and I'm trying to run the most basic, minimal example, copied pretty much verbatim from the Evernote docs: http://dev.evernote.com/start/core/authentication.php

var Evernote = require('evernote').Evernote;

var developerToken = "my secret dev token";

var client = new Evernote.Client({token: developerToken});

// Set up the NoteStore client 
var noteStore = client.getNoteStore();

// Make API calls
noteStore.listNotebooks(function(notebooks) {
    console.log('notebooks',notebooks);
});

Which throws an error when run:

~/workspace⚡ node app.js 

/Users/jacob/workspace/node_modules/evernote/evernote-sdk-js/thrift/lib/node/thrift-node-binary.js:59
    if (!async) throw 'Error in NodeBinaryHttpTransport.flush: Binary protocol
                ^
Error in NodeBinaryHttpTransport.flush: Binary protocol does not support synchronous calls

Any ideas?

note content always null

Hello, I'm using the nodejs library v1.25.3 to retrieve notes and it is returning a title but null content (for any kind of note retrieval call) :

{ guid: '1f990236-786d-4100-8f32-5e95497bf4ee',
  title: 'Getting Started',
  content: null,
  contentHash:
>>> ... hash data
contentLength: 10457,
  created: 1414556229000,
  updated: 1414556229000,
  deleted: null,
  active: true,
  updateSequenceNum: 2,
  notebookGuid: 'ac66910a-6a3d-4ff5-b3e1-1e87fa425593',
  tagGuids: null,
  resources: [
>>> ... resource data
  ]
}

any ideas?

ReferenceError: Note is not defined

Using node v0.10.7, I'm trying to use getFilteredSyncChunk with a SyncChunkFilter with includeNotes set to true against the sandbox and have a couple of problems.

Case1:
If I use an afterUSN that is "far" away from the updateCount then I run into "ReferenceError: Note is not defined". I've tracked it down to line 212 of generated/NoteStore_types.js:
elem6 = new Note();

Case2:
If I use an afterUSN that is "close" to, but less than, the updateCount then I get back only the following which does not include any reference to the note(s) that have changed:
{ currentTime: 1369084267492,
chunkHighUSN: null,
updateCount: 44,
notes: null,
notebooks: null,
tags: null,
searches: null,
resources: null,
expungedNotes: null,
expungedNotebooks: null,
expungedTags: null,
expungedSearches: null,
linkedNotebooks: null,
expungedLinkedNotebooks: null }

Is this correct? I was expecting to also get a reference to the notes that changed since the afterUSN.

Thanks for your help!

Error in NodeBinaryHttpTransport.flush: Binary protocol does not support synchronous calls

I have an Evernote Webapp which in most time runs well, but occasionally crashes down by this exception. When it happens, it lasts for a while and makes the app out of service.

/home/gock/github/dillinger/node_modules/evernote/evernote-sdk-js/thrift/lib/node/thrift-node-binary.js:59
    if (!async) throw 'Error in NodeBinaryHttpTransport.flush: Binary protocol
                ^
Error in NodeBinaryHttpTransport.flush: Binary protocol does not support synchronous calls

I am almost certain that it is not caused by my app and the Evernote SDK/service should be blamed. I even guess it is caused by api limit.

Please fix this, at least make a more elegant callback error which not crashes the whole service. If it is caused by myself, please let me know.

CERT_UNTRUSTED when initializing Evernote Client in the node.js SDK

Hi,

I'm getting the following error using the node client:

CERT_UNTRUSTED

My code (coffeescript) is as follows:


client = new Evernote.Client(
consumerKey: 'my consumer key'
consumerSecret: 'my secret'
sandbox: false
)

f = new Future()
client.getRequestToken(config_settings.private.evernote_callbackUrl+user_id,
(error, oauthToken, oauthTokenSecret, results) ->
if error
console.info("Error with Evernote OAuth:"+error)
f'return'
else
new Fiber(()->
userDetails.update({user_id:user_id},{$set:{evernote_intermediate:{oauthToken: oauthToken,oauthTokenSecret: oauthTokenSecret}}})
).run()
f['return'] (client.getAuthorizeUrl(oauthToken))
)


It appears the error is because www.evernote.com redirects to evernote.com causing as SSL error due to some mismatch.

By my reckoning the following code (Lines 28-32) of evernote-sdk-js/evernote/node/client.js is the culprit:


  if (this.sandbox) {
    var defaultServiceHost = 'sandbox.evernote.com';
  } else {
    var defaultServiceHost = 'www.evernote.com';
  }

Unable to use 'getSharedNoteStore' can't get property sharedToken of undefined

When I try to use the simple sample from the readme about "NoteStore for linked notebooks", I have this error : Cannot read property 'sharedToken' of undefined.

Having a look to the code, it seems that the cache check is not robust enough:

  const cache = this[linkedNotebook.sharedNotebookGlobalId];
  if (cache.sharedToken) {
    return Promise.resolve({token: cache.sharedToken, url: linkedNotebook.noteStoreUrl});
  } else {
    ... ...
  }

I guess we should check that cache is defined:

  if (cache && cache.sharedToken)

regards

findNotesMetadata error

Please look at my error, node 9.3.0 evernote 2.0.5:

var filter = new Evernote.NoteStore.NoteFilter({
words: ['markdown'],
ascending: true
});

var spec = new Evernote.NoteStore.NotesMetadataResultSpec({
includeTitle: true
});

noteStore.findNotesMetadata(filter, 0, 10, spec).catch(function (err) {
    console.log(err);
    });

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type object
at Function.byteLength (buffer.js:512:11)
at Object.BinaryParser.fromString (/Users/michael/.node/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:500:22)
at BinaryProtocol.writeString (/Users/michael/.node/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:148:30)
at BinaryProtocol.writeType (/Users/michael/.node/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:168:25)
at new Thrift.Struct.write (/Users/michael/.node/node_modules/evernote/lib/thrift/thrift.js:532:24)
at Thrift.Struct.write (/Users/michael/.node/node_modules/evernote/lib/thrift/thrift.js:530:17)
at Thrift.Method.sendRequest (/Users/michael/.node/node_modules/evernote/lib/thrift/thrift.js:162:15)
at NoteStoreClient.findNotesMetadata (/Users/michael/.node/node_modules/evernote/lib/thrift/gen-js2/NoteStore.js:1584:8)
at /Users/michael/.node/node_modules/evernote/lib/stores.js:106:14
at

A good updated tutorial is needed! Thx

No guidance for building evernote-sdk-minified.js

For development I'd like to use a non-minified version,
but can only guess that minified.js is a concatenation of thrift.js and other js file (what are they?)

It would be better to provide a guidance for building the production js.

Exception in getBusinessNoteStore

I'm getting a crash when calling getBusinessNoteStore.

Debugging showed that the authenticateToBusiness callback internal to evernote-sdk-js is called twice. The first time is fine, no error and the bizAuth argument is valid. The second time both err and bizAuth arguments are undefined

This crashes my process with the following exception:

TypeError: Cannot read property 'authenticationToken' of undefined
    at /.../node_modules/evernote/evernote-sdk-js/evernote/node/client.js:112:37
    at IncomingMessage.send (/.../node_modules/evernote/evernote-sdk-js/thrift/lib/node/thrift-node-binary.js:132:11)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

Has anybody else seen this? Any ideas?

Thanks,
Oscar

NoteFilter() and NotesMetadataResultSpec() no longer constructors

Multiple SO questions dating from 2015 show using the JS SDK in this fasion:

filter = new Evernote.NoteFilter();
//set the notebook guid filter to the GUID of the default notebook
filter.notebookGuid = notebooks[0].guid; //change this to the GUID of the notebook you want
//create a new result spec for findNotesMetadata
resultSpec = new Evernote.NotesMetadataResultSpec();
//set the result spec to include titles
resultSpec.includeTitle=true;

The problem is it appears the API has changed recently in that neither of these constructors exist, resulting in the error below:

Evernote.NoteFilter is not a constructor

forget to rebuild before publish?

  • i found var url = 'http://' + this.serviceHost + ":8080"; in client.js using npm
  • also i found defaultServiceHost = 'akhaku.evernote.com'; line 101

have you rebuild this project before publishing?

Typo in docs

var hostName = "http://sandbox.evernote.com"; should be https , otherwise it will get a 401 error.

errorCode: 8, "authenticationToken"

I just created a developer token, but with the following code, I'm getting this error:

ThriftException {
    errorCode: 8,
    message: 'authenticationToken',
    rateLimitDuration: null 
}

What am I doing wrong?

const client = new Evernote.Client({
  token: evernoteToken,
});

const noteStore = client.getNoteStore();

const newestFilter = new Evernote.NoteStore.NoteFilter({
  order: 2,
  ascending: false,
  inactive: false,
  includeAllReadableNotebooks: false,
});

const completeSpec = new Evernote.NoteStore.NotesMetadataResultSpec({
  includeTitle: true,
  includeContentLength: true,
  includeCreated: true,
  includeUpdated: true,
  includeDeleted: true,
  includeUpdateSequenceNum: true,
  includeNotebookGuid: true,
  includeTagGuids: true,
  includeAttributes: true,
  includeLargestResourceMime: true,
  includeLargestResourceSize: true,
});

noteStore.findNotesMetadata(newestFilter, 0, 10, completeSpec)
.then((data) => {
  console.log(data);
})
.catch(failed);

Evernote Cloud SDK for JavaScript?

Hi,

Glad to see recent updates of the sdk. Will there be an Evernote Cloud SDK for JavaScript, just like the php version? And when? If it didn't coming in a month, I'll have to implement the tedious business and shared notebook things by my self.

Don't use '*' instead of a version number in the package.json file

This is the content of the package.json (https://github.com/evernote/evernote-sdk-js/blob/master/sample/express/package.json).

"dependencies": {
  "express": "3.1.0",
  "jade": "*",
  "less-middleware": "*",
  "evernote": "*"
  }

But your Express app example is compatible only with older version of jade and less-middleware and it doesn't work with the current version of these packages.

Also I think your sample codes (https://dev.evernote.com/doc/articles/creating_notes.php) works only with older version of evernote sdk.

Btw why you don't use unit tests? It is not a good idea to publish your code without tests...

So much global variables

Reviewed some files of this project. I found too much variables. like BusinessUtils, evernote in index.js.

I don't think it is a good design.

Error: Protocol "https:" not supported. Expected "http:"

Hello. I cant do requests to Evernote using the SDK. I always get the following error:

Error: Protocol "https:" not supported. Expected "http:"
    at new ClientRequest (_http_client.js:54:11)
    at Object.request (http.js:26:10)
    at BinaryHttpTransport.module.exports.BinaryHttpTransport.flush (/media/DATA/Code/personal/cerebro-plugin-evernote/dist/index.js:6117:20)
    at BinaryProtocol.module.exports.BinaryProtocol.flush (/media/DATA/Code/personal/cerebro-plugin-evernote/dist/index.js:5569:23)

Here is my code:

My code:

  this.client = new Evernote.Client({ token: token });

  const userStore = this.client.getUserStore();
  userStore.getUser().then(function (user) {
      console.log(user);
    }).catch((err) => {
      console.error(err);
    });

getResourceByHash hash content how change?

In python

"""
get resource by its hash
 """
        hash_bin = hash_str.decode('hex')
        resource = self.note_store.getResourceByHash(self.note_guid, hash_bin, True, False, False);

this hash_bin in node how get?
i try it can't work

hashBin = new Buffer('hashStr', 'hex').toString()
noteStore.getResourceByHash noteGuid, 'hashBin', true, false, false, (err, data) ->
  if err
    return console.log err

sdk-js with phonegap

Based on the minified version of evernote-sdk-js, In a phonegap application, i'm able to retrieve the list of notes by using a noteStore.
Function to get NoteStore :

createNoteStore : function(options) {
                    var noteStoreURL = options.edam_noteStoreUrl;
                    var noteStoreTransport = new Thrift.BinaryHttpTransport(
                            noteStoreURL);
                    var noteStoreProtocol = new Thrift.BinaryProtocol(
                            noteStoreTransport);
                    return new NoteStoreClient(noteStoreProtocol);
                };

With this function i'm able to get the list of notes

function getList(){
                                    var $callback = $.Deferred();
                    createNoteStore(params).listNotebooks(
                            params.oauth_token, function onSuccess(notebooks) {
                                $callback.resolve(notebooks);
                            }, function onerror(error) {
                                $callback.reject(notebooks);
                            });
                    return $callback;
}

Now I'm looking to share a single note or to search for notes with some key words by using 'findNotesMetadata' and findNotes, none of them works with EDAMUserException {errorCode: 3, parameter: "authenticationToken"}

function Search(word, options, params){
                                    var $callback = $.Deferred();
                    if (!params) {
                        throw new Error('missing required parametres');
                    }
                    var filter = new NoteFilter();
                    filter.words = 'notebook:' + word + ' ';
                    var spec = new NotesMetadataResultSpec();
                    spec.includeTitle = true;
                    // if !options.noteStore && !
                    // create
                    api.createNoteStore(params).findNotes(
                    params.oauth_token, filter, 0, 100, spec,
                            function onSuccess(notebooks) {
                                $callback.resolve(notebooks);
                            }, function onerror(error) {
                                $callback.reject(error);
                            });
                    return $callback;
}

how to use evernote js sdk in react-native

react-native use Common js modules .
but react-native do not have some libs can be used in nodejs
i.e. fs vm path crypto

how can I use evernote js sdk in commonjs way ,without the nodejs libs

(Node.js) cannot use two or more shared NoteStore for one client

I'm trying to get notes from two or more linked notebooks.

For this, I wrote code like this.

client = new Evernote.Client(token: oauthAccessToken, sandbox: false);
notebooks = <linked notebooks by noteStore.listLinkedNotebooks>;

notebooks.forEach(function (notebook) {
  notebook.noteStore = client.getSharedNoteStore(notebook);
});

But, when I called noteStore.getNoteContent, it returned EADMUserException, and I found the SDK sent invalid authentication token.

The problem is that sharedToken is stored in the Client instance, not in the NoteStore instance.
(In Client.prototype.getSharedNoteStore, self of self.sharedToken indicated Client, not NoteStore)

How to use findNotesMeradata?

        var client = new Evernote.Client({token: token})
        var noteStore = client.getNoteStore()
        noteStore.findNotesMetadata({words: 'test'}, 0, 10, {
            includeTitle: true,
            includeContentLength: true,
            includeCreated: true,
            includeUpdated: true
        }, function (err, result) {
            if (err) {
                console.log(err)
            } else {
                console.log(result)
            }
        })

I always get a error
[TypeError: Object 0 has no method 'write']

I do not know what's wrong.

getNoteContent MemBuffer overrun

Hi,

Seeing the following issue when calling getNoteContent()

/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/transport/memBuffer.js:29
    if (this.offset + len > this.buffer.length) throw Error('MemBuffer overrun');
                                                ^

Error: MemBuffer overrun
    at Error (native)
    at MemBuffer.read (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/transport/memBuffer.js:29:55)
    at BinaryProtocol.readString (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/protocol/binaryProtocol.j
s:333:29)
    at BinaryProtocol.readType (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:
353:25)
    at Object.Thrift.Struct.readFields (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/thrift.js:505:49)
    at Thrift.Struct.read (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/thrift.js:485:19)

    at Thrift.Method.processResponse (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/thrift.js:204:26)
    at null.<anonymous> (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/thrift.js:165:42)
    at wrapTransport (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:48:20)
    at IncomingMessage.<anonymous> (/Users/andy.britcliffe/code/action/node_modules/evernote/lib/thrift/transport/binaryHttpTra
nsport.js:77:27)

Code is:

var noteStore = authClient.getNoteStore();
  var filter = {
    words: searchText,
  };

  noteStore.findNotesMetadata(
      filter,
      0,
      100,
      {
            includeTitle: true,
            includeContentLength: true,
            includeCreated: true,
            includeUpdated: true
        }
  ).then(function(res) {
    for (var i = 0; i < res.notes.length; i++) {
      noteStore.getNoteContent(res.notes[i].guid).then(function(note){
          console.log(note);
      });
    }
  })

Using v6.9.2

Looks like someone has seen something similar here: http://stackoverflow.com/questions/41189736/how-to-avoid-membuffer-overrun-in-node-js-evernote-api-2-0-0-beta

Any help/insight appreciated. Thanks

`undefined function error` when create note | notebook | tag

var libEvernote = require('Evernote');

var token = "...";
var client = new libEvernote.Evernote.Client({token: token});

// Set up the NoteStore client
var noteStore = client.getNoteStore();

noteStore.createTag(token, {name: "test1"}, function(err, data) {
  console.log(arguments);
});
/usr/local/bin/node test.js
{ '0': [TypeError: undefined is not a function] }

OAuth callback URL must be a string

Hello there,
I've been developing an application using Electron but I have a problem authenticating users. Most of the times, when I call the getRequestToken function and redirect the user to the login form, evernote throws an error:

Uncaught AssertionError: path must be a string

This is my code is structured:

var Evernote = require('evernote');
var client = new Evernote.Client({
  consumerKey: 'consumer',
  consumerSecret: 'secret',
  sandbox: false
});

client.getRequestToken("http://localhost:53546/", function(error, oauthToken, oauthTokenSecret) {
    if (error) {
    // do your error handling here
    }
    oauthStore.oauthToken = oauthToken;
    oauthStore.oauthTokenSecret = oauthTokenSecret;
    mainWindow.loadURL(client.getAuthorizeUrl(oauthToken)); // send the user to Evernote
});

The problem is that 95% of the times, the callback is not called. I even tried it with a different URL (not localhost), but the issue remains.

Thank you.

Node.js Streams for Resource API

When working with resources with .getResource() or .createNote(), .updateNote(),
the full file contents must be loaded to memory, which is bad for a non blocking io system like Node.js.

Node.js uses Streams, so that only a chunk of content is loaded into memory when streaming files. Wonder if Resource API can implement Readable/Writeable streams like:

noteStore.getResourceStream({ guid: ... })
  .pipe(fs.createWriteStream('./foo'));

var resource = new Evernote.Resource();
resource.data = fs.createReadStream('./bar');

getResourceRecognition returns a JSON data instead of .enex file.Issue with Javascript sdk

We Used the below function to get the content of a JPEG.

noteStore.getResourceRecognition(authenticationToken,guidnum,function(notes){
console.log('Success- ' + JSON.stringify(notes));
},function onerror(error) {
console.log('Error- ' + JSON.stringify(error));
});

It was given like the expected response would be in the form of an xml (.enex file) having the specifications of the texts present in the file.But what we got was in the form of JSON and not understandable.

Function Responce
"body":{"0":255,"1":216,"2":255,"3":224,"4":0,"5":16,"6":74,"7":70,"8":73,"9":70,"10":0,"11":1,"12":0,"13":1,"14":0,"15":96,"16":0,"17":96,"18":0,"19" ............................................................................... goes a long way.

We just read through the javascript sdk and found that getResourceRecognition call a function send which has the following lines.
var h=new XMLHttpRequest;
h.responseType="arraybuffer";

for all other function we tried JSON was the expected response but for getResourceRecognition it had to be xml.
We just removed the line "h.responseType="arraybuffer";" and got the .enex file in the response of the request and viewed them in the logs (console.log(h.response)) though the output of the getResourceRecognition function was an error as we guess though might be wrong the other following functions expected arraybuffer.

Kindly help and guide us if we are in the wrong track.

Console Log Response:
06-06 08:14:25.539: D/CordovaLog(3172):

blog-EN.doc Microsoft Mierosoft

Bad response content type from "https://sandbox.evernote.com//edam/user": text/html

Hello,

I'm using the node module (release 1.25.3) and I'm getting the following error when I try to access something after oauth phase:
'Bad response content type from "https://sandbox.evernote.com//edam/user": text/html'

This also happens with the provided express sample.

Steps to reproduce:

Launch the express sample, go to http://localhost:3000/ and authorize your application (I'm using sandbox credentials of course).

You may have to adjust some code due to the use of wildcards the package.json that prevent the example to work properly out of the box.

When the authorization succeed, sadly the error is not handled by the express route, so here is the modified code that shows the error:

~/evernote-sdk-js/sample/express/routes/index.js:16

noteStore.listNotebooks(function(err, notebooks){
  console.log(err); // added debug
  req.session.notebooks = notebooks;
  res.render('index');
});

This will display the error when the oauth process is complete (or in any case if the token is already in the session):

Bad response content type from "https://sandbox.evernote.com//edam/user": text/html

It seems that text/html is sent by evernote instead of application/x-thrift, maybe it is what we get when going on https://sandbox.evernote.com//edam/user through the browser.

After some research, it is maybe related to this

PS: It seems there is a (maybe) unrelated issue about the double / in the generated url

Creating Resources in node.js

The writeBinary function from thrift/lib/thrift-binary.js expects a String or an object with a byteLength property.

The problem is when you add a Resource to a Note and you put a binary file as the data property of the resource, for instance you can't convert a jpg into an UTF-8 string or the BinaryParser.fromString method will fail using the encodeURIComponent function in thrift/lib/thrift-binary.js and the Buffer object in node.js doesn't have a byteLengthproperty.

As a workaround I add a byteLength property to my buffer so the writeBinary function won't fail. Maybe we can do some changes or the workaround can be documented in the README so other developers don't have to figure it out. What are your thoughts about it?

Don't suggest http:// URLs

In the README, it's suggested we use http:// URLs for the OAuth handshake:

Change this to http://www.evernote.com, when you are ready to activate on production).

and...

var hostName = "http://sandbox.evernote.com";

But when we initiate the OAuth handshake with those URLs, we get a 301 Moved Permanently to the https:// version of the URL.

This breaks the jsOAuth library you recommend we use. Inside its main xhr.onreadystatechange callback, there is this comment:

// we are powerless against 3xx redirects

The docs just need updating to always refer to https:// URLs.

Thanks for requiring HTTPS, though!

Callback potentially can be called twice in thrift-node-binary.js

Hi,

Here is piece of code, that can potentially call callback twice:

    res.on('end', function() {
    if (res.headers['content-type'] != 'application/x-thrift') {
      callback('Bad response content type from "' + self.url + '": ' +
        res.headers['content-type']);
      return;
    }

    self.offset = 0;

    var buffer = new Buffer(dataLength);
    for (var i = 0, len = data.length, pos = 0; i < len; i++) {
      data[i].copy(buffer, pos);
      pos += data[i].length;
    }
    self.received = bufferToArrayBuffer(buffer);
    try {
      callback(null, recv_method.call(client));
    } catch(e) {
      callback(e);
    }
  });
});

if in the callback we will get exception, we will call this callback twice.

Would evernote provide a new API to do user authorization in backend?

In some situations when I work, I want to get my notes from Evernote and show them in my own blog for my readers, so I have authorize my account in backend to get the OAUTHVERIFY key instead of redirecting to authorization page to fill in the form. Would evernote be able to provide such an API?

Error: MemBuffer overrun when notes contain binary data [files, images etc]

I am working on evernote javascript SDK [[email protected]], things worked fine till I tried to make the following call ::

noteStore.getNoteWithResultSpec(guid, {includeContent:true, includeResourcesData: true})

The call to this function getNoteWithResultSpecfails when my notes on evernote contain binary data e.g. [img / pdf] etc. However if my notes only contain text data [ no img / pdf ] then this function works fine.

The console shows the following ::

` evernote/node_modules/evernote/lib/thrift/transport/memBuffer.js:32
if (this.offset + len > this.buffer.length) throw Error('MemBuffer overrun');
^

Error: MemBuffer overrun
at Error (native)
at MemBuffer.read (/evernote/node_modules/evernote/lib/thrift/transport/memBuffer.js:32:55)
at BinaryProtocol.readBinary (/evernote/node_modules/evernote/lib/thrift/protocol/binaryProto
col.js:327:29)
at BinaryProtocol.readType (/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtoco
l.js:355:25)
at Object.Thrift.Struct.readFields (/evernote/node_modules/evernote/lib/thrift/thrift.js:505:
49)
at Thrift.Struct.read (/evernote/node_modules/evernote/lib/thrift/thrift.js:485:19)
`

Please suggest / help to resolve this.

Cannot read property byteLength of undefined in getUser

We've recently upgraded out platform to Node 4.2.3 and have had some troubles from within the Evernote node Library.

Basically I've been digging into the following stack on a getUser call:

all_apps_ _papertrail

It looks like something is happening within the Thrift library causing the returned ArrayBuffer from writeString to be undefined. The weird part is this is only happening on our servers and I can't seem to reproduce this locally. Wondering if anyone else has experienced this or knows the source of the issue.

I also noticed the thrift library being used is 3 patch versions behind (current: 0.9.0, latest: 0.9.3). That could possibly have a fix for this issue.

"Evernote SDK for Node.js doesn't support synchronous calls"

Hi..sorry but the api is a bit confusing...I wish retrieve my notes inside a notebook..checking the api I found this

   NoteStoreClient.prototype.findNotes = function(authenticationToken, filter, offset, maxNotes, callback) { ...

then I did something like this (I'm not sure about the NoteFilter and I only can found this object inside a thriff file produced)

    noteStore.findNotes(_token,new Evernote.NoteFilter({notebookGuid : "f145764c-4cfb-4f2d-8954-8bd688035ce3"},0,10, function (err,resp) {
         if(err) console.log("error en notas \n\n"+err)
          else{
           console.log(JSON.stringify(resp));
         }
         }))

when I run it I get this error...

     "Evernote SDK for Node.js doesn't support synchronous calls"

also...I think than would be better than findNotes would receive an object aoviding pass all those params (like offset or maxNotes), something similar to NoteFilter..

    NoteStoreClient.prototype.findNotes = function(optionObj, callback) { ...   

would be more clear...thanks!!

how to search for reminders that has not been marked as done

hello,

how should i set the filter to get only the reminders that has not been marked as done?

I tried with,

const nFilter = new Evernote.NoteStore.NoteFilter({
  words: "reminderOrder:*-reminderDoneTime:*",
  ascending: false,
});

but didn't work

createBusinessNotebook() returns error even when successful

var Evernote = require('evernote').Evernote;
...
var notebook = new Evernote.Notebook();
notebook.name = 'Sample Business Notebook ' + new Date().getTime();
client.createBusinessNotebook(notebook, function(err, createdNotebook) {
  console.log(err); 
  console.log(createdNotebook);
  ...

prints the following:

[ReferenceError: Evernote is not defined] 
undefined

However, if I call client.getBusinessNoteStore().listNotebooks(), I see that the notebook has been created. However, it does not contain the SharedNotebook that should be automatically created with the BusinessNotebook. Instead, its JSON shows its sharedNotebooks as null:

...
sharedNotebooks: null,
...

Is this a problem with the SDK? Or am I missing some detail?

I have documented the same issue on the Developer Forum: https://discussion.evernote.com/topic/85956-createbusinessnotebook-returns-error-even-when-successful/

Use SDK in a Chrome extension

Hello,

I am working on a Chrome extension that needs integration with Evernote. I've already written the oath part. I just need to send simple notes to a user selected notebook. Can somebody let me know what part of this module I need? Basically, I want to just have those modules that are really required. BTW, there is basically no documentation on how to use this SDK in a browser. Just NodeJS...

get reminders

Hello,

I'm trying to get reminders with this code:

var Evernote = require('evernote');
 
const nFilter = new Evernote.NoteStore.NoteFilter({
  words: ["reminderOrder:*"],
  ascending: true,
});
 
const rSpec = {};
rSpec.includeTitle = true;
 
var client = new Evernote.Client({token: token, sandbox: false});
var noteStore = client.getNoteStore();

noteStore.findNotesMetadata(nFilter, 0, 50, rSpec).then(function(notesMetadataList) {
    console.log("Found " + notesMetadataList.notes.length + " notes with `reminderOrder` set.");
    console.log();
    console.log("Here are their titles: ");

    for (var i in notesMetadataList.notes) {
      console.log("\t" + notesMetadataList.notes[i].title);
    }
  }).catch(function(err){
      console.log('Error:',err);
  });

But i get this error:

TypeError: "string" must be a string, Buffer, or ArrayBuffer

What I'm doing wrong?

How to use app nootbook oauth?

there's no examples and i tried add supportLinkedSandbox=true&suggestedNotebookName=myNotebook in oauth url but dose no work.

Questions related to thrift errors

Since we moved to v2, I find a lot of these in our logs:

Error making Thrift HTTP request: Error: connect ETIMEDOUT xx.xxx.xxx.xxx:80
Error in Thrift HTTP response: 302
Error in Thrift HTTP response: 502

They coincide with the following pattern on our servers:

  • spikes of errors coming from Evernote
  • spikes in memory usage
  • crashes

Is there any reason why those errors would come in waves every few days? Given the error codes, I don't think they would be related to specific users updating their account, more due to server issues on your side, maybe?
Is there any way to shield from them?
Any clues on why they would tend to fill up memory?

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.