github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/user.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, StrictInt, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictInt, StrictStr
    27  
    28  class User(BaseModel):
    29      """
    30      User
    31      """
    32      id: StrictStr = Field(..., description="A unique identifier for the user. Cannot be edited.")
    33      creation_date: StrictInt = Field(..., description="Unix Epoch in seconds")
    34      friendly_name: Optional[StrictStr] = Field(None, description="A shorter name for the user than the id. Unlike id it does not identify the user (it might not be unique). Used in some places in the UI. ")
    35      email: Optional[StrictStr] = Field(None, description="The email address of the user. If API authentication is enabled, this field is mandatory and will be invited to login. If API authentication is disabled, this field will be ignored. All current APIAuthenticators require the email to be  lowercase and unique, although custom authenticators may not enforce this. ")
    36      __properties = ["id", "creation_date", "friendly_name", "email"]
    37  
    38      class Config:
    39          """Pydantic configuration"""
    40          allow_population_by_field_name = True
    41          validate_assignment = True
    42  
    43      def to_str(self) -> str:
    44          """Returns the string representation of the model using alias"""
    45          return pprint.pformat(self.dict(by_alias=True))
    46  
    47      def to_json(self) -> str:
    48          """Returns the JSON representation of the model using alias"""
    49          return json.dumps(self.to_dict())
    50  
    51      @classmethod
    52      def from_json(cls, json_str: str) -> User:
    53          """Create an instance of User from a JSON string"""
    54          return cls.from_dict(json.loads(json_str))
    55  
    56      def to_dict(self):
    57          """Returns the dictionary representation of the model using alias"""
    58          _dict = self.dict(by_alias=True,
    59                            exclude={
    60                            },
    61                            exclude_none=True)
    62          return _dict
    63  
    64      @classmethod
    65      def from_dict(cls, obj: dict) -> User:
    66          """Create an instance of User from a dict"""
    67          if obj is None:
    68              return None
    69  
    70          if not isinstance(obj, dict):
    71              return User.parse_obj(obj)
    72  
    73          _obj = User.parse_obj({
    74              "id": obj.get("id"),
    75              "creation_date": obj.get("creation_date"),
    76              "friendly_name": obj.get("friendly_name"),
    77              "email": obj.get("email")
    78          })
    79          return _obj
    80  
    81