github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/comm_prefs_input.py (about)

     1  # coding: utf-8
     2  
     3  """
     4      lakeFS API
     5  
     6      lakeFS HTTP API
     7  
     8      The version of the OpenAPI document: 1.0.0
     9      Contact: services@treeverse.io
    10      Generated by OpenAPI Generator (https://openapi-generator.tech)
    11  
    12      Do not edit the class manually.
    13  """  # noqa: E501
    14  
    15  
    16  from __future__ import annotations
    17  import pprint
    18  import re  # noqa: F401
    19  import json
    20  
    21  
    22  from typing import Optional
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictBool, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictBool, StrictStr
    27  
    28  class CommPrefsInput(BaseModel):
    29      """
    30      CommPrefsInput
    31      """
    32      email: Optional[StrictStr] = Field(None, description="the provided email")
    33      feature_updates: StrictBool = Field(..., alias="featureUpdates", description="user preference to receive feature updates")
    34      security_updates: StrictBool = Field(..., alias="securityUpdates", description="user preference to receive security updates")
    35      __properties = ["email", "featureUpdates", "securityUpdates"]
    36  
    37      class Config:
    38          """Pydantic configuration"""
    39          allow_population_by_field_name = True
    40          validate_assignment = True
    41  
    42      def to_str(self) -> str:
    43          """Returns the string representation of the model using alias"""
    44          return pprint.pformat(self.dict(by_alias=True))
    45  
    46      def to_json(self) -> str:
    47          """Returns the JSON representation of the model using alias"""
    48          return json.dumps(self.to_dict())
    49  
    50      @classmethod
    51      def from_json(cls, json_str: str) -> CommPrefsInput:
    52          """Create an instance of CommPrefsInput from a JSON string"""
    53          return cls.from_dict(json.loads(json_str))
    54  
    55      def to_dict(self):
    56          """Returns the dictionary representation of the model using alias"""
    57          _dict = self.dict(by_alias=True,
    58                            exclude={
    59                            },
    60                            exclude_none=True)
    61          return _dict
    62  
    63      @classmethod
    64      def from_dict(cls, obj: dict) -> CommPrefsInput:
    65          """Create an instance of CommPrefsInput from a dict"""
    66          if obj is None:
    67              return None
    68  
    69          if not isinstance(obj, dict):
    70              return CommPrefsInput.parse_obj(obj)
    71  
    72          _obj = CommPrefsInput.parse_obj({
    73              "email": obj.get("email"),
    74              "feature_updates": obj.get("featureUpdates"),
    75              "security_updates": obj.get("securityUpdates")
    76          })
    77          return _obj
    78  
    79