Add cast checks around in-reply-to
This commit is contained in:
parent
93c7614efd
commit
04e37a8257
|
@ -281,11 +281,14 @@ func mapToItem(result map[string]interface{}) microsub.Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if value, e := result["in-reply-to"]; e {
|
if value, e := result["in-reply-to"]; e {
|
||||||
for _, v := range value.([]interface{}) {
|
if replyTo, ok := value.(string); ok {
|
||||||
if replyTo, ok := v.(string); ok {
|
} else if replyTo, ok := value.([]interface{}); ok {
|
||||||
item.InReplyTo = append(item.InReplyTo, replyTo)
|
for _, v := range value.([]interface{}) {
|
||||||
} else if cite, ok := v.(map[string]interface{}); ok {
|
if replyTo, ok := v.(string); ok {
|
||||||
item.InReplyTo = append(item.InReplyTo, cite["url"].(string))
|
item.InReplyTo = append(item.InReplyTo, replyTo)
|
||||||
|
} else if cite, ok := v.(map[string]interface{}); ok {
|
||||||
|
item.InReplyTo = append(item.InReplyTo, cite["url"].(string))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Feedbin is the main object for calling the Feedbin API
|
||||||
type Feedbin struct {
|
type Feedbin struct {
|
||||||
user string
|
user string
|
||||||
password string
|
password string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New returns a new Feedbin object with the provided user and password
|
||||||
func New(user, password string) *Feedbin {
|
func New(user, password string) *Feedbin {
|
||||||
var fb Feedbin
|
var fb Feedbin
|
||||||
fb.user = user
|
fb.user = user
|
||||||
|
@ -17,6 +19,7 @@ func New(user, password string) *Feedbin {
|
||||||
return &fb
|
return &fb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Taggings returns taggings
|
||||||
func (fb *Feedbin) Taggings() ([]Tagging, error) {
|
func (fb *Feedbin) Taggings() ([]Tagging, error) {
|
||||||
resp, err := fb.get("/v2/taggings.json")
|
resp, err := fb.get("/v2/taggings.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,6 +35,7 @@ func (fb *Feedbin) Taggings() ([]Tagging, error) {
|
||||||
return taggings, nil
|
return taggings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Feed returns a Feed for id
|
||||||
func (fb *Feedbin) Feed(id int64) (Feed, error) {
|
func (fb *Feedbin) Feed(id int64) (Feed, error) {
|
||||||
resp, err := fb.get(fmt.Sprintf("/v2/feeds/%d.json", id))
|
resp, err := fb.get(fmt.Sprintf("/v2/feeds/%d.json", id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,6 +52,7 @@ func (fb *Feedbin) Feed(id int64) (Feed, error) {
|
||||||
return feed, nil
|
return feed, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Entries return a slice of entries
|
||||||
func (fb *Feedbin) Entries() ([]Entry, error) {
|
func (fb *Feedbin) Entries() ([]Entry, error) {
|
||||||
resp, err := fb.get("/v2/entries.json")
|
resp, err := fb.get("/v2/entries.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user