## ListMemberships `client.Groups.Memberships.List(ctx, params) (*MembersPage[GroupMembership], error)` **post** `/gitpod.v1.GroupService/ListMemberships` Lists all memberships of a group. Use this method to: - View all members of a group - Audit group membership ### Examples - List group members: Shows all members of a specific group. ```yaml groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" pagination: pageSize: 20 ``` ### Authorization All organization members can view group membership (transparency model). ### Parameters - `params GroupMembershipListParams` - `Token param.Field[string]` Query param - `PageSize param.Field[int64]` Query param - `Filter param.Field[GroupMembershipListParamsFilter]` Body param: filter contains options for filtering the list of memberships. - `Search string` search performs case-insensitive search across member name, email, ID, and service account name and description - `GroupID param.Field[string]` Body param - `Pagination param.Field[GroupMembershipListParamsPagination]` Body param: pagination contains the pagination options for listing memberships - `Token string` Token for the next set of results that was returned as next_token of a PaginationResponse - `PageSize int64` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `type GroupMembership struct{…}` GroupMembership represents a subject's membership in a group - `ID string` Unique identifier for the group membership - `AvatarURL string` Subject's avatar URL - `GroupID string` Group identifier - `Name string` Subject's display name - `Subject Subject` Subject (user, runner, environment, service account, etc.) - `ID string` id is the UUID of the subject - `Principal Principal` Principal is the principal of the subject - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.Groups.Memberships.List(context.TODO(), gitpod.GroupMembershipListParams{ GroupID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Pagination: gitpod.F(gitpod.GroupMembershipListParamsPagination{ PageSize: gitpod.F(int64(20)), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "members": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "avatarUrl": "avatarUrl", "groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "name": "name", "subject": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" } } ], "pagination": { "nextToken": "nextToken" } } ```