feat: add a paginated organization members endpoint (#16835)

Closes
[coder/internal#460](https://github.com/coder/internal/issues/460)
This commit is contained in:
brettkolodny
2025-03-10 14:42:07 -04:00
committed by GitHub
parent 191b0efb80
commit 8c0350e20c
18 changed files with 548 additions and 1 deletions
+90
View File
@@ -813,6 +813,96 @@ curl -X PUT http://coder-server:8080/api/v2/organizations/{organization}/members
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Paginated organization members
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/paginated-members \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /organizations/{organization}/paginated-members`
### Parameters
| Name | In | Type | Required | Description |
|----------------|-------|---------|----------|--------------------------------------|
| `organization` | path | string | true | Organization ID |
| `limit` | query | integer | false | Page limit, if 0 returns all members |
| `offset` | query | integer | false | Page offset |
### Example responses
> 200 Response
```json
[
{
"count": 0,
"members": [
{
"avatar_url": "string",
"created_at": "2019-08-24T14:15:22Z",
"email": "string",
"global_roles": [
{
"display_name": "string",
"name": "string",
"organization_id": "string"
}
],
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"roles": [
{
"display_name": "string",
"name": "string",
"organization_id": "string"
}
],
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
"username": "string"
}
]
}
]
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.PaginatedMembersResponse](schemas.md#codersdkpaginatedmembersresponse) |
<h3 id="paginated-organization-members-responseschema">Response Schema</h3>
Status Code **200**
| Name | Type | Required | Restrictions | Description |
|-----------------------|-------------------|----------|--------------|-------------|
| `[array item]` | array | false | | |
| `» count` | integer | false | | |
| `» members` | array | false | | |
| `»» avatar_url` | string | false | | |
| `»» created_at` | string(date-time) | false | | |
| `»» email` | string | false | | |
| `»» global_roles` | array | false | | |
| `»»» display_name` | string | false | | |
| `»»» name` | string | false | | |
| `»»» organization_id` | string | false | | |
| `»» name` | string | false | | |
| `»» organization_id` | string(uuid) | false | | |
| `»» roles` | array | false | | |
| `»» updated_at` | string(date-time) | false | | |
| `»» user_id` | string(uuid) | false | | |
| `»» username` | string | false | | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get site member roles
### Code samples
+41
View File
@@ -4189,6 +4189,47 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
| » `[any property]` | array of string | false | | |
| `organization_assign_default` | boolean | false | | Organization assign default will ensure the default org is always included for every user, regardless of their claims. This preserves legacy behavior. |
## codersdk.PaginatedMembersResponse
```json
{
"count": 0,
"members": [
{
"avatar_url": "string",
"created_at": "2019-08-24T14:15:22Z",
"email": "string",
"global_roles": [
{
"display_name": "string",
"name": "string",
"organization_id": "string"
}
],
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"roles": [
{
"display_name": "string",
"name": "string",
"organization_id": "string"
}
],
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
"username": "string"
}
]
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-----------|---------------------------------------------------------------------------------------------|----------|--------------|-------------|
| `count` | integer | false | | |
| `members` | array of [codersdk.OrganizationMemberWithUserData](#codersdkorganizationmemberwithuserdata) | false | | |
## codersdk.PatchGroupIDPSyncConfigRequest
```json