Skip to content

Commit

Permalink
feat: sort option on getReplies endpoint (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Apr 29, 2024
1 parent 0d5f87f commit 9ad65d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
QueryChannelAPIResponse,
PollVoteData,
SendMessageOptions,
AscDesc,
} from './types';
import { Role } from './permissions';

Expand Down Expand Up @@ -823,10 +824,13 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
async getReplies(
parent_id: string,
options: MessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string },
sort?: { created_at: AscDesc }[],
) {
const normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
const data = await this.getClient().get<GetRepliesAPIResponse<StreamChatGenerics>>(
this.getClient().baseURL + `/messages/${parent_id}/replies`,
{
sort: normalizedSort,
...options,
},
);
Expand Down

0 comments on commit 9ad65d3

Please sign in to comment.