Negatively Proportional Model
    Wondering what’s next for npm?Check out our public roadmap! »

    vk-got

    1.1.0 • Public • Published

    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

    Install

    npm i vk-got

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • avatar