Struct zerotier_central_api::Client
source · pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
pub fn new(baseurl: &str) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn baseurl(&self) -> &String
pub fn client(&self) -> &Client
sourcepub async fn get_status<'a>(
&'a self
) -> Result<ResponseValue<Status>, Error<()>>
pub async fn get_status<'a>( &'a self ) -> Result<ResponseValue<Status>, Error<()>>
Obtain the overall status of the account tied to the API token in use
Sends a GET
request to /status
sourcepub async fn get_network_list<'a>(
&'a self
) -> Result<ResponseValue<Vec<Network>>, Error<()>>
pub async fn get_network_list<'a>( &'a self ) -> Result<ResponseValue<Vec<Network>>, Error<()>>
Returns a list of Networks you have access to
Sends a GET
request to /network
sourcepub async fn new_network<'a>(
&'a self,
body: &'a HashMap<String, Value>
) -> Result<ResponseValue<Network>, Error<()>>
pub async fn new_network<'a>( &'a self, body: &'a HashMap<String, Value> ) -> Result<ResponseValue<Network>, Error<()>>
Create a new network
Sends a POST
request to /network
Arguments:
body
: empty JSON object
sourcepub async fn get_network_by_id<'a>(
&'a self,
network_id: &'a str
) -> Result<ResponseValue<Network>, Error<()>>
pub async fn get_network_by_id<'a>( &'a self, network_id: &'a str ) -> Result<ResponseValue<Network>, Error<()>>
Get network by ID
Returns a single network
Sends a GET
request to /network/{networkID}
Arguments:
network_id
: ID of the network to return
sourcepub async fn update_network<'a>(
&'a self,
network_id: &'a str,
body: &'a Network
) -> Result<ResponseValue<Network>, Error<()>>
pub async fn update_network<'a>( &'a self, network_id: &'a str, body: &'a Network ) -> Result<ResponseValue<Network>, Error<()>>
update network configuration
Sends a POST
request to /network/{networkID}
Arguments:
network_id
: ID of the network to changebody
: Network object JSON
sourcepub async fn delete_network<'a>(
&'a self,
network_id: &'a str
) -> Result<ResponseValue<()>, Error<()>>
pub async fn delete_network<'a>( &'a self, network_id: &'a str ) -> Result<ResponseValue<()>, Error<()>>
delete network
Sends a DELETE
request to /network/{networkID}
Arguments:
network_id
: ID of the network
sourcepub async fn get_network_member_list<'a>(
&'a self,
network_id: &'a str
) -> Result<ResponseValue<Vec<Member>>, Error<()>>
pub async fn get_network_member_list<'a>( &'a self, network_id: &'a str ) -> Result<ResponseValue<Vec<Member>>, Error<()>>
Returns a list of Members on the network
Sends a GET
request to /network/{networkID}/member
Arguments:
network_id
: ID of the network to return
sourcepub async fn get_network_member<'a>(
&'a self,
network_id: &'a str,
member_id: &'a str
) -> Result<ResponseValue<Member>, Error<()>>
pub async fn get_network_member<'a>( &'a self, network_id: &'a str, member_id: &'a str ) -> Result<ResponseValue<Member>, Error<()>>
Return an individual member on a network
Sends a GET
request to /network/{networkID}/member/{memberID}
Arguments:
network_id
: ID of the networkmember_id
: ID of the member
sourcepub async fn update_network_member<'a>(
&'a self,
network_id: &'a str,
member_id: &'a str,
body: &'a Member
) -> Result<ResponseValue<Member>, Error<()>>
pub async fn update_network_member<'a>( &'a self, network_id: &'a str, member_id: &'a str, body: &'a Member ) -> Result<ResponseValue<Member>, Error<()>>
Modify a network member
Sends a POST
request to /network/{networkID}/member/{memberID}
Arguments:
network_id
: ID of the networkmember_id
: ID of the memberbody
: Member object JSON
sourcepub async fn delete_network_member<'a>(
&'a self,
network_id: &'a str,
member_id: &'a str
) -> Result<ResponseValue<()>, Error<()>>
pub async fn delete_network_member<'a>( &'a self, network_id: &'a str, member_id: &'a str ) -> Result<ResponseValue<()>, Error<()>>
Delete a network member
Sends a DELETE
request to /network/{networkID}/member/{memberID}
Arguments:
network_id
: ID of the networkmember_id
: ID of the member
sourcepub async fn get_user_by_id<'a>(
&'a self,
user_id: &'a str
) -> Result<ResponseValue<User>, Error<()>>
pub async fn get_user_by_id<'a>( &'a self, user_id: &'a str ) -> Result<ResponseValue<User>, Error<()>>
Get user record
Sends a GET
request to /user/{userID}
Arguments:
user_id
: User ID
sourcepub async fn update_user_by_id<'a>(
&'a self,
user_id: &'a str,
body: &'a User
) -> Result<ResponseValue<User>, Error<()>>
pub async fn update_user_by_id<'a>( &'a self, user_id: &'a str, body: &'a User ) -> Result<ResponseValue<User>, Error<()>>
Update user record (SMS number or Display Name only)
Sends a POST
request to /user/{userID}
Arguments:
user_id
: User IDbody
: User object JSON
sourcepub async fn delete_user_by_id<'a>(
&'a self,
user_id: &'a str
) -> Result<ResponseValue<()>, Error<()>>
pub async fn delete_user_by_id<'a>( &'a self, user_id: &'a str ) -> Result<ResponseValue<()>, Error<()>>
Delete user
Deletes the user and all associated networks. This is not reversible. Delete at your own risk.
Sends a DELETE
request to /user/{userID}
Arguments:
user_id
: User ID
sourcepub async fn add_api_token<'a>(
&'a self,
user_id: &'a str,
body: &'a ApiToken
) -> Result<ResponseValue<ApiToken>, Error<()>>
pub async fn add_api_token<'a>( &'a self, user_id: &'a str, body: &'a ApiToken ) -> Result<ResponseValue<ApiToken>, Error<()>>
Add an API token
Sends a POST
request to /user/{userID}/token
Arguments:
user_id
: User IDbody
: APIToken JSON object
sourcepub async fn delete_api_token<'a>(
&'a self,
user_id: &'a str,
token_name: &'a str
) -> Result<ResponseValue<()>, Error<()>>
pub async fn delete_api_token<'a>( &'a self, user_id: &'a str, token_name: &'a str ) -> Result<ResponseValue<()>, Error<()>>
Delete API Token
Sends a DELETE
request to /user/{userID}/token/{tokenName}
Arguments:
user_id
: User IDtoken_name
: Token Name
sourcepub async fn get_organization<'a>(
&'a self
) -> Result<ResponseValue<Organization>, Error<()>>
pub async fn get_organization<'a>( &'a self ) -> Result<ResponseValue<Organization>, Error<()>>
Get the current user’s organization
Sends a GET
request to /org
sourcepub async fn get_organization_by_id<'a>(
&'a self,
org_id: &'a str
) -> Result<ResponseValue<Organization>, Error<()>>
pub async fn get_organization_by_id<'a>( &'a self, org_id: &'a str ) -> Result<ResponseValue<Organization>, Error<()>>
Get organization by ID
Sends a GET
request to /org/{orgID}
Arguments:
org_id
: Organization ID
sourcepub async fn get_organization_members<'a>(
&'a self,
org_id: &'a str
) -> Result<ResponseValue<OrganizationMember>, Error<()>>
pub async fn get_organization_members<'a>( &'a self, org_id: &'a str ) -> Result<ResponseValue<OrganizationMember>, Error<()>>
Get list of organization members
Sends a GET
request to /org/{orgID}/user
Arguments:
org_id
: Organization ID
sourcepub async fn get_organization_invitation_list<'a>(
&'a self
) -> Result<ResponseValue<Vec<OrganizationInvitation>>, Error<()>>
pub async fn get_organization_invitation_list<'a>( &'a self ) -> Result<ResponseValue<Vec<OrganizationInvitation>>, Error<()>>
Get list of organization invitations
Sends a GET
request to /org-invitation
sourcepub async fn invite_user_by_email<'a>(
&'a self,
body: &'a OrganizationInvitation
) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
pub async fn invite_user_by_email<'a>( &'a self, body: &'a OrganizationInvitation ) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
Invite a user to your organization by email
Sends a POST
request to /org-invitation
Arguments:
body
: Organization Invitation JSON object
sourcepub async fn get_invitation_by_id<'a>(
&'a self,
invite_id: &'a str
) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
pub async fn get_invitation_by_id<'a>( &'a self, invite_id: &'a str ) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
Get organization invitation
Sends a GET
request to /org-invitation/{inviteID}
Arguments:
invite_id
: Invitation ID
sourcepub async fn accept_invitation<'a>(
&'a self,
invite_id: &'a str
) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
pub async fn accept_invitation<'a>( &'a self, invite_id: &'a str ) -> Result<ResponseValue<OrganizationInvitation>, Error<()>>
Accept organization invitation
Sends a POST
request to /org-invitation/{inviteID}
Arguments:
invite_id
: Invitation ID
sourcepub async fn decline_invitation<'a>(
&'a self,
invite_id: &'a str
) -> Result<ResponseValue<()>, Error<()>>
pub async fn decline_invitation<'a>( &'a self, invite_id: &'a str ) -> Result<ResponseValue<()>, Error<()>>
Decline organization invitation
Sends a DELETE
request to /org-invitation/{inviteID}
Arguments:
invite_id
: Invitation ID
sourcepub async fn get_random_token<'a>(
&'a self
) -> Result<ResponseValue<RandomToken>, Error<()>>
pub async fn get_random_token<'a>( &'a self ) -> Result<ResponseValue<RandomToken>, Error<()>>
Get a random 32 character token
Get a random 32 character. Used by the web UI to generate API keys
Sends a GET
request to /randomToken