pub struct Client { /* private fields */ }
Expand description
A Client used to send commands to the serverquery interface.
Implementations§
source§impl Client
impl Client
sourcepub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<Client, Error>
pub async fn connect<A: ToSocketAddrs>(addr: A) -> Result<Client, Error>
Create a new connection
pub fn set_event_handler<H: EventHandler + 'static>(&self, handler: H)
source§impl Client
impl Client
sourcepub async fn apikeyadd(
&self,
scope: ApiKeyScope,
lifetime: Option<u64>,
cldbid: Option<ClientDatabaseId>
) -> Result<ApiKey, Error>
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.
sourcepub async fn apikeydel(&self, id: u64) -> Result<(), Error>
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
.
sourcepub async fn apikeylist(
&self,
cldbid: Option<(ClientDatabaseId, bool)>,
start: Option<u64>,
duration: Option<u64>,
count: bool
) -> Result<List<ApiKey, Pipe>, Error>
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
.
sourcepub 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>
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
.
sourcepub async fn gm(&self, msg: &str) -> Result<(), Error>
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.
sourcepub async fn login(&self, username: &str, password: &str) -> Result<(), Error>
pub async fn login(&self, username: &str, password: &str) -> Result<(), Error>
Authenticate with the given data.
sourcepub async fn logout(&self) -> Result<(), Error>
pub async fn logout(&self) -> Result<(), Error>
Deselects the active virtual server and logs out from the server instance.
sourcepub async fn quit(&self) -> Result<(), Error>
pub async fn quit(&self) -> Result<(), Error>
Send a quit command, disconnecting the client and closing the TCP connection
pub async fn sendtextmessage( &self, target: TextMessageTarget, msg: &str ) -> Result<(), Error>
sourcepub async fn servergroupaddclient(
&self,
sgid: ServerGroupId,
cldbid: ClientDatabaseId
) -> Result<(), Error>
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.
sourcepub async fn servergroupdelclient(
&self,
sgid: ServerGroupId,
cldbid: ClientDatabaseId
) -> Result<(), Error>
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.
sourcepub async fn servernotifyregister(
&self,
event: ServerNotifyRegister
) -> Result<(), Error>
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.
sourcepub async fn serverstart<T>(&self, sid: T) -> Result<(), Error>where
T: Into<ServerId>,
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.
sourcepub async fn serverstop<T>(&self, sid: T) -> Result<(), Error>where
T: Into<ServerId>,
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.
sourcepub async fn use_sid<T>(&self, sid: T) -> Result<(), Error>where
T: Into<ServerId>,
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
sourcepub async fn use_port(&self, port: u16) -> Result<(), Error>
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