matrix-js-sdk
Version:
Matrix Client-Server SDK for Javascript
85 lines • 3.15 kB
TypeScript
/** @module ContentHelpers */
import { MsgType } from "./@types/event";
import { ILocationContent } from "./@types/location";
import { IPollContent } from "./@types/polls";
/**
* Generates the content for a HTML Message event
* @param {string} body the plaintext body of the message
* @param {string} htmlBody the HTML representation of the message
* @returns {{msgtype: string, format: string, body: string, formatted_body: string}}
*/
export declare function makeHtmlMessage(body: string, htmlBody: string): {
msgtype: MsgType;
format: string;
body: string;
formatted_body: string;
};
/**
* Generates the content for a HTML Notice event
* @param {string} body the plaintext body of the notice
* @param {string} htmlBody the HTML representation of the notice
* @returns {{msgtype: string, format: string, body: string, formatted_body: string}}
*/
export declare function makeHtmlNotice(body: string, htmlBody: string): {
msgtype: MsgType;
format: string;
body: string;
formatted_body: string;
};
/**
* Generates the content for a HTML Emote event
* @param {string} body the plaintext body of the emote
* @param {string} htmlBody the HTML representation of the emote
* @returns {{msgtype: string, format: string, body: string, formatted_body: string}}
*/
export declare function makeHtmlEmote(body: string, htmlBody: string): {
msgtype: MsgType;
format: string;
body: string;
formatted_body: string;
};
/**
* Generates the content for a Plaintext Message event
* @param {string} body the plaintext body of the emote
* @returns {{msgtype: string, body: string}}
*/
export declare function makeTextMessage(body: string): {
msgtype: MsgType;
body: string;
};
/**
* Generates the content for a Plaintext Notice event
* @param {string} body the plaintext body of the notice
* @returns {{msgtype: string, body: string}}
*/
export declare function makeNotice(body: string): {
msgtype: MsgType;
body: string;
};
/**
* Generates the content for a Plaintext Emote event
* @param {string} body the plaintext body of the emote
* @returns {{msgtype: string, body: string}}
*/
export declare function makeEmoteMessage(body: string): {
msgtype: MsgType;
body: string;
};
/**
* Generates the content for a Poll Start event
* @param question the poll question
* @param answers the possible answers
* @param kind whether the poll is disclosed or undisclosed. Allowed values are
* "m.poll.disclosed" or "m.poll.undisclosed", or the unstable equivalents
*/
export declare function makePollContent(question: string, answers: string[], kind: string): IPollContent;
/**
* Generates the content for a Location event
* @param text a text for of our location
* @param uri a geo:// uri for the location
* @param ts the timestamp when the location was correct (milliseconds since
* the UNIX epoch)
* @param description the (optional) label for this location on the map
*/
export declare function makeLocationContent(text: string, uri: string, ts: number, description?: string): ILocationContent;
//# sourceMappingURL=content-helpers.d.ts.map