OrganizationMembers lists filtered and paginated members in an organization
(ctx context.Context, organizationID uuid.UUID, req UsersRequest)
| 819 | |
| 820 | // OrganizationMembers lists filtered and paginated members in an organization |
| 821 | func (c *Client) OrganizationMembersPaginated(ctx context.Context, organizationID uuid.UUID, req UsersRequest) (PaginatedMembersResponse, error) { |
| 822 | res, err := c.Request(ctx, http.MethodGet, |
| 823 | fmt.Sprintf("/api/v2/organizations/%s/paginated-members", organizationID), |
| 824 | nil, |
| 825 | req.Pagination.asRequestOption(), |
| 826 | req.asRequestOption(), |
| 827 | ) |
| 828 | if err != nil { |
| 829 | return PaginatedMembersResponse{}, err |
| 830 | } |
| 831 | defer res.Body.Close() |
| 832 | if res.StatusCode != http.StatusOK { |
| 833 | return PaginatedMembersResponse{}, ReadBodyAsError(res) |
| 834 | } |
| 835 | var membersRes PaginatedMembersResponse |
| 836 | return membersRes, json.NewDecoder(res.Body).Decode(&membersRes) |
| 837 | } |
| 838 | |
| 839 | // UpdateUserRoles grants the userID the specified roles. |
| 840 | // Include ALL roles the user has. |