File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -728,6 +728,11 @@ interface IRoomHierarchy {
728
728
rooms : IHierarchyRoom [ ] ;
729
729
next_batch ?: string ;
730
730
}
731
+
732
+ interface ITimestampToEventResponse {
733
+ event_id : string ;
734
+ origin_server_ts : string ;
735
+ }
731
736
/* eslint-enable camelcase */
732
737
733
738
// We're using this constant for methods overloading and inspect whether a variable
@@ -8937,6 +8942,36 @@ export class MatrixClient extends EventEmitter {
8937
8942
public async whoami ( ) : Promise < { user_id : string } > { // eslint-disable-line camelcase
8938
8943
return this . http . authedRequest ( undefined , Method . Get , "/account/whoami" ) ;
8939
8944
}
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
+ }
8940
8975
}
8941
8976
8942
8977
/**
You can’t perform that action at this time.
0 commit comments