@@ -64,15 +64,11 @@ export interface AttachmentOptions {
6464}
6565
6666export interface EditMessageOptions extends UserIdOptions {
67- roomId : string
68- messageId : string
6967 text : string
7068 attachment ?: AttachmentOptions
7169}
7270
7371export interface EditMultipartMessageOptions {
74- roomId : string
75- messageId : string
7672 userId : string
7773 parts : Array < NewPart >
7874}
@@ -580,7 +576,7 @@ export default class Chatkit {
580576 . then ( ( { body } ) => JSON . parse ( body ) )
581577 }
582578
583- editMessage ( options : EditMessageOptions ) : Promise < void > {
579+ editMessage ( roomId : string , messageId : string , options : EditMessageOptions ) : Promise < void > {
584580 let messagePayload : any = { text : options . text }
585581
586582 if ( options . attachment ) {
@@ -593,7 +589,7 @@ export default class Chatkit {
593589 return this . serverInstanceV2
594590 . request ( {
595591 method : "PUT" ,
596- path : `/rooms/${ encodeURIComponent ( options . roomId ) } /messages/${ encodeURIComponent ( options . messageId ) } ` ,
592+ path : `/rooms/${ encodeURIComponent ( roomId ) } /messages/${ encodeURIComponent ( messageId ) } ` ,
597593 jwt : this . generateAccessToken ( {
598594 su : true ,
599595 userId : options . userId ,
@@ -603,16 +599,14 @@ export default class Chatkit {
603599 . then ( ( ) => { } )
604600 }
605601
606- editSimpleMessage ( options : EditMessageOptions ) : Promise < void > {
607- return this . editMultipartMessage ( {
608- roomId : options . roomId ,
609- messageId : options . messageId ,
602+ editSimpleMessage ( roomId : string , messageId : string , options : EditMessageOptions ) : Promise < void > {
603+ return this . editMultipartMessage ( roomId , messageId , {
610604 userId : options . userId ,
611605 parts : [ { type : "text/plain" , content : options . text } ] ,
612606 } )
613607 }
614608
615- editMultipartMessage ( options : EditMultipartMessageOptions ) : Promise < void > {
609+ editMultipartMessage ( roomId : string , messageId : string , options : EditMultipartMessageOptions ) : Promise < void > {
616610 if ( options . parts . length === 0 ) {
617611 return Promise . reject (
618612 new TypeError ( "message must contain at least one part" ) ,
@@ -625,7 +619,7 @@ export default class Chatkit {
625619 part . file
626620 ? this . uploadAttachment ( {
627621 userId : options . userId ,
628- roomId : options . roomId ,
622+ roomId : roomId ,
629623 part,
630624 } )
631625 : part ,
@@ -634,7 +628,7 @@ export default class Chatkit {
634628 . then ( parts =>
635629 this . serverInstance . request ( {
636630 method : "PUT" ,
637- path : `/rooms/${ encodeURIComponent ( options . roomId ) } /messages/${ encodeURIComponent ( options . messageId ) } ` ,
631+ path : `/rooms/${ encodeURIComponent ( roomId ) } /messages/${ encodeURIComponent ( messageId ) } ` ,
638632 jwt : this . generateAccessToken ( {
639633 su : true ,
640634 userId : options . userId ,
0 commit comments