diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-24 14:03:36 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-24 14:03:36 +0200 |
commit | 633c92eae865e957121e08de634aeee11a8b3992 (patch) | |
tree | 09d881bee1dae0b6eee49db1dfaf0f500240606c /includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts | |
parent | c4657e4509733699c0f26a3c900bab47e915d5a0 (diff) | |
download | pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.gz pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.bz2 pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.zip |
Updated 18 files, added 1692 files and deleted includes/system/compare.inc (automated)
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts')
-rw-r--r-- | includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts new file mode 100644 index 0000000..f0cde3b --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-widget-api/lib/models/WidgetParser.d.ts @@ -0,0 +1,46 @@ +import { Widget } from "./Widget"; +import { IWidget } from ".."; +export interface IStateEvent { + event_id: string; + room_id: string; + type: string; + sender: string; + origin_server_ts: number; + unsigned?: unknown; + content: unknown; + state_key: string; +} +export interface IAccountDataWidgets { + [widgetId: string]: { + type: "m.widget"; + state_key: string; + sender: string; + content: IWidget; + id?: string; + }; +} +export declare class WidgetParser { + private constructor(); + /** + * Parses widgets from the "m.widgets" account data event. This will always + * return an array, though may be empty if no valid widgets were found. + * @param {IAccountDataWidgets} content The content of the "m.widgets" account data. + * @returns {Widget[]} The widgets in account data, or an empty array. + */ + static parseAccountData(content: IAccountDataWidgets): Widget[]; + /** + * Parses all the widgets possible in the given array. This will always return + * an array, though may be empty if no widgets could be parsed. + * @param {IStateEvent[]} currentState The room state to parse. + * @returns {Widget[]} The widgets in the state, or an empty array. + */ + static parseWidgetsFromRoomState(currentState: IStateEvent[]): Widget[]; + /** + * Parses a state event into a widget. If the state event does not represent + * a widget (wrong event type, invalid widget, etc) then null is returned. + * @param {IStateEvent} stateEvent The state event. + * @returns {Widget|null} The widget, or null if invalid + */ + static parseRoomWidget(stateEvent: IStateEvent): Widget | null; + private static processEstimatedWidget; +} |