vk-sdk
Easier way to make vk.com API requests
Methods
Method | Returns | Description |
---|---|---|
setToken(String token) |
this |
Sets token which will be used for requests to VK API. |
serverAuth(Object authParams) |
promise |
Performs Application Server Authorization. authParams must contain client_id and client_secret properties. |
siteAuth(Object authParams) |
promise |
Performs Sites Authorization. authParams must contain client_id , client_secret , code , redirect_uri properties. |
callMethod(String name, Object params) |
promise |
Calls API method method with parameters params . |
appendCall(String methodName, Object params) |
promise |
Used to delay request until execute method is called. |
execute() |
promise |
Sends by one request all delayed calls added by appendCall method. |
Example of usage
Preparation
var vk = ; vk;
Simple request
vk ;
Grouping several requests to a single
There are two calls of the execute
method in the snippet below, so only two request would be sent in fact.
vk ; vk ; vk ; vk; vk ; vk ; vk ; vk; { console;}