Documentation ¶
Index ¶
- Constants
- type AppTokenSource
- type KeyProvider
- type Opt
- type OrgTokenSource
- type TeamReadWriter
- func (g *TeamReadWriter) Descendants(ctx context.Context, groupID string) ([]*groupsync.User, error)
- func (g *TeamReadWriter) GetGroup(ctx context.Context, groupID string) (*groupsync.Group, error)
- func (g *TeamReadWriter) GetMembers(ctx context.Context, groupID string) ([]groupsync.Member, error)
- func (g *TeamReadWriter) GetUser(ctx context.Context, userID string) (*groupsync.User, error)
- func (g *TeamReadWriter) SetMembers(ctx context.Context, groupID string, members []groupsync.Member) error
Constants ¶
const IDSep = ":"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppTokenSource ¶
type AppTokenSource struct {
// contains filtered or unexported fields
}
func NewAppTokenSource ¶
func NewAppTokenSource(keyProvider KeyProvider, appID string, appOpts ...githubauth.Option) *AppTokenSource
func (*AppTokenSource) TokenForOrg ¶
type KeyProvider ¶
KeyProvider provides a private key.
type Opt ¶
type Opt func(writer *TeamReadWriter)
func WithoutSubTeamsAsMembers ¶
func WithoutSubTeamsAsMembers() Opt
WithoutSubTeamsAsMembers toggles off treating subteams as members of their parent team. When this option is used TeamReadWriter.GetMembers will only return user members of the team. Similarly, TeamReadWriter.SetMembers will only consider user members when setting members.
type OrgTokenSource ¶
type TeamReadWriter ¶
type TeamReadWriter struct {
// contains filtered or unexported fields
}
TeamReadWriter adheres to the groupsync.GroupReadWriter interface and provides mechanisms for manipulating GitHub Teams.
func NewTeamReadWriter ¶
func NewTeamReadWriter(orgTokenSource OrgTokenSource, client *github.Client, opts ...Opt) *TeamReadWriter
NewTeamReadWriter creates a new TeamReadWriter. By default, TeamReadWriter considers subteams as members of their parent team and will treat them as such when executing calls to TeamReadWriter.GetMembers and TeamReadWriter.SetMembers. This behavior can be disabled by supply the WithoutSubTeamsAsMembers option, in which case only users will be considered as members of a team.
func (*TeamReadWriter) Descendants ¶
func (g *TeamReadWriter) Descendants(ctx context.Context, groupID string) ([]*groupsync.User, error)
Descendants retrieve all users (children, recursively) of the GitHub team with the given ID. The ID must be of the form 'orgID:teamID'.
func (*TeamReadWriter) GetGroup ¶
GetGroup retrieves the GitHub team with the given ID. The ID must be of the form 'orgID:teamID'.
func (*TeamReadWriter) GetMembers ¶
func (g *TeamReadWriter) GetMembers(ctx context.Context, groupID string) ([]groupsync.Member, error)
GetMembers retrieves the direct members (children) of the GitHub team with given ID. The ID must be of the form 'orgID:teamID'.
func (*TeamReadWriter) GetUser ¶
GetUser retrieves the GitHub user with the given ID. The ID is the GitHub user's login.
func (*TeamReadWriter) SetMembers ¶
func (g *TeamReadWriter) SetMembers(ctx context.Context, groupID string, members []groupsync.Member) error
SetMembers replaces the members of the GitHub team with the given ID with the given members. The ID must be of the form 'orgID:teamID'. Any members of the GitHub team not found in the given members list will be removed. Likewise, any members of the given list that are not currently members of the team will be added.