ListMembers lists the members for an organization. If the authenticated user is an owner of the organization, this will return both concealed and public members; otherwise, it will only return public members. GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-orga
(ctx context.Context, org string, opts *ListMembersOptions)
| 78 | //meta:operation GET /orgs/{org}/members |
| 79 | //meta:operation GET /orgs/{org}/public_members |
| 80 | func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts *ListMembersOptions) ([]*User, *Response, error) { |
| 81 | var u string |
| 82 | if opts != nil && opts.PublicOnly { |
| 83 | u = fmt.Sprintf("orgs/%v/public_members", org) |
| 84 | } else { |
| 85 | u = fmt.Sprintf("orgs/%v/members", org) |
| 86 | } |
| 87 | u, err := addOptions(u, opts) |
| 88 | if err != nil { |
| 89 | return nil, nil, err |
| 90 | } |
| 91 | |
| 92 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 93 | if err != nil { |
| 94 | return nil, nil, err |
| 95 | } |
| 96 | |
| 97 | var members []*User |
| 98 | resp, err := s.client.Do(req, &members) |
| 99 | if err != nil { |
| 100 | return nil, resp, err |
| 101 | } |
| 102 | |
| 103 | return members, resp, nil |
| 104 | } |
| 105 | |
| 106 | // IsMember checks if a user is a member of an organization. |
| 107 | // |