From a86a02b634b8608a7a76f4fa36592c3c9666da3e Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 13:18:41 +0200 Subject: [PATCH 01/19] add appeal endpoint --- src/moderation.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index 2db800d50..289515327 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -180,6 +180,30 @@ export class Moderation { ); } + /** + * Appeal against the moderation action + * @param {string} text + * @param {string} entityID + * @param {string} entityType + * @param {Array} attachments + */ + async appeal( + text: string, + entityID: string, + entityType: string, + attachments: string[], + ) { + return await this.client.post( + this.client.baseURL + '/api/v2/moderation/appeal', + { + text: text, + entityID: entityID, + entityType: entityType, + attachments: attachments, + }, + ); + } + /** * Upsert moderation config * @param {Object} config Moderation config to be upserted From a2ebceae05f1af03c840646b440bbcd006359f0e Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 13:21:28 +0200 Subject: [PATCH 02/19] add appeal endpoint --- src/moderation.ts | 3 ++- src/types.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/moderation.ts b/src/moderation.ts index 289515327..36c635f07 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -1,5 +1,6 @@ import type { APIResponse, + AppealResponse, CustomCheckFlag, GetConfigResponse, GetUserModerationReportOptions, @@ -193,7 +194,7 @@ export class Moderation { entityType: string, attachments: string[], ) { - return await this.client.post( + return await this.client.post( this.client.baseURL + '/api/v2/moderation/appeal', { text: text, diff --git a/src/types.ts b/src/types.ts index e80e68ed5..f39eff352 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3756,6 +3756,11 @@ export type UpsertConfigResponse = { config: ModerationConfigResponse; }; +export type AppealResponse = APIResponse & { + appeal_id: string; + review_queue_item_id: string; +}; + export type ModerationFlagOptions = { custom?: Record; moderation_payload?: ModerationPayload; From 351d49adc16932c432c86f2553b53683644e9207 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 13:23:03 +0200 Subject: [PATCH 03/19] add appeal endpoint --- src/moderation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index 36c635f07..88724af9b 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -198,8 +198,8 @@ export class Moderation { this.client.baseURL + '/api/v2/moderation/appeal', { text: text, - entityID: entityID, - entityType: entityType, + entity_id: entityID, + entity_type: entityType, attachments: attachments, }, ); From 1f9d1d1bc19ac351a1aa819c8c8dbff98e927d88 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 13:24:34 +0200 Subject: [PATCH 04/19] add appeal endpoint --- src/moderation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/moderation.ts b/src/moderation.ts index 88724af9b..44076d896 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -182,7 +182,7 @@ export class Moderation { } /** - * Appeal against the moderation action + * Appeal against the moderation decision * @param {string} text * @param {string} entityID * @param {string} entityType From b423807cd9c21de3c882d7ce7c519c596f07d7ae Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 14:03:27 +0200 Subject: [PATCH 05/19] add query Appeals endpoint --- src/moderation.ts | 25 +++++++++++++++ src/types.ts | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index 44076d896..adc0e8362 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -1,6 +1,7 @@ import type { APIResponse, AppealResponse, + AppealsSort, CustomCheckFlag, GetConfigResponse, GetUserModerationReportOptions, @@ -10,6 +11,9 @@ import type { ModerationMuteOptions, MuteUserResponse, Pager, + QueryAppealsFilters, + QueryAppealsPaginationOptions, + QueryAppealsResponse, QueryConfigsResponse, QueryModerationConfigsFilters, QueryModerationConfigsSort, @@ -205,6 +209,27 @@ export class Moderation { ); } + /** + * Query appeals + * @param {Object} filterConditions Filter conditions for querying appeals + * @param {Object} sort Sort conditions for querying appeals + * @param {Object} options Pagination options for querying appeals + */ + async queryAppeals( + filterConditions: QueryAppealsFilters = {}, + sort: AppealsSort = [], + options: QueryAppealsPaginationOptions = {}, + ) { + return await this.client.post( + this.client.baseURL + '/api/v2/moderation/appeals', + { + filter: filterConditions, + sort: normalizeQuerySort(sort), + ...options, + }, + ); + } + /** * Upsert moderation config * @param {Object} config Moderation config to be upserted diff --git a/src/types.ts b/src/types.ts index f39eff352..2d5ce08d2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3506,6 +3506,20 @@ export type ModerationFlag = { moderation_payload_hash?: string; }; +export type AppealItem = { + attachments: string[]; + created_at: string; + updated_at: string; + decision_reason: string; + entity_id: string; + entity_type: string; + review_queue_item_id: string; + status: string; + text: string; + user: UserResponse; + user_id: string; +}; + export type ReviewQueueItem = { // eslint-disable-next-line @typescript-eslint/no-explicit-any actions_taken: any[]; @@ -3534,6 +3548,7 @@ export type ReviewQueueItem = { reviewed_at: string; status: string; updated_at: string; + appeal?: AppealItem; }; export type CustomCheckFlag = { @@ -3708,6 +3723,12 @@ export type ReviewQueueFilters = QueryFilters< date_range?: RequireOnlyOne<{ $eq?: string; // Format: "date1_date2" }>; + } & { + appeal?: boolean; + } & { + appeal_status?: RequireOnlyOne<{ + $eq?: 'submitted' | 'accepted' | 'rejected'; + }>; } >; @@ -3715,6 +3736,56 @@ export type ReviewQueueSort = | Sort> | Array>>; +export type AppealsSort = + | Sort> + | Array>>; + +export type QueryAppealsFilters = QueryFilters< + { + entity_type?: + | RequireOnlyOne, '$eq' | '$in'>> + | PrimitiveFilter; + } & { + created_at?: + | RequireOnlyOne< + Pick< + QueryFilter, + '$eq' | '$gt' | '$lt' | '$gte' | '$lte' + > + > + | PrimitiveFilter; + } & { + entity_id?: + | RequireOnlyOne, '$eq' | '$in'>> + | PrimitiveFilter; + } & { + status?: + | RequireOnlyOne, '$eq' | '$in'>> + | PrimitiveFilter; + } & { + updated_at?: + | RequireOnlyOne< + Pick< + QueryFilter, + '$eq' | '$gt' | '$lt' | '$gte' | '$lte' + > + > + | PrimitiveFilter; + } & { + text?: RequireOnlyOne<{ + $eq?: string; + }>; + } & { + decision_reason?: RequireOnlyOne<{ + $eq?: string; + }>; + } & { + review_queue_item_id?: RequireOnlyOne<{ + $eq?: string; + }>; + } +>; + export type QueryModerationConfigsSort = Array>; export type ReviewQueuePaginationOptions = Pager; @@ -3725,6 +3796,14 @@ export type ReviewQueueResponse = { prev?: string; }; +export type QueryAppealsResponse = APIResponse & { + items: AppealItem[]; + next?: string; + prev?: string; +}; + +export type QueryAppealsPaginationOptions = Pager; + export type ModerationConfig = { key: string; ai_image_config?: AIImageConfig; From 5dfea8a91ae66307c2764dd908e2e9d61ca79114 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 14:09:31 +0200 Subject: [PATCH 06/19] use property shorthand --- src/moderation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index adc0e8362..d5f2105ac 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -201,10 +201,10 @@ export class Moderation { return await this.client.post( this.client.baseURL + '/api/v2/moderation/appeal', { - text: text, + text, entity_id: entityID, entity_type: entityType, - attachments: attachments, + attachments, }, ); } From 032f2031d8666863ebd52704d965c386d551d4ce Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 14:12:42 +0200 Subject: [PATCH 07/19] add decide_appeal to submit action --- src/types.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/types.ts b/src/types.ts index 2d5ce08d2..3a1e867e9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3581,6 +3581,10 @@ export type SubmitActionOptions = { channel_cid?: string; }; user_id?: string; + decide_appeal?: { + DecisionReason: string; + status: 'accepted' | 'rejected'; + }; }; export type GetUserModerationReportResponse = { From 76f551838844307bb3a65f454387af6ebafd7272 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 14:15:01 +0200 Subject: [PATCH 08/19] DecisionReason to decision_reason --- src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index 3a1e867e9..90489d1a2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3582,7 +3582,7 @@ export type SubmitActionOptions = { }; user_id?: string; decide_appeal?: { - DecisionReason: string; + decision_reason: string; status: 'accepted' | 'rejected'; }; }; From 7969bc59a46d36d26ca8746ff3a39244f22e4184 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 14:48:54 +0200 Subject: [PATCH 09/19] update appeal structures --- src/types.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/types.ts b/src/types.ts index 90489d1a2..fc1fad232 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3513,11 +3513,9 @@ export type AppealItem = { decision_reason: string; entity_id: string; entity_type: string; - review_queue_item_id: string; status: string; text: string; user: UserResponse; - user_id: string; }; export type ReviewQueueItem = { @@ -3841,7 +3839,6 @@ export type UpsertConfigResponse = { export type AppealResponse = APIResponse & { appeal_id: string; - review_queue_item_id: string; }; export type ModerationFlagOptions = { From e96d3e851eac74e561709a89d228cd503f696907 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 16:53:36 +0200 Subject: [PATCH 10/19] feat: add user_id to appeal for server side call --- src/moderation.ts | 3 +++ src/types.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index d5f2105ac..9a668fddb 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -1,5 +1,6 @@ import type { APIResponse, + AppealOptions, AppealResponse, AppealsSort, CustomCheckFlag, @@ -197,6 +198,7 @@ export class Moderation { entityID: string, entityType: string, attachments: string[], + options: AppealOptions = {}, ) { return await this.client.post( this.client.baseURL + '/api/v2/moderation/appeal', @@ -205,6 +207,7 @@ export class Moderation { entity_id: entityID, entity_type: entityType, attachments, + ...options, }, ); } diff --git a/src/types.ts b/src/types.ts index fc1fad232..6347cc1ad 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3847,6 +3847,11 @@ export type ModerationFlagOptions = { user_id?: string; }; +export type AppealOptions = { + custom?: Record; + user_id?: string; +}; + export type ModerationMuteOptions = { timeout?: number; user_id?: string; From e489934ff9f85afe566067e352e61a7180504b11 Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 1 Jul 2025 17:00:37 +0200 Subject: [PATCH 11/19] feat: add id to appeal item --- src/types.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/types.ts b/src/types.ts index 6347cc1ad..94e2b8ddb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3516,6 +3516,7 @@ export type AppealItem = { status: string; text: string; user: UserResponse; + id: string; }; export type ReviewQueueItem = { @@ -3756,6 +3757,10 @@ export type QueryAppealsFilters = QueryFilters< > > | PrimitiveFilter; + } & { + id?: + | RequireOnlyOne, '$eq' | '$in'>> + | PrimitiveFilter; } & { entity_id?: | RequireOnlyOne, '$eq' | '$in'>> From cca016242565cee897a7a6ad24254a8ca8f85e25 Mon Sep 17 00:00:00 2001 From: Varsh Date: Wed, 20 Aug 2025 13:05:25 +0200 Subject: [PATCH 12/19] add channel_cid to appeal item --- src/moderation.ts | 2 ++ src/types.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index 9a668fddb..1782041f3 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -198,6 +198,7 @@ export class Moderation { entityID: string, entityType: string, attachments: string[], + channelCID: "", options: AppealOptions = {}, ) { return await this.client.post( @@ -207,6 +208,7 @@ export class Moderation { entity_id: entityID, entity_type: entityType, attachments, + channel_cid: "", ...options, }, ); diff --git a/src/types.ts b/src/types.ts index b5bacc20e..fcccfc020 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3812,6 +3812,10 @@ export type QueryAppealsFilters = QueryFilters< text?: RequireOnlyOne<{ $eq?: string; }>; + } & { + channel_cid?: RequireOnlyOne<{ + $eq?: string; + }>; } & { decision_reason?: RequireOnlyOne<{ $eq?: string; From c141f8af5e8583564008e2f22dc515d8edc5b642 Mon Sep 17 00:00:00 2001 From: Varsh Date: Wed, 20 Aug 2025 13:06:41 +0200 Subject: [PATCH 13/19] add channel_cid to appeal item --- src/moderation.ts | 2 +- src/types.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/moderation.ts b/src/moderation.ts index 1782041f3..50cb8ec8b 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -208,7 +208,7 @@ export class Moderation { entity_id: entityID, entity_type: entityType, attachments, - channel_cid: "", + channel_cid: channelCID, ...options, }, ); diff --git a/src/types.ts b/src/types.ts index fcccfc020..aea9f904c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3545,6 +3545,7 @@ export type AppealItem = { entity_type: string; status: string; text: string; + channel_cid: string; user: UserResponse; id: string; }; From 30c44269b9c1a6986e6e3f8c261c6c0a1b4c2206 Mon Sep 17 00:00:00 2001 From: Varsh Date: Wed, 20 Aug 2025 13:08:25 +0200 Subject: [PATCH 14/19] chore: run prettier --- src/moderation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index 50cb8ec8b..c5f022f99 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -198,7 +198,7 @@ export class Moderation { entityID: string, entityType: string, attachments: string[], - channelCID: "", + channelCID: '', options: AppealOptions = {}, ) { return await this.client.post( @@ -208,7 +208,7 @@ export class Moderation { entity_id: entityID, entity_type: entityType, attachments, - channel_cid: channelCID, + channel_cid: channelCID, ...options, }, ); From 29550249fc9a526b484f475eb4f7a9a3fd24ffcf Mon Sep 17 00:00:00 2001 From: Varsh Date: Tue, 26 Aug 2025 11:45:09 +0200 Subject: [PATCH 15/19] update appeal fn --- src/moderation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/moderation.ts b/src/moderation.ts index c5f022f99..cd984db14 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -192,13 +192,14 @@ export class Moderation { * @param {string} entityID * @param {string} entityType * @param {Array} attachments + * @param {string} channelCID */ async appeal( text: string, entityID: string, entityType: string, attachments: string[], - channelCID: '', + channelCID: string = '', options: AppealOptions = {}, ) { return await this.client.post( From 39001f9388c399ea7af669ff9c397e46bb8d639a Mon Sep 17 00:00:00 2001 From: Varsh Date: Fri, 3 Oct 2025 13:44:33 +0200 Subject: [PATCH 16/19] feat(mod): update appeal APIs --- src/moderation.ts | 38 +++++++++++++++++++------------------- src/types.ts | 28 ++++++++++++++++++---------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index 68cb0fc60..aa116d6f4 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -1,7 +1,7 @@ import type { APIResponse, - AppealOptions, AppealResponse, + AppealRequest, AppealsSort, CustomCheckFlag, GetConfigResponse, @@ -32,6 +32,8 @@ import type { SubmitActionOptions, UpsertConfigResponse, UpsertModerationRuleResponse, + AppealOptions, + GetAppealResponse, } from './types'; import type { StreamChat } from './client'; import { normalizeQuerySort } from './utils'; @@ -194,33 +196,31 @@ export class Moderation { /** * Appeal against the moderation decision - * @param {string} text - * @param {string} entityID - * @param {string} entityType - * @param {Array} attachments - * @param {string} channelCID + * @param {AppealRequest} appealRequest Appeal request to be appealed against */ - async appeal( - text: string, - entityID: string, - entityType: string, - attachments: string[], - channelCID: string = '', - options: AppealOptions = {}, - ) { + async appeal(appealRequest: AppealRequest, options: AppealOptions = {}) { return await this.client.post( this.client.baseURL + '/api/v2/moderation/appeal', { - text, - entity_id: entityID, - entity_type: entityType, - attachments, - channel_cid: channelCID, + text: appealRequest.text, + entity_id: appealRequest.entityID, + entity_type: appealRequest.entityType, + attachments: appealRequest.attachments, ...options, }, ); } + /** + * Get Appeal Item + * @param {string} appealID ID of the appeal to be fetched + */ + async getAppeal(appealID: string) { + return await this.client.get( + this.client.baseURL + '/api/v2/moderation/appeal/' + appealID, + ); + } + /** * Query appeals * @param {Object} filterConditions Filter conditions for querying appeals diff --git a/src/types.ts b/src/types.ts index d5d9bb67e..19d897ed8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3570,7 +3570,6 @@ export type AppealItem = { entity_type: string; status: string; text: string; - channel_cid: string; user: UserResponse; id: string; }; @@ -3622,24 +3621,26 @@ export type SubmitActionOptions = { reason?: string; timeout?: number; delete_messages?: DeleteMessagesOptions; + decision_reason?: string; }; delete_message?: { hard_delete?: boolean; + decision_reason?: string; }; delete_user?: { delete_conversation_channels?: boolean; hard_delete?: boolean; mark_messages_deleted?: boolean; + decision_reason?: string; + }; + restore?: { + decision_reason?: string; }; - restore?: {}; unban?: { channel_cid?: string; + decision_reason?: string; }; user_id?: string; - decide_appeal?: { - decision_reason: string; - status: 'accepted' | 'rejected'; - }; }; export type GetUserModerationReportResponse = { @@ -3838,10 +3839,6 @@ export type QueryAppealsFilters = QueryFilters< text?: RequireOnlyOne<{ $eq?: string; }>; - } & { - channel_cid?: RequireOnlyOne<{ - $eq?: string; - }>; } & { decision_reason?: RequireOnlyOne<{ $eq?: string; @@ -3906,6 +3903,10 @@ export type AppealResponse = APIResponse & { appeal_id: string; }; +export type GetAppealResponse = APIResponse & { + item: AppealItem; +}; + // Moderation Rule Builder Types export type ModerationRule = { id: string; @@ -3928,6 +3929,13 @@ export type ModerationRuleRequest = { enabled: boolean; }; +export type AppealRequest = { + text: string; + entityID: string; + entityType: string; + attachments: string[]; +}; + export type RuleBuilderRule = { id: string; rule_type: 'user' | 'content'; From 585b49adb632a4086e69d7310c68d97b6018332e Mon Sep 17 00:00:00 2001 From: Varsh Date: Fri, 3 Oct 2025 13:55:23 +0200 Subject: [PATCH 17/19] feat(mod): update appeal APIs --- src/moderation.ts | 23 +++++++++++++++++++++++ src/types.ts | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index aa116d6f4..349329574 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -34,6 +34,7 @@ import type { UpsertModerationRuleResponse, AppealOptions, GetAppealResponse, + DecideAppealRequest, } from './types'; import type { StreamChat } from './client'; import { normalizeQuerySort } from './utils'; @@ -211,6 +212,28 @@ export class Moderation { ); } + /** + * Decide on an appeal + * @param {DecideAppealRequest} decideAppealRequest Request to decide on an appeal + */ + async decideAppeal( + decideAppealRequest: DecideAppealRequest, + options: AppealOptions = {}, + ) { + return await this.client.post( + this.client.baseURL + '/api/v2/moderation/decide_appeal', + { + appeal_id: decideAppealRequest.appealID, + status: decideAppealRequest.status, + decision_reason: decideAppealRequest.decisionReason, + ...(decideAppealRequest.channelCIDs + ? { channel_cids: decideAppealRequest.channelCIDs } + : {}), + ...options, + }, + ); + } + /** * Get Appeal Item * @param {string} appealID ID of the appeal to be fetched diff --git a/src/types.ts b/src/types.ts index 19d897ed8..0d57424da 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3936,6 +3936,13 @@ export type AppealRequest = { attachments: string[]; }; +export type DecideAppealRequest = { + appealID: string; + status: 'accepted' | 'rejected'; + decisionReason: string; + channelCIDs?: string[]; +}; + export type RuleBuilderRule = { id: string; rule_type: 'user' | 'content'; From 85a2ae3b77fdf6f3425b94637557c20234eca728 Mon Sep 17 00:00:00 2001 From: Varsh Date: Fri, 3 Oct 2025 14:14:19 +0200 Subject: [PATCH 18/19] feat(mod): update appeal APIs --- src/moderation.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index 349329574..5e5468c6b 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -1,9 +1,12 @@ import type { APIResponse, - AppealResponse, + AppealOptions, AppealRequest, + AppealResponse, AppealsSort, CustomCheckFlag, + DecideAppealRequest, + GetAppealResponse, GetConfigResponse, GetUserModerationReportOptions, GetUserModerationReportResponse, @@ -32,9 +35,6 @@ import type { SubmitActionOptions, UpsertConfigResponse, UpsertModerationRuleResponse, - AppealOptions, - GetAppealResponse, - DecideAppealRequest, } from './types'; import type { StreamChat } from './client'; import { normalizeQuerySort } from './utils'; From 367f26a49edaa18c699c9ad3e96ef74d62107ca8 Mon Sep 17 00:00:00 2001 From: Varsh Date: Mon, 6 Oct 2025 12:54:06 +0200 Subject: [PATCH 19/19] feat(mod): add acceptAppeal and rejectAppeal --- src/moderation.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index 5e5468c6b..71e828e19 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -234,6 +234,38 @@ export class Moderation { ); } + /** + * Accept an appeal + * @param {appealID} appealID ID of appeal + * @param {decisionReason} decisionReason Reason for accepting an appeal + */ + async acceptAppeal( + appealID: string, + decisionReason: string, + options: AppealOptions = {}, + ) { + return await this.decideAppeal( + { appealID, decisionReason, status: 'accepted' }, + options, + ); + } + + /** + * Reject an appeal + * @param {appealID} appealID ID of appeal + * @param {decisionReason} decisionReason Reason for rejecting an appeal + */ + async rejectAppeal( + appealID: string, + decisionReason: string, + options: AppealOptions = {}, + ) { + return await this.decideAppeal( + { appealID, decisionReason, status: 'rejected' }, + options, + ); + } + /** * Get Appeal Item * @param {string} appealID ID of the appeal to be fetched