-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathIterableEmbeddedMessageElementsButton.ts
More file actions
61 lines (57 loc) · 1.95 KB
/
Copy pathIterableEmbeddedMessageElementsButton.ts
File metadata and controls
61 lines (57 loc) · 1.95 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
55
56
57
58
59
60
61
import { IterableEmbeddedMessageElementsButtonAction } from './IterableEmbeddedMessageElementsButtonAction';
/**
* IterableEmbeddedMessageElementsButton represents a button in an embedded message.
*/
export class IterableEmbeddedMessageElementsButton {
/** The ID for the embedded message button */
readonly id: string;
/** The title for the embedded message button */
readonly title?: string;
/** The action for the embedded message button */
readonly action?: IterableEmbeddedMessageElementsButtonAction;
/**
* Creates an instance of IterableEmbeddedMessageButton.
*
* @param id - The ID for the embedded message button.
* @param title - The title for the embedded message button.
* @param action - The action for the embedded message button.
*/
constructor(
id: string,
title?: string,
action?: IterableEmbeddedMessageElementsButtonAction
) {
this.id = id;
this.title = title;
this.action = action;
}
/**
* Creates an instance of `IterableEmbeddedMessageButton` from a dictionary object.
*
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageButton` instance.
* @returns A new instance of `IterableEmbeddedMessageButton` initialized with the provided dictionary properties.
*/
static fromDict(
dict: Partial<EmbeddedMessageElementsButtonDict>
): IterableEmbeddedMessageElementsButton {
if (!dict.id) {
throw new Error('id is required');
}
const action = dict.action
? IterableEmbeddedMessageElementsButtonAction.fromDict(dict.action)
: undefined;
return new IterableEmbeddedMessageElementsButton(
dict.id,
dict.title,
action
);
}
}
/**
* An interface defining the dictionary object containing the properties for the embedded message button.
*/
export interface EmbeddedMessageElementsButtonDict {
id: string;
title?: string;
action?: IterableEmbeddedMessageElementsButtonAction;
}