aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/orgs_members.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/orgs_members.go')
-rw-r--r--vendor/github.com/google/go-github/github/orgs_members.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/github.com/google/go-github/github/orgs_members.go b/vendor/github.com/google/go-github/github/orgs_members.go
index d0ea6a9..98e138e 100644
--- a/vendor/github.com/google/go-github/github/orgs_members.go
+++ b/vendor/github.com/google/go-github/github/orgs_members.go
@@ -297,3 +297,74 @@ func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, or
}
return pendingInvitations, resp, nil
}
+
+// CreateOrgInvitationOptions specifies the parameters to the OrganizationService.Invite
+// method.
+type CreateOrgInvitationOptions struct {
+ // GitHub user ID for the person you are inviting. Not required if you provide Email.
+ InviteeID *int64 `json:"invitee_id,omitempty"`
+ // Email address of the person you are inviting, which can be an existing GitHub user.
+ // Not required if you provide InviteeID
+ Email *string `json:"email,omitempty"`
+ // Specify role for new member. Can be one of:
+ // * admin - Organization owners with full administrative rights to the
+ // organization and complete access to all repositories and teams.
+ // * direct_member - Non-owner organization members with ability to see
+ // other members and join teams by invitation.
+ // * billing_manager - Non-owner organization members with ability to
+ // manage the billing settings of your organization.
+ // Default is "direct_member".
+ Role *string `json:"role"`
+ TeamID []int64 `json:"team_ids"`
+}
+
+// CreateOrgInvitation invites people to an organization by using their GitHub user ID or their email address.
+// In order to create invitations in an organization,
+// the authenticated user must be an organization owner.
+//
+// https://developer.github.com/v3/orgs/members/#create-organization-invitation
+func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opt *CreateOrgInvitationOptions) (*Invitation, *Response, error) {
+ u := fmt.Sprintf("orgs/%v/invitations", org)
+
+ req, err := s.client.NewRequest("POST", u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview)
+
+ var invitation *Invitation
+ resp, err := s.client.Do(ctx, req, &invitation)
+ if err != nil {
+ return nil, resp, err
+ }
+ return invitation, resp, nil
+}
+
+// ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization,
+// the authenticated user must be an organization owner.
+//
+// GitHub API docs: https://developer.github.com/v3/orgs/members/#list-organization-invitation-teams
+func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opt *ListOptions) ([]*Team, *Response, error) {
+ u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID)
+ u, err := addOptions(u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeOrganizationInvitationPreview)
+
+ var orgInvitationTeams []*Team
+ resp, err := s.client.Do(ctx, req, &orgInvitationTeams)
+ if err != nil {
+ return nil, resp, err
+ }
+ return orgInvitationTeams, resp, nil
+}