Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typescript support for moderation V2 payload in message response #1392

Merged
merged 2 commits into from
Nov 15, 2024
Merged
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
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
Loading