Socket
Socket
Sign inDemoInstall

vkfriends-node

Package Overview
Dependencies
3
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vkfriends-node

VKontakte api calls for retrieving user friends, names and photos.


Version published
Weekly downloads
1
decreased by-93.33%
Maintainers
1
Install size
1.54 MB
Created
Weekly downloads
 

Readme

Source

vkfriends-node

Install

npm install --save vkfriends-node

Usage


import {  
   getUserId, getUserFriends, getUserPhotos,
   getUsersNames, getUsersFriends, getUsersPhotos,
   userID, userFriends, Photo, User, userPhotos
} from 'vkfriends-node'; 

 
 getUserId(access_token,"somenamenearuserurlvk")
 .then(
    (user_id : userID) => {
      console.log(user_id) //564564547
                        
      getUserFriends(token.access_token, user_id)
      .then(
       (friends:userFriends) => {

         console.log(friends)  /* { userID: 564564547,
                                    userFriendsIDs:
                                    [ 1943343,
                                        2324566,
                                        29054677,
                                        137563461...
                                */ 
        getUsersNames(token.access_token,friends.userFriendsIDs)
        .then(
            (users : User[]) => {
                    
                console.log(users)  
                /*
                    [ { id: 1943343, first_name: 'Sobaka', last_name: 'Pes' },
                    { id: 2324566, first_name: 'Bober', last_name: 'Pushistiy' },
                    { id: 29054677, first_name: 'Konb', last_name: 'Voronnoi' },
                    { id: 137563461, first_name: 'Viktoria', last_name: 'Smyslova' },
                */

            }
        ); 
                                
        getUsersFriends(token.access_token,friends.userFriendsIDs)
        .then(
            (friends : userFriends[]) => {
                    
                    console.log(friends) 
                        /* 
                        [
                        { userID: 1943343,
                            userFriendsIDs:
                            [ 8169304,
                            9565727,
                            15407679,
                            15313392... ] },
                        { userID: 2324566,
                            userFriendsIDs:
                            [ 1454,
                            10837, 
                            215620,
                            93438... 
                    */

            }
        )});  
    }
 );


Available methods: 

getUserId : (token : string, name : string) : Promise<userID> 
getUserFriends : (token : string, user_id : number) : Promise<userFriends>
getUserPhotos : (token : string, user_id : number, count : number) : Promise<Photo[]>
getUsersNames : (access_token:string,ids:number[]) : Promise<User[]>
getUsersFriends : (access_token:string,ids:number[]) : Promise<userFriends[]>
getUsersPhotos : (access_token:string,ids:number[], count:number) : Promise<userPhotos[]>


License

MIT

Keywords

FAQs

Last updated on 19 Oct 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc