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

Example code not works #100

Open
jopemachine opened this issue Jun 24, 2020 · 0 comments
Open

Example code not works #100

jopemachine opened this issue Jun 24, 2020 · 0 comments

Comments

@jopemachine
Copy link

jopemachine commented Jun 24, 2020

Environment

system: mac OS Catalina
node: 12.17.0
npm: 6.14.4
evernote module: 2.0.5

Issue

It seems that example code of README.md not works.

words of filter are causing type error.

In README, words are the array of String ( ['one', 'two', 'three'] ), but the code requires String.

Code

const noteStore = authenticatedClient.getNoteStore();

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

var spec = 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(filter, 0, 500, spec).then(notesMetadataList => {
  
  console.log(notesMetadataList);

}).catch(err => {
  console.log(err);
});

Error

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Array
    at Function.byteLength (buffer.js:727:11)
    at Object.BinaryParser.fromString (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:500:22)
    at BinaryProtocol.writeString (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:148:30)
    at BinaryProtocol.writeType (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:168:25)
    at new Thrift.Struct.write (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/thrift.js:532:24)
    at Thrift.Struct.write (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/thrift.js:530:17)
    at Thrift.Method.sendRequest (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/thrift.js:162:15)
    at NoteStoreClient.findNotesMetadata (/Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/thrift/gen-js2/NoteStore.js:1584:8)
    at /Users/igyubong/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8A34E19E-3B95-497D-8274-D0776DF242F3/node_modules/evernote/lib/stores.js:106:14
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'ERR_INVALID_ARG_TYPE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant