2024-08-23 16:22:29 +02:00
# coding: utf-8
"""
2026-06-24 11:10:22 +00:00
Logos Storage API
2024-08-23 16:22:29 +02:00
2026-06-24 11:10:22 +00:00
List of endpoints and interfaces available to Logos Storage API users
2024-08-23 16:22:29 +02:00
The version of the OpenAPI document : 0.0 .1
Generated by OpenAPI Generator ( https : / / openapi - generator . tech )
Do not edit the class manually .
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel , ConfigDict , Field , StrictStr
2026-06-24 11:10:22 +00:00
from typing import Any , ClassVar , Dict , List , Optional
2024-12-18 14:22:21 +01:00
from codex_api_client . models . peers_table import PeersTable
2026-06-24 11:10:22 +00:00
from codex_api_client . models . storage_version import StorageVersion
2024-08-23 16:22:29 +02:00
from typing import Optional , Set
from typing_extensions import Self
class DebugInfo ( BaseModel ) :
"""
DebugInfo
""" # noqa: E501
2025-04-23 10:59:04 +02:00
id : StrictStr = Field ( description = " Peer Identity reference as specified at https://docs.libp2p.io/concepts/fundamentals/peers/ " )
addrs : List [ StrictStr ]
spr : StrictStr = Field ( description = " Signed Peer Record (libp2p) " )
2026-06-24 11:10:22 +00:00
provider_record : Optional [ StrictStr ] = Field ( default = None , description = " Signed Peer Record (libp2p) " , alias = " providerRecord " )
2025-04-23 10:59:04 +02:00
announce_addresses : List [ StrictStr ] = Field ( alias = " announceAddresses " )
2026-06-24 11:10:22 +00:00
libp2p_pub_key : StrictStr = Field ( description = " Hex-encoded libp2p public key of the node " , alias = " libp2pPubKey " )
mix_pub_key : Optional [ StrictStr ] = Field ( default = None , description = " Hex-encoded mix public key (present only for nodes that support mix) " , alias = " mixPubKey " )
2025-04-23 10:59:04 +02:00
table : PeersTable
2026-06-24 11:10:22 +00:00
storage : StorageVersion
__properties : ClassVar [ List [ str ] ] = [ " id " , " addrs " , " spr " , " providerRecord " , " announceAddresses " , " libp2pPubKey " , " mixPubKey " , " table " , " storage " ]
2024-08-23 16:22:29 +02:00
model_config = ConfigDict (
populate_by_name = True ,
validate_assignment = True ,
protected_namespaces = ( ) ,
)
def to_str ( self ) - > str :
""" Returns the string representation of the model using alias """
return pprint . pformat ( self . model_dump ( by_alias = True ) )
def to_json ( self ) - > str :
""" Returns the JSON representation of the model using alias """
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json . dumps ( self . to_dict ( ) )
@classmethod
def from_json ( cls , json_str : str ) - > Optional [ Self ] :
""" Create an instance of DebugInfo from a JSON string """
return cls . from_dict ( json . loads ( json_str ) )
def to_dict ( self ) - > Dict [ str , Any ] :
""" Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic ' s
` self . model_dump ( by_alias = True ) ` :
* ` None ` is only added to the output dict for nullable fields that
were set at model initialization . Other fields with value ` None `
are ignored .
"""
excluded_fields : Set [ str ] = set ( [
] )
_dict = self . model_dump (
by_alias = True ,
exclude = excluded_fields ,
exclude_none = True ,
)
2024-12-18 14:22:21 +01:00
# override the default output from pydantic by calling `to_dict()` of table
if self . table :
_dict [ ' table ' ] = self . table . to_dict ( )
2026-06-24 11:10:22 +00:00
# override the default output from pydantic by calling `to_dict()` of storage
if self . storage :
_dict [ ' storage ' ] = self . storage . to_dict ( )
# set to None if mix_pub_key (nullable) is None
# and model_fields_set contains the field
if self . mix_pub_key is None and " mix_pub_key " in self . model_fields_set :
_dict [ ' mixPubKey ' ] = None
2024-08-23 16:22:29 +02:00
return _dict
@classmethod
def from_dict ( cls , obj : Optional [ Dict [ str , Any ] ] ) - > Optional [ Self ] :
""" Create an instance of DebugInfo from a dict """
if obj is None :
return None
if not isinstance ( obj , dict ) :
return cls . model_validate ( obj )
_obj = cls . model_validate ( {
" id " : obj . get ( " id " ) ,
" addrs " : obj . get ( " addrs " ) ,
2024-12-18 14:22:21 +01:00
" spr " : obj . get ( " spr " ) ,
2026-06-24 11:10:22 +00:00
" providerRecord " : obj . get ( " providerRecord " ) ,
2025-03-26 16:42:46 +01:00
" announceAddresses " : obj . get ( " announceAddresses " ) ,
2026-06-24 11:10:22 +00:00
" libp2pPubKey " : obj . get ( " libp2pPubKey " ) ,
" mixPubKey " : obj . get ( " mixPubKey " ) ,
2024-12-18 14:22:21 +01:00
" table " : PeersTable . from_dict ( obj [ " table " ] ) if obj . get ( " table " ) is not None else None ,
2026-06-24 11:10:22 +00:00
" storage " : StorageVersion . from_dict ( obj [ " storage " ] ) if obj . get ( " storage " ) is not None else None
2024-08-23 16:22:29 +02:00
} )
return _obj