Skip to content

NOCELL/vk_connect_promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VK Connect promisify

Module for working with API callings as Promise

Init


import connect from '@vkontakte/vkui-connect'
import connect_promise from 'vk_connect_promise'

connect.subscribe(connect_promise.resolver)

Methods

.call

Call VK Connect method

await connect_promise.call("VKWebAppShare", {"link": "https://vk.com/nocell"});

.getToken

Get access_token for calling VK API methods

const {
    data: {
        access_token
    }
} = await connect_promise.getToken(app_id, ['photos', 'friends']

.api

Make VK API request

const {
    data: { response },
} = await connect_promise.api('users.get', {
    user_ids: '1',
    v: '5.92',
    access_token: this.state.token,
})

.updateToken

Set token for call VK API methods via execute-wrapper

const {
    data: { access_token },
} = await connect_promise.getToken(app_id, '')
connect_promise.updateToken(access_token)

.execute

Make VK API request via execute-wrapper

const data = await connect_promise.execute('users.get', {
    user_ids: '1',
    v: '5.92',
    access_token: this.state.token,
})

About

Promise API wrapper for VK Connect ( VK Apps )

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published