-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicon.go
More file actions
57 lines (46 loc) · 1.09 KB
/
icon.go
File metadata and controls
57 lines (46 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package pana
import (
"encoding/json"
ld "sourcery.dny.nu/longdistance"
as "sourcery.dny.nu/pana/vocab/w3/activitystreams"
)
// Icon is a more constrained version of [Image] used with [as.Icon].
type Icon Image
// NewIcon initialises a new Icon.
func NewIcon() *Icon {
return &Icon{
Properties: make(ld.Properties),
Type: []string{as.TypeImage},
}
}
// Build finalises the Icon.
func (i *Icon) Build() Icon {
return *i
}
// See [Object.GetType].
func (i *Icon) GetType() string {
return (*Image)(i).GetType()
}
// See [Object.SetType].
func (i *Icon) SetType() *Icon {
(*Image)(i).SetType(as.TypeImage)
return i
}
// GetMediaType returns the value in [as.MediaType].
func (i *Icon) GetMediaType() json.RawMessage {
return (*Image)(i).GetMediaType()
}
// SetMediaType sets the value in [as.MediaType].
func (i *Icon) SetMediaType(v json.RawMessage) *Icon {
(*Image)(i).SetMediaType(v)
return i
}
// See [Object.GetURL].
func (i *Icon) GetURL() string {
return (*Image)(i).GetURL()
}
// See [Object.SetURL].
func (i *Icon) SetURL(url string) *Icon {
(*Image)(i).SetURL(url)
return i
}