[−][src]Crate rvk
Overview
This is a crate for accessing VK API (synchronously).
It consists of:
api
module, which works with the API;error
module, which handles errors that may occur during an API call;methods
module, which contains API methods;objects
module, which contains API objects,
Example
extern crate rvk; extern crate serde_json; use rvk::{methods::*, objects::user::User, APIClient, Params}; use serde_json::from_value; fn main() { let mut api = APIClient::new("your_access_token"); // Create an API Client let mut params = Params::new(); // Create a HashMap to store parameters params.insert("user_ids".into(), "1".into()); let res = users::get(&api, params); match res { Ok(v) => { // v is `serde_json::Value` let users: Vec<User> = from_value(v).unwrap(); let user = &users[0]; println!( "User #{} is {} {}.", user.id, user.first_name, user.last_name ); } Err(e) => println!("{}", e), }; }
Re-exports
pub use crate::api::APIClient; |
pub use crate::api::Params; |
Modules
api | Works with the API |
error | Represents errors that can happen during a method call. |
methods | Contains all of the API methods in the respective submodules. |
objects | Represents various objects that are returned as JSON by the API. |
Constants
API_VERSION | Defines the version of VK API that is used. |