Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

vk-got

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vk-got

Convenience wrapper for `got` to interact with the VK API

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
4
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

vk-got Build Status

Convenience wrapper for got to interact with the VK API

Inspired by gh-got.

Install

$ npm install --save vk-got

Usage

const vkGot = require('vk-got');

vkGot('users.get', {
	body: {
		'userIds': 'sobo13v',
		'v': '5.37'
	}
}).then(res => {
	const dima = res.body.response[0];
	console.log(dima['first_name'] + ' ' + dima['last_name']);
});

API

vkGot(method, [options]) → promise

method

Required
Type: string

One of many VK API methods.

options

Basically same as got, except token, endpoint and body.

token

Type: string

VK access token.

Can be overridden globally with the VK_ACCESS_TOKEN environment variable.

endpoint

Type: string
Default: https://api.vk.com/method/

body

Type: object

Data to send with request. All keys are decamelized before being sent, so you can write them in camelCase!

vkGot.token([options]) → promise

Shorthand method for requesting access token.

Errors

vk-got extends got errors with one VK-specific error type.

vkGot.VKError

When you're lucky enough to catch one of VK errors.

Credits

vk-got is built ontop of got, a very useful module made by Sindre Sorhus and Vsevolod Strukchinsky – two real open-source gangsters. Shout out to them!

License

MIT © Dimzel Sobolev

Keywords

vk

FAQs

Package last updated on 19 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts