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 @@ -728,6 +728,11 @@ interface IRoomHierarchy {
728728 rooms : IHierarchyRoom [ ] ;
729729 next_batch ?: string ;
730730}
731+
732+ interface ITimestampToEventResponse {
733+ event_id : string ;
734+ origin_server_ts : string ;
735+ }
731736/* eslint-enable camelcase */
732737
733738// We're using this constant for methods overloading and inspect whether a variable
@@ -8937,6 +8942,36 @@ export class MatrixClient extends EventEmitter {
89378942 public async whoami ( ) : Promise < { user_id : string } > { // eslint-disable-line camelcase
89388943 return this . http . authedRequest ( undefined , Method . Get , "/account/whoami" ) ;
89398944 }
8945+
8946+ /**
8947+ * Find the event_id closest to the given timestamp in the given direction.
8948+ * @return {Promise } A promise of an object containing the event_id and
8949+ * origin_server_ts of the closest event to the timestamp in the given
8950+ * direction
8951+ */
8952+ public async timestampToEvent (
8953+ roomId : string ,
8954+ timestamp : number ,
8955+ dir : Direction ,
8956+ ) : Promise < ITimestampToEventResponse > {
8957+ const path = utils . encodeUri ( "/rooms/$roomId/timestamp_to_event" , {
8958+ $roomId : roomId ,
8959+ } ) ;
8960+
8961+ return await this . http . authedRequest (
8962+ undefined ,
8963+ Method . Get ,
8964+ path ,
8965+ {
8966+ ts : timestamp . toString ( ) ,
8967+ dir : dir ,
8968+ } ,
8969+ undefined ,
8970+ {
8971+ prefix : "/_matrix/client/unstable/org.matrix.msc3030" ,
8972+ } ,
8973+ ) ;
8974+ }
89408975}
89418976
89428977/**
You can’t perform that action at this time.
0 commit comments