♻️ Constructors are handy
This commit is contained in:
parent
60131a4701
commit
fb84ebb9db
1 changed files with 15 additions and 14 deletions
|
|
@ -54,23 +54,24 @@ type Config struct {
|
|||
Id string `toml:"id"`
|
||||
}
|
||||
|
||||
func (c Config) GetIcon() vocab.IRI {
|
||||
// @todo return a media object, instead of an IRI
|
||||
func (c Config) GetIcon() *vocab.Object {
|
||||
var link = vocab.ObjectNew(vocab.ImageType)
|
||||
link.URL = vocab.IRI(c.IconUrl)
|
||||
// @todo figure out actual mime type
|
||||
link.MediaType = vocab.MimeType("image/jpeg")
|
||||
|
||||
return vocab.IRI(c.IconUrl)
|
||||
return link
|
||||
}
|
||||
|
||||
func (c Config) GetActor() vocab.Actor {
|
||||
return vocab.Actor{
|
||||
// Id:
|
||||
Name: vocab.NaturalLanguageValues{
|
||||
vocab.LangRefValue{
|
||||
Ref: "en",
|
||||
Value: []byte(c.Name),
|
||||
},
|
||||
},
|
||||
Icon: c.GetIcon(),
|
||||
}
|
||||
func (c Config) GetActor() *vocab.Actor {
|
||||
var me = vocab.PersonNew(vocab.IRI(c.Id))
|
||||
me.Name = vocab.DefaultNaturalLanguageValue(c.Name)
|
||||
me.Icon = c.GetIcon()
|
||||
|
||||
// @todo parse markdown into html
|
||||
me.Summary = vocab.DefaultNaturalLanguageValue(c.Summary)
|
||||
|
||||
return me
|
||||
}
|
||||
|
||||
var config Config
|
||||
|
|
|
|||
Reference in a new issue