Skip to content

Commit 953bcb9

Browse files
authored
Merge pull request #26 from spectrogram/master
Fix type definition of Issue.StatusDetails, other misc improvements
2 parents 2fa4d83 + 2d90e22 commit 953bcb9

File tree

6 files changed

+50
-38
lines changed

6 files changed

+50
-38
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ func (c *Client) newRequest(method, endpoint string, in interface{}) (*http.Requ
125125
bodyreader = newbodyreader
126126
}
127127

128-
finalEndpoint := c.Endpoint+endpoint
129-
if !strings.HasSuffix(endpoint, "/") {
128+
finalEndpoint := c.Endpoint + endpoint
129+
if !strings.HasSuffix(endpoint, "/") {
130130
finalEndpoint = finalEndpoint + "/"
131131
}
132132

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.13
44

55
require (
66
github.com/certifi/gocertifi v0.0.0-20200104152315-a6d78f326758 // indirect
7-
github.com/getsentry/raven-go v0.2.0
7+
github.com/getsentry/raven-go v0.2.0 // indirect
88
github.com/getsentry/sentry-go v0.4.0
99
github.com/pkg/errors v0.9.1 // indirect
1010
)

issue.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,35 @@ type Activity struct {
8282

8383
// Issue returns a issue found in sentry
8484
type Issue struct {
85-
Annotations *[]string `json:"annotations,omitempty"`
86-
AssignedTo *InternalUser `json:"assignedTo,omitempty"`
87-
Activity *[]Activity `json:"activity,omitempty"`
88-
Count *string `json:"count,omitempty"`
89-
Culprit *string `json:"culprit,omitempty"`
90-
FirstSeen *time.Time `json:"firstSeen,omitempty"`
91-
HasSeen *bool `json:"hasSeen,omitempty"`
92-
ID *string `json:"id,omitempty"`
93-
IsBookmarked *bool `json:"isBookmarked,omitempty"`
94-
IsPublic *bool `json:"isPublic,omitempty"`
95-
IsSubscribed *bool `json:"isSubscribed,omitempty"`
96-
LastSeen *time.Time `json:"lastSeen,omitempty"`
97-
Level *string `json:"level,omitempty"`
98-
Logger *string `json:"logger,omitempty"`
99-
Metadata *map[string]string `json:"metadata,omitempty"`
100-
NumComments *int `json:"numComments,omitempty"`
101-
Permalink *string `json:"permalink,omitempty"`
102-
Project *Project `json:"project,omitempty"`
103-
ShareID *string `json:"shareId,omitempty"`
104-
ShortID *string `json:"shortId,omitempty"`
105-
Stats *IssueStats `json:"stats,omitempty"`
106-
Status *Status `json:"status,omitempty"`
107-
StatusDetails *map[string]string `json:"statusDetails,omitempty"`
108-
SubscriptionDetails *map[string]string `json:"subscriptionDetails,omitempty"`
109-
Tags *[]IssueTag `json:"tags,omitempty"`
110-
Title *string `json:"title,omitempty"`
111-
Type *string `json:"type,omitempty"`
112-
UserCount *int `json:"userCount,omitempty"`
113-
UserReportCount *int `json:"userReportCount,omitempty"`
85+
Annotations *[]string `json:"annotations,omitempty"`
86+
AssignedTo *InternalUser `json:"assignedTo,omitempty"`
87+
Activity *[]Activity `json:"activity,omitempty"`
88+
Count *string `json:"count,omitempty"`
89+
Culprit *string `json:"culprit,omitempty"`
90+
FirstSeen *time.Time `json:"firstSeen,omitempty"`
91+
HasSeen *bool `json:"hasSeen,omitempty"`
92+
ID *string `json:"id,omitempty"`
93+
IsBookmarked *bool `json:"isBookmarked,omitempty"`
94+
IsPublic *bool `json:"isPublic,omitempty"`
95+
IsSubscribed *bool `json:"isSubscribed,omitempty"`
96+
LastSeen *time.Time `json:"lastSeen,omitempty"`
97+
Level *string `json:"level,omitempty"`
98+
Logger *string `json:"logger,omitempty"`
99+
Metadata *map[string]string `json:"metadata,omitempty"`
100+
NumComments *int `json:"numComments,omitempty"`
101+
Permalink *string `json:"permalink,omitempty"`
102+
Project *Project `json:"project,omitempty"`
103+
ShareID *string `json:"shareId,omitempty"`
104+
ShortID *string `json:"shortId,omitempty"`
105+
Stats *IssueStats `json:"stats,omitempty"`
106+
Status *Status `json:"status,omitempty"`
107+
StatusDetails *map[string]interface{} `json:"statusDetails,omitempty"`
108+
SubscriptionDetails *map[string]string `json:"subscriptionDetails,omitempty"`
109+
Tags *[]IssueTag `json:"tags,omitempty"`
110+
Title *string `json:"title,omitempty"`
111+
Type *string `json:"type,omitempty"`
112+
UserCount *int `json:"userCount,omitempty"`
113+
UserReportCount *int `json:"userReportCount,omitempty"`
114114
}
115115

116116
type issueQuery struct {

issue_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestIssueResource(t *testing.T) {
8383
}
8484
for _, issue := range issues {
8585
if issue.Stats.FourteenDays == nil {
86-
t.Fatal("We should be able to get 14 days of stats for this issue but didn't.")
86+
t.Fatal("We should be able to get 14 days of stats for this issue but didn't")
8787
}
8888
}
8989
})
@@ -127,6 +127,9 @@ func TestIssueResource(t *testing.T) {
127127

128128
resolved := Resolved
129129
firstIssue.Status = &resolved
130+
firstIssue.StatusDetails = &map[string]interface{}{
131+
"inNextRelease": true,
132+
}
130133

131134
if err := client.UpdateIssue(firstIssue); err != nil {
132135
t.Error(err)
@@ -136,6 +139,15 @@ func TestIssueResource(t *testing.T) {
136139
t.Error("Status did not get updated")
137140
}
138141

142+
details, ok := (*firstIssue.StatusDetails)["inNextRelease"].(bool)
143+
if !ok {
144+
t.Error("Status details did not get updated")
145+
}
146+
147+
if !details {
148+
t.Error("Status details did not get updated")
149+
}
150+
139151
t.Run("Delete the first issue in this project", func(t *testing.T) {
140152
err := client.DeleteIssue(firstIssue)
141153
if err != nil {

makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ devenv:
1919
docker run -d --name sentry-worker-1 -e SENTRY_SECRET_KEY='${STUPIDSECRET}' --link sentry-postgres:postgres --link sentry-redis:redis sentry:latest run worker
2020

2121
devclean:
22-
docker kill $$(docker ps -q)
23-
docker rm $$(docker ps -a -q)
22+
docker kill $$(docker ps -q -a --no-trunc --filter name=^sentry)
23+
docker rm $$(docker ps -q -a --no-trunc --filter name=^sentry)

stat.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ func (o *statRequest) ToQueryString() string {
2727
query.Add("stat", string(o.Stat))
2828
query.Add("since", strconv.FormatInt(o.Since, 10))
2929
query.Add("until", strconv.FormatInt(o.Until, 10))
30-
30+
3131
if o.Resolution != nil {
32-
query.Add("resolution", string(*o.Resolution))
32+
query.Add("resolution", string(*o.Resolution))
3333
}
34-
34+
3535
return query.Encode()
3636
}
3737

0 commit comments

Comments
 (0)