Skip to content

Commit 023ed30

Browse files
author
Evan Greer
committed
feat: adds IterableEmbeddedMessageText class
1 parent 78c92f8 commit 023ed30

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1-
export class IterableEmbeddedMessageText {}
1+
export class IterableEmbeddedMessageText {
2+
/** The id of the text element */
3+
readonly id: string;
4+
/** The text of the text element */
5+
readonly text?: string;
6+
/** The type of the text element */
7+
readonly type?: string;
8+
9+
/**
10+
* Creates an instance of `IterableEmbeddedMessageText`.
11+
*
12+
* @param id - The id of the text element
13+
* @param text - The text of the text element
14+
* @param type - The type of the text element
15+
*/
16+
constructor(id: string, text?: string, type?: string) {
17+
this.id = id;
18+
this.text = text;
19+
this.type = type;
20+
}
21+
22+
/**
23+
* Creates an instance of `IterableEmbeddedMessageText` from a dictionary object.
24+
*
25+
* @param dict - The dictionary object containing the properties to initialize the `IterableEmbeddedMessageText` instance.
26+
* @returns A new instance of `IterableEmbeddedMessageText` initialized with the provided dictionary properties.
27+
*/
28+
static fromDict(
29+
dict: Partial<EmbeddedMessageTextDict>
30+
): IterableEmbeddedMessageText {
31+
if (!dict.id) {
32+
throw new Error('id is required');
33+
}
34+
return new IterableEmbeddedMessageText(dict.id, dict.text, dict.type);
35+
}
36+
}
37+
38+
/**
39+
* An interface defining the dictionary object containing the properties for an embedded message text.
40+
*/
41+
export interface EmbeddedMessageTextDict {
42+
id: string;
43+
text?: string;
44+
type?: string;
45+
}

0 commit comments

Comments
 (0)