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 |
#657 in Web programming
1,266 downloads per month
Used in wacr
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–17MB
~252K SLoC