pub struct Client { /* private fields */ }Expand description
Top-level Bee API client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(url: &str) -> Result<Self, Error>
pub fn new(url: &str) -> Result<Self, Error>
Construct a client from a base URL (e.g. "http://localhost:1633").
A trailing slash is appended if missing so relative paths resolve
correctly.
Sourcepub fn with_http_client(url: &str, http: Client) -> Result<Self, Error>
pub fn with_http_client(url: &str, http: Client) -> Result<Self, Error>
Construct a client with a caller-provided reqwest::Client.
Use this to share a connection pool with other code or to set
custom timeouts / TLS roots.
Sourcepub fn with_token(url: &str, token: &str) -> Result<Self, Error>
pub fn with_token(url: &str, token: &str) -> Result<Self, Error>
Construct a client that sends Authorization: Bearer <token>
on every request. Convenience for talking to a Bee node running
with restricted-mode auth.
For more control (custom timeouts, TLS roots, additional
headers), build a reqwest::Client yourself and pass it via
Client::with_http_client.
Sourcepub async fn ping(&self) -> Result<Duration, Error>
pub async fn ping(&self) -> Result<Duration, Error>
GET /health round-trip latency. Useful for connection-status
indicators in dashboards and TUIs. Returns the elapsed
Duration regardless of body — the response is not parsed.
Sourcepub fn file(&self) -> FileApi
pub fn file(&self) -> FileApi
Sub-service: file / data / chunk / SOC / feed / collection uploads and downloads.
Sourcepub fn postage(&self) -> PostageApi
pub fn postage(&self) -> PostageApi
Sub-service: postage batch CRUD + stamp metadata. Stamp math
helpers live as free functions in crate::postage.
Sourcepub fn debug(&self) -> DebugApi
pub fn debug(&self) -> DebugApi
Sub-service: debug / operator endpoints (health, versions, peers, accounting, chequebook, stake).
Sourcepub fn api(&self) -> ApiService
pub fn api(&self) -> ApiService
Sub-service: generic /api/* endpoints (pin, tag, stewardship,
grantee, envelope).