-
Notifications
You must be signed in to change notification settings - Fork 0
/
nagato.go
43 lines (34 loc) · 850 Bytes
/
nagato.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
package nagato
import (
"net/http"
"github.com/rl404/nagato/internal/limiter"
"github.com/rl404/nagato/internal/playground"
"github.com/rl404/nagato/mal"
)
// Client is nagato client.
type Client struct {
mal *mal.Client
validator *playground.Validator
}
// New to create new default nagato client.
func New(clientID string) *Client {
c := Client{
mal: mal.NewPublic(clientID),
validator: playground.New(true),
}
c.initValidator()
return &c
}
// SetMalClient to override mal client.
func (c *Client) SetMalClient(mal *mal.Client) {
c.mal = mal
}
// SetHttpClient to override http client used
// by mal client.
func (c *Client) SetHttpClient(http *http.Client) {
c.mal.Http = http
}
// SetLimiter to override limiter in mal client.
func (c *Client) SetLimiter(limiter limiter.Limiter) {
c.mal.Limiter = limiter
}