~chrisppy/go-barefeed

go-barefeed/schema.go -rw-r--r-- 2.5 KiB
f9d9820fChris Palmer fix doc link in readme 8 months ago
                                                                                
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package barefeed

// Code generated by go-bare/cmd/gen, DO NOT EDIT.

import (
	"git.sr.ht/~sircmpwn/go-bare"
)

type Time string

func (t *Time) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Time) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Text struct {
	TextType string `bare:"textType"`
	Value    string `bare:"value"`
}

func (t *Text) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Text) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Link struct {
	Href     string  `bare:"href"`
	Rel      *string `bare:"rel"`
	LinkType *string `bare:"linkType"`
	Lang     *string `bare:"lang"`
	Title    *string `bare:"title"`
	Length   *string `bare:"length"`
}

func (t *Link) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Link) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Person struct {
	Name  string  `bare:"name"`
	Email *string `bare:"email"`
	Uri   *string `bare:"uri"`
}

func (t *Person) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Person) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Entry struct {
	FeedID    string   `bare:"feedID"`
	EntryID   string   `bare:"entryID"`
	Read      bool     `bare:"read"`
	Liked     bool     `bare:"liked"`
	Position  uint     `bare:"position"`
	Title     Text     `bare:"title"`
	Content   Text     `bare:"content"`
	Updated   Time     `bare:"updated"`
	Published *Time    `bare:"published"`
	Authors   []Person `bare:"authors"`
	Links     []Link   `bare:"links"`
}

func (t *Entry) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Entry) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Feed struct {
	FeedPath string   `bare:"feedPath"`
	FeedID   string   `bare:"feedID"`
	Title    Text     `bare:"title"`
	Updated  Time     `bare:"updated"`
	Authors  []Person `bare:"authors"`
	Links    []Link   `bare:"links"`
}

func (t *Feed) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Feed) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Bin struct {
	Generator string  `bare:"generator"`
	Content   Content `bare:"content"`
}

func (t *Bin) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Bin) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Content interface {
	bare.Union
}

func (_ Feed) IsUnion() {}

func (_ Entry) IsUnion() {}

func init() {
	bare.RegisterUnion((*Content)(nil)).
		Member(*new(Feed), 0).
		Member(*new(Entry), 1)

}