directory

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GHAllTeam containing all users in GitHub
	GHAllTeam = "all"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	GetMatches(string) Matches
	GetMembers() []Member
	GetTeams() []Team
	GetTeamMembers(string) []string
	GetActiveMemberTeams() []string
	IsMember(string) (string, bool)
	IsTeam(string) (string, bool)
	Whoami() (string, error)
}

Backend allows us to have an easy way to get information from GitHub for members and teams

type ByMembers

type ByMembers func(p1, p2 *Member) bool

ByMembers is the type of a "less" function that defines the ordering of its Member arguments.

func (ByMembers) Sort

func (by ByMembers) Sort(members []Member)

Sort is a method on the function type, By, that sorts the argument slice according to the function.

type ByTeams

type ByTeams func(p1, p2 *Team) bool

ByTeams is the type of a "less" function that defines the ordering of its Team arguments.

func (ByTeams) Sort

func (by ByTeams) Sort(teams []Team)

Sort is a method on the function type, By, that sorts the argument slice according to the function.

type GH

type GH struct {
	*github.Client

	UsersService UsersService
	Info
}

GH hosts a client for accessing GH as well as cached Member and Team lists

func NewGitHub

func NewGitHub(org string, updateCache bool) (*GH, error)

NewGitHub returns an initialized GitHub client to the caller and stored GH members and teams

func (*GH) GetActiveMemberTeams added in v0.2.0

func (g *GH) GetActiveMemberTeams() []string

GetActiveMemberTeams returns a slice of team names

func (*GH) GetMatches

func (g *GH) GetMatches(lookup string) Matches

GetMatches will search for a given value as part of a username or team name and return a set of available options for the user.

func (*GH) GetMembers

func (g *GH) GetMembers() []Member

GetMembers returns the list of members

func (*GH) GetTeamMembers

func (g *GH) GetTeamMembers(name string) []string

GetTeamMembers returns a list of members for the provided team name

func (*GH) GetTeams

func (g *GH) GetTeams() []Team

GetTeams returns the list of teams

func (*GH) IsMember

func (g *GH) IsMember(lookup string) (string, bool)

IsMember will check an organization for a specific user

func (*GH) IsTeam

func (g *GH) IsTeam(lookup string) (string, bool)

IsTeam will check an organization for a specific team

func (*GH) Whoami

func (g *GH) Whoami() (string, error)

Whoami returns the login name of the currently authenitcated user

type Info

type Info struct {
	Org               string
	ActiveMemberTeams []string
	Members           []Member
	Teams             []Team
}

Info is the basic information required by all directory implementations

type Matches

type Matches struct {
	Members []Member
	Teams   []Team
}

Matches allows us to return both usernames and team names as single type

type Member

type Member struct {
	Login string
	Name  string
}

Member contains basic info about a member

type Team

type Team struct {
	Name    string
	Members []string
}

Team contains basic info about Team or group

type UsersService

type UsersService interface {
	Get(context.Context, string) (*github.User, *github.Response, error)
}

UsersService holds methods used in the GitHub UsersService for easier testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL