pub struct Network { /* private fields */ }Implementations§
Source§impl Network
impl Network
pub fn id(&self) -> &str
pub fn name(&self) -> &str
pub fn is_default(&self) -> bool
pub fn info(&self) -> &NetworkInfo
pub fn client(&self) -> &HeyoClient
Sourcepub async fn create(
options: NetworkCreateOptions,
client_options: HeyoClientOptions,
) -> Result<Self, HeyoError>
pub async fn create( options: NetworkCreateOptions, client_options: HeyoClientOptions, ) -> Result<Self, HeyoError>
POST /networks — create a named network.
Sourcepub async fn list(
client_options: HeyoClientOptions,
) -> Result<Vec<NetworkInfo>, HeyoError>
pub async fn list( client_options: HeyoClientOptions, ) -> Result<Vec<NetworkInfo>, HeyoError>
GET /networks — list networks for the caller’s account (lazily
creates the default network so the result is never empty).
Sourcepub async fn get(
id: &str,
client_options: HeyoClientOptions,
) -> Result<Self, HeyoError>
pub async fn get( id: &str, client_options: HeyoClientOptions, ) -> Result<Self, HeyoError>
GET /networks/{id}.
Sourcepub async fn default_for_me(
client_options: HeyoClientOptions,
) -> Result<Self, HeyoError>
pub async fn default_for_me( client_options: HeyoClientOptions, ) -> Result<Self, HeyoError>
GET /networks/me — the caller’s default network, lazily created.
Sourcepub async fn delete_by_id(
id: &str,
client_options: HeyoClientOptions,
) -> Result<(), HeyoError>
pub async fn delete_by_id( id: &str, client_options: HeyoClientOptions, ) -> Result<(), HeyoError>
DELETE /networks/{id} — refuses the default network (400).
pub async fn delete(self) -> Result<(), HeyoError>
Sourcepub async fn update(
&mut self,
options: NetworkUpdateOptions,
) -> Result<(), HeyoError>
pub async fn update( &mut self, options: NetworkUpdateOptions, ) -> Result<(), HeyoError>
PATCH /networks/{id} — rename or change description. The default
network refuses rename attempts (server returns 400).
Sourcepub async fn list_services(
client_options: HeyoClientOptions,
) -> Result<Vec<NetworkService>, HeyoError>
pub async fn list_services( client_options: HeyoClientOptions, ) -> Result<Vec<NetworkService>, HeyoError>
GET /networks/me/services — services registered in the caller’s
default network (each a name:port route). Use dial_service
to resolve one to a live connection ticket.
Sourcepub async fn dial_service(
name: &str,
port: u16,
client_options: HeyoClientOptions,
) -> Result<ServiceRoute, HeyoError>
pub async fn dial_service( name: &str, port: u16, client_options: HeyoClientOptions, ) -> Result<ServiceRoute, HeyoError>
GET /networks/me/services/{name}/{port}/dial — resolve a service to a
live iroh route. The returned ServiceRoute::connection_url is a
heyo:// ticket consumable by P2pTunnel::connect.
Errors with a 409 when the service has no live proxy route yet (run
heyvm network expose-service for the target).
Sourcepub async fn list_members(&self) -> Result<Vec<NetworkMember>, HeyoError>
pub async fn list_members(&self) -> Result<Vec<NetworkMember>, HeyoError>
GET /networks/{id}/members.
Sourcepub async fn add_member(
&self,
registration: NetworkMemberRegistration,
) -> Result<NetworkMember, HeyoError>
pub async fn add_member( &self, registration: NetworkMemberRegistration, ) -> Result<NetworkMember, HeyoError>
POST /networks/{id}/members — register a sandbox into the
network. Idempotent on (network_id, sandbox_kind, sandbox_ref);
re-registering updates device_name.
Sourcepub async fn remove_member(
&self,
sandbox_kind: NetworkMemberKind,
sandbox_ref: &str,
) -> Result<(), HeyoError>
pub async fn remove_member( &self, sandbox_kind: NetworkMemberKind, sandbox_ref: &str, ) -> Result<(), HeyoError>
DELETE /networks/{id}/members/{kind}/{ref}.