Add stylesheet methods and more to subreddit service
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ const (
|
||||
kindWikiPage = "wikipage"
|
||||
kindWikiPageListing = "wikipagelisting"
|
||||
kindWikiPageSettings = "wikipagesettings"
|
||||
kindStyleSheet = "stylesheet"
|
||||
)
|
||||
|
||||
type anchor interface {
|
||||
@@ -106,6 +107,8 @@ func (t *thing) UnmarshalJSON(b []byte) error {
|
||||
v = new([]string)
|
||||
case kindWikiPageSettings:
|
||||
v = new(WikiPageSettings)
|
||||
case kindStyleSheet:
|
||||
v = new(SubredditStyleSheet)
|
||||
default:
|
||||
return fmt.Errorf("unrecognized kind: %q", t.Kind)
|
||||
}
|
||||
@@ -206,6 +209,11 @@ func (t *thing) WikiPageSettings() (v *WikiPageSettings, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func (t *thing) StyleSheet() (v *SubredditStyleSheet, ok bool) {
|
||||
v, ok = t.Data.(*SubredditStyleSheet)
|
||||
return
|
||||
}
|
||||
|
||||
// listing is a list of things coming from the Reddit API.
|
||||
// It also contains the after/before anchors useful for subsequent requests.
|
||||
type listing struct {
|
||||
|
||||
Reference in New Issue
Block a user