MCPcopy
hub / github.com/simstudioai/sim / getNote

Function getNote

apps/sim/app/api/tools/evernote/lib/client.ts:395–428  ·  view source on GitHub ↗
(
  token: string,
  guid: string,
  withContent = true
)

Source from the content-addressed store, hash-verified

393}
394
395export async function getNote(
396 token: string,
397 guid: string,
398 withContent = true
399): Promise<EvernoteNote> {
400 const writer = new ThriftWriter()
401 writer.writeMessageBegin('getNote', 0)
402 writer.writeStringField(1, token)
403 writer.writeStringField(2, guid)
404 writer.writeBoolField(3, withContent)
405 writer.writeBoolField(4, false)
406 writer.writeBoolField(5, false)
407 writer.writeBoolField(6, false)
408 writer.writeFieldStop()
409
410 const reader = await callNoteStore(token, writer)
411 let note: EvernoteNote | null = null
412
413 reader.readStruct((r, fieldId, fieldType) => {
414 if (fieldId === 0 && fieldType === TYPE_STRUCT) {
415 note = readNote(r)
416 } else {
417 if (!checkEvernoteException(r, fieldId, fieldType)) {
418 r.skip(fieldType)
419 }
420 }
421 })
422
423 if (!note) {
424 throw new Error('No note returned from Evernote API')
425 }
426
427 return note
428}
429
430/** Wrap content in ENML if it's not already */
431function wrapInEnml(content: string): string {

Callers 1

route.tsFile · 0.90

Calls 9

writeMessageBeginMethod · 0.95
writeStringFieldMethod · 0.95
writeBoolFieldMethod · 0.95
writeFieldStopMethod · 0.95
readNoteFunction · 0.85
checkEvernoteExceptionFunction · 0.85
readStructMethod · 0.80
skipMethod · 0.80
callNoteStoreFunction · 0.70

Tested by

no test coverage detected