1010 Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
1212 Do not edit the class manually.
13- """ # noqa: E501 docstring might be too long
13+ """ # noqa: E501
1414
1515import datetime
1616import json
@@ -332,6 +332,10 @@ def sanitize_for_serialization(self, obj):
332332 else :
333333 obj_dict = obj .__dict__
334334
335+ if isinstance (obj_dict , list ):
336+ # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
337+ return self .sanitize_for_serialization (obj_dict )
338+
335339 return {key : self .sanitize_for_serialization (val ) for key , val in obj_dict .items ()}
336340
337341 def deserialize (self , response_text : str , response_type : str , content_type : Optional [str ]):
@@ -351,12 +355,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti
351355 data = json .loads (response_text )
352356 except ValueError :
353357 data = response_text
354- elif content_type . startswith ( " application/json" ):
358+ elif re . match ( r"^ application/( json|[\w!#$&.+-^_]+\+json)\s*(;|$)" , content_type , re . IGNORECASE ):
355359 if response_text == "" :
356360 data = ""
357361 else :
358362 data = json .loads (response_text )
359- elif content_type . startswith ( " text/plain" ):
363+ elif re . match ( r"^ text\/[a-z.+-]+\s*(;|$)" , content_type , re . IGNORECASE ):
360364 data = response_text
361365 else :
362366 raise ApiException (status = 0 , reason = "Unsupported content type: {0}" .format (content_type ))
@@ -458,7 +462,7 @@ def parameters_to_url_query(self, params, collection_formats):
458462 if k in collection_formats :
459463 collection_format = collection_formats [k ]
460464 if collection_format == "multi" :
461- new_params .extend ((k , str (value )) for value in v )
465+ new_params .extend ((k , quote ( str (value ) )) for value in v )
462466 else :
463467 if collection_format == "ssv" :
464468 delimiter = " "
@@ -474,7 +478,10 @@ def parameters_to_url_query(self, params, collection_formats):
474478
475479 return "&" .join (["=" .join (map (str , item )) for item in new_params ])
476480
477- def files_parameters (self , files : Dict [str , Union [str , bytes ]]):
481+ def files_parameters (
482+ self ,
483+ files : Dict [str , Union [str , bytes , List [str ], List [bytes ], Tuple [str , bytes ]]],
484+ ):
478485 """Builds form parameters.
479486
480487 :param files: File parameters.
@@ -489,6 +496,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]):
489496 elif isinstance (v , bytes ):
490497 filename = k
491498 filedata = v
499+ elif isinstance (v , tuple ):
500+ filename , filedata = v
501+ elif isinstance (v , list ):
502+ for file_param in v :
503+ params .extend (self .files_parameters ({k : file_param }))
504+ continue
492505 else :
493506 raise ValueError ("Unsupported file value" )
494507 mimetype = mimetypes .guess_type (filename )[0 ] or "application/octet-stream"
0 commit comments