Skip to content

Commit 921296c

Browse files
authored
Merge pull request #24 from spectrogram/master
Add ability to parse 14 days of issue stats
2 parents a9ccec1 + 9eee62b commit 921296c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

issue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Status string
2727
// IssueStats is the stats of a issue
2828
type IssueStats struct {
2929
TwentyFourHour *[]Stat `json:"24h,omitempty"`
30+
FourteenDays *[]Stat `json:"14d,omitempty"`
3031
ThirtyDays *[]Stat `json:"30d,omitempty"`
3132
}
3233

issue_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ func TestIssueResource(t *testing.T) {
7272
t.Error("Should be no new results")
7373
}
7474

75+
t.Run("Get issues with statsPeriod of 14 days", func(t *testing.T) {
76+
period := "14d"
77+
issues, _, err := client.GetIssues(org, project, &period, nil, nil)
78+
if err != nil {
79+
t.Error(err)
80+
}
81+
if len(issues) <= 0 {
82+
t.Fatal("No issues found for this project")
83+
}
84+
for _, issue := range issues {
85+
if issue.Stats.FourteenDays == nil {
86+
t.Fatal("We should be able to get 14 days of stats for this issue but didn't.")
87+
}
88+
}
89+
})
90+
7591
t.Run("Get hashes for issue", func(t *testing.T) {
7692
hashes, link, err := client.GetIssueHashes(issues[0])
7793
if err != nil {

0 commit comments

Comments
 (0)