2023-01-04 23:40:16 +00:00
|
|
|
from typing import Any, Literal
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
class NodeInfoServices(BaseModel):
|
|
|
|
inbound: list[str]
|
|
|
|
outbound: list[str]
|
|
|
|
|
|
|
|
|
|
|
|
class NodeInfoSoftware(BaseModel):
|
|
|
|
name: str
|
|
|
|
version: str = "unknown"
|
|
|
|
|
|
|
|
|
|
|
|
class NodeInfoUsage(BaseModel):
|
2023-01-18 17:57:28 +00:00
|
|
|
users: dict[str, int | None] | None
|
2023-01-04 23:40:16 +00:00
|
|
|
local_posts: int = Field(default=0, alias="localPosts")
|
|
|
|
|
|
|
|
|
|
|
|
class NodeInfo(BaseModel):
|
|
|
|
|
|
|
|
version: Literal["2.0"]
|
|
|
|
software: NodeInfoSoftware
|
|
|
|
protocols: list[str] | None
|
|
|
|
open_registrations: bool = Field(alias="openRegistrations")
|
|
|
|
usage: NodeInfoUsage
|
|
|
|
|
2023-01-03 17:31:11 +00:00
|
|
|
metadata: dict[str, Any] | None
|
2023-01-04 23:40:16 +00:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
extra = "ignore"
|