Skip to content

Commit

Permalink
Add thread member pagination and details changes (discord#5834)
Browse files Browse the repository at this point in the history
* Add thread member pagination and details changes

* broken links

* add note to table about member field

* formatting

* oops
  • Loading branch information
shaydewael committed May 14, 2024
1 parent 44ac494 commit bc766fe
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
15 changes: 15 additions & 0 deletions docs/Change_Log.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change Log

## Thread Member Details and Pagination

> danger
> This entry includes breaking changes
#### Jan 09, 2023

A new `member` field was added to the [thread member object](#DOCS_RESOURCES_CHANNEL/thread-member-object). `member` is a [guild member object](#DOCS_RESOURCES_GUILD/guild-member-object) that will be included within returned thread member objects when the new `with_member` field is set to `true` in the [List Thread Members](#DOCS_RESOURCES_CHANNEL/list-thread-members) (`GET /channels/<channel_id>/thread-members`) and [Get Thread Member](#DOCS_RESOURCES_CHANNEL/get-thread-member) (`GET /channels/<channel_id>/thread-members/<user_id>`) endpoints.

Setting `with_member` to `true` will also enable pagination for the [List Thread Members](#DOCS_RESOURCES_CHANNEL/list-thread-members) endpoint. When the results are paginated, you can use the new `after` and `limit` fields to fetch additional thread members and limit the number of thread members returned. By default, `limit` is 100.

#### Upcoming Changes

Starting in API v11, [List Thread Members](#DOCS_RESOURCES_CHANNEL/list-thread-members) (`GET /channels/<channel_id>/thread-members`) will *always* return paginated results, regardless of whether `with_member` is passed or not.

## Add Default Layout setting for Forum channels

#### Dec 13, 2022
Expand Down
40 changes: 32 additions & 8 deletions docs/resources/Channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,21 @@ The thread metadata object contains a number of thread-specific channel fields t

### Thread Member Object

A thread member is used to indicate whether a user has joined a thread or not.
A thread member object contains information about a user that has joined a thread.

###### Thread Member Structure

| Field | Type | Description |
| -------------- | ----------------- | --------------------------------------------------------------- |
| id? \* | snowflake | the id of the thread |
| user_id? \* | snowflake | the id of the user |
| join_timestamp | ISO8601 timestamp | the time the current user last joined the thread |
| flags | integer | any user-thread settings, currently only used for notifications |
| Field | Type | Description |
| --------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
| id? \* | snowflake | ID of the thread |
| user_id? \* | snowflake | ID of the user |
| join_timestamp | ISO8601 timestamp | Time the user last joined the thread |
| flags | integer | Any user-thread settings, currently only used for notifications |
| member? \* \*\* | [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object | Additional information about the user |

**\* These fields are omitted on the member sent within each thread in the [GUILD_CREATE](#DOCS_TOPICS_GATEWAY_EVENTS/guild-create) event**
\* These fields are omitted on the member sent within each thread in the [GUILD_CREATE](#DOCS_TOPICS_GATEWAY_EVENTS/guild-create) event.

\*\* The `member` field is only present when `with_member` is set to `true` when calling [List Thread Members](#DOCS_RESOURCES_CHANNEL/list-thread-members) or [Get Thread Member](#DOCS_RESOURCES_CHANNEL/get-thread-member).

### Default Reaction Object

Expand Down Expand Up @@ -1297,13 +1300,34 @@ Removes another member from a thread. Requires the `MANAGE_THREADS` permission,

Returns a [thread member](#DOCS_RESOURCES_CHANNEL/thread-member-object) object for the specified user if they are a member of the thread, returns a 404 response otherwise.

When `with_member` is set to `true`, the thread member object will include a `member` field containing a [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object.

###### Query String Params

| Field | Type | Description |
| ------------ | --------- | ----------------------------------------------------------------------------------------------------------- |
| with_member? | boolean | Whether to include a [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object for the thread member |

## List Thread Members % GET /channels/{channel.id#DOCS_RESOURCES_CHANNEL/channel-object}/thread-members

> warn
> Starting in API v11, this endpoint will always return paginated results. Paginated results can be enabled before API v11 by setting `with_member` to `true`. Read [the changelog](#DOCS_CHANGE_LOG/thread-member-details-and-pagination) for details.
Returns array of [thread members](#DOCS_RESOURCES_CHANNEL/thread-member-object) objects that are members of the thread.

When `with_member` is set to `true`, the results will be paginated and each thread member object will include a `member` field containing a [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object.

> warn
> This endpoint is restricted according to whether the `GUILD_MEMBERS` [Privileged Intent](#DOCS_TOPICS_GATEWAY/privileged-intents) is enabled for your application.
###### Query String Params

| Field | Type | Description |
| ------------ | --------- | ------------------------------------------------------------------------------------------------------------ |
| with_member? | boolean | Whether to include a [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object for each thread member |
| after? | snowflake | Get thread members after this user ID |
| limit? | integer | Max number of thread members to return (1-100). Defaults to 100. |

## List Public Archived Threads % GET /channels/{channel.id#DOCS_RESOURCES_CHANNEL/channel-object}/threads/archived/public

Returns archived threads in the channel that are public. When called on a `GUILD_TEXT` channel, returns threads of [type](#DOCS_RESOURCES_CHANNEL/channel-object-channel-types) `PUBLIC_THREAD`. When called on a `GUILD_ANNOUNCEMENT` channel returns threads of [type](#DOCS_RESOURCES_CHANNEL/channel-object-channel-types) `ANNOUNCEMENT_THREAD`. Threads are ordered by `archive_timestamp`, in descending order. Requires the `READ_MESSAGE_HISTORY` permission.
Expand Down

0 comments on commit bc766fe

Please sign in to comment.