diff --git a/types.go b/types.go index f60bfc7..8edb2b0 100644 --- a/types.go +++ b/types.go @@ -15,12 +15,22 @@ type ReadingList struct { Entries []ReadingListEntry `json:"entries"` } +func (l ReadingList) String() string { + data, _ := json.MarshalIndent(l, "", "\t") + return string(data) +} + type ReadingListEntry struct { Novel NovelEntry `json:"novel"` CurrentChapter ReadingListChapterEntry `json:"current_chapter"` LatestChapter ReadingListChapterEntry `json:"latest_chapter"` } +func (e ReadingListEntry) String() string { + data, _ := json.MarshalIndent(e, "", "\t") + return string(data) +} + func (e ReadingListEntry) NewChapterAvailable() bool { return e.CurrentChapter.ID != e.LatestChapter.ID } @@ -31,11 +41,21 @@ type ReadingListChapterEntry struct { Link string `json:"link"` } +func (e ReadingListChapterEntry) String() string { + data, _ := json.MarshalIndent(e, "", "\t") + return string(data) +} + type NovelEntry struct { NovelID NovelID `json:"id"` Name string `json:"name"` } +func (e NovelEntry) String() string { + data, _ := json.MarshalIndent(e, "", "\t") + return string(data) +} + type Novel struct { ID NovelID `json:"id"` Name string `json:"name"` @@ -48,6 +68,11 @@ type Novel struct { Tags []TagID `json:"tags"` } +func (n Novel) String() string { + data, _ := json.MarshalIndent(n, "", "\t") + return string(data) +} + type NovelType string const (