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

#674 in Web programming

Download history 3/week @ 2024-08-02 5/week @ 2024-08-23 5/week @ 2024-08-30 41/week @ 2024-09-20 36/week @ 2024-09-27 7/week @ 2024-10-04

1,266 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

~5–17MB
~256K SLoC