2 releases

0.1.1 May 18, 2020
0.1.0 May 18, 2020

#1275 in Text processing

Custom license

39KB
1K SLoC

Table of Contents

  1. Vndbrs
    1. Usage
    2. Features
    3. Examples
      1. Login and get db stats
      2. Login and get all info about vn with id 1
      3. Login using credentials and set vote to 8.5 for VN with id 17
    4. References

Vndbrs

Bare-bones VNDB api

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

  • 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 vndb_rs::{
    API_URL,
    sync::client::Client,
};

let mut client = Client::new(TcpStream::connect(API_URL).unwrap());
let response = client.login();
println!("{:#?}", response);
let response = client.get_dbstats();
println!("{:#?}", response);

Login and get all info about vn with id 1

use std::net::TcpStream;
use vndb_rs::{
    API_URL,
    sync::client::Client,
    get::vn::VN_FLAGS,
};

let mut client = Client::new(TcpStream::connect(API_URL).unwrap());
let response = client.login();
println!("{:#?}", response);
let response = client.get_vn(&VN_FLAGS, "(id=6540)".to_owned(), None);
println!("{:#?}", response);

Login using credentials and set vote to 8.5 for VN with id 17

use std::net::TcpStream;
use vndb_rs::{
    API_URL,
    sync::client::Client,
    common::set::ulist::UListFields,
};

let mut client = Client::new(TcpStream::connect(API_URL).unwrap());
let response = client.login_with_credentials("username", "password");
println!("{:#?}", response);
let response = client.set_ulist(
    "17".to_owned(),
    UListFields::new(None, None, None, Some(85), None),
);
println!("{:#?}", response);

References

Dependencies

~1.2–2MB
~41K SLoC