【问题标题】:JS SDK, Thrift error code 12 when getting SharedNotebooksListJS SDK,获取 SharedNotebooksList 时出现 Thrift 错误代码 12
【发布时间】:2018-11-17 01:06:14
【问题描述】:

这是我第一次使用印象笔记, 就像JS SDK 中给出的示例一样,我使用从 OAuth 获得的令牌创建了我的客户端,并获得了当前用户的所有笔记本,所以这对我有好处。

但我遇到了一个我无法理解的问题,当我使用共享存储的任何方法时,它会引发 Thrift 异常,错误代码为 12,并在消息中提供分片 ID。

我知道 12 错误代码是分片暂时不可用.. 但我知道这是另一回事,因为它不是暂时的……

我有一个完全访问权限的 api 密钥,它可以与笔记商店一起使用,我错过了什么吗?

// This is the example in the JS SDK    
var linkedNotebook = noteStore.listLinkedNotebooks()
.then(function(linkedNotebooks) {
   // just pick the first LinkedNotebook for this example
   return client.getSharedNoteStore(linkedNotebooks[0]);
   }).then(function(sharedNoteStore) {
   // /!\ There is the problem, throw Thrift exception !
      return sharedNoteStore.listNotebooks().then(function(notebooks) {
         return sharedNoteStore.listTagsByNotebook(notebooks[0].guid);
      }).then(function(tags) {
   // tags here is a list of Tag objects
   });
});

【问题讨论】:

    标签: javascript evernote


    【解决方案1】:

    这似乎是 SDK 的错误。我创建了一个 PR (https://github.com/evernote/evernote-sdk-js/pull/90)。

    您可以自己使用 authenticateToSharedNotebook 来解​​决此问题。

    const client = new Evernote.Client({ token, sandbox });
    const noteStore = client.getNoteStore();
    const notebooks = await noteStore
      .listLinkedNotebooks()
      .catch(err => console.error(err));
    const notebook = notebooks.find(x => x.guid === guid);
    const { authenticationToken } = await client
      .getNoteStore(notebook.noteStoreUrl)
      .authenticateToSharedNotebook(notebook.sharedNotebookGlobalId);
    const client2 = new Evernote.Client({
      token: authenticationToken,
      sandbox
    });
    const noteStore2 = client2.getNoteStore();
    const [notebook2] = await noteStore2.listNotebooks();
    noteStore2.listTagsByNotebook(notebook2.guid)
    

    【讨论】:

      猜你喜欢
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-20
      • 1970-01-01
      • 2022-11-01
      • 2020-09-27
      • 2013-09-28
      相关资源
      最近更新 更多