-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
card_set_info.go
48 lines (40 loc) · 1012 Bytes
/
card_set_info.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
package yugioh
import "net/http"
// CardSetInfoService ...
type CardSetInfoService struct {
client *Client
}
// CardSetInfo ...
type CardSetInfo struct {
ID int `json:"id"`
Name string `json:"name"`
Price float32 `json:"set_price,string"`
SetName string `json:"set_name"`
Code string `json:"set_code"`
Rarity string `json:"set_rarity"`
}
// CardSetInfoOneOptions ...
type CardSetInfoOneOptions struct {
Code string `url:"setcode" validate:"required"`
}
// One ...
func (s *CardSetInfoService) One(opt *CardSetInfoOneOptions) (*CardSetInfo, *http.Response, error) {
err := Validate(opt)
if err != nil {
return nil, nil, err
}
u, err := addOptions("cardsetsinfo.php", opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(http.MethodGet, u, nil)
if err != nil {
return nil, nil, err
}
cardSetInfo := new(CardSetInfo)
resp, err := s.client.Do(req, cardSetInfo)
if err != nil {
return nil, resp, err
}
return cardSetInfo, resp, err
}