This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
forked from darenliang/jikan-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseason.go
108 lines (102 loc) · 3.02 KB
/
season.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package jikan
import (
"fmt"
"time"
)
type SeasonInfo struct {
SeasonName string `json:"season_name"`
SeasonYear int `json:"season_year"`
Anime []struct {
MalID int `json:"mal_id"`
URL string `json:"url"`
Title string `json:"title"`
ImageURL string `json:"image_url"`
Synopsis string `json:"synopsis"`
Type string `json:"type"`
AiringStart time.Time `json:"airing_start"`
Episodes int `json:"episodes"`
Members int `json:"members"`
Genres []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"genres"`
Source string `json:"source"`
Producers []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"producers"`
Score float64 `json:"score"`
Licensors []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"licensors"`
R18 bool `json:"r18"`
Kids bool `json:"kids"`
Continuing bool `json:"continuing"`
} `json:"anime"`
}
type SeasonArchive struct {
Archive []struct {
Year int `json:"year"`
Seasons []string `json:"seasons"`
} `json:"archive"`
}
type SeasonLater struct {
SeasonName string `json:"season_name"`
SeasonYear int `json:"season_year"`
Anime []struct {
MalID int `json:"mal_id"`
URL string `json:"url"`
Title string `json:"title"`
ImageURL string `json:"image_url"`
Synopsis string `json:"synopsis"`
Type string `json:"type"`
AiringStart time.Time `json:"airing_start"`
Episodes int `json:"episodes"`
Members int `json:"members"`
Genres []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"genres"`
Source string `json:"source"`
Producers []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"producers"`
Score float64 `json:"score"`
Licensors []struct {
MalID int `json:"mal_id"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"licensors"`
R18 bool `json:"r18"`
Kids bool `json:"kids"`
Continuing bool `json:"continuing"`
} `json:"anime"`
}
func GetSeasonInfo(season string, year int) (SeasonInfo, error) {
result := SeasonInfo{}
err := ParseResults(fmt.Sprintf("%s/season/%d/%s", Endpoint, year, season), &result)
return result, err
}
func GetSeasonArchive() (SeasonArchive, error) {
result := SeasonArchive{}
err := ParseResults(fmt.Sprintf("%s/season/archive", Endpoint), &result)
return result, err
}
func GetSeasonLater() (SeasonLater, error) {
result := SeasonLater{}
err := ParseResults(fmt.Sprintf("%s/season/later", Endpoint), &result)
return result, err
}