Skip to content

Commit 9bf8e0e

Browse files
committed
DEVX-10006: Fixing RCS Card models and tests
1 parent 0f31306 commit 9bf8e0e

File tree

3 files changed

+504
-230
lines changed

3 files changed

+504
-230
lines changed

messages/src/vonage_messages/models/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
from .rcs import (
1414
RcsCustom,
1515
RcsCarousel,
16-
RcsCardContent,
17-
RcsCard,
16+
RcsCardItem,
17+
RcsCardMessage,
18+
RcsCardBase,
1819
RcsFile,
1920
RcsImage,
2021
RcsResource,

messages/src/vonage_messages/models/rcs.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ class RcsFile(BaseRcs):
263263
file: RcsResource
264264
message_type: MessageType = MessageType.FILE
265265

266-
class RcsCardContent(BaseModel):
266+
267+
class RcsCardBase(BaseModel):
267268
"""Model for the content of an RCS card.
268269
269270
Args:
@@ -295,7 +296,20 @@ class RcsCardContent(BaseModel):
295296
] = Field(None, min_length=1, max_length=4)
296297

297298

298-
class RcsCard(RcsCardContent, BaseRcs):
299+
class RcsCardItem(RcsCardBase):
300+
"""Model for the content of an RCS card.
301+
302+
Args:
303+
title (str): The title of the card.
304+
text (str): The text of the card.
305+
media_url (str): The media URL for the card. Can be an image or a video.
306+
suggestions (List[Union[RcsSuggestionReply, RcsSuggestionActionDial, RcsSuggestionActionViewLocation, RcsSuggestionActionShareLocation, RcsSuggestionActionOpenUrl, RcsSuggestionActionOpenUrlWebview, RcsSuggestionActionCreateCalendarEvent], Optional): A list of suggestions to include on the card. Can include up to 4 suggestions.
307+
"""
308+
309+
media_height: RcsMediaHeight
310+
311+
312+
class RcsCardMessage(RcsCardBase, BaseRcs):
299313
"""Model for an RCS card message.
300314
301315
Args:
@@ -328,7 +342,20 @@ class RcsCarousel(BaseRcs):
328342
webhook_version (WebhookVersion, Optional): Which version of the Messages API will be used to send Status Webhook messages for this particular message.
329343
"""
330344

331-
cards: List[RcsCardContent] = Field(..., min_length=1, max_length=10)
345+
cards: List[RcsCardItem] = Field(..., min_length=1, max_length=10)
346+
suggestions: Optional[
347+
List[
348+
Union[
349+
RcsSuggestionReply,
350+
RcsSuggestionActionDial,
351+
RcsSuggestionActionViewLocation,
352+
RcsSuggestionActionShareLocation,
353+
RcsSuggestionActionOpenUrl,
354+
RcsSuggestionActionOpenUrlWebview,
355+
RcsSuggestionActionCreateCalendarEvent,
356+
]
357+
]
358+
] = Field(None, min_length=1, max_length=11)
332359
rcs: Optional[RcsOptionsCarousel] = None
333360
message_type: MessageType = MessageType.CAROUSEL
334361

0 commit comments

Comments
 (0)