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

Function createNote

apps/sim/app/api/tools/evernote/lib/client.ts:443–485  ·  view source on GitHub ↗
(
  token: string,
  title: string,
  content: string,
  notebookGuid?: string,
  tagNames?: string[]
)

Source from the content-addressed store, hash-verified

441}
442
443export async function createNote(
444 token: string,
445 title: string,
446 content: string,
447 notebookGuid?: string,
448 tagNames?: string[]
449): Promise<EvernoteNote> {
450 const writer = new ThriftWriter()
451 writer.writeMessageBegin('createNote', 0)
452 writer.writeStringField(1, token)
453
454 writer.writeFieldBegin(TYPE_STRUCT, 2)
455 writer.writeStringField(2, title)
456 writer.writeStringField(3, wrapInEnml(content))
457 if (notebookGuid) {
458 writer.writeStringField(11, notebookGuid)
459 }
460 if (tagNames && tagNames.length > 0) {
461 writer.writeStringListField(15, tagNames)
462 }
463 writer.writeFieldStop()
464
465 writer.writeFieldStop()
466
467 const reader = await callNoteStore(token, writer)
468 let note: EvernoteNote | null = null
469
470 reader.readStruct((r, fieldId, fieldType) => {
471 if (fieldId === 0 && fieldType === TYPE_STRUCT) {
472 note = readNote(r)
473 } else {
474 if (!checkEvernoteException(r, fieldId, fieldType)) {
475 r.skip(fieldType)
476 }
477 }
478 })
479
480 if (!note) {
481 throw new Error('No note returned from Evernote API')
482 }
483
484 return note
485}
486
487export async function updateNote(
488 token: string,

Callers 1

route.tsFile · 0.90

Calls 11

writeMessageBeginMethod · 0.95
writeStringFieldMethod · 0.95
writeFieldBeginMethod · 0.95
writeStringListFieldMethod · 0.95
writeFieldStopMethod · 0.95
wrapInEnmlFunction · 0.85
readNoteFunction · 0.85
checkEvernoteExceptionFunction · 0.85
readStructMethod · 0.80
skipMethod · 0.80
callNoteStoreFunction · 0.70

Tested by

no test coverage detected