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

Function updateNote

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

Source from the content-addressed store, hash-verified

485}
486
487export async function updateNote(
488 token: string,
489 guid: string,
490 title?: string,
491 content?: string,
492 notebookGuid?: string,
493 tagNames?: string[]
494): Promise<EvernoteNote> {
495 const writer = new ThriftWriter()
496 writer.writeMessageBegin('updateNote', 0)
497 writer.writeStringField(1, token)
498
499 writer.writeFieldBegin(TYPE_STRUCT, 2)
500 writer.writeStringField(1, guid)
501 if (title !== undefined) {
502 writer.writeStringField(2, title)
503 }
504 if (content !== undefined) {
505 writer.writeStringField(3, wrapInEnml(content))
506 }
507 if (notebookGuid !== undefined) {
508 writer.writeStringField(11, notebookGuid)
509 }
510 if (tagNames !== undefined) {
511 writer.writeStringListField(15, tagNames)
512 }
513 writer.writeFieldStop()
514
515 writer.writeFieldStop()
516
517 const reader = await callNoteStore(token, writer)
518 let note: EvernoteNote | null = null
519
520 reader.readStruct((r, fieldId, fieldType) => {
521 if (fieldId === 0 && fieldType === TYPE_STRUCT) {
522 note = readNote(r)
523 } else {
524 if (!checkEvernoteException(r, fieldId, fieldType)) {
525 r.skip(fieldType)
526 }
527 }
528 })
529
530 if (!note) {
531 throw new Error('No note returned from Evernote API')
532 }
533
534 return note
535}
536
537export async function deleteNote(token: string, guid: string): Promise<number> {
538 const writer = new ThriftWriter()

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