pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub fn new(baseurl: &str) -> Self

source

pub fn new_with_client(baseurl: &str, client: Client) -> Self

source

pub fn baseurl(&self) -> &String

source

pub fn client(&self) -> &Client

source

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

source

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

source

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
source

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
source

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 change
  • body: Network object JSON
source

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
source

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
source

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 network
  • member_id: ID of the member
source

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 network
  • member_id: ID of the member
  • body: Member object JSON
source

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 network
  • member_id: ID of the member
source

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
source

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 ID
  • body: User object JSON
source

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
source

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 ID
  • body: APIToken JSON object
source

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 ID
  • token_name: Token Name
source

pub async fn get_organization<'a>( &'a self ) -> Result<ResponseValue<Organization>, Error<()>>

Get the current user’s organization

Sends a GET request to /org

source

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
source

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
source

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

source

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
source

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
source

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
source

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
source

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

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more