|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Generated by: https://openapi-generator.tech |
| 5 | +""" |
| 6 | + |
| 7 | +from __future__ import annotations |
| 8 | +import pprint |
| 9 | +import re # noqa: F401 |
| 10 | +import json |
| 11 | + |
| 12 | +from pydantic import ConfigDict, Field, StrictStr |
| 13 | +from typing import Any, ClassVar, Dict, List |
| 14 | +from regula.documentreader.webclient.gen.models.result import Result |
| 15 | +from regula.documentreader.webclient.gen.models.result_item import ResultItem |
| 16 | +from typing import Optional, Set |
| 17 | +from typing_extensions import Self |
| 18 | +from pydantic import SkipValidation, Field |
| 19 | + |
| 20 | +class BSIV2Result(ResultItem): |
| 21 | + """ |
| 22 | + BSIV2Result |
| 23 | + """ # noqa: E501 |
| 24 | + xml_buffer: SkipValidation[str] = Field(alias="XML_buffer") |
| 25 | + __properties: ClassVar[List[str]] = ["buf_length", "light", "list_idx", "page_idx", "result_type", "XML_buffer"] |
| 26 | + |
| 27 | + model_config = ConfigDict( |
| 28 | + populate_by_name=True, |
| 29 | + validate_assignment=True, |
| 30 | + protected_namespaces=(), |
| 31 | + arbitrary_types_allowed=True, |
| 32 | + use_enum_values=True |
| 33 | + ) |
| 34 | + |
| 35 | + |
| 36 | + def to_str(self) -> str: |
| 37 | + """Returns the string representation of the model using alias""" |
| 38 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 39 | + |
| 40 | + def to_json(self) -> str: |
| 41 | + """Returns the JSON representation of the model using alias""" |
| 42 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 43 | + return json.dumps(self.to_dict()) |
| 44 | + |
| 45 | + @classmethod |
| 46 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 47 | + """Create an instance of BSIV2Result from a JSON string""" |
| 48 | + return cls.from_dict(json.loads(json_str)) |
| 49 | + |
| 50 | + def to_dict(self) -> Dict[str, Any]: |
| 51 | + """Return the dictionary representation of the model using alias. |
| 52 | +
|
| 53 | + This has the following differences from calling pydantic's |
| 54 | + `self.model_dump(by_alias=True)`: |
| 55 | +
|
| 56 | + * `None` is only added to the output dict for nullable fields that |
| 57 | + were set at model initialization. Other fields with value `None` |
| 58 | + are ignored. |
| 59 | + """ |
| 60 | + excluded_fields: Set[str] = set([ |
| 61 | + ]) |
| 62 | + |
| 63 | + _dict = self.model_dump( |
| 64 | + by_alias=True, |
| 65 | + exclude=excluded_fields, |
| 66 | + exclude_none=True, |
| 67 | + ) |
| 68 | + return _dict |
| 69 | + |
| 70 | + @classmethod |
| 71 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 72 | + """Create an instance of BSIV2Result from a dict""" |
| 73 | + if obj is None: |
| 74 | + return None |
| 75 | + |
| 76 | + if not isinstance(obj, dict): |
| 77 | + return cls.model_validate(obj) |
| 78 | + |
| 79 | + _obj = cls.model_validate({ |
| 80 | + "buf_length": obj.get("buf_length"), |
| 81 | + "light": obj.get("light"), |
| 82 | + "list_idx": obj.get("list_idx"), |
| 83 | + "page_idx": obj.get("page_idx"), |
| 84 | + "result_type": obj.get("result_type"), |
| 85 | + "XML_buffer": obj.get("XML_buffer") |
| 86 | + }) |
| 87 | + return _obj |
| 88 | + |
| 89 | + |
0 commit comments