[MOB-11551] creates IterableEmbeddedMessageElements class#656
Merged
evantk91 merged 4 commits intoJun 24, 2025
Merged
Conversation
❌ 7 blocking issues (10 total)
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
lposen
reviewed
Jun 9, 2025
lposen
reviewed
Jun 9, 2025
lposen
reviewed
Jun 9, 2025
lposen
reviewed
Jun 9, 2025
| /** | ||
| * IterableEmbeddedMessageText represents a text element in an embedded message. | ||
| */ | ||
| export class IterableEmbeddedMessageText { |
Contributor
There was a problem hiding this comment.
I feel like a lot of these don't necessarily need to be classes, and that they could just be interfaces. But I'll have to double check how they all fit together.
lposen
reviewed
Jun 9, 2025
Contributor
lposen
left a comment
There was a problem hiding this comment.
Please update the comments
Base automatically changed from
evan/MOB-11550-iterable-embedded-message-button-class
to
evan/embedded-message-class
June 24, 2025 19:22
…le-embedded-message-elements-class
| @@ -0,0 +1,40 @@ | |||
| import { IterableEmbeddedMessageDefaultAction } from '../embedded/classes/IterableEmbeddedMessageDefaultAction'; | |||
There was a problem hiding this comment.
| @@ -0,0 +1,214 @@ | |||
| import { IterableEmbeddedMessageElements } from '../embedded/classes/IterableEmbeddedMessageElements'; | |||
There was a problem hiding this comment.
| @@ -0,0 +1,38 @@ | |||
| import { IterableEmbeddedMessageText } from '../embedded/classes/IterableEmbeddedMessageText'; | |||
There was a problem hiding this comment.
| @@ -0,0 +1,51 @@ | |||
| /** | |||
There was a problem hiding this comment.
Comment on lines
+5
to
+42
| 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); | ||
| } |
| @@ -0,0 +1,101 @@ | |||
| import { IterableEmbeddedMessageDefaultAction } from './IterableEmbeddedMessageDefaultAction'; | |||
There was a problem hiding this comment.
Comment on lines
+35
to
+42
| constructor( | ||
| title?: string, | ||
| body?: string, | ||
| mediaUrl?: string, | ||
| mediaUrlCaption?: string, | ||
| defaultAction?: IterableEmbeddedMessageDefaultAction, | ||
| buttons?: IterableEmbeddedMessageElementsButton[], | ||
| text?: IterableEmbeddedMessageText[] |
| IterableEmbeddedMessageElementsButton.fromDict(button) | ||
| ); | ||
|
|
||
| const text = dict.text?.map((text) => |
| @@ -0,0 +1,48 @@ | |||
| /** | |||
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔹 JIRA Ticket(s) if any
✏️ Description