diff --git a/line-openapi b/line-openapi index b4589bc6..9c6ae632 160000 --- a/line-openapi +++ b/line-openapi @@ -1 +1 @@ -Subproject commit b4589bc62a4c1a42016a08e2b8945154e10e7193 +Subproject commit 9c6ae632250038aab446aaad9da5e29b533708e2 diff --git a/linebot/v3/webhooks/__init__.py b/linebot/v3/webhooks/__init__.py index e5d444f0..2e5710d9 100644 --- a/linebot/v3/webhooks/__init__.py +++ b/linebot/v3/webhooks/__init__.py @@ -34,7 +34,6 @@ # import models into sdk package from linebot.v3.webhooks.models.account_link_event import AccountLinkEvent -from linebot.v3.webhooks.models.action_result import ActionResult from linebot.v3.webhooks.models.activated_event import ActivatedEvent from linebot.v3.webhooks.models.all_mentionee import AllMentionee from linebot.v3.webhooks.models.attached_module_content import AttachedModuleContent @@ -65,7 +64,6 @@ from linebot.v3.webhooks.models.left_members import LeftMembers from linebot.v3.webhooks.models.left_membership_content import LeftMembershipContent from linebot.v3.webhooks.models.link_content import LinkContent -from linebot.v3.webhooks.models.link_things_content import LinkThingsContent from linebot.v3.webhooks.models.location_message_content import LocationMessageContent from linebot.v3.webhooks.models.member_joined_event import MemberJoinedEvent from linebot.v3.webhooks.models.member_left_event import MemberLeftEvent @@ -83,15 +81,10 @@ from linebot.v3.webhooks.models.postback_event import PostbackEvent from linebot.v3.webhooks.models.renewed_membership_content import RenewedMembershipContent from linebot.v3.webhooks.models.room_source import RoomSource -from linebot.v3.webhooks.models.scenario_result import ScenarioResult -from linebot.v3.webhooks.models.scenario_result_things_content import ScenarioResultThingsContent from linebot.v3.webhooks.models.source import Source from linebot.v3.webhooks.models.sticker_message_content import StickerMessageContent from linebot.v3.webhooks.models.text_message_content import TextMessageContent -from linebot.v3.webhooks.models.things_content import ThingsContent -from linebot.v3.webhooks.models.things_event import ThingsEvent from linebot.v3.webhooks.models.unfollow_event import UnfollowEvent -from linebot.v3.webhooks.models.unlink_things_content import UnlinkThingsContent from linebot.v3.webhooks.models.unsend_detail import UnsendDetail from linebot.v3.webhooks.models.unsend_event import UnsendEvent from linebot.v3.webhooks.models.user_mentionee import UserMentionee diff --git a/linebot/v3/webhooks/models/__init__.py b/linebot/v3/webhooks/models/__init__.py index 779719ce..5fd92f10 100644 --- a/linebot/v3/webhooks/models/__init__.py +++ b/linebot/v3/webhooks/models/__init__.py @@ -15,7 +15,6 @@ # import models into model package from linebot.v3.webhooks.models.account_link_event import AccountLinkEvent -from linebot.v3.webhooks.models.action_result import ActionResult from linebot.v3.webhooks.models.activated_event import ActivatedEvent from linebot.v3.webhooks.models.all_mentionee import AllMentionee from linebot.v3.webhooks.models.attached_module_content import AttachedModuleContent @@ -46,7 +45,6 @@ from linebot.v3.webhooks.models.left_members import LeftMembers from linebot.v3.webhooks.models.left_membership_content import LeftMembershipContent from linebot.v3.webhooks.models.link_content import LinkContent -from linebot.v3.webhooks.models.link_things_content import LinkThingsContent from linebot.v3.webhooks.models.location_message_content import LocationMessageContent from linebot.v3.webhooks.models.member_joined_event import MemberJoinedEvent from linebot.v3.webhooks.models.member_left_event import MemberLeftEvent @@ -64,15 +62,10 @@ from linebot.v3.webhooks.models.postback_event import PostbackEvent from linebot.v3.webhooks.models.renewed_membership_content import RenewedMembershipContent from linebot.v3.webhooks.models.room_source import RoomSource -from linebot.v3.webhooks.models.scenario_result import ScenarioResult -from linebot.v3.webhooks.models.scenario_result_things_content import ScenarioResultThingsContent from linebot.v3.webhooks.models.source import Source from linebot.v3.webhooks.models.sticker_message_content import StickerMessageContent from linebot.v3.webhooks.models.text_message_content import TextMessageContent -from linebot.v3.webhooks.models.things_content import ThingsContent -from linebot.v3.webhooks.models.things_event import ThingsEvent from linebot.v3.webhooks.models.unfollow_event import UnfollowEvent -from linebot.v3.webhooks.models.unlink_things_content import UnlinkThingsContent from linebot.v3.webhooks.models.unsend_detail import UnsendDetail from linebot.v3.webhooks.models.unsend_event import UnsendEvent from linebot.v3.webhooks.models.user_mentionee import UserMentionee diff --git a/linebot/v3/webhooks/models/action_result.py b/linebot/v3/webhooks/models/action_result.py deleted file mode 100644 index 3d3fa01f..00000000 --- a/linebot/v3/webhooks/models/action_result.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic.v1 import BaseModel, Field, StrictStr, validator - -class ActionResult(BaseModel): - """ - ActionResult - """ - type: StrictStr = Field(...) - data: Optional[StrictStr] = Field(None, description="Base64-encoded binary data") - - __properties = ["type", "data"] - - @validator('type') - def type_validate_enum(cls, value): - """Validates the enum""" - if value not in ('void', 'binary'): - raise ValueError("must be one of enum values ('void', 'binary')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ActionResult: - """Create an instance of ActionResult from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ActionResult: - """Create an instance of ActionResult from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ActionResult.parse_obj(obj) - - _obj = ActionResult.parse_obj({ - "type": obj.get("type"), - "data": obj.get("data") - }) - return _obj - diff --git a/linebot/v3/webhooks/models/event.py b/linebot/v3/webhooks/models/event.py index 0226d6fc..91db398c 100644 --- a/linebot/v3/webhooks/models/event.py +++ b/linebot/v3/webhooks/models/event.py @@ -64,7 +64,6 @@ class Config: 'message': 'MessageEvent', 'module': 'ModuleEvent', 'postback': 'PostbackEvent', - 'things': 'ThingsEvent', 'unfollow': 'UnfollowEvent', 'unsend': 'UnsendEvent', 'videoPlayComplete': 'VideoPlayCompleteEvent' @@ -88,7 +87,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Union(AccountLinkEvent, ActivatedEvent, BeaconEvent, BotResumedEvent, BotSuspendedEvent, DeactivatedEvent, FollowEvent, JoinEvent, LeaveEvent, MemberJoinedEvent, MemberLeftEvent, MembershipEvent, MessageEvent, ModuleEvent, PnpDeliveryCompletionEvent, PostbackEvent, ThingsEvent, UnfollowEvent, UnsendEvent, VideoPlayCompleteEvent): + def from_json(cls, json_str: str) -> Union(AccountLinkEvent, ActivatedEvent, BeaconEvent, BotResumedEvent, BotSuspendedEvent, DeactivatedEvent, FollowEvent, JoinEvent, LeaveEvent, MemberJoinedEvent, MemberLeftEvent, MembershipEvent, MessageEvent, ModuleEvent, PnpDeliveryCompletionEvent, PostbackEvent, UnfollowEvent, UnsendEvent, VideoPlayCompleteEvent): """Create an instance of Event from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -107,7 +106,7 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Union(AccountLinkEvent, ActivatedEvent, BeaconEvent, BotResumedEvent, BotSuspendedEvent, DeactivatedEvent, FollowEvent, JoinEvent, LeaveEvent, MemberJoinedEvent, MemberLeftEvent, MembershipEvent, MessageEvent, ModuleEvent, PnpDeliveryCompletionEvent, PostbackEvent, ThingsEvent, UnfollowEvent, UnsendEvent, VideoPlayCompleteEvent): + def from_dict(cls, obj: dict) -> Union(AccountLinkEvent, ActivatedEvent, BeaconEvent, BotResumedEvent, BotSuspendedEvent, DeactivatedEvent, FollowEvent, JoinEvent, LeaveEvent, MemberJoinedEvent, MemberLeftEvent, MembershipEvent, MessageEvent, ModuleEvent, PnpDeliveryCompletionEvent, PostbackEvent, UnfollowEvent, UnsendEvent, VideoPlayCompleteEvent): """Create an instance of Event from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) diff --git a/linebot/v3/webhooks/models/link_things_content.py b/linebot/v3/webhooks/models/link_things_content.py deleted file mode 100644 index 88160cdc..00000000 --- a/linebot/v3/webhooks/models/link_things_content.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic.v1 import Field, StrictStr -from linebot.v3.webhooks.models.things_content import ThingsContent - -class LinkThingsContent(ThingsContent): - """ - LinkThingsContent - """ - device_id: StrictStr = Field(..., alias="deviceId", description="Device ID of the device that has been linked with LINE.") - type: str = "link" - - __properties = ["type", "deviceId"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> LinkThingsContent: - """Create an instance of LinkThingsContent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> LinkThingsContent: - """Create an instance of LinkThingsContent from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return LinkThingsContent.parse_obj(obj) - - _obj = LinkThingsContent.parse_obj({ - "type": obj.get("type"), - "device_id": obj.get("deviceId") - }) - return _obj - diff --git a/linebot/v3/webhooks/models/scenario_result.py b/linebot/v3/webhooks/models/scenario_result.py deleted file mode 100644 index 6e84fc44..00000000 --- a/linebot/v3/webhooks/models/scenario_result.py +++ /dev/null @@ -1,94 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, conlist -from linebot.v3.webhooks.models.action_result import ActionResult - -class ScenarioResult(BaseModel): - """ - ScenarioResult - https://developers.line.biz/en/reference/messaging-api/#scenario-result-event - """ - scenario_id: Optional[StrictStr] = Field(None, alias="scenarioId", description="Scenario ID executed") - revision: Optional[StrictInt] = Field(None, description="Revision number of the scenario set containing the executed scenario") - start_time: StrictInt = Field(..., alias="startTime", description="Timestamp for when execution of scenario action started (milliseconds, LINE app time)") - end_time: StrictInt = Field(..., alias="endTime", description="Timestamp for when execution of scenario was completed (milliseconds, LINE app time)") - result_code: StrictStr = Field(..., alias="resultCode", description="Scenario execution completion status") - action_results: Optional[conlist(ActionResult)] = Field(None, alias="actionResults", description="Execution result of individual operations specified in action. Only included when things.result.resultCode is success.") - ble_notification_payload: Optional[StrictStr] = Field(None, alias="bleNotificationPayload", description="Data contained in notification.") - error_reason: Optional[StrictStr] = Field(None, alias="errorReason", description="Error reason.") - - __properties = ["scenarioId", "revision", "startTime", "endTime", "resultCode", "actionResults", "bleNotificationPayload", "errorReason"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ScenarioResult: - """Create an instance of ScenarioResult from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic.v1 by calling `to_dict()` of each item in action_results (list) - _items = [] - if self.action_results: - for _item in self.action_results: - if _item: - _items.append(_item.to_dict()) - _dict['actionResults'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ScenarioResult: - """Create an instance of ScenarioResult from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ScenarioResult.parse_obj(obj) - - _obj = ScenarioResult.parse_obj({ - "scenario_id": obj.get("scenarioId"), - "revision": obj.get("revision"), - "start_time": obj.get("startTime"), - "end_time": obj.get("endTime"), - "result_code": obj.get("resultCode"), - "action_results": [ActionResult.from_dict(_item) for _item in obj.get("actionResults")] if obj.get("actionResults") is not None else None, - "ble_notification_payload": obj.get("bleNotificationPayload"), - "error_reason": obj.get("errorReason") - }) - return _obj - diff --git a/linebot/v3/webhooks/models/scenario_result_things_content.py b/linebot/v3/webhooks/models/scenario_result_things_content.py deleted file mode 100644 index 5e53afad..00000000 --- a/linebot/v3/webhooks/models/scenario_result_things_content.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic.v1 import Field, StrictStr -from linebot.v3.webhooks.models.scenario_result import ScenarioResult -from linebot.v3.webhooks.models.things_content import ThingsContent - -class ScenarioResultThingsContent(ThingsContent): - """ - ScenarioResultThingsContent - """ - device_id: StrictStr = Field(..., alias="deviceId", description="Device ID of the device that has been linked with LINE.") - result: ScenarioResult = Field(...) - type: str = "scenarioResult" - - __properties = ["type", "deviceId", "result"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ScenarioResultThingsContent: - """Create an instance of ScenarioResultThingsContent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic.v1 by calling `to_dict()` of result - if self.result: - _dict['result'] = self.result.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ScenarioResultThingsContent: - """Create an instance of ScenarioResultThingsContent from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ScenarioResultThingsContent.parse_obj(obj) - - _obj = ScenarioResultThingsContent.parse_obj({ - "type": obj.get("type"), - "device_id": obj.get("deviceId"), - "result": ScenarioResult.from_dict(obj.get("result")) if obj.get("result") is not None else None - }) - return _obj - diff --git a/linebot/v3/webhooks/models/things_content.py b/linebot/v3/webhooks/models/things_content.py deleted file mode 100644 index 4e05d60b..00000000 --- a/linebot/v3/webhooks/models/things_content.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json -import linebot.v3.webhooks.models - - -from typing import Union -from pydantic.v1 import BaseModel, Field, StrictStr - -class ThingsContent(BaseModel): - """ - ThingsContent - """ - type: StrictStr = Field(..., description="Type") - - __properties = ["type"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - # JSON field name that stores the object type - __discriminator_property_name = 'type' - - # discriminator mappings - __discriminator_value_class_map = { - 'link': 'LinkThingsContent', - 'scenarioResult': 'ScenarioResultThingsContent', - 'unlink': 'UnlinkThingsContent' - } - - @classmethod - def get_discriminator_value(cls, obj: dict) -> str: - """Returns the discriminator value (object type) of the data""" - discriminator_value = obj[cls.__discriminator_property_name] - if discriminator_value: - return cls.__discriminator_value_class_map.get(discriminator_value) - else: - return None - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Union(LinkThingsContent, ScenarioResultThingsContent, UnlinkThingsContent): - """Create an instance of ThingsContent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Union(LinkThingsContent, ScenarioResultThingsContent, UnlinkThingsContent): - """Create an instance of ThingsContent from a dict""" - # look up the object type based on discriminator mapping - object_type = cls.get_discriminator_value(obj) - if object_type: - klass = getattr(linebot.v3.webhooks.models, object_type) - return klass.from_dict(obj) - else: - raise ValueError("ThingsContent failed to lookup discriminator value from " + - json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + - ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) - diff --git a/linebot/v3/webhooks/models/things_event.py b/linebot/v3/webhooks/models/things_event.py deleted file mode 100644 index 3c9d755f..00000000 --- a/linebot/v3/webhooks/models/things_event.py +++ /dev/null @@ -1,94 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic.v1 import Field, StrictStr -from linebot.v3.webhooks.models.delivery_context import DeliveryContext -from linebot.v3.webhooks.models.event import Event -from linebot.v3.webhooks.models.event_mode import EventMode -from linebot.v3.webhooks.models.source import Source -from linebot.v3.webhooks.models.things_content import ThingsContent - -class ThingsEvent(Event): - """ - Indicates that a user linked a device with LINE. - """ - reply_token: StrictStr = Field(..., alias="replyToken", description="Reply token used to send reply message to this event") - things: ThingsContent = Field(...) - type: str = "things" - - __properties = ["type", "source", "timestamp", "mode", "webhookEventId", "deliveryContext", "replyToken", "things"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ThingsEvent: - """Create an instance of ThingsEvent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic.v1 by calling `to_dict()` of source - if self.source: - _dict['source'] = self.source.to_dict() - # override the default output from pydantic.v1 by calling `to_dict()` of delivery_context - if self.delivery_context: - _dict['deliveryContext'] = self.delivery_context.to_dict() - # override the default output from pydantic.v1 by calling `to_dict()` of things - if self.things: - _dict['things'] = self.things.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ThingsEvent: - """Create an instance of ThingsEvent from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ThingsEvent.parse_obj(obj) - - _obj = ThingsEvent.parse_obj({ - "type": obj.get("type"), - "source": Source.from_dict(obj.get("source")) if obj.get("source") is not None else None, - "timestamp": obj.get("timestamp"), - "mode": obj.get("mode"), - "webhook_event_id": obj.get("webhookEventId"), - "delivery_context": DeliveryContext.from_dict(obj.get("deliveryContext")) if obj.get("deliveryContext") is not None else None, - "reply_token": obj.get("replyToken"), - "things": ThingsContent.from_dict(obj.get("things")) if obj.get("things") is not None else None - }) - return _obj - diff --git a/linebot/v3/webhooks/models/unlink_things_content.py b/linebot/v3/webhooks/models/unlink_things_content.py deleted file mode 100644 index cf6ec5e4..00000000 --- a/linebot/v3/webhooks/models/unlink_things_content.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding: utf-8 - -""" - Webhook Type Definition - - Webhook event definition of the LINE Messaging API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic.v1 import Field, StrictStr -from linebot.v3.webhooks.models.things_content import ThingsContent - -class UnlinkThingsContent(ThingsContent): - """ - UnlinkThingsContent - """ - device_id: StrictStr = Field(..., alias="deviceId", description="Device ID of the device that has been linked with LINE.") - type: str = "unlink" - - __properties = ["type", "deviceId"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> UnlinkThingsContent: - """Create an instance of UnlinkThingsContent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> UnlinkThingsContent: - """Create an instance of UnlinkThingsContent from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return UnlinkThingsContent.parse_obj(obj) - - _obj = UnlinkThingsContent.parse_obj({ - "type": obj.get("type"), - "device_id": obj.get("deviceId") - }) - return _obj -