0.4.0 • Published 3 years ago

vrcapi-client v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vrcapi-client

Unofficial VRChat API Client library.

Functions for each API endpoint, type information for convenient use in TypeScript are provided.

Created for internal use with VRCFriendCheck. So there are multiple endpoints that are not implemented.

Install

Install with npm:

npm install vrcapi-client

Usage

See type information for details.

import * as vrc from 'vrcapi-client'

// login
const res = await vrc.user.login('username', 'password')

// Check if two-factor authentication is enabled
if ('requiresTwoFactorAuth' in res) {
  // Get authentication code
  const code = getAuthenticationCode()
  const res = await vrc.user.verify2FactorAuth(code)
}

// get friends
const friends = await vrc.user.getFriends()

// and more...

Websocket API

const c = await vrc.webSocketAPI()
// Note: msg is passed as a string type.
c.on('message', (msg) => {
    const data = JSON.parse(msg)
    // message type
    // ex) friend-online, friend-location, etc...
    console.log(data.type);
    // message data
    // This is also a string. Must be parsed if used.
    console.log(data.content)
  })

See Events in unofficial api documentation for message types.

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago