Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/forlos/vndb_rs
Bare-bones VNDB API
https://github.com/forlos/vndb_rs
rust vndb vndb-api
Last synced: 10 days ago
JSON representation
Bare-bones VNDB API
- Host: GitHub
- URL: https://github.com/forlos/vndb_rs
- Owner: Forlos
- License: unlicense
- Created: 2020-05-09T21:00:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-31T15:11:58.000Z (over 4 years ago)
- Last Synced: 2024-12-11T02:08:02.682Z (about 1 month ago)
- Topics: rust, vndb, vndb-api
- Language: Rust
- Size: 55.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE.md
Awesome Lists containing this project
README
* Vndb_rs
Bare-bones VNDB apiIt is recommended to write higher level wrapper around this library rather than using it directly.
** Usage
Requires Rust 1.42
#+BEGIN_SRC toml
[dependencies]
vndb_rs = "0.1"
#+END_SRC
** 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
#+BEGIN_SRC rust
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);
#+END_SRC
*** Login and get all info about vn with id 1
#+BEGIN_SRC rust
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=1)".to_owned(), None);
println!("{:#?}", response);
#+END_SRC
*** Login using credentials and set vote to 8.5 for VN with id 17
#+BEGIN_SRC rust
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);
#+END_SRC** References
- https://vndb.org/d11