-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
card_sets.go
35 lines (29 loc) · 817 Bytes
/
card_sets.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
package yugioh
import "net/http"
// CardSetsService handles communication with the card sets related
// methods of the Yu-Gi-Oh! API by YGOPRODeck.
type CardSetsService struct {
client *Client
}
// CardSet ...
type CardSet struct {
Name string `json:"set_name"`
Code string `json:"set_code"`
CardCounts int `json:"num_of_cards"`
ReleasedDate string `json:"tcg_date"`
}
// List all card sets name.
// This method can NOT use options.
func (s *CardSetsService) List() ([]CardSet, *http.Response, error) {
u := defaultBaseURL + "cardsets.php"
req, err := s.client.NewRequest(http.MethodGet, u, nil)
if err != nil {
return nil, nil, err
}
cardSets := new([]CardSet)
resp, err := s.client.Do(req, cardSets)
if err != nil {
return nil, resp, err
}
return *cardSets, resp, err
}