-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathIterableEmbeddedMessageDefaultAction.ts
More file actions
51 lines (47 loc) · 1.59 KB
/
Copy pathIterableEmbeddedMessageDefaultAction.ts
File metadata and controls
51 lines (47 loc) · 1.59 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* IterableEmbeddedMessageDefaultAction represents the default action defined as
* a response to user events for an embedded message
*/
export class IterableEmbeddedMessageDefaultAction {
/**
* The type of iterable action
* For custom actions, the type is `action://` prefix followed by a custom action name
*/
readonly type: string;
/**
* The url for the action when the type is `openUrl`
* For custom actions, data is empty
*/
readonly data?: string;
/**
* Creates an instance of `IterableEmbeddedMessageDefaultAction`.
*
* @param type - The type of iterable action
* @param data - The url for the action when the type is `openUrl`
*/
constructor(type: string, data?: string) {
this.type = type;
this.data = data;
}
/**
* Creates an instance of `IterableEmbeddedMessageDefaultAction` from a dictionary object.
*
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageDefaultAction` instance.
* @returns A new instance of `IterableEmbeddedMessageDefaultAction` initialized with the provided dictionary properties.
*/
static fromDict(
dict: Partial<EmbeddedMessageDefaultActionDict>
): IterableEmbeddedMessageDefaultAction {
if (!dict.type) {
throw new Error('type is required');
}
return new IterableEmbeddedMessageDefaultAction(dict.type, dict.data);
}
}
/**
* An interface defining the dictionary object containing the properties for the embedded message default action.
*/
export interface EmbeddedMessageDefaultActionDict {
type: string;
data?: string;
}