Skip to content

Commit

Permalink
feat: add typescript support for moderation V2 payload in message res…
Browse files Browse the repository at this point in the history
…ponse (#1392)
  • Loading branch information
MartinCupela authored Nov 15, 2024
1 parent 0a68e25 commit 79fa5ce
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ export type MessageResponseBase<
latest_reactions?: ReactionResponse<StreamChatGenerics>[];
mentioned_users?: UserResponse<StreamChatGenerics>[];
message_text_updated_at?: string;
moderation_details?: ModerationDetailsResponse;
moderation?: ModerationResponse; // present only with Moderation v2
moderation_details?: ModerationDetailsResponse; // present only with Moderation v1
own_reactions?: ReactionResponse<StreamChatGenerics>[] | null;
pin_expires?: string | null;
pinned_at?: string | null;
Expand Down Expand Up @@ -713,6 +714,18 @@ export type ModerationHarmResponse = {
phrase_list_ids: number[];
};

export type ModerationAction = 'bounce' | 'flag' | 'remove' | 'shadow';

export type ModerationResponse = {
action: ModerationAction;
original_text: string;
blocklist_matched?: string;
image_harms?: string[];
platform_circumvented?: boolean;
semantic_filter_matched?: string;
text_harms?: string[];
};

export type MuteResponse<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
user: UserResponse<StreamChatGenerics>;
created_at?: string;
Expand Down

0 comments on commit 79fa5ce

Please sign in to comment.