Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/web-api/src/types/request/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@ interface Searchable extends OptionalTeamAssignable, SortDir {
sort?: 'score' | 'timestamp';
}

interface SearchMessagesCursorPagination {
/**
* @description Paginate through collections of data by setting the `cursor` parameter to `*` for the first "page"
* or a `next_cursor` attribute returned by a previous request's `response_metadata`.
* Use the `count` parameter to set the number of items to return per page rather than `limit`.
Comment on lines +17 to +19
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧮 praise: Thank you for including this.

* @see {@link https://docs.slack.dev/apis/web-api/pagination pagination} for more detail.
*/
cursor?: string;
}

// https://docs.slack.dev/reference/methods/search.all
export interface SearchAllArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable {}
// https://docs.slack.dev/reference/methods/search.files
export interface SearchFilesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable {}
// https://docs.slack.dev/reference/methods/search.messages
export interface SearchMessagesArguments extends TokenOverridable, TraditionalPagingEnabled, Searchable {}
export interface SearchMessagesArguments
extends TokenOverridable,
TraditionalPagingEnabled,
Searchable,
SearchMessagesCursorPagination {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️‍🗨️ suggestion(non-blocking): I don't believe a similar cursor is used elsewhere? Might be nice to inline this IMO but no blocker!

Copy link
Copy Markdown
Contributor Author

@vegeris vegeris Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how Biome wants it to look 😛

Yeah, I think an API-specific interface makes sense here. The same count param from the TraditionalPagingEnabled interface is reused for cursor pagination

7 changes: 7 additions & 0 deletions packages/web-api/test/types/methods/search.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ expectAssignable<Parameters<typeof web.search.messages>>([
query: '1234', // must specify query
},
]);
expectAssignable<Parameters<typeof web.search.messages>>([
{
query: '1234',
cursor: '*', // optional: enable cursor pagination
count: 30, // optional: the number of results to return per page
},
]);