Skip to content

Commit d73ddb2

Browse files
committed
feat: add flagActivity and flagReaction
1 parent c8f6d7c commit d73ddb2

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/moderation.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { normalizeQuerySort } from './utils';
2727
export const MODERATION_ENTITY_TYPES = {
2828
user: 'stream:user',
2929
message: 'stream:chat:v1:message',
30+
activity: 'stream:feeds:v2:activity',
31+
reaction: 'stream:feeds:v2:reaction',
3032
userprofile: 'stream:v1:user_profile',
3133
};
3234

@@ -66,6 +68,58 @@ export class Moderation {
6668
return this.flag(MODERATION_ENTITY_TYPES.message, messageID, '', reason, options);
6769
}
6870

71+
/**
72+
* Flag an activity
73+
*
74+
* @param {string} entityID Activity ID to be flagged
75+
* @param {string} entityCreatorID User ID of the Activity creator
76+
* @param {string} reason Reason for flagging the activity
77+
* @param {Object} options Additional options for flagging the activity
78+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target activity
79+
* @param {Object} options.custom Additional data to be stored with the flag
80+
* @returns
81+
*/
82+
flagActivity(
83+
entityID: string,
84+
entityCreatorID: string,
85+
reason: string,
86+
options: ModerationFlagOptions = {},
87+
) {
88+
return this.flag(
89+
MODERATION_ENTITY_TYPES.activity,
90+
entityID,
91+
entityCreatorID,
92+
reason,
93+
options,
94+
);
95+
}
96+
97+
/**
98+
* Flag a reaction
99+
*
100+
* @param {string} entityID Reaction ID to be flagged
101+
* @param {string} entityCreatorID User ID of the Reaction creator
102+
* @param {string} reason Reason for flagging the reaction
103+
* @param {Object} options Additional options for flagging the reaction
104+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target reaction
105+
* @param {Object} options.custom Additional data to be stored with the flag
106+
* @returns
107+
*/
108+
flagReaction(
109+
entityID: string,
110+
entityCreatorID: string,
111+
reason: string,
112+
options: ModerationFlagOptions = {},
113+
) {
114+
return this.flag(
115+
MODERATION_ENTITY_TYPES.reaction,
116+
entityID,
117+
entityCreatorID,
118+
reason,
119+
options,
120+
);
121+
}
122+
69123
/**
70124
* Flag a user
71125
*

0 commit comments

Comments
 (0)