File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -3101,6 +3101,41 @@ export class StreamChat {
31013101 ) ;
31023102 }
31033103
3104+ /**
3105+ * Updates message fields without storing them in the database, only sends update event.
3106+ *
3107+ * Available only on the server-side.
3108+ *
3109+ * @param messageId the message id to update.
3110+ * @param partialMessageObject the message payload.
3111+ * @param partialUserOrUserId the user id linked to this action.
3112+ * @param options additional options.
3113+ */
3114+ async ephemeralUpdateMessage (
3115+ messageId : string ,
3116+ partialMessageObject : PartialMessageUpdate ,
3117+ partialUserOrUserId ?: string | { id : string } ,
3118+ options ?: UpdateMessageOptions ,
3119+ ) {
3120+ if ( ! messageId ) throw Error ( 'messageId is required' ) ;
3121+
3122+ let user : { id : string } | undefined = undefined ;
3123+ if ( typeof partialUserOrUserId === 'string' ) {
3124+ user = { id : partialUserOrUserId } ;
3125+ } else if ( typeof partialUserOrUserId ?. id === 'string' ) {
3126+ user = { id : partialUserOrUserId . id } ;
3127+ }
3128+
3129+ return await this . patch < UpdateMessageAPIResponse > (
3130+ `${ this . baseURL } /messages/${ encodeURIComponent ( messageId ) } /ephemeral` ,
3131+ {
3132+ ...partialMessageObject ,
3133+ ...options ,
3134+ user,
3135+ } ,
3136+ ) ;
3137+ }
3138+
31043139 /**
31053140 * deleteMessage - Delete a message
31063141 *
You can’t perform that action at this time.
0 commit comments