nildb.base_client

Base NIL DB client implementation.

class NilDbBaseClientOptions(*, about: ReadAboutNodeResponse, base_url: str)[source]

Bases: BaseModel

Options for NIL DB base client.

about: ReadAboutNodeResponse
base_url: str
class AuthenticatedRequestOptions(*, path: str, token: str | None = None, method: str = 'GET', body: Dict[str, Any] | None = None)[source]

Bases: BaseModel

Options for authenticated requests.

path: str
token: str | None
method: str
body: Dict[str, Any] | None
class NilDbBaseClient(options: NilDbBaseClientOptions)[source]

Bases: object

Base NIL DB client implementation.

property name: str

Get the client name (last 4 chars of public key).

property id: str

Get the client ID (DID).

async close()[source]

Close the client and cleanup resources.

async request(options: AuthenticatedRequestOptions, response_schema: type[T] | None = None) T[source]

Make an authenticated request to the NilDb API.

async about_node() ReadAboutNodeResponse[source]

Retrieve comprehensive node information including version and configuration.

async health_check() str[source]

Check node health status.

async __aenter__()[source]

Async context manager entry.

async __aexit__(exc_type, exc_val, exc_tb)[source]

Async context manager exit.