24 stable releases (4 major)

new 5.1.2 Apr 12, 2024
5.0.6 Apr 4, 2024
4.0.4 Jun 20, 2023
4.0.3 Nov 13, 2022
1.0.1 Oct 1, 2022

#311 in Web programming

Download history 10/week @ 2024-02-26 6/week @ 2024-03-11 729/week @ 2024-04-01

735 downloads per month
Used in wacr

MIT/Apache

40KB
832 lines

VK API Client

This is a base pure rust implementation of VK API client. The client supports zstd compression and msgpack format of VK API. It's works with http2 only connections.

Supported features

  • API requests
  • Longpoll
  • Upload files

See the library documentation or VK API documentation for more.

Usage

use vkclient::VkApi;

fn main() {
    let client: VkApi = vkclient::VkApiBuilder::new(access_token).into();
    ..
}
use vkclient::{VkApi, VkApiResult, List};
use serde::{Deserialize, Serialize};

async fn get_users_info(client: &VkApi) -> VkApiResult<Vec<UsersGetResponse>> {
    client.send_request("users.get", UsersGetRequest {
        user_ids: List(vec![1,2]),
        fields: List(vec!["id", "sex"]),
   }).await
}

#[derive(Serialize)]
struct UsersGetRequest<'a> {
    user_ids: List<Vec<usize>>,
    fields: List<Vec<&'a str>>,
}

#[derive(Deserialize)]
struct UsersGetResponse {
    id: i64,
    first_name: String,
    last_name: String,
    sex: u8,
}

Dependencies

~4–18MB
~258K SLoC