35 releases (19 breaking)

0.20.0 Jan 12, 2021
0.19.0 Dec 21, 2020
0.18.0 Jul 30, 2020
0.15.0 Mar 27, 2020
0.5.0 Jul 19, 2018

#23 in HTTP client

Download history 42/week @ 2020-10-01 7/week @ 2020-10-08 6/week @ 2020-10-15 41/week @ 2020-10-22 40/week @ 2020-10-29 6/week @ 2020-11-05 6/week @ 2020-11-12 6/week @ 2020-11-19 42/week @ 2020-11-26 41/week @ 2020-12-03 6/week @ 2020-12-10 21/week @ 2020-12-17 3/week @ 2020-12-24 43/week @ 2020-12-31 26/week @ 2021-01-07 16/week @ 2021-01-14

89 downloads per month
Used in vk-bot

MIT license

170KB
2K SLoC

rvk

version downloads license

A crate for accessing VK (VKontakte) API in Rust (asynchronously).

The version of VK API that is used by this crate can be found here. Changelog is available here.

Modules

Usage

Add the dependency to your project:

Cargo.toml

[dependencies]
rvk = "0.20"

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 tokio crate for the tokio::main attribute proc macro.

Cargo.toml

[dependencies]
tokio = { version = "1.0", features = ["full"] }

main.rs

use rvk::{methods::users, objects::user::User, APIClient, Params};

#[tokio::main]
async fn main() {
    let api = APIClient::new("your_access_token"); // 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::<Vec<User>>(&api, params).await;

    match res {
        Ok(users) => {
            let user: &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!

Dependencies

~3.5–7.5MB
~175K SLoC