Crate rvk[−][src]
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,
which collectively make accessing the VK API easy, as shown in the example below.
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".into()); // 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 api::APIClient; |
pub use api::Params; |
Modules
api |
Works with the API |
error |
All 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 |