MCPcopy Create free account
hub / github.com/blues/note / GetNotefiles

Method GetNotefiles

lib/wire.go:563–596  ·  view source on GitHub ↗

GetNotefiles gets the multi-notefile structure from within the a notehubMessage

()

Source from the content-addressed store, hash-verified

561
562// GetNotefiles gets the multi-notefile structure from within the a notehubMessage
563func (msg *notehubMessage) GetNotefiles() (notefiles map[string]*Notefile, err error) {
564 notefiles = map[string]*Notefile{}
565
566 // If native is available, return it, else decompress
567 if msg.nf != nil && msg.nf.Notefiles != nil {
568 notefiles = *msg.nf.Notefiles
569 } else {
570 if msg.cf == nil || len(msg.cf.Notefiles) == 0 {
571 return
572 }
573 jdata, err2 := jsonDecompress(msg.cf.Notefiles)
574 if err2 != nil {
575 err = err2
576 return
577 }
578 err = note.JSONUnmarshal(jdata, notefiles)
579 if err != nil {
580 return
581 }
582 }
583
584 // If there's an externalized payload, internalize it
585 if msg.nf.Payload != nil && len(*msg.nf.Payload) != 0 {
586 for _, notefile := range notefiles {
587 err = notefile.InternalizePayload(*msg.nf.Payload)
588 if err != nil {
589 return
590 }
591 }
592 }
593
594 // Done
595 return
596}
597
598// SetBody sets the body within the a notehubMessage data structure
599func (msg *notehubMessage) SetBody(body map[string]interface{}) error {

Callers 1

hubNotefilesMergeFunction · 0.80

Calls 2

jsonDecompressFunction · 0.85
InternalizePayloadMethod · 0.80

Tested by

no test coverage detected