@@ -115,6 +115,7 @@ import {
115
115
type IGuestAccessOpts ,
116
116
type IJoinRoomOpts ,
117
117
type INotificationsResponse ,
118
+ type InviteOpts ,
118
119
type IPaginateOpts ,
119
120
type IPresenceOpts ,
120
121
type IRedactOpts ,
@@ -3755,12 +3756,19 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
3755
3756
}
3756
3757
3757
3758
/**
3758
- * @param reason - Optional.
3759
- * @returns Promise which resolves: `{}` an empty object.
3760
- * @returns Rejects: with an error response.
3759
+ * Send an invite to the given user to join the given room.
3760
+ *
3761
+ * @param roomId - The ID of the room to which the user should be invited.
3762
+ * @param userId - The ID of the user that should be invited.
3763
+ * @param opts - Optional reason object. For backwards compatibility, a string is also accepted, and will be interpreted as a reason.
3764
+ *
3765
+ * @returns An empty object.
3761
3766
*/
3762
- public invite ( roomId : string , userId : string , reason ?: string ) : Promise < EmptyObject > {
3763
- return this . membershipChange ( roomId , userId , KnownMembership . Invite , reason ) ;
3767
+ public invite ( roomId : string , userId : string , opts : InviteOpts | string = { } ) : Promise < EmptyObject > {
3768
+ if ( typeof opts != "object" ) {
3769
+ opts = { reason : opts } ;
3770
+ }
3771
+ return this . membershipChange ( roomId , userId , KnownMembership . Invite , opts . reason ) ;
3764
3772
}
3765
3773
3766
3774
/**
0 commit comments