2019-11-05 02:53:11 +00:00
|
|
|
package feta
|
2019-11-03 10:56:57 +00:00
|
|
|
|
2019-12-14 17:03:38 +00:00
|
|
|
import "encoding/json"
|
|
|
|
|
2019-12-14 15:24:42 +00:00
|
|
|
type toot struct {
|
2019-12-14 17:03:38 +00:00
|
|
|
original *json.RawMessage
|
|
|
|
parsed *tootFromAPI
|
|
|
|
}
|
|
|
|
|
|
|
|
func newToots(input []*json.RawMessage) []*toot {
|
|
|
|
l := make([]*toot, 0)
|
|
|
|
for x := range input {
|
|
|
|
t := newToot(x)
|
|
|
|
if t != nil {
|
|
|
|
l = append(l, t)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return l
|
2019-11-03 10:56:57 +00:00
|
|
|
}
|
|
|
|
|
2019-12-14 17:03:38 +00:00
|
|
|
func newToot(input *json.RawMessage) *toot {
|
2019-12-14 15:24:42 +00:00
|
|
|
t := new(toot)
|
2019-12-14 17:03:38 +00:00
|
|
|
t.original = input
|
|
|
|
t.parsed = new(tootFromAPI)
|
|
|
|
err = json.Unmarshal(*input, t.parsed)
|
|
|
|
if err != nil {
|
|
|
|
t.parsed = nil
|
|
|
|
}
|
2019-11-03 11:09:04 +00:00
|
|
|
return t
|
2019-11-03 10:56:57 +00:00
|
|
|
}
|
2019-12-14 17:03:38 +00:00
|
|
|
|
|
|
|
func (t *toot) identityHashInput() string {
|
|
|
|
// id + datestamp + acct + content
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toot) hash() tootHash {
|
|
|
|
}
|