-
Notifications
You must be signed in to change notification settings - Fork 0
/
card-cycles.go
40 lines (32 loc) · 958 Bytes
/
card-cycles.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
package nrdb
import (
"fmt"
"time"
)
type CardCycle struct {
Document[CardCycleAttributes, CardCycleRelationships]
}
type CardCycleAttributes struct {
Name string `json:"name"`
DateRelease string `json:"date_release"`
CardSetIDs []string `json:"card_set_ids"`
FirstPrintingID string `json:"first_printing_id"`
Position int `json:"position"`
ReleasedBy string `json:"released_by"`
UpdatedAt time.Time `json:"updated_at"`
}
type CardCycleRelationships struct {
CardSets *Relationship `json:"card_sets"`
Cards *Relationship `json:"cards"`
Printings *Relationship `json:"printings"`
}
func (doc CardCycle) String() string {
return fmt.Sprintf("%s (%s)", doc.Attributes.Name, doc.ID)
}
func (cl client) CardCycles() ([]*CardCycle, error) {
var res Response[[]*CardCycle]
if err := cl.nrdbReq("card_cycles", &res, nil); err != nil {
return nil, err
}
return res.Data, nil
}