-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Widgets] feat: add image carousel row
- Loading branch information
1 parent
39fdb2d
commit 3e3f4e4
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
from typing import List, Dict | ||
|
||
from pydantic import BaseModel | ||
|
||
from kenar.widgets.base import BaseWidget | ||
|
||
|
||
class ImageCarouselRow(BaseModel, BaseWidget): | ||
class ImageCarouselRowItem(BaseModel): | ||
image_url: str | ||
description: str | ||
|
||
items: List[ImageCarouselRowItem] | ||
has_divider: bool = False | ||
|
||
|
||
def serialize_model(self) -> dict: | ||
return { | ||
"widget_type": "IMAGE_CAROUSEL_ROW", | ||
"data": {"@type": "type.googleapis.com/widgets.ImageCarouselRowData"} | self.dict(), | ||
} | ||
|
||
@classmethod | ||
def deserialize_model(cls, data: Dict): | ||
widget_data = data.get("data", {}) | ||
widget_data.pop("@type", None) | ||
return cls.parse_obj(widget_data) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
setup( | ||
name='Kenar', | ||
version='0.5.7', | ||
version='0.5.8', | ||
author='Nastaran Alipour', | ||
author_email='[email protected]', | ||
description='facilitate using kenar divar APIs', | ||
|