-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreviews.go
57 lines (52 loc) · 1.65 KB
/
reviews.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package jikan
import "time"
// RecentAnimeReviews struct
type RecentAnimeReviews struct {
Data []struct {
User UserItem `json:"user"`
Anime EntryTitle3 `json:"anime"`
MalId int `json:"mal_id"`
Url string `json:"url"`
Type string `json:"type"`
Votes int `json:"votes"`
Date time.Time `json:"date"`
Review string `json:"review"`
EpisodesWatched int `json:"episodes_watched"`
Scores ScoresAnime `json:"scores"`
} `json:"data"`
Pagination Pagination `json:"pagination"`
}
// GetRecentAnimeReviews returns recent anime reviews
func GetRecentAnimeReviews() (*RecentAnimeReviews, error) {
res := &RecentAnimeReviews{}
err := urlToStruct("/reviews/anime", res)
if err != nil {
return nil, err
}
return res, nil
}
// RecentMangaReviews struct
type RecentMangaReviews struct {
Data []struct {
User UserItem `json:"user"`
Manga EntryTitle3 `json:"manga"`
MalId int `json:"mal_id"`
Url string `json:"url"`
Type string `json:"type"`
Votes int `json:"votes"`
Date time.Time `json:"date"`
ChaptersRead int `json:"chapters_read"`
Review string `json:"review"`
Scores ScoresManga `json:"scores"`
} `json:"data"`
Pagination Pagination `json:"pagination"`
}
// GetRecentMangaReviews returns recent manga reviews
func GetRecentMangaReviews() (*RecentMangaReviews, error) {
res := &RecentMangaReviews{}
err := urlToStruct("/reviews/manga", res)
if err != nil {
return nil, err
}
return res, nil
}