MCPcopy
hub / github.com/cli/cli / OrganizationTeam

Function OrganizationTeam

api/queries_org.go:52–74  ·  view source on GitHub ↗

OrganizationTeam fetch the team in an organization with the given slug

(client *Client, hostname string, org string, teamSlug string)

Source from the content-addressed store, hash-verified

50
51// OrganizationTeam fetch the team in an organization with the given slug
52func OrganizationTeam(client *Client, hostname string, org string, teamSlug string) (*OrgTeam, error) {
53 type responseData struct {
54 Organization struct {
55 Team OrgTeam `graphql:"team(slug: $teamSlug)"`
56 } `graphql:"organization(login: $owner)"`
57 }
58
59 variables := map[string]interface{}{
60 "owner": githubv4.String(org),
61 "teamSlug": githubv4.String(teamSlug),
62 }
63
64 var query responseData
65 err := client.Query(hostname, "OrganizationTeam", &query, variables)
66 if err != nil {
67 return nil, err
68 }
69 if query.Organization.Team.ID == "" {
70 return nil, fmt.Errorf("could not resolve to a Team with the slug of '%s'", teamSlug)
71 }
72
73 return &query.Organization.Team, nil
74}
75
76// OrganizationTeams fetches all the teams in an organization
77func OrganizationTeams(client *Client, repo ghrepo.Interface) ([]OrgTeam, error) {

Callers 2

linkTeamFunction · 0.92
unlinkTeamFunction · 0.92

Calls 3

QueryMethod · 0.65
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected