24 stable releases (4 major)

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

#2 in #vk

Download history 1/week @ 2024-02-21 9/week @ 2024-02-28 2/week @ 2024-03-06 4/week @ 2024-03-13 5/week @ 2024-03-27 732/week @ 2024-04-03 336/week @ 2024-04-10 456/week @ 2024-04-17 1/week @ 2024-04-24

793 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–19MB
~261K SLoC