[−][src]Crate ts3_query
Ts3 query library
Small, bare-metal ts query lib without any callback support currently.
A connectivity checking wrapper is available under managed when enabling its feature.
Examples
Simple auth + clients of a server group
use ts3_query::*; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; let group_clients = client.get_servergroup_client_list(7)?; println!("Got clients in group 7: {:?}",group_clients); client.logout()?;
Using the raw interface for setting client descriptions.
use ts3_query::*; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; // escape things like string args, not required for clid // as it's not user input/special chars in this case let cmd = format!("clientedit clid={} client_description={}", 7, raw::escape_arg("Some Description!") ); // we don't expect any value returned let _ = client.raw_command(&cmd)?; client.logout()?;
Raw interface example retrieving online client names
use ts3_query::*; use std::collections::HashSet; let mut client = QueryClient::new("localhost:10011")?; client.login("serveradmin", "password")?; client.select_server_by_port(9987)?; let res = raw::parse_multi_hashmap(client.raw_command("clientlist")?, false); let names = res .into_iter() .map(|e| e.get("client_nickname").map(raw::unescape_val) // may want to catch this in a real application .unwrap()) .collect::<HashSet<String>>(); println!("{:?}",names); client.logout()?;
Modules
managed | feature="managed" Managed connection module. |
raw | Module with helpers for raw-calls |
Structs
ErrorResponse | Server error response |
QueryClient | Ts3 Query client with active connection |
Enums
Ts3Error |