@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ import { EitherAnd } from "matrix-events-sdk/lib/types" ;
18+
1719import { IContent , IEvent } from "../models/event" ;
1820import { Preset , Visibility } from "./partials" ;
1921import { IEventWithRoomId , SearchKey } from "./search" ;
@@ -76,6 +78,52 @@ export interface ISendEventResponse {
7678 event_id : string ;
7779}
7880
81+ export interface IFutureGroupId {
82+ future_group_id : string ;
83+ }
84+
85+ export interface IFutureTimeout {
86+ future_timeout : number ;
87+ }
88+
89+ export type ISendFutureRequestOpts = EitherAnd < IFutureGroupId , IFutureTimeout > ;
90+
91+ export interface IFutureTokens {
92+ send_token : string ;
93+ cancel_token : string ;
94+ }
95+
96+ export interface ITimeoutFutureTokens extends IFutureTokens {
97+ refresh_token : string ;
98+ }
99+
100+ export type ISendActionFutureResponse = IFutureGroupId & IFutureTokens ;
101+ export type ISendTimeoutFutureResponse = IFutureGroupId & ITimeoutFutureTokens ;
102+
103+ export type ISendFutureResponse < F extends ISendFutureRequestOpts > = F extends IFutureTimeout
104+ ? ISendTimeoutFutureResponse
105+ : ISendActionFutureResponse ;
106+
107+ export interface ISendFutureGroupResponse {
108+ send_on_timeout : ITimeoutFutureTokens ;
109+ send_on_action ?: {
110+ [ action_name : string ] : IFutureTokens ;
111+ } ;
112+ send_now ?: ISendEventResponse ;
113+ }
114+
115+ interface IFuturePartialEvent {
116+ room_id : string ;
117+ type : string ;
118+ state_key ?: string ;
119+ content : IContent ;
120+ }
121+
122+ export type IActionFutureInfo = IFutureGroupId & IFuturePartialEvent & IFutureTokens ;
123+ export type ITimeoutFutureInfo = IFutureGroupId & IFutureTimeout & IFuturePartialEvent & ITimeoutFutureTokens ;
124+
125+ export type IFutureInfo = IActionFutureInfo | ITimeoutFutureInfo ;
126+
79127export interface IPresenceOpts {
80128 // One of "online", "offline" or "unavailable"
81129 presence : "online" | "offline" | "unavailable" ;
0 commit comments