-
Notifications
You must be signed in to change notification settings - Fork 0
/
anyTypeModel.go
46 lines (38 loc) · 1.06 KB
/
anyTypeModel.go
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
package anytype_to_linkwarden
import "slices"
type AnytypeObjectDetails struct {
Tag []string `json:"tag,omitempty"`
Source string `json:"source,omitempty"`
Name string `json:"name,omitempty"`
Id string `json:"id,omitempty"`
RelationKey string `json:"relationKey,omitempty"`
}
func (d *AnytypeObjectDetails) Tags(tags map[string]*AnyTypeTag) []string {
return slices.Collect(func(yield func(E string) bool) {
for _, tag := range d.Tag {
v := tags[tag]
if v != nil {
if !yield(v.Snapshot.Data.Details.Name) {
return
}
}
}
})
}
type AnytypeObjectData struct {
ObjectTypes []string `json:"objectTypes,omitempty"`
Details AnytypeObjectDetails `json:"details,omitempty"`
}
type AnytypeObjectSnapshot struct {
Data AnytypeObjectData `json:"data,omitempty"`
}
type AnytypeObject struct {
SBType string `json:"sbType,omitempty"`
Snapshot AnytypeObjectSnapshot `json:"snapshot,omitempty"`
}
type Bookmark struct {
*AnytypeObject
}
type AnyTypeTag struct {
*AnytypeObject
}