-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathIterableEmbeddedMessageElementsButtonAction.ts
More file actions
54 lines (50 loc) · 1.64 KB
/
Copy pathIterableEmbeddedMessageElementsButtonAction.ts
File metadata and controls
54 lines (50 loc) · 1.64 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
52
53
54
/**
* IterableEmbeddedMessageElementsButtonAction represents an action defined as a response to user events
* for an embedded message button.
*/
export class IterableEmbeddedMessageElementsButtonAction {
/**
* 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 IterableEmbeddedMessageElementsButtonAction.
*
* @param type - The type of the action.
* @param data - Optional data associated with the action.
*/
constructor(type: string, data?: string) {
this.type = type;
this.data = data;
}
/**
* Creates an instance of `IterableEmbeddedMessageElementsButtonAction` from a dictionary object.
*
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageElementsButtonAction` instance.
* @returns A new instance of `IterableEmbeddedMessageElementsButtonAction` initialized with the provided dictionary properties.
*/
static fromDict(
dict: Partial<EmbeddedMessageButtonActionDict>
): IterableEmbeddedMessageElementsButtonAction {
if (!dict.type) {
throw new Error('type is required');
}
return new IterableEmbeddedMessageElementsButtonAction(
dict.type,
dict.data
);
}
}
/**
* An interface defining the dictionary object containing the properties for the embedded message button action.
*/
export interface EmbeddedMessageButtonActionDict {
type: string;
data?: string;
}