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 pathrates.go
63 lines (48 loc) · 1.88 KB
/
rates.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
package shikimori
import (
"context"
"strconv"
"time"
)
type UserRateTargetType string
const (
UserRateTargetAnime UserRateTargetType = "Anime"
UserRateTargetManga UserRateTargetType = "Manga"
)
type UserRate struct {
ID int `json:"id"`
UserID *int `json:"user_id,omitempty"`
TargetID *int `json:"target_id,omitempty"`
TargetType *UserRateTargetType `json:"target_type,omitempty"`
Score int `json:"score"`
Status UserRateStatus `json:"status"`
Rewatches int `json:"rewatches"`
Episodes *int `json:"episodes,omitempty"`
Volumes *int `json:"volumes,omitempty"`
Chapters *int `json:"chapters,omitempty"`
Text *string `json:"text,omitempty"`
TextHTML string `json:"text_html"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type UserRateParams struct{}
func (s *API) UserRate(ctx context.Context, id int, params *UserRateParams) (resp UserRate, err error) {
err = s.get(ctx, &resp, "v2/user_rates/"+strconv.Itoa(id), params)
return
}
type UserRatesParams struct {
UserID int `json:"user_id,omitempty"`
TargetID int `json:"target_id,omitempty"`
// Must be one of: Anime, Manga.
TargetType UserRateTargetType `json:"target_type,omitempty"`
// Must be one of: planned, watching, rewatching, completed, on_hold, dropped
Status UserRateStatus `json:"status,omitempty"`
// Must be a number between 1 and 100000. This field is ignored when user_id is set
Page int `json:"page,omitempty"`
// 1000 maximum. This field is ignored when user_id is set
Limit int `json:"limit,omitempty"`
}
func (s *API) UserRates(ctx context.Context, params *UserRatesParams) (resp []UserRate, err error) {
err = s.get(ctx, &resp, "v2/user_rates", params)
return
}