MCPcopy Index your code
hub / github.com/simstudioai/sim / callNoteStore

Function callNoteStore

apps/sim/app/api/tools/evernote/lib/client.ts:80–107  ·  view source on GitHub ↗

Make a Thrift RPC call to the NoteStore

(token: string, writer: ThriftWriter)

Source from the content-addressed store, hash-verified

78
79/** Make a Thrift RPC call to the NoteStore */
80async function callNoteStore(token: string, writer: ThriftWriter): Promise<ThriftReader> {
81 const url = getNoteStoreUrl(token)
82 const body = writer.toBuffer()
83
84 const response = await fetch(url, {
85 method: 'POST',
86 headers: {
87 'Content-Type': 'application/x-thrift',
88 Accept: 'application/x-thrift',
89 },
90 body: new Uint8Array(body),
91 })
92
93 if (!response.ok) {
94 throw new Error(`Evernote API HTTP error: ${response.status} ${response.statusText}`)
95 }
96
97 const arrayBuffer = await response.arrayBuffer()
98 const reader = new ThriftReader(arrayBuffer)
99 const msg = reader.readMessageBegin()
100
101 if (reader.isException(msg.type)) {
102 const ex = reader.readException()
103 throw new Error(`Evernote API error: ${ex.message}`)
104 }
105
106 return reader
107}
108
109/** Check for Evernote-specific exceptions in the response struct. Returns true if handled. */
110function checkEvernoteException(reader: ThriftReader, fieldId: number, fieldType: number): boolean {

Callers 11

listNotebooksFunction · 0.70
getNoteFunction · 0.70
createNoteFunction · 0.70
updateNoteFunction · 0.70
deleteNoteFunction · 0.70
searchNotesFunction · 0.70
getNotebookFunction · 0.70
createNotebookFunction · 0.70
listTagsFunction · 0.70
createTagFunction · 0.70
copyNoteFunction · 0.70

Calls 5

readMessageBeginMethod · 0.95
isExceptionMethod · 0.95
readExceptionMethod · 0.95
getNoteStoreUrlFunction · 0.70
toBufferMethod · 0.45

Tested by

no test coverage detected