2020
2121from pydantic import BaseModel , ConfigDict , Field , StrictInt , StrictStr
2222from typing import Any , ClassVar , Dict , List
23- from messente_api .models .whats_app_parameter import WhatsAppParameter
2423from typing import Optional , Set
2524from typing_extensions import Self
2625
@@ -31,7 +30,7 @@ class ViberVideo(BaseModel):
3130 url : StrictStr = Field (description = "URL pointing to the video resource." )
3231 thumbnail : StrictStr = Field (description = "URL pointing to the video thumbnail resource." )
3332 file_size : StrictInt = Field (description = "Size of the video file in bytes. Cannot be larger than 200MB." )
34- duration : List [ WhatsAppParameter ] = Field (description = "Duration of the video in seconds. Cannot be longer than 600 seconds." )
33+ duration : StrictInt = Field (description = "Duration of the video in seconds. Cannot be longer than 600 seconds." )
3534 additional_properties : Dict [str , Any ] = {}
3635 __properties : ClassVar [List [str ]] = ["url" , "thumbnail" , "file_size" , "duration" ]
3736
@@ -76,13 +75,6 @@ def to_dict(self) -> Dict[str, Any]:
7675 exclude = excluded_fields ,
7776 exclude_none = True ,
7877 )
79- # override the default output from pydantic by calling `to_dict()` of each item in duration (list)
80- _items = []
81- if self .duration :
82- for _item in self .duration :
83- if _item :
84- _items .append (_item .to_dict ())
85- _dict ['duration' ] = _items
8678 # puts key-value pairs in additional_properties in the top level
8779 if self .additional_properties is not None :
8880 for _key , _value in self .additional_properties .items ():
@@ -103,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
10395 "url" : obj .get ("url" ),
10496 "thumbnail" : obj .get ("thumbnail" ),
10597 "file_size" : obj .get ("file_size" ),
106- "duration" : [ WhatsAppParameter . from_dict ( _item ) for _item in obj [ "duration" ]] if obj .get ("duration" ) is not None else None
98+ "duration" : obj .get ("duration" )
10799 })
108100 # store additional fields in additional_properties
109101 for _key in obj .keys ():
0 commit comments