11from collections .abc import Mapping
22from io import BytesIO
3- from typing import Any , TypeVar , Union
3+ from typing import Any , TypeVar
44
55from attrs import define as _attrs_define
66from attrs import field as _attrs_field
77
8- from ..types import UNSET , File , Unset
8+ from ..types import File
99
1010T = TypeVar ("T" , bound = "PostBodyMultipartBody" )
1111
@@ -15,20 +15,23 @@ class PostBodyMultipartBody:
1515 """
1616 Attributes:
1717 a_string (str):
18- file (File): For the sake of this test, include a file name and content type. The payload should also be valid
19- UTF-8.
20- description (Union[Unset, str]):
18+ files (list[File]):
19+ description (str):
2120 """
2221
2322 a_string : str
24- file : File
25- description : Union [ Unset , str ] = UNSET
23+ files : list [ File ]
24+ description : str
2625 additional_properties : dict [str , Any ] = _attrs_field (init = False , factory = dict )
2726
2827 def to_dict (self ) -> dict [str , Any ]:
2928 a_string = self .a_string
3029
31- file = self .file .to_tuple ()
30+ files = []
31+ for files_item_data in self .files :
32+ files_item = files_item_data .to_tuple ()
33+
34+ files .append (files_item )
3235
3336 description = self .description
3437
@@ -37,11 +40,10 @@ def to_dict(self) -> dict[str, Any]:
3740 field_dict .update (
3841 {
3942 "a_string" : a_string ,
40- "file" : file ,
43+ "files" : files ,
44+ "description" : description ,
4145 }
4246 )
43- if description is not UNSET :
44- field_dict ["description" ] = description
4547
4648 return field_dict
4749
@@ -50,10 +52,10 @@ def to_multipart(self) -> list[tuple[str, Any]]:
5052
5153 field_list .append (("a_string" , (None , str (self .a_string ).encode (), "text/plain" )))
5254
53- field_list .append (("file" , self .file .to_tuple ()))
55+ for files_item_element in self .files :
56+ field_list .append (("files" , files_item_element .to_tuple ()))
5457
55- if not isinstance (self .description , Unset ):
56- field_list .append (("description" , (None , str (self .description ).encode (), "text/plain" )))
58+ field_list .append (("description" , (None , str (self .description ).encode (), "text/plain" )))
5759
5860 for prop_name , prop in self .additional_properties .items ():
5961 field_list .append ((prop_name , (None , str (prop ).encode (), "text/plain" )))
@@ -65,13 +67,18 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
6567 d = dict (src_dict )
6668 a_string = d .pop ("a_string" )
6769
68- file = File (payload = BytesIO (d .pop ("file" )))
70+ files = []
71+ _files = d .pop ("files" )
72+ for files_item_data in _files :
73+ files_item = File (payload = BytesIO (files_item_data ))
74+
75+ files .append (files_item )
6976
70- description = d .pop ("description" , UNSET )
77+ description = d .pop ("description" )
7178
7279 post_body_multipart_body = cls (
7380 a_string = a_string ,
74- file = file ,
81+ files = files ,
7582 description = description ,
7683 )
7784
0 commit comments