|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + LINE Messaging API |
| 5 | +
|
| 6 | + This document describes LINE Messaging API. # noqa: E501 |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 0.0.1 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +""" |
| 13 | + |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import json |
| 19 | + |
| 20 | + |
| 21 | +from typing import Optional |
| 22 | +from pydantic.v1 import Field, StrictStr, constr |
| 23 | +from linebot.v3.messaging.models.imagemap_action import ImagemapAction |
| 24 | +from linebot.v3.messaging.models.imagemap_area import ImagemapArea |
| 25 | + |
| 26 | +class ClipboardImagemapAction(ImagemapAction): |
| 27 | + """ |
| 28 | + ClipboardImagemapAction |
| 29 | + https://developers.line.biz/en/reference/messaging-api/#imagemap-clipboard-action-object |
| 30 | + """ |
| 31 | + clipboard_text: constr(strict=True, max_length=1000, min_length=1) = Field(..., alias="clipboardText", description="Text that is copied to the clipboard. Max character limit: 1000 ") |
| 32 | + label: Optional[StrictStr] = None |
| 33 | + type: str = "clipboard" |
| 34 | + |
| 35 | + __properties = ["type", "area", "clipboardText", "label"] |
| 36 | + |
| 37 | + class Config: |
| 38 | + """Pydantic configuration""" |
| 39 | + allow_population_by_field_name = True |
| 40 | + validate_assignment = True |
| 41 | + |
| 42 | + def to_str(self) -> str: |
| 43 | + """Returns the string representation of the model using alias""" |
| 44 | + return pprint.pformat(self.dict(by_alias=True)) |
| 45 | + |
| 46 | + def to_json(self) -> str: |
| 47 | + """Returns the JSON representation of the model using alias""" |
| 48 | + return json.dumps(self.to_dict()) |
| 49 | + |
| 50 | + @classmethod |
| 51 | + def from_json(cls, json_str: str) -> ClipboardImagemapAction: |
| 52 | + """Create an instance of ClipboardImagemapAction from a JSON string""" |
| 53 | + return cls.from_dict(json.loads(json_str)) |
| 54 | + |
| 55 | + def to_dict(self): |
| 56 | + """Returns the dictionary representation of the model using alias""" |
| 57 | + _dict = self.dict(by_alias=True, |
| 58 | + exclude={ |
| 59 | + }, |
| 60 | + exclude_none=True) |
| 61 | + # override the default output from pydantic.v1 by calling `to_dict()` of area |
| 62 | + if self.area: |
| 63 | + _dict['area'] = self.area.to_dict() |
| 64 | + return _dict |
| 65 | + |
| 66 | + @classmethod |
| 67 | + def from_dict(cls, obj: dict) -> ClipboardImagemapAction: |
| 68 | + """Create an instance of ClipboardImagemapAction from a dict""" |
| 69 | + if obj is None: |
| 70 | + return None |
| 71 | + |
| 72 | + if not isinstance(obj, dict): |
| 73 | + return ClipboardImagemapAction.parse_obj(obj) |
| 74 | + |
| 75 | + _obj = ClipboardImagemapAction.parse_obj({ |
| 76 | + "type": obj.get("type"), |
| 77 | + "area": ImagemapArea.from_dict(obj.get("area")) if obj.get("area") is not None else None, |
| 78 | + "clipboard_text": obj.get("clipboardText"), |
| 79 | + "label": obj.get("label") |
| 80 | + }) |
| 81 | + return _obj |
| 82 | + |
0 commit comments