Crate 📦 for accessing VK API
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0033140 Dec 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Rust 2018! Dec 7, 2018
.gitattributes Remove travis badge, .gitattributes, v0.1.5 May 28, 2018
.gitignore Update to VK API v5.92 Nov 24, 2018
.travis.yml Add .travis.yml May 26, 2018
CHANGELOG.md Rust 2018! Dec 7, 2018
Cargo.toml Rust 2018! Dec 7, 2018
LICENSE Add LICENSE May 28, 2018
README.md Rust 2018! Dec 7, 2018
logo.png Make logo transparent May 29, 2018

README.md

rvk

version downloads license

A crate for accessing VK API in Rust (synchronously).

Changelog is available here.

Modules

Usage

Add the dependency to your project:

Cargo.toml

[dependencies]
rvk = "0.9"

Now you can take a look at rvk's API documentation to learn more about the available functions.

Example

To use this example, you will also need the serde_json crate to deserialize the API response:

Cargo.toml

[dependencies]
serde_json = "1.0"

main.rs

use rvk::{methods::*, objects::user::User, APIClient, Params};
use serde_json::from_value;

fn main() {
    let api = APIClient::new("your_access_token".into()); // Create an API Client

    let mut params = Params::new(); // Create a HashMap to store parameters
    params.insert("user_ids".into(), "1".into());

    let res = users::get(&api, params);

    match res {
        Ok(v) => { // v is `serde_json::Value`
            let users: Vec<User> = from_value(v).unwrap();
            let user = &users[0];

            println!(
                "User #{} is {} {}.",
                user.id, user.first_name, user.last_name
            );
        }
        Err(e) => println!("{}", e),
    };
}

Notes

Objects

Due to the nature of the VK API documentation, it is not always clear if the value is always passed or not, and sometimes the data type is not defined.

If you spot any mistakes or bugs, please report them!