#low-level #client #requests #client-instance #per #second #api

fast_vk

Relatively low-level VK API library designed for millions requests per second

18 releases (5 breaking)

0.6.1 Oct 23, 2022
0.6.0 Oct 22, 2022
0.5.6 Oct 22, 2022
0.4.0 Oct 2, 2022
0.1.1 Sep 16, 2022

#4 in #client-instance


Used in vapper

MIT license

28KB
536 lines

Fast VK 🚀

Library for fast data collection from VK

[dependencies]
fast_vk = "0.5"

Example

use fast_vk::{Client, Instance};
use vk_method::{Method, Params};

#[tokio::main]
async fn main() {
    let token = ["1234567890abcdef1234567890abcdef1234567890abcdef"];
    let instances = Instance::from_tokens(token).unwrap();

    let pool = Client::from_instances(instances);

    let mut params = Params::new();
    params.insert("user_id", 1);

    let response = pool.method(Method::new(
        "users.get",
        params,
    )).await.unwrap();

    assert_eq!(
        response,
        serde_json::json!([
            {
                "id": 1,
                "first_name": "Pavel",
                "last_name": "Durov",
                "is_closed": false,
                "can_access_closed": true
            }
        ])
    )
}

lib.rs:

Library for fast data collection from VK

By default, it provides relatively low-level Client::method However, there is thisvk feature avaible. With this feature you can call vk methods directly from Client. For details see thisvk.

Dependencies

~8–20MB
~280K SLoC