Skip to content

Commit 0c3674f

Browse files
committed
Add GetOrganizationMember, ListOrganizationUsers
1 parent 43d8827 commit 0c3674f

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

events.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ type Tag struct {
1616

1717
//User is the user that was affected
1818
type User struct {
19-
Username *string `json:"username,omitempty"`
20-
Email *string `json:"email,omitempty"`
21-
ID *string `json:"id,omitempty"`
19+
Username *string `json:"username,omitempty"`
20+
Email *string `json:"email,omitempty"`
21+
ID *string `json:"id,omitempty"`
22+
Name *string `json:"name,omitempty"`
23+
Projects []string `json:"projects,omitempty"`
2224
}
2325

2426
// Entry is the entry for the message/stacktrace/etc...

organization.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ package sentry
22

33
import (
44
"fmt"
5+
"path"
56
"time"
67
)
78

89
const (
9-
// OrgEndpointName is set to roganizations
10-
OrgEndpointName = "organizations"
10+
MembersEndpointName = "members"
11+
OrgEndpointName = "organizations"
12+
UsersEndpointName = "users"
1113
)
1214

1315
// Quota is your quote for a project limit and max rate
@@ -37,13 +39,27 @@ func (c *Client) GetOrganization(orgslug string) (Organization, error) {
3739
return org, err
3840
}
3941

42+
// GetOrganizationMember returns the member associated with orgslug and memberID
43+
func (c *Client) GetOrganizationMember(orgslug string, memberID string) (Member, error) {
44+
var member Member
45+
err := c.do("GET", path.Join(OrgEndpointName, orgslug, MembersEndpointName, memberID), &member, nil)
46+
return member, err
47+
}
48+
4049
// GetOrganizations will return back every organization in the sentry instance
4150
func (c *Client) GetOrganizations() ([]Organization, *Link, error) {
4251
orgs := make([]Organization, 0)
4352
link, err := c.doWithPagination("GET", OrgEndpointName, &orgs, nil)
4453
return orgs, link, err
4554
}
4655

56+
// ListOrganizationUsers returns users in the organization identified by orgslug
57+
func (c *Client) ListOrganizationUsers(orgslug string) ([]User, error) {
58+
users := make([]User, 0)
59+
err := c.do("GET", path.Join(OrgEndpointName, orgslug, UsersEndpointName), &users, nil)
60+
return users, err
61+
}
62+
4763
// CreateOrganization creates a organization with a name
4864
func (c *Client) CreateOrganization(orgname string) (Organization, error) {
4965
var org Organization

0 commit comments

Comments
 (0)