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