This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopic.go
66 lines (55 loc) · 1.86 KB
/
topic.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
package shikimori
import (
"context"
"time"
)
// Can be Anime, Manga structs.
type TopicLinked struct {
Anime
// Manga
}
type Topic struct {
ID int `json:"id"`
TopicTitle string `json:"topic_title"`
Body string `json:"body"`
HTMLBody string `json:"html_body"`
HTMLFooter string `json:"html_footer"`
CreatedAt time.Time `json:"created_at"`
CommentsCount int `json:"comments_count"`
Forum Forum `json:"forum"`
User User `json:"user"`
Type string `json:"type"`
LinkedID int `json:"linked_id"`
LinkedType string `json:"linked_type"`
Linked *TopicLinked `json:"linked,omitempty"`
Viewed bool `json:"viewed"`
LastCommentViewed *bool `json:"last_comment_viewed,omitempty"`
Event *string `json:"event,omitempty"`
Episode *int `json:"episode,omitempty"`
}
type TopicsUpdate struct {
ID int `json:"id"`
Linked TopicLinked `json:"linked"`
Event *string `json:"event,omitempty"`
Episode *int `json:"episode,omitempty"`
CreatedAt time.Time `json:"created_at"`
URL string `json:"url"`
}
type TopicsUpdatesParams struct {
// Must be a number between 1 and 100000.
Page int `json:"page,omitempty"`
// 30 maximum.
Limit int `json:"limit,omitempty"`
}
func (s *API) TopicsUpdates(ctx context.Context, params *TopicsUpdatesParams) (resp []TopicsUpdate, err error) {
err = s.get(ctx, &resp, "topics/updates", params)
return
}
type TopicsHotParams struct {
// 10 maximum.
Limit int `json:"limit,omitempty"`
}
func (s *API) TopicsHot(ctx context.Context, params *TopicsHotParams) (resp []Topic, err error) {
err = s.get(ctx, &resp, "topics/hot", params)
return
}