It is recommended to write higher level wrapper around this library rather than using it directly. ** Usage Requires Rust 1.42
[dependencies] vndb_rs = "0.1"
* Features - [X] All api actions - [ ] TLS support - [ ] Async * Examples For now creating TCP stream is on user side. This is subject to change.
* Login and get db stats
use std::net::TcpStream; use vndbrs::{ APIURL, sync::client::Client, };
let mut client = Client::new(TcpStream::connect(APIURL).unwrap()); let response = client.login(); println!("{:#?}", response); let response = client.getdbstats(); println!("{:#?}", response);
* Login and get all info about vn with id 1
use std::net::TcpStream; use vndbrs::{ APIURL, sync::client::Client, get::vn::VN_FLAGS, };
let mut client = Client::new(TcpStream::connect(APIURL).unwrap()); let response = client.login(); println!("{:#?}", response); let response = client.getvn(&VNFLAGS, "(id=6540)".toowned(), None); println!("{:#?}", response);
* Login using credentials and set vote to 8.5 for VN with id 17
use std::net::TcpStream; use vndbrs::{ APIURL, sync::client::Client, common::set::ulist::UListFields, };
let mut client = Client::new(TcpStream::connect(APIURL).unwrap()); let response = client.loginwithcredentials("username", "password"); println!("{:#?}", response); let response = client.setulist( "17".to_owned(), UListFields::new(None, None, None, Some(85), None), ); println!("{:#?}", response);
** References - https://vndb.org/d11