75 lines
1.3 KiB
Python
75 lines
1.3 KiB
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
|
|
|
|
class StatusResponse(BaseModel):
|
|
online: bool
|
|
transport_enabled: bool
|
|
identity_hash: str
|
|
uptime_seconds: float
|
|
announced_count: int
|
|
path_count: int
|
|
|
|
|
|
class NodeInfo(BaseModel):
|
|
destination_hash: str
|
|
app_name: Optional[str] = None
|
|
aspects: Optional[str] = None
|
|
last_heard: Optional[float] = None
|
|
hops: Optional[int] = None
|
|
|
|
|
|
class NodesResponse(BaseModel):
|
|
nodes: list[NodeInfo]
|
|
total: int
|
|
|
|
|
|
class TopologyLink(BaseModel):
|
|
source: str
|
|
target: str
|
|
hops: int
|
|
active: bool
|
|
|
|
|
|
class TopologyResponse(BaseModel):
|
|
nodes: list[NodeInfo]
|
|
links: list[TopologyLink]
|
|
node_count: int
|
|
link_count: int
|
|
|
|
|
|
class MessageIn(BaseModel):
|
|
destination_hash: str
|
|
content: str
|
|
title: str = ""
|
|
|
|
|
|
class MessageOut(BaseModel):
|
|
id: str
|
|
direction: str # inbound | outbound
|
|
sender_hash: str
|
|
recipient_hash: str
|
|
title: str
|
|
content: str
|
|
status: str # pending | delivered | failed
|
|
timestamp: float
|
|
|
|
|
|
class MessagesResponse(BaseModel):
|
|
messages: list[MessageOut]
|
|
total: int
|
|
|
|
|
|
class IdentityResponse(BaseModel):
|
|
identity_hash: str
|
|
public_key_hex: str
|
|
|
|
|
|
class AnnounceResponse(BaseModel):
|
|
announced: bool
|
|
identity_hash: str
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: str = "ok"
|