-
Notifications
You must be signed in to change notification settings - Fork 119
/
IPreMessageSentExtend.ts
29 lines (27 loc) · 1.26 KB
/
IPreMessageSentExtend.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { IHttp, IMessageExtender, IPersistence, IRead } from '../accessors';
import { IMessage } from './IMessage';
/** Handler called when an App wants to enrich a message. */
export interface IPreMessageSentExtend {
/**
* Enables the handler to signal to the Apps framework whether
* this handler should actually be executed for the message
* about to be sent.
*
* @param message The message which is being sent
* @param read An accessor to the environment
* @param http An accessor to the outside world
* @returns whether to run the execute or not
*/
checkPreMessageSentExtend?(message: IMessage, read: IRead, http: IHttp): Promise<boolean>;
/**
* Method which is to be used to non-destructively enrich the message.
*
* @param message The message about to be sent
* @param extend An accessor for modifying the message non-destructively
* @param read An accessor to the environment
* @param http An accessor to the outside world
* @param persistence An accessor to the App's persistence storage
* @returns the resulting message
*/
executePreMessageSentExtend(message: IMessage, extend: IMessageExtender, read: IRead, http: IHttp, persistence: IPersistence): Promise<IMessage>;
}