owl-blogs/interactions/webmention.go

35 lines
620 B
Go
Raw Normal View History

2023-08-08 18:17:04 +00:00
package interactions
2023-08-09 18:36:44 +00:00
import (
"fmt"
"owl-blogs/domain/model"
"owl-blogs/render"
)
2023-08-08 18:17:04 +00:00
type Webmention struct {
model.InteractionBase
2023-08-09 18:10:51 +00:00
meta WebmentionMetaData
2023-08-08 18:17:04 +00:00
}
2023-08-09 18:10:51 +00:00
type WebmentionMetaData struct {
2023-08-08 18:17:04 +00:00
Source string
Target string
Title string
2023-08-08 18:17:04 +00:00
}
func (i *Webmention) Content() model.InteractionContent {
2023-08-09 18:36:44 +00:00
str, err := render.RenderTemplateToString("interaction/Webmention", i)
if err != nil {
fmt.Println(err)
}
return model.InteractionContent(str)
2023-08-08 18:17:04 +00:00
}
func (i *Webmention) MetaData() interface{} {
return &i.meta
}
func (i *Webmention) SetMetaData(metaData interface{}) {
2023-08-09 18:10:51 +00:00
i.meta = *metaData.(*WebmentionMetaData)
2023-08-08 18:17:04 +00:00
}