forked from bgentry/heroku-go
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathorganization_member.go
69 lines (58 loc) · 2.33 KB
/
organization_member.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// WARNING: This code is auto-generated from the Heroku Platform API JSON Schema
// by a Ruby script (gen/gen.rb). Changes should be made to the generation
// script rather than the generated files.
package heroku
import (
"time"
)
// An organization member is an individual with access to an organization.
type OrganizationMember struct {
// when organization-member was created
CreatedAt time.Time `json:"created_at"`
// email address of the organization member
Email string `json:"email"`
// role in the organization
Role string `json:"role"`
// when organization-member was updated
UpdatedAt time.Time `json:"updated_at"`
}
// Create a new organization member, or update their role.
//
// organizationIdentity is the unique identifier of the OrganizationMember's
// Organization. email is the email address of the organization member. role is
// the role in the organization.
func (c *Client) OrganizationMemberCreateOrUpdate(organizationIdentity string, email string, role string) (*OrganizationMember, error) {
params := struct {
Email string `json:"email"`
Role string `json:"role"`
}{
Email: email,
Role: role,
}
var organizationMemberRes OrganizationMember
return &organizationMemberRes, c.Post(&organizationMemberRes, "/organizations/"+organizationIdentity+"/members", params)
}
// Remove a member from the organization.
//
// organizationIdentity is the unique identifier of the OrganizationMember's
// Organization. organizationMemberIdentity is the unique identifier of the
// OrganizationMember.
func (c *Client) OrganizationMemberDelete(organizationIdentity string, organizationMemberIdentity string) error {
return c.Delete("/organizations/" + organizationIdentity + "/members/" + organizationIdentity)
}
// List members of the organization.
//
// organizationIdentity is the unique identifier of the OrganizationMember's
// Organization. lr is an optional ListRange that sets the Range options for the
// paginated list of results.
func (c *Client) OrganizationMemberList(organizationIdentity string, lr *ListRange) ([]OrganizationMember, error) {
req, err := c.NewRequest("GET", "/organizations/"+organizationIdentity+"/members", nil)
if err != nil {
return nil, err
}
if lr != nil {
lr.SetHeader(req)
}
var organizationMembersRes []OrganizationMember
return organizationMembersRes, c.DoReq(req, &organizationMembersRes)
}