Crates.io | vkclient |
lib.rs | vkclient |
version | 5.1.2 |
source | src |
created_at | 2022-10-01 15:49:14.913721 |
updated_at | 2024-04-12 14:43:28.702277 |
description | Vk Api client implementation |
homepage | |
repository | https://github.com/Mnwa/vkclient |
max_upload_size | |
id | 677880 |
size | 42,398 |
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.
See the library documentation or VK API documentation for more.
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,
}