Struct ts3::Client

source ·
pub struct Client { /* private fields */ }
Expand description

A Client used to send commands to the serverquery interface.

Implementations§

source§

impl Client

source

pub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<Client, Error>

Create a new connection

source

pub fn set_event_handler<H: EventHandler + 'static>(&self, handler: H)

source

pub async fn send<T, R>(&self, request: R) -> Result<T, Error>where T: Decode, T::Error: Into<Error>, R: Into<Request>,

Sends a Request to the server.

source§

impl Client

source

pub async fn apikeyadd( &self, scope: ApiKeyScope, lifetime: Option<u64>, cldbid: Option<ClientDatabaseId> ) -> Result<ApiKey, Error>

Creates a new apikey using the specified scope, for the invoking user. The default lifetime of a token is 14 days, a zero lifetime means no expiration. It is possible to create apikeys for other users using b_virtualserver_apikey_manage.

source

pub async fn apikeydel(&self, id: u64) -> Result<(), Error>

Delete an apikey. Any apikey owned by the current user can always be deleted. Deleting apikeys from another user requires b_virtualserver_apikey_manage.

source

pub async fn apikeylist( &self, cldbid: Option<(ClientDatabaseId, bool)>, start: Option<u64>, duration: Option<u64>, count: bool ) -> Result<List<ApiKey, Pipe>, Error>

Lists all apikeys owned by the user, or of all users using cldbid=(0, true). Usage of cldbid=… requires b_virtualserver_apikey_manage.

source

pub async fn banadd( &self, ip: Option<&str>, name: Option<&str>, uid: Option<&str>, mytsid: Option<&str>, time: Option<u64>, banreason: Option<&str>, lastnickname: Option<&str> ) -> Result<(), Error>

Add a new ban rule on the selected virtual server. One of ip, name, uid and mytsid must not be None.

source

pub async fn gm(&self, msg: &str) -> Result<(), Error>

Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.

source

pub async fn login(&self, username: &str, password: &str) -> Result<(), Error>

Authenticate with the given data.

source

pub async fn logout(&self) -> Result<(), Error>

Deselects the active virtual server and logs out from the server instance.

source

pub async fn quit(&self) -> Result<(), Error>

Send a quit command, disconnecting the client and closing the TCP connection

source

pub async fn sendtextmessage( &self, target: TextMessageTarget, msg: &str ) -> Result<(), Error>

source

pub async fn servergroupaddclient( &self, sgid: ServerGroupId, cldbid: ClientDatabaseId ) -> Result<(), Error>

Adds one or more clients to the server group specified with sgid. Please note that a client cannot be added to default groups or template groups.

source

pub async fn servergroupdelclient( &self, sgid: ServerGroupId, cldbid: ClientDatabaseId ) -> Result<(), Error>

Removes one or more clients specified with cldbid from the server group specified with sgid.

source

pub async fn servernotifyregister( &self, event: ServerNotifyRegister ) -> Result<(), Error>

Registers for a specified category of events on a virtual server to receive notification messages. Depending on the notifications you’ve registered for, the server will send you a message on every event in the view of your ServerQuery client (e.g. clients joining your channel, incoming text messages, server configuration changes, etc). The event source is declared by the event parameter while id can be used to limit the notifications to a specific channel.

source

pub async fn serverstart<T>(&self, sid: T) -> Result<(), Error>where T: Into<ServerId>,

Starts the virtual server specified with sid. Depending on your permissions, you’re able to start either your own virtual server only or all virtual servers in the server instance.

source

pub async fn serverstop<T>(&self, sid: T) -> Result<(), Error>where T: Into<ServerId>,

Stops the virtual server specified with sid. Depending on your permissions, you’re able to stop either your own virtual server only or all virtual servers in the server instance. The reasonmsg parameter specifies a text message that is sent to the clients before the client disconnects.

source

pub async fn use_sid<T>(&self, sid: T) -> Result<(), Error>where T: Into<ServerId>,

Switch to the virtualserver (voice) with the given server id

source

pub async fn use_port(&self, port: u16) -> Result<(), Error>

Like use_sid but instead use_port uses the voice port to connect to the virtualserver

source

pub async fn version(&self) -> Result<Version, Error>

Returns information about the server version

source

pub async fn whoami(&self) -> Result<Whoami, Error>

Returns information about the query client connected

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.
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.
source§

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

Performs the conversion.