♻️ 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"`
|
Id string `toml:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) GetIcon() vocab.IRI {
|
func (c Config) GetIcon() *vocab.Object {
|
||||||
// @todo return a media object, instead of an IRI
|
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 {
|
func (c Config) GetActor() *vocab.Actor {
|
||||||
return vocab.Actor{
|
var me = vocab.PersonNew(vocab.IRI(c.Id))
|
||||||
// Id:
|
me.Name = vocab.DefaultNaturalLanguageValue(c.Name)
|
||||||
Name: vocab.NaturalLanguageValues{
|
me.Icon = c.GetIcon()
|
||||||
vocab.LangRefValue{
|
|
||||||
Ref: "en",
|
// @todo parse markdown into html
|
||||||
Value: []byte(c.Name),
|
me.Summary = vocab.DefaultNaturalLanguageValue(c.Summary)
|
||||||
},
|
|
||||||
},
|
return me
|
||||||
Icon: c.GetIcon(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
|
|
||||||
Reference in a new issue