OrganizationTeam fetch the team in an organization with the given slug
(client *Client, hostname string, org string, teamSlug string)
| 50 | |
| 51 | // OrganizationTeam fetch the team in an organization with the given slug |
| 52 | func 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 |
| 77 | func OrganizationTeams(client *Client, repo ghrepo.Interface) ([]OrgTeam, error) { |
no test coverage detected